mrrl

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

mpc (4371B)


      1 #!/usr/bin/env pthbs-build
      2 #+musl-cross-make.9be7a57aa0035ff26870115e69056e25445f3a96768a7d81251e7073630aadf9
      3 #+gnu-make.05bfcd168c0d3714ecba9e27d84e02bfd2ef8f754c26c162be357882390451fc
      4 #+busybox.23105cf3c52263661c44f7d855ae5dfc7287f5f8b60d6a026dedee24f4cf7a2e
      5 #+m4.b0e22ef7946f84d34196869bd6845993b87a25bfcb3c26a0d64cf926089dabce
      6 #+nawk.abe3790fd5e321ccd4e1ab7dab56339222e2eee686bc4b2241e7853104a4a500
      7 #+gmp.d9302a6becadcc9ee59a2089e6051e8cf491292e7510e1d696b9f9996249cb07
      8 #+mpfr.cc67b8eb2ce766b7020361756991c10c7febb274822ccb73b7721f45b63c4784
      9 #@untar:-z:sha256:ab642492f5cf882b74aa0cb730cd410a81edcdbec895183ce930e706c1c759b8:.
     10 
     11 
     12 # - build script start -
     13 
     14 autotools_config() {
     15 	prefix=/home/ccx/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'/home/ccx/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=/home/ccx/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/home/ccx/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