ocamlbuild (3518B)
1 #!/usr/bin/env pthbs-build 2 #+busybox.d2d7aa00eac6ec561a10d126b1866f22e226a1276307466251e80fd8a4a1ebc7 3 #+busybox-findutils.85b2328981df683d1ae7597eebdf3a332aa4241b936c0030fe3618cec1f4841a 4 #+busybox-awk.4c3f8cc249ba35f1206fcaf2979bcfd66d09b117eeea4e6a939024825a542496 5 #+busybox-diffutils.24775f761d337796ffe81623350e4bf2f039067f593411146bfeb9c80567d182 6 #+musl-cross-make.e4735d8572f9b6654a7381ebdfbd62e665d1d1da5e06a56923e89274cc6a510f 7 #+gnu-make.75a726f6c19f7bc10b95a84da3ce72fb785ebdf587504430c6b74cfb6610b728 8 #+m4.478aa95758da2858007dad2c971921d7d91e7166d000285a1b91bc684a6f17a9 9 #+ocaml.a604427fdad1fc3adfb39b93cce894b4d525cb8c8d9933a4a7e69f2fa9b3a605 10 #@untar:-z:sha256:2ba6857f2991b7f69368e8db818b163d31cf5a367f15f5953bf8f01a77b3d4fc:. 11 12 13 # - build script start - 14 15 check_dynamic() { 16 local exe || true 17 exe=$pthbs_destdir'/home/ccx/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 (*'/home/ccx/versions/musl-cross-make.e4735d8572f9b6654a7381ebdfbd62e665d1d1da5e06a56923e89274cc6a510f/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=/home/ccx/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/home/ccx/versions/ocaml.a604427fdad1fc3adfb39b93cce894b4d525cb8c8d9933a4a7e69f2fa9b3a605" 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/home/ccx/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