mrrl

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

easyseccomp (4310B)


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