libmd (3556B)
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 #@untar:-J:sha256:1bd6aa42275313af3141c7cf2e5b964e8b1fd488025caf2f971f43b00776b332:. 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/libmd" \ 26 --datadir="$prefix/data" \ 27 --datarootdir="$prefix/data" \ 28 --localstatedir='/var/pthbs' \ 29 "$@" 30 31 } 32 33 autotools_config_static() { 34 build_env_static 35 autotools_config "$@" --enable-static --disable-shared 36 } 37 38 build_env_static() { 39 export LD_LIBRARY_PATH="$pthbs_build_environment/library" 40 export CPATH="$pthbs_build_environment/include" 41 export LDFLAGS="-static -L$pthbs_build_environment/library $LDFLAGS" 42 } 43 44 check_static() { 45 local exe || true 46 exe=$pthbs_destdir'/home/ccx/versions'/$pthbs_package/$1 47 if ! test -f $exe; then 48 printf '%s\n' "Error: file '$1' doesn't exist!" 49 exit 1 50 fi 51 local interp_info || true 52 interp_info=$(readelf --string-dump=.interp "$exe") || exit $? 53 if test x '!=' "x$interp_info"; then 54 printf '%s\n' "Error: '$1' is a dynamic binary!" 55 exit 1 56 fi 57 } 58 59 prefix=/home/ccx/versions/$pthbs_package 60 dest=${pthbs_destdir%/}${prefix} 61 cd 'libmd-1.1.0' 62 63 64 autotools_config_static 65 66 67 make -j${JOBS:-1} -l$((1+${JOBS:-1})) 68 69 make DESTDIR="$pthbs_destdir" install 70 71 72 73 74 75 cd "$pthbs_destdir/home/ccx/versions/$pthbs_package" 76 find -type d -o -print | awk -F/ ' 77 BEGIN { 78 x["./library/libmd.a"]=1 79 x["./include/rmd160.h"]=1 80 x["./include/sha512.h"]=1 81 } 82 83 function r1(s) { 84 sub("^[.]/[^/]*", ".", s) 85 return s 86 } 87 function s1(repl, s) { 88 sub("^[.]/[^/]*", "./"repl, s) 89 return s 90 } 91 function link(src) { 92 x[$0]=0 93 printf "%s\t%s\n", $0, src 94 printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr" 95 } 96 $1!="."{exit 1} 97 98 99 $2 == "config" { link($0); next } 100 $2 == "keys" { link($0); next } 101 $2 == "zsh" { link($0); next } 102 $2 == "env" { link($0); next } 103 $2 == "command" { link($0); next } 104 $2 == "bin" { link(s1("command", $0)); next } 105 106 $2 == "library.so" { link($0); next } 107 $2 == "library" { link($0); next } 108 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next } 109 $2 == "lib" && $NF ~ /\.so(\..*)?$/ { link(s1("library.so", $0)); next } 110 111 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next } 112 113 $2 == "man" { link($0); next } 114 $2 == "info" { link($0); next } 115 $2 == "doc" { link($0); next } 116 $2 == "icons" { link($0); next } 117 $2 == "terminfo" { link($0); next } 118 $2 == "data" { link($0); next } 119 $2 == "include" { link($0); next } 120 121 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" } 122 123 END { 124 for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" } 125 for(fname in x) { 126 if(x[fname]) { 127 printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr" 128 exit 3 129 } 130 } 131 }' >.install-links.new 132 mv .install-links.new .install-links 133