mrrl

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

strace (3969B)


      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 #+patch.f68185f5f766e7ba981276f806b05c1b549d908db89557d83873e53100c3a74f
     10 #+libunwind.b42bbbb19ed834bc53545382a6d7016b0877728f27ea19fd8fd6eb29181cf009
     11 #@sha256:37d93db7135d47852dbe763f1b18b3aeab142431a6f5268a17fc700387a326e4:strace-6.5-static.patch
     12 #@untar:-J:sha256:e209daf0ee038ca5adcc4c277e9273b4d51f46a2ff86da575d36742ac3508a17:.
     13 
     14 
     15 # - build script start -
     16 
     17 autotools_config() {
     18 	prefix=/home/ccx/versions/$pthbs_package
     19 	./configure -C \
     20 		--prefix="$prefix" \
     21 		--build="$(${CC:-gcc} -dumpmachine)" \
     22 		--bindir="$prefix/command" \
     23 		--sbindir="$prefix/command" \
     24 		--infodir="$prefix/info" \
     25 		--localedir="$prefix/locale" \
     26 		--mandir="$prefix/man" \
     27 		--libdir="$prefix/library" \
     28 		--docdir="$prefix/doc/strace" \
     29 		--datadir="$prefix/data" \
     30 		--datarootdir="$prefix/data" \
     31 		--localstatedir='/var/pthbs' \
     32 		"$@"
     33 
     34 }
     35 
     36 autotools_config_static() {
     37 	build_env_static
     38 	autotools_config "$@" --enable-static --disable-shared
     39 }
     40 
     41 build_env_static() {
     42 	export LD_LIBRARY_PATH="$pthbs_build_environment/library"
     43 	export CPATH="$pthbs_build_environment/include"
     44 	export LDFLAGS="-static -L$pthbs_build_environment/library $LDFLAGS"
     45 }
     46 
     47 check_static() {
     48 	local exe || true
     49 	exe=$pthbs_destdir'/home/ccx/versions'/$pthbs_package/$1
     50 	if ! test -f $exe; then
     51 		printf '%s\n' "Error: file '$1' doesn't exist!"
     52 		exit 1
     53 	fi
     54 	local interp_info || true
     55 	interp_info=$(readelf --string-dump=.interp "$exe") || exit $?
     56 	if test x '!=' "x$interp_info"; then
     57 		printf '%s\n' "Error: '$1' is a dynamic binary!"
     58 		exit 1
     59 	fi
     60 }
     61 
     62 prefix=/home/ccx/versions/$pthbs_package
     63 dest=${pthbs_destdir%/}${prefix}
     64 cd 'strace-6.13'
     65 patch -p1 <../strace-6.5-static.patch
     66 
     67 
     68 
     69 autotools_config_static --with-unwind --without-libdw --enable-mpers=check
     70 
     71 
     72 make -j${JOBS:-1} -l$((1+${JOBS:-1}))
     73 
     74 make DESTDIR="$pthbs_destdir" install
     75 
     76 
     77 
     78 check_static command/strace
     79 
     80 
     81 
     82 cd "$pthbs_destdir/home/ccx/versions/$pthbs_package"
     83 find -type d -o -print | awk -F/ '
     84 BEGIN {
     85 	x["./command/strace"]=1
     86 	x["./command/strace-log-merge"]=1
     87 	x["./man/man1/strace.1"]=1
     88 	x["./man/man1/strace-log-merge.1"]=1
     89 }
     90 
     91 function r1(s) {
     92 	sub("^[.]/[^/]*", ".", s)
     93 	return s
     94 }
     95 function s1(repl, s) {
     96 	sub("^[.]/[^/]*", "./"repl, s)
     97 	return s
     98 }
     99 function link(src) {
    100 	x[$0]=0
    101 	printf "%s\t%s\n", $0, src
    102 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
    103 }
    104 $1!="."{exit 1}
    105 
    106 
    107 $2 == "config" { link($0); next }
    108 $2 == "keys" { link($0); next }
    109 $2 == "zsh" { link($0); next }
    110 $2 == "env" { link($0); next }
    111 $2 == "command" { link($0); next }
    112 $2 == "bin" { link(s1("command", $0)); next }
    113 
    114 $2 == "library.so" { link($0); next }
    115 $2 == "library" { link($0); next }
    116 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
    117 $2 == "lib" && $NF ~ /\.so(\..*)?$/ { link(s1("library.so", $0)); next }
    118 
    119 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
    120 
    121 $2 == "man" { link($0); next }
    122 $2 == "info" { link($0); next }
    123 $2 == "doc" { link($0); next }
    124 $2 == "icons" { link($0); next }
    125 $2 == "terminfo" { link($0); next }
    126 $2 == "data" { link($0); next }
    127 $2 == "include" { link($0); next }
    128 
    129 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
    130 
    131 END {
    132 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
    133 	for(fname in x) {
    134 		if(x[fname]) {
    135 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
    136 			exit 3
    137 		}
    138 	}
    139 }' >.install-links.new
    140 mv .install-links.new .install-links
    141