mrrl

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

binutils (4918B)


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