mrrl

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

opam (3637B)


      1 #!/usr/bin/env pthbs-build
      2 #+busybox.539513a18a06a21e4660004fea30f3658959c5c7f54488b66b5fee7120b0c27c
      3 #+busybox-findutils.3ba95afbbde5f39d6a3c0b17d82ff2e5350904cf19dd40acdf1c60ed126d3bda
      4 #+busybox-awk.4ac003d165540d0084cd08c1386f136343851ef344ac5ff844769b058049d859
      5 #+diffutils.ef2b0d428c7e8d58bc3fef1988a55f540eaac8e9b2185b84c38e249cb481006b
      6 #+patch.c713f3aa67a288e6bb986c0545f22f7e63211a00383bac354bba563b8320da95
      7 #+gnu-make.6c204d453a2d9b4e29dd7b9f93fc7c5a928284402b8646493cf72004f748753c
      8 #+musl-cross-make.ef7f483eefcad5b8f2d6c8329e61a0acaca7864b88e9521cb839392c62f45676
      9 #+getconf.4b854851f3ab2ef4a524ffc24897fe1dee95e5d3f60c94914c23d57d16b901d7
     10 #+ocaml.4ba185dd68257d664e10ef27e557636e8abb7a415a49a8137175a33e7b7ccf7d
     11 #+dune.0bf65718bc1e5a3abfdf3b4104edc05e8902dfe2c665bbe2f24375f031b692c9
     12 #@untar:-z:sha256:c4d053029793c714e4e7340b1157428c0f90783585fb17f35158247a640467d9:.
     13 
     14 
     15 # - build script start -
     16 
     17 check_static() {
     18 	local exe || true
     19 	exe=$pthbs_destdir'/versions'/$pthbs_package/$1
     20 	if ! test -f $exe; then
     21 		printf '%s\n' "Error: file '$1' doesn't exist!"
     22 		exit 1
     23 	fi
     24 	local interp_info || true
     25 	interp_info=$(readelf --string-dump=.interp "$exe") || exit $?
     26 	if test x '!=' "x$interp_info"; then
     27 		printf '%s\n' "Error: '$1' is a dynamic binary!"
     28 		exit 1
     29 	fi
     30 }
     31 
     32 prefix=/versions/$pthbs_package
     33 dest=${pthbs_destdir%/}${prefix}
     34 cd 'opam-full-2.4.1'
     35 
     36 
     37 export DUNE_CACHE=disabled
     38 ./configure \
     39 	--prefix="$prefix" \
     40 	--libdir="$prefix/library.ocaml" \
     41 	--bindir="$prefix/command" \
     42 	--sbindir="$prefix/command" \
     43 	--mandir="$prefix/man" \
     44 	--docdir="$prefix/doc/opam" \
     45 	--datadir="$prefix/data" \
     46 	--datarootdir="$prefix/data" \
     47 	--infodir="$prefix/info" \
     48 	--localedir="$prefix/locale" \
     49 	--localstatedir='/var/pthbs' \
     50 	--with-dune='/versions/dune.0bf65718bc1e5a3abfdf3b4104edc05e8902dfe2c665bbe2f24375f031b692c9/command/dune' \
     51 	--with-mccs \
     52 	--with-vendored-deps \
     53 	--enable-static
     54 
     55 
     56 make DUNE_ARGS=--verbose
     57 make DESTDIR="$pthbs_destdir" install
     58 
     59 
     60 
     61 make tests || true
     62 ## dynamic build
     63 #check_static bin/opam
     64 #check_static bin/opam-installer
     65 "$dest/bin/opam" --version
     66 "$dest/bin/opam-installer" --version
     67 
     68 
     69 
     70 cd "$pthbs_destdir/versions/$pthbs_package"
     71 find -type d -o -print | awk -F/ '
     72 BEGIN {
     73 	x["./bin/opam"]=1
     74 	x["./bin/opam-installer"]=1
     75 }
     76 
     77 function r1(s) {
     78 	sub("^[.]/[^/]*", ".", s)
     79 	return s
     80 }
     81 function s1(repl, s) {
     82 	sub("^[.]/[^/]*", "./"repl, s)
     83 	return s
     84 }
     85 function link(src) {
     86 	x[$0]=0
     87 	printf "%s\t%s\n", $0, src
     88 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
     89 }
     90 $1!="."{exit 1}
     91 
     92 
     93 $2 == "library.ocaml" { link($0); next }
     94 
     95 $2 == "config" { link($0); next }
     96 $2 == "keys" { link($0); next }
     97 $2 == "zsh" { link($0); next }
     98 $2 == "env" { link($0); next }
     99 $2 == "command" { link($0); next }
    100 $2 == "bin" { link(s1("command", $0)); next }
    101 
    102 $2 == "library.so" { link($0); next }
    103 $2 == "library" { link($0); next }
    104 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
    105 $2 == "lib" && $NF ~ /\.so(\..*)?$/ { link(s1("library.so", $0)); next }
    106 
    107 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
    108 
    109 $2 == "man" { link($0); next }
    110 $2 == "info" { link($0); next }
    111 $2 == "doc" { link($0); next }
    112 $2 == "icons" { link($0); next }
    113 $2 == "terminfo" { link($0); next }
    114 $2 == "data" { link($0); next }
    115 $2 == "include" { link($0); next }
    116 
    117 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
    118 
    119 END {
    120 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
    121 	for(fname in x) {
    122 		if(x[fname]) {
    123 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
    124 			exit 3
    125 		}
    126 	}
    127 }' >.install-links.new
    128 mv .install-links.new .install-links
    129