mrrl

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

gmp (4205B)


      1 #!/usr/bin/env pthbs-build
      2 #+musl-cross-make.de554c172179c402cf921f506a2369385ea83330a5bb4ab6bb6a253db9aac258
      3 #+gnu-make.6236d2c236f658167aece4d10bc59fa913f7fac60938f31bb5ef4a34bad42a94
      4 #+busybox.119bbc99a86bd999b052ed79095bc38c05f6280924ec718a0eb13f1a8d3410c1
      5 #+m4.1058b2157e8b83f551f705566e5fc2dde4b860df65aa59ae021b64157e71f67d
      6 #+nawk.596c1948e96cbcabfe3954a70deb947de0c73be1ddde41fafe8291bfec04bdd4
      7 #@untar:-J:sha256:a3c2b80201b89e68616f4ad30bc66aee4927c3ce50e33929ca819d5c43538898:.
      8 
      9 
     10 # - build script start -
     11 
     12 autotools_config() {
     13 	prefix=/versions/$pthbs_package
     14 	./configure -C \
     15 		--prefix="$prefix" \
     16 		--build="$(${CC:-gcc} -dumpmachine)" \
     17 		--bindir="$prefix/command" \
     18 		--sbindir="$prefix/command" \
     19 		--infodir="$prefix/info" \
     20 		--localedir="$prefix/locale" \
     21 		--mandir="$prefix/man" \
     22 		--libdir="$prefix/library" \
     23 		--docdir="$prefix/doc/gmp" \
     24 		--datadir="$prefix/data" \
     25 		--datarootdir="$prefix/data" \
     26 		--localstatedir='/var/pthbs' \
     27 		"$@"
     28 
     29 }
     30 
     31 autotools_config_static() {
     32 	autotools_config "$@" --enable-static --disable-shared
     33 }
     34 
     35 build_env_static() {
     36 	export CFLAGS="-ffile-prefix-map=${pthbs_workdir}=builddir $CFLAGS"
     37 	export CXXFLAGS="-ffile-prefix-map=${pthbs_workdir}=builddir $CXXFLAGS"
     38 	export LDFLAGS="-static -L$pthbs_build_environment/library $LDFLAGS"
     39 }
     40 
     41 check_static() {
     42 	local exe || true
     43 	exe=$pthbs_destdir'/versions'/$pthbs_package/$1
     44 	if ! test -f $exe; then
     45 		printf '%s\n' "Error: file '$1' doesn't exist!"
     46 		exit 1
     47 	fi
     48 	local interp_info || true
     49 	interp_info=$(readelf --string-dump=.interp "$exe") || exit $?
     50 	if test x '!=' "x$interp_info"; then
     51 		printf '%s\n' "Error: '$1' is a dynamic binary!"
     52 		exit 1
     53 	fi
     54 }
     55 
     56 prefix=/versions/$pthbs_package
     57 dest=${pthbs_destdir%/}${prefix}
     58 cd 'gmp-6.3.0'
     59 
     60 
     61 build_env_static
     62 export CPATH=$pthbs_build_environment/'include'
     63 export LIBRARY_PATH=$pthbs_build_environment/'library'
     64 export LD_LIBRARY_PATH=$pthbs_build_environment/'library.so'
     65 
     66 autotools_config_static --disable-nls \
     67 	CFLAGS="-g -Og -static --static" \
     68 	CXXFLAGS="-g -Og -static --static" \
     69 	LDFLAGS="-s --static $LDFLAGS"
     70  
     71 
     72 make -j${JOBS:-1} -l$((1+${JOBS:-1})) \
     73 	MULTILIB_OSDIRNAMES= \
     74 	INFO_DEPS= \
     75 	infodir= \
     76 	ac_cv_prog_lex_root=lex.yy \
     77 	MAKEINFO=false \
     78 	MAKE="make MULTILIB_OSDIRNAMES= INFO_DEPS= infodir= ac_cv_prog_lex_root=lex.yy MAKEINFO=false " \
     79 	all
     80 
     81 make -j${JOBS:-1} -l$((1+${JOBS:-1})) \
     82 	MULTILIB_OSDIRNAMES= \
     83 	INFO_DEPS= \
     84 	infodir= \
     85 	ac_cv_prog_lex_root=lex.yy \
     86 	MAKEINFO=false \
     87 	MAKE="make MULTILIB_OSDIRNAMES= INFO_DEPS= infodir= ac_cv_prog_lex_root=lex.yy MAKEINFO=false " \
     88 	DESTDIR="$pthbs_destdir" \
     89 	install
     90 
     91 
     92 
     93 
     94 
     95 cd "$pthbs_destdir/versions/$pthbs_package"
     96 find -type d -o -print | awk -F/ '
     97 BEGIN {
     98 	x["./library/libgmp.a"]=1
     99 	x["./include/gmp.h"]=1
    100 }
    101 
    102 function r1(s) {
    103 	sub("^[.]/[^/]*", ".", s)
    104 	return s
    105 }
    106 function s1(repl, s) {
    107 	sub("^[.]/[^/]*", "./"repl, s)
    108 	return s
    109 }
    110 function link(src) {
    111 	x[$0]=0
    112 	printf "%s\t%s\n", $0, src
    113 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
    114 }
    115 $1!="."{exit 1}
    116 $2 == "env" { link($0); next }
    117 $2 == ".env-template" { link($0); next }
    118 
    119 $2 == "command" { link($0); next }
    120 $2 == "command" { link($0); next }
    121 $2 == "bin" { link(s1("command", $0)); next }
    122 $2 == "sbin" { link(s1("command", $0)); next }
    123 
    124 $2 == "library.so" { link($0); next }
    125 $2 == "library" { link($0); next }
    126 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
    127 $2 == "lib" && $NF ~ /\.so(\..*)?$/ { link(s1("library.so", $0)); next }
    128 
    129 $2 == "share" && $3 == "info" { link(s1("info", r1($0))); next }
    130 $2 == "share" && $3 == "man" { link(s1("man", r1($0))); next }
    131 $2 == "share" && $3 == "doc" { link(s1("doc", r1($0))); next }
    132 
    133 $2 == "config" { link($0); next }
    134 $2 == "man" { link($0); next }
    135 $2 == "info" { link($0); next }
    136 $2 == "doc" { link($0); next }
    137 $2 == "data" { link($0); next }
    138 $2 == "include" { link($0); next }
    139 
    140 
    141 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
    142 
    143 END {
    144 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
    145 	retcode = 0
    146 	for(fname in x) {
    147 		if(x[fname]) {
    148 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
    149 			retcode = 3
    150 		}
    151 	}
    152 	exit retcode
    153 }' >.install-links.new
    154 mv .install-links.new .install-links
    155