ocaml:dynlink (3418B)
1 #!/usr/bin/env pthbs-build 2 #+busybox.539513a18a06a21e4660004fea30f3658959c5c7f54488b66b5fee7120b0c27c 3 #+busybox-findutils.3ba95afbbde5f39d6a3c0b17d82ff2e5350904cf19dd40acdf1c60ed126d3bda 4 #+busybox-awk.4ac003d165540d0084cd08c1386f136343851ef344ac5ff844769b058049d859 5 #+busybox-diffutils.b820ef7a40bea977a2bf740425ae15b2d9a21097bcf3a2f5ec77c21782b9deb8 6 #+musl-cross-make.ef7f483eefcad5b8f2d6c8329e61a0acaca7864b88e9521cb839392c62f45676 7 #+gnu-make.6c204d453a2d9b4e29dd7b9f93fc7c5a928284402b8646493cf72004f748753c 8 #+m4.24db011b72096e07a0a7df3d38942fd5ea0bb7d245ea0408aec9d8e5c4091cc7 9 #@untar:-J:sha256:dfaa8a2e11c799bc1765d8bef44911406ee5f4803027190382a939f88c912266:. 10 11 12 # - build script start - 13 14 autotools_config() { 15 prefix=/versions/$pthbs_package 16 ./configure -C \ 17 --prefix="$prefix" \ 18 --build="$(${CC:-gcc} -dumpmachine)" \ 19 --bindir="$prefix/command" \ 20 --sbindir="$prefix/command" \ 21 --infodir="$prefix/info" \ 22 --localedir="$prefix/locale" \ 23 --mandir="$prefix/man" \ 24 --libdir="$prefix/library" \ 25 --docdir="$prefix/doc/ocaml" \ 26 --datadir="$prefix/data" \ 27 --datarootdir="$prefix/data" \ 28 --localstatedir='/var/pthbs' \ 29 "$@" 30 31 } 32 33 autotools_config_static() { 34 build_env_static 35 autotools_config "$@" --enable-static --disable-shared 36 } 37 38 build_env_dynamic() { 39 export LD_LIBRARY_PATH="$pthbs_build_environment/library.so" 40 export CPATH="$pthbs_build_environment/include" 41 export LDFLAGS="-L$pthbs_build_environment/library.so $LDFLAGS" 42 } 43 44 prefix=/versions/$pthbs_package 45 dest=${pthbs_destdir%/}${prefix} 46 cd 'ocaml-5.4.0' 47 48 49 build_env_dynamic 50 autotools_config --enable-native-compiler --disable-native-toplevel --enable-installing-bytecode-programs --libdir="$prefix/library.ocaml" 51 52 53 make -j${JOBS:-1} -l$((1+${JOBS:-1})) 54 55 make DESTDIR="$pthbs_destdir" install 56 57 58 59 60 mkdir -p "$dest/.env-template" 61 printf '%s' >"$dest/.env-template"/'OCAMLPATH' '@ENVROOT@/library.ocaml' 62 63 cd "$pthbs_destdir/versions/$pthbs_package" 64 find -type d -o -print | awk -F/ ' 65 BEGIN { 66 x["./command/ocamlopt"]=1 67 } 68 69 function r1(s) { 70 sub("^[.]/[^/]*", ".", s) 71 return s 72 } 73 function s1(repl, s) { 74 sub("^[.]/[^/]*", "./"repl, s) 75 return s 76 } 77 function link(src) { 78 x[$0]=0 79 printf "%s\t%s\n", $0, src 80 printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr" 81 } 82 $1!="."{exit 1} 83 84 85 $2 == "library.ocaml" { link($0); next } 86 $2 == ".env-template" { link($0); next } 87 88 $2 == "config" { link($0); next } 89 $2 == "keys" { link($0); next } 90 $2 == "zsh" { link($0); next } 91 $2 == "env" { link($0); next } 92 $2 == "command" { link($0); next } 93 $2 == "bin" { link(s1("command", $0)); next } 94 95 $2 == "library.so" { link($0); next } 96 $2 == "library" { link($0); next } 97 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next } 98 $2 == "lib" && $NF ~ /\.so(\..*)?$/ { link(s1("library.so", $0)); next } 99 100 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next } 101 102 $2 == "man" { link($0); next } 103 $2 == "info" { link($0); next } 104 $2 == "doc" { link($0); next } 105 $2 == "icons" { link($0); next } 106 $2 == "terminfo" { link($0); next } 107 $2 == "data" { link($0); next } 108 $2 == "include" { link($0); next } 109 110 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" } 111 112 END { 113 for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" } 114 for(fname in x) { 115 if(x[fname]) { 116 printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr" 117 exit 3 118 } 119 } 120 }' >.install-links.new 121 mv .install-links.new .install-links 122