|
root / lang / ocaml-astring
ocaml-astring Plain Text 76 lines 2.2 KB
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/zsh
# Build script for OCaml astring library
set -e
cd "$SRCDIR"

export PATH="$PREFIX/bin:$PATH"
export LD_LIBRARY_PATH="/usr/lib:${LD_LIBRARY_PATH:-}"
export LIBRARY_PATH="/usr/lib:${LIBRARY_PATH:-}"

# Build with topkg
ocaml pkg/pkg.ml build

# Install from .install file without opam-installer
# Parse sections and copy files to appropriate directories
install_from_dotinstall() {
    local installfile="$1" prefix="$2" pkgname="$3"
    local section="" src dest dir
    while IFS= read -r line; do
        # Detect section headers (lib:, bin:, etc.)
        if [[ "$line" =~ '^([a-z_]+):' ]]; then
            section="${match[1]}"
            continue
        fi
        [[ -z "$section" || "$line" =~ '^\]' ]] && { [[ "$line" =~ '^\]' ]] && section=""; continue; }
        # Extract source file path (between first pair of quotes)
        src="${${line#*\"}%%\"*}"
        [[ -z "$src" || ! -f "$src" ]] && continue
        # Extract optional dest name (between braces if present)
        if [[ "$line" =~ '\{"?([^}"]+)"?\}' ]]; then
            dest="${match[1]}"
        else
            dest="${src:t}"
        fi
        # Map section to directory
        case "$section" in
            lib|libexec) dir="$prefix/lib/ocaml/$pkgname" ;;
            bin) dir="$prefix/bin" ;;
            share) dir="$prefix/share/$pkgname" ;;
            doc) dir="$prefix/doc/$pkgname" ;;
            man) dir="$prefix/man" ;;
            *) continue ;;
        esac
        mkdir -p "$dir/$(dirname "$dest")"
        cp "$src" "$dir/$dest"
    done < "$installfile"
}

install_from_dotinstall astring.install "$PKGDIR$PREFIX" astring
# OCaml astring - Alternative String module
# https://github.com/dbuenzli/astring

[package]
name = "ocaml-astring"
version = "0.8.5"
release = 1
description = "OCaml alternative String module"
url = "https://github.com/dbuenzli/astring"
license = "ISC"
maintainer = "Chris Tusa <chris.tusa@leafscale.com>"
arch = "x86_64"

[dependencies]
runtime = ["ocaml"]
build = ["ocaml", "ocaml-findlib", "ocaml-ocamlbuild", "ocaml-topkg"]

[[source]]
file = "astring-0.8.5.tar.gz"
urls = [
    "https://github.com/dbuenzli/astring/archive/refs/tags/v0.8.5.tar.gz"
]
checksum = "skip"
extract = true

[build]
parallel = false