zsh (4405B)
1 #!/usr/bin/env pthbs-build 2 #+musl-cross-make.65f98305f5666435bf0c6b9ccedffae2179ff1b3286752756886f760cf7771d2 3 #+gnu-make.782c9e6625fd7420e2cd38b847afed19db3b3844cae8a0426a0dbf73e10d78e5 4 #+busybox.e60885fe93ee85c01831673bb29f0e62a64903f4ce3094e3dc35bc8ec8887ad9 5 #+busybox-diffutils.4f5a07b29246414b77a7d71b103263af8f1249d75ddcbd9864e00def3d6feded 6 #+m4.d61a4ef6e5ca207e24ed8bbbd9931e1e0ac2359ed5aae4e384b49d71401b4840 7 #+netbsd-curses.ff25fe788224b3d213f4fc5b1627e5c08f24ca35f1590f25465e2bd9fb47ceae 8 #+libbsd.b10dae40b24e581364779dc07b7224f4af78d02daa708d413c85f87e72cb1ced 9 #@git:c73505cc47870bd09e8e204d98ac5976e0d4cb52:zsh_config 10 #@untar:-J:sha256:9b8d1ecedd5b5e81fbf1918e876752a7dd948e05c1a0dba10ab863842d45acd5:. 11 12 build_env_static() { 13 export LD_LIBRARY_PATH="$pthbs_build_environment/library" 14 export CPATH="$pthbs_build_environment/include" 15 export LDFLAGS="-static -L$pthbs_build_environment/library $LDFLAGS" 16 } 17 autotools_config() { 18 prefix=/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/zsh" \ 29 --datadir="$prefix/data" \ 30 --datarootdir="$prefix/data" \ 31 --localstatedir='/var/pthbs' \ 32 "$@" 33 34 } 35 36 autotools() { 37 cd "$1" 38 shift 39 autotools_config "$@" 40 make -j${JOBS:-1} -l$((1+${JOBS:-1})) 41 make DESTDIR="$pthbs_destdir" install 42 } 43 44 autotools_static() { 45 build_env_static 46 autotools "$@" --enable-static --disable-shared 47 } 48 check_static() { 49 local exe || true 50 exe=$pthbs_destdir/'/versions'/$pthbs_package/$1 51 if ! test -f $exe; then 52 printf '%s\n' "Error: file '$1' doesn't exist!" 53 exit 1 54 fi 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 build_env_static 63 cd zsh-5.9 64 autotools_config \ 65 --enable-static --disable-shared \ 66 --enable-libc-musl --disable-locale \ 67 --enable-cap \ 68 --enable-maildir-support \ 69 --enable-datadir="/versions/$pthbs_package" \ 70 --enable-datarootdir="/versions/$pthbs_package" \ 71 --enable-etcdir="/versions/$pthbs_package/etc" \ 72 --enable-scriptdir="/versions/$pthbs_package/zsh/scripts" \ 73 --enable-site-scriptdir="/versions/$pthbs_package/zsh/site-scripts" \ 74 --enable-fndir="/versions/$pthbs_package/zsh/functions" \ 75 --enable-site-fndir="/versions/$pthbs_package/zsh/site-functions" \ 76 --enable-runhelpdir="/versions/$pthbs_package/zsh/help" 77 78 sed -Ee '/name=zsh\/(files|stat|system|zselect|zutil|regex|net\/socket|net\/tcp) /s/link=[^ ]+/link=static/' -i config.modules 79 cat config.modules 80 81 make -j${JOBS:-1} -l$((1+${JOBS:-1})) 82 83 cat Src/zshpaths.h 84 make DESTDIR="$pthbs_destdir" install 85 mv -v ../zsh_config/etc "$pthbs_destdir//versions/$pthbs_package/" 86 mv -v ../zsh_config/zsh-functions/* "$pthbs_destdir//versions/$pthbs_package/zsh/site-functions/" 87 check_static command/zsh 88 89 90 91 cd "$pthbs_destdir/versions/$pthbs_package" 92 find -type d -o -print | awk -F/ ' 93 BEGIN { 94 x["./command/zsh"]=1 95 x["./man/man1/zsh.1"]=1 96 x["./man/man1/zshall.1"]=1 97 } 98 99 function r1(s) { 100 sub("^[.]/[^/]*", ".", s) 101 return s 102 } 103 function s1(repl, s) { 104 sub("^[.]/[^/]*", "./"repl, s) 105 return s 106 } 107 function link(src) { 108 x[$0]=0 109 printf "%s\t%s\n", $0, src 110 printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr" 111 } 112 $1!="."{exit 1} 113 114 115 $2 == "zsh" { link($0); next } 116 $2 == "command" { link($0); next } 117 $2 == "bin" { link(s1("command", $0)); next } 118 119 $2 == "library.so" { link($0); next } 120 $2 == "library" { link($0); next } 121 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next } 122 $2 == "lib" && $NF ~ /\.so(|\..*)$/ { link(s1("library.so", $0)); next } 123 124 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next } 125 126 $2 == "man" { link($0); next } 127 $2 == "info" { link($0); next } 128 $2 == "doc" { link($0); next } 129 $2 == "icons" { link($0); next } 130 $2 == "terminfo" { link($0); next } 131 $2 == "data" { link($0); next } 132 $2 == "include" { link($0); next } 133 134 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" } 135 136 END { 137 for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" } 138 for(fname in x) { 139 if(x[fname]) { 140 printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr" 141 exit 3 142 } 143 } 144 }' >.install-links.new 145 mv .install-links.new .install-links