zsh (4405B)
1 #!/usr/bin/env pthbs-build 2 #+musl-cross-make.675bc960d97b88b341ba4c64ea1b10f6afd9c9f0394ed84ca848768c5e1b646c 3 #+gnu-make.152d99fd58e3130b4bd4d23833643ca418555a0560e88962cd8a28ffcd9a9ab7 4 #+busybox.7818e9d6df97d97317c8fcdf404811731aa0c5c3ab7eb6aec00c9652b6da511c 5 #+busybox-diffutils.3579038707d7520c09339ee4fc3b67ef03caeeaf8fff3b6f93c51ace141a4393 6 #+m4.9943b16e3463f08c59487393409dc10df95173d9d015f907948a44a96e7fd8ee 7 #+netbsd-curses.004393af64d72860abfbd3f65687fd84cee8800418aa806091b7792cb14934c7 8 #+libbsd.5a8c8c47db896a588db6a8f01233156844bad6f36e0edfb11bc0dccddbfffa1f 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