mrrl

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

ocaml-findlib (4182B)


      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 #+netbsd-curses.39c323dbca09f6623bbafd4fd00b9f129a0402cfddecdabcc606f760f5586a55
     10 #+ocaml.a604427fdad1fc3adfb39b93cce894b4d525cb8c8d9933a4a7e69f2fa9b3a605
     11 #+ocamlbuild.a64c7b5658b13dffe7daa77a1b350b6e73de7877c85fe3474b72c950fee31967
     12 #@untar:-z:sha256:662c910f774e9fee3a19c4e057f380581ab2fc4ee52da4761304ac9c31b8869d:.
     13 
     14 
     15 # - build script start -
     16 
     17 check_dynamic() {
     18 	local exe || true
     19 	exe=$pthbs_destdir'/home/ccx/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 	case $interp_info in
     27 		('')
     28 			printf '%s\n' "Error: '$1' is not a dynamic binary!"
     29 			exit 1
     30 			;;
     31 		(*'/home/ccx/versions/musl-cross-make.e4735d8572f9b6654a7381ebdfbd62e665d1d1da5e06a56923e89274cc6a510f/x86_64-linux-musl/lib/ld-musl-x86_64.so.1')
     32 			return 0
     33 			;;
     34 		(*)
     35 			printf '%s\n' "Error: '$1' unexpected linker path!"
     36 			exit 1
     37 	esac
     38 }
     39 
     40 prefix=/home/ccx/versions/$pthbs_package
     41 dest=${pthbs_destdir%/}${prefix}
     42 cd 'findlib-1.9.8'
     43 
     44 
     45 ./configure -h || true
     46 ./configure \
     47 	-bindir "$prefix/command" \
     48 	-mandir "$prefix/man" \
     49 	-sitelib "$prefix/library.ocaml" \
     50 	-config "$prefix/config/etc/findlib.conf" \
     51 	-no-camlp4
     52  
     53 
     54 make -j1 all opt
     55 
     56 # workaround `topfind` getting installed to stdlib directory, this is not configurable
     57 stdlib="$pthbs_destdir/home/ccx/versions/ocaml.a604427fdad1fc3adfb39b93cce894b4d525cb8c8d9933a4a7e69f2fa9b3a605"
     58 mkdir -p "${stdlib%/*}"
     59 ln -s "$pthbs_package" "$stdlib"
     60 make install prefix="$pthbs_destdir"
     61 
     62 
     63 
     64 check_dynamic command/ocamlfind
     65 
     66 
     67 
     68 cd "$pthbs_destdir/home/ccx/versions/$pthbs_package"
     69 find -type d -o -print | awk -F/ '
     70 BEGIN {
     71 	x["./command/ocamlfind"]=1
     72 	x["./library.ocaml/findlib/topfind.mli"]=1
     73 	x["./library.ocaml/findlib/topfind.cmi"]=1
     74 	x["./library.ocaml/findlib/META"]=1
     75 	x["./library.ocaml/topfind"]=1
     76 	# x["./library.ocaml/bigarray/META"]=1
     77 	x["./library.ocaml/bytes/META"]=1
     78 	# x["./library.ocaml/compiler-libs/META"]=1
     79 	# x["./library.ocaml/dynlink/META"]=1
     80 	# x["./library.ocaml/ocamldoc/META"]=1
     81 	# x["./library.ocaml/stdlib/META"]=1
     82 	# x["./library.ocaml/str/META"]=1
     83 	# x["./library.ocaml/threads/META"]=1
     84 	# x["./library.ocaml/unix/META"]=1
     85 }
     86 
     87 function r1(s) {
     88 	sub("^[.]/[^/]*", ".", s)
     89 	return s
     90 }
     91 function s1(repl, s) {
     92 	sub("^[.]/[^/]*", "./"repl, s)
     93 	return s
     94 }
     95 function link(src) {
     96 	x[$0]=0
     97 	printf "%s\t%s\n", $0, src
     98 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
     99 }
    100 $1!="."{exit 1}
    101 
    102 
    103 $2 == "library.ocaml" { link($0); next }
    104 
    105 $2 == "config" { link($0); next }
    106 $2 == "keys" { link($0); next }
    107 $2 == "zsh" { link($0); next }
    108 $2 == "env" { link($0); next }
    109 $2 == "command" { link($0); next }
    110 $2 == "bin" { link(s1("command", $0)); next }
    111 
    112 $2 == "library.so" { link($0); next }
    113 $2 == "library" { link($0); next }
    114 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
    115 $2 == "lib" && $NF ~ /\.so(\..*)?$/ { link(s1("library.so", $0)); next }
    116 
    117 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
    118 
    119 $2 == "man" { link($0); next }
    120 $2 == "info" { link($0); next }
    121 $2 == "doc" { link($0); next }
    122 $2 == "icons" { link($0); next }
    123 $2 == "terminfo" { link($0); next }
    124 $2 == "data" { link($0); next }
    125 $2 == "include" { link($0); next }
    126 
    127 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
    128 
    129 END {
    130 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
    131 	for(fname in x) {
    132 		if(x[fname]) {
    133 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
    134 			exit 3
    135 		}
    136 	}
    137 }' >.install-links.new
    138 mv .install-links.new .install-links
    139