mrrl

Minimal Reliable Reproducible Linux
git clone https://ccx.te2000.cz/git/mrrl
Log | Files | Refs | Submodules | README

dune (3606B)


      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 #+ocaml.4ba185dd68257d664e10ef27e557636e8abb7a415a49a8137175a33e7b7ccf7d
      8 #@untar:-z:sha256:579c738f8ca191ba0a9b22dbe78f1377542442c9827cf4939f8964f09f9edb28:.
      9 
     10 
     11 # - build script start -
     12 
     13 check_dynamic() {
     14 	local exe || true
     15 	exe=$pthbs_destdir'/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 		(*'/versions/musl-cross-make.ef7f483eefcad5b8f2d6c8329e61a0acaca7864b88e9521cb839392c62f45676/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=/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/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