xbps (4262B)
1 #!/usr/bin/env pthbs-build 2 #+busybox.539513a18a06a21e4660004fea30f3658959c5c7f54488b66b5fee7120b0c27c 3 #+busybox-findutils.3ba95afbbde5f39d6a3c0b17d82ff2e5350904cf19dd40acdf1c60ed126d3bda 4 #+busybox-awk.4ac003d165540d0084cd08c1386f136343851ef344ac5ff844769b058049d859 5 #+musl-cross-make.ef7f483eefcad5b8f2d6c8329e61a0acaca7864b88e9521cb839392c62f45676 6 #+gnu-make.6c204d453a2d9b4e29dd7b9f93fc7c5a928284402b8646493cf72004f748753c 7 #+libarchive.c6aade76cb26f9612722270485d1f7c67da82a93c70a52470a715d02621335a2 8 #+libressl.e97bfa759fd72f50d85a4acf6095ffc27a96a40b443e951c1024d7f5afe898e9 9 #+pkgconf-pkg-config.2176b62d5271a766426ccdf60171dc4c8ceeec26f0b0f69683e11e035de4e96d 10 #@untar:-z:sha256:a6607e83fcd654a0ae846d729e43fefd8da9a61323e91430f884caf895b4f59b:. 11 12 13 # - build script start - 14 15 build_env_static() { 16 export LD_LIBRARY_PATH="$pthbs_build_environment/library" 17 export CPATH="$pthbs_build_environment/include" 18 export LDFLAGS="-static -L$pthbs_build_environment/library $LDFLAGS" 19 } 20 21 check_static() { 22 local exe || true 23 exe=$pthbs_destdir'/versions'/$pthbs_package/$1 24 if ! test -f $exe; then 25 printf '%s\n' "Error: file '$1' doesn't exist!" 26 exit 1 27 fi 28 local interp_info || true 29 interp_info=$(readelf --string-dump=.interp "$exe") || exit $? 30 if test x '!=' "x$interp_info"; then 31 printf '%s\n' "Error: '$1' is a dynamic binary!" 32 exit 1 33 fi 34 } 35 36 prefix=/versions/$pthbs_package 37 dest=${pthbs_destdir%/}${prefix} 38 cd 'xbps-0.59.2' 39 40 41 export LDFLAGS=--static 42 export CPPFLAGS="-D_GNU_SOURCE -DSTDC_HEADERS" 43 build_env_static 44 45 find lib bin -name '*.c' -exec sed -iEe '/^[\t ]*#[\t ]*define[\t ]+_GNU_SOURCE/d' '{}' \; 46 find lib bin -name '*.c' -exec sed -iEe '/#.*_GNU_SOURCE/d' '{}' \; 47 48 ./configure --verbose \ 49 --prefix="$prefix" \ 50 --build="$(${CC:-gcc} -dumpmachine)" \ 51 --datadir="$prefix" \ 52 --bindir="$prefix/command" \ 53 --infodir="$prefix/info" \ 54 --mandir="$prefix/man" \ 55 --libdir="$prefix/library" \ 56 --localstatedir=/var \ 57 --enable-static 58 59 60 make -j${JOBS:-1} -l$((1+${JOBS:-1})) -C include 61 make -j${JOBS:-1} -l$((1+${JOBS:-1})) -C lib libxbps.a 62 63 install -d "$dest/library" 64 install -m 644 lib/libxbps.a "$dest/library" 65 install -d "$dest/command" 66 for cmd in xbps-alternatives xbps-create xbps-dgraph xbps-install xbps-pkgdb xbps-query xbps-reconfigure xbps-remove xbps-rindex xbps-uhelper xbps-checkvers xbps-fbulk xbps-digest xbps-fetch xbps-uchroot xbps-uunshare; do 67 make -j${JOBS:-1} -l$((1+${JOBS:-1})) -C "bin/$cmd" "$cmd.static" 68 install -m 755 "bin/$cmd/$cmd.static" "$pthbs_destdir/$prefix/command" 69 done 70 make -j${JOBS:-1} -l$((1+${JOBS:-1})) -C data 71 make -j${JOBS:-1} -l$((1+${JOBS:-1})) -C data install DESTDIR="$pthbs_destdir" 72 73 74 75 check_static command/xbps-install.static 76 mkdir -p "$dest/keys" 77 mv -v "$pthbs_destdir/var/db/xbps/keys" "$dest/keys/void" 78 79 80 81 cd "$pthbs_destdir/versions/$pthbs_package" 82 find -type d -o -print | awk -F/ ' 83 BEGIN { 84 x["./command/xbps-install.static"]=1 85 } 86 87 function r1(s) { 88 sub("^[.]/[^/]*", ".", s) 89 return s 90 } 91 function s1(repl, s) { 92 sub("^[.]/[^/]*", "./"repl, s) 93 return s 94 } 95 function link(src) { 96 x[$0]=0 97 printf "%s\t%s\n", $0, src 98 printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr" 99 } 100 $1!="."{exit 1} 101 102 103 $2 == "keys" { link($0); next } 104 105 $2 == "config" { link($0); next } 106 $2 == "keys" { link($0); next } 107 $2 == "zsh" { link($0); next } 108 $2 == "env" { link($0); next } 109 $2 == "command" { link($0); next } 110 $2 == "bin" { link(s1("command", $0)); next } 111 112 $2 == "library.so" { link($0); next } 113 $2 == "library" { link($0); next } 114 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next } 115 $2 == "lib" && $NF ~ /\.so(\..*)?$/ { link(s1("library.so", $0)); next } 116 117 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next } 118 119 $2 == "man" { link($0); next } 120 $2 == "info" { link($0); next } 121 $2 == "doc" { link($0); next } 122 $2 == "icons" { link($0); next } 123 $2 == "terminfo" { link($0); next } 124 $2 == "data" { link($0); next } 125 $2 == "include" { link($0); next } 126 127 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" } 128 129 END { 130 for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" } 131 for(fname in x) { 132 if(x[fname]) { 133 printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr" 134 exit 3 135 } 136 } 137 }' >.install-links.new 138 mv .install-links.new .install-links 139