ocamlbuild (3473B)
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 #+ocaml.4ba185dd68257d664e10ef27e557636e8abb7a415a49a8137175a33e7b7ccf7d 10 #@untar:-z:sha256:2ba6857f2991b7f69368e8db818b163d31cf5a367f15f5953bf8f01a77b3d4fc:. 11 12 13 # - build script start - 14 15 check_dynamic() { 16 local exe || true 17 exe=$pthbs_destdir'/versions'/$pthbs_package/$1 18 if ! test -f $exe; then 19 printf '%s\n' "Error: file '$1' doesn't exist!" 20 exit 1 21 fi 22 local interp_info || true 23 interp_info=$(readelf --string-dump=.interp "$exe") || exit $? 24 case $interp_info in 25 ('') 26 printf '%s\n' "Error: '$1' is not a dynamic binary!" 27 exit 1 28 ;; 29 (*'/versions/musl-cross-make.ef7f483eefcad5b8f2d6c8329e61a0acaca7864b88e9521cb839392c62f45676/x86_64-linux-musl/lib/ld-musl-x86_64.so.1') 30 return 0 31 ;; 32 (*) 33 printf '%s\n' "Error: '$1' unexpected linker path!" 34 exit 1 35 esac 36 } 37 38 prefix=/versions/$pthbs_package 39 dest=${pthbs_destdir%/}${prefix} 40 cd 'ocamlbuild-0.16.1' 41 42 43 make configure \ 44 PREFIX="$prefix" \ 45 OCAML_NATIVE=true \ 46 OCAMLBUILD_BINDIR="$prefix/command" \ 47 OCAMLBUILD_LIBDIR="$prefix/library.ocaml" 48 49 50 make -j${JOBS:-1} -l$((1+${JOBS:-1})) 51 52 # workaround ocamlbuild manpage getting installed to stdlib directory 53 stdlib="$pthbs_destdir/versions/ocaml.4ba185dd68257d664e10ef27e557636e8abb7a415a49a8137175a33e7b7ccf7d" 54 mkdir -p "${stdlib%/*}" 55 ln -s "$pthbs_package" "$stdlib" 56 57 make DESTDIR="$pthbs_destdir" install 58 59 60 61 check_dynamic command/ocamlbuild 62 63 64 65 cd "$pthbs_destdir/versions/$pthbs_package" 66 find -type d -o -print | awk -F/ ' 67 BEGIN { 68 x["./command/ocamlbuild"]=1 69 x["./man/man1/ocamlbuild.1"]=1 70 } 71 72 function r1(s) { 73 sub("^[.]/[^/]*", ".", s) 74 return s 75 } 76 function s1(repl, s) { 77 sub("^[.]/[^/]*", "./"repl, s) 78 return s 79 } 80 function link(src) { 81 x[$0]=0 82 printf "%s\t%s\n", $0, src 83 printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr" 84 } 85 $1!="."{exit 1} 86 87 88 $2 == "library.ocaml" { link($0); next } 89 90 $2 == "config" { link($0); next } 91 $2 == "keys" { link($0); next } 92 $2 == "zsh" { link($0); next } 93 $2 == "env" { link($0); next } 94 $2 == "command" { link($0); next } 95 $2 == "bin" { link(s1("command", $0)); next } 96 97 $2 == "library.so" { link($0); next } 98 $2 == "library" { link($0); next } 99 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next } 100 $2 == "lib" && $NF ~ /\.so(\..*)?$/ { link(s1("library.so", $0)); next } 101 102 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next } 103 104 $2 == "man" { link($0); next } 105 $2 == "info" { link($0); next } 106 $2 == "doc" { link($0); next } 107 $2 == "icons" { link($0); next } 108 $2 == "terminfo" { link($0); next } 109 $2 == "data" { link($0); next } 110 $2 == "include" { link($0); next } 111 112 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" } 113 114 END { 115 for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" } 116 for(fname in x) { 117 if(x[fname]) { 118 printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr" 119 exit 3 120 } 121 } 122 }' >.install-links.new 123 mv .install-links.new .install-links 124