dune (3642B)
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 #+ocaml.a604427fdad1fc3adfb39b93cce894b4d525cb8c8d9933a4a7e69f2fa9b3a605 8 #@untar:-z:sha256:579c738f8ca191ba0a9b22dbe78f1377542442c9827cf4939f8964f09f9edb28:. 9 10 11 # - build script start - 12 13 check_dynamic() { 14 local exe || true 15 exe=$pthbs_destdir'/home/ccx/versions'/$pthbs_package/$1 16 if ! test -f $exe; then 17 printf '%s\n' "Error: file '$1' doesn't exist!" 18 exit 1 19 fi 20 local interp_info || true 21 interp_info=$(readelf --string-dump=.interp "$exe") || exit $? 22 case $interp_info in 23 ('') 24 printf '%s\n' "Error: '$1' is not a dynamic binary!" 25 exit 1 26 ;; 27 (*'/home/ccx/versions/musl-cross-make.e4735d8572f9b6654a7381ebdfbd62e665d1d1da5e06a56923e89274cc6a510f/x86_64-linux-musl/lib/ld-musl-x86_64.so.1') 28 return 0 29 ;; 30 (*) 31 printf '%s\n' "Error: '$1' unexpected linker path!" 32 exit 1 33 esac 34 } 35 36 37 prefix=/home/ccx/versions/$pthbs_package 38 dest=${pthbs_destdir%/}${prefix} 39 cd 'dune-3.20.2' 40 41 # This allows 'dune --version' to output the correct version instead of "n/a" 42 sed -i "/^(name dune)/a (version 3.20.2)" dune-project 43 # This enables dune-configurator to use the vendored csexp module 44 sed -i 's/stdune.csexp/dune-configurator.csexp/' vendor/csexp/src/dune 45 46 47 48 export DUNE_CACHE=disabled 49 ./configure \ 50 --prefix="$prefix" \ 51 --libdir="$prefix/library.ocaml" \ 52 --bindir="$prefix/command" \ 53 --sbindir="$prefix/command" \ 54 --etcdir="$prefix/config/etc" \ 55 --mandir="$prefix/man" \ 56 --docdir="$prefix/doc/dune" \ 57 --datadir="$prefix/data" 58 59 60 61 ocaml boot/bootstrap.ml --verbose 62 ./dune.exe build \ 63 -p dune,dune-configurator \ 64 --profile dune-bootstrap --verbose 65 66 ./dune.exe install --root=. \ 67 --destdir="$pthbs_destdir" \ 68 dune dune-configurator 69 70 rm -vrf _build 71 ls -lhA . 72 73 74 check_dynamic command/dune 75 76 77 78 cd "$pthbs_destdir/home/ccx/versions/$pthbs_package" 79 find -type d -o -print | awk -F/ ' 80 BEGIN { 81 x["./command/dune"]=1 82 } 83 84 function r1(s) { 85 sub("^[.]/[^/]*", ".", s) 86 return s 87 } 88 function s1(repl, s) { 89 sub("^[.]/[^/]*", "./"repl, s) 90 return s 91 } 92 function link(src) { 93 x[$0]=0 94 printf "%s\t%s\n", $0, src 95 printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr" 96 } 97 $1!="."{exit 1} 98 99 100 $2 == "library.ocaml" { link($0); next } 101 102 $2 == "config" { link($0); next } 103 $2 == "keys" { link($0); next } 104 $2 == "zsh" { link($0); next } 105 $2 == "env" { link($0); next } 106 $2 == "command" { link($0); next } 107 $2 == "bin" { link(s1("command", $0)); next } 108 109 $2 == "library.so" { link($0); next } 110 $2 == "library" { link($0); next } 111 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next } 112 $2 == "lib" && $NF ~ /\.so(\..*)?$/ { link(s1("library.so", $0)); next } 113 114 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next } 115 116 $2 == "man" { link($0); next } 117 $2 == "info" { link($0); next } 118 $2 == "doc" { link($0); next } 119 $2 == "icons" { link($0); next } 120 $2 == "terminfo" { link($0); next } 121 $2 == "data" { link($0); next } 122 $2 == "include" { link($0); next } 123 124 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" } 125 126 END { 127 for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" } 128 for(fname in x) { 129 if(x[fname]) { 130 printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr" 131 exit 3 132 } 133 } 134 }' >.install-links.new 135 mv .install-links.new .install-links 136