mrrl

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

mpc (4335B)


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