mrrl

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

zsh (8156B)


      1 #!/usr/bin/env pthbs-build
      2 #+busybox.504428034e649f598212c8994966e36667178683ec90987355f495ad3ca4abac
      3 #+busybox-bzip2.4ea548a271f41e7147568dc02e5071fb200eab38a9a22e733d3106b71e354812
      4 #+busybox-gzip.0999e8c6a8b7df82fc1cf10ade2468fb2bc4352f76d4b1d2af5099a65ccada9b
      5 #+busybox-lzop.f0d93621bfd8ca106a8590562d93158b05087e5ef48068c7a84d9967b67d2d25
      6 #+busybox-unzip.737f61aac20ef6c0554fca59bb599bf98e4fb77fbd97fba65a3692ac9d4afb84
      7 #+busybox-xz.639cf99dd37a7d6f719b937d13af92202e01adf11c130f8647574c1d9ef5b0d2
      8 #+busybox-cpio.d22266c2b6c056c0ea96873402d06591aa23368ea24d91f1fbf8a8327cb210f8
      9 #+busybox-dpkg.2b0dd2fa41e946e98f2f8948ae3d3a152a069c77460768d9c76d41f56974e514
     10 #+busybox-rpm.62bb242b4fbb3fd51b233ed9ce6c257ab997b1ee3a68ef3048656addc98f3d97
     11 #+busybox-tar.dd3d9b0075fc038df431ce2a16fc1b140de521e1aa6d154dc7b607f9403d5ac0
     12 #+busybox-ed.6ff6cd59168705c6b256d800cde7e8c69dd05c556520317dae6a0b492029fe6b
     13 #+busybox-sed.8793bcd2536ab32fa528bbb0c22f0c014663ac5e045193aa7bd113a07f58c5b9
     14 #+busybox-vi.db3d29c62845a55b7c5491d057cb9ea6c6deba93c567f4ef9eb15f06be8ad171
     15 #+busybox-xxd.9dff38f0c9dbf57856a0824bc23cc99cb31a67ce5138de7a6de2e255880a5696
     16 #+busybox-process-extra.448a35fa5362e576a23ef306ec6e0da2f625adae08cc5c3b12a01d5d28f76ce6
     17 #+busybox-procps.835712dc539d5583773d175255a5c4e27b5823d97e855948d27cc2c194247b0f
     18 #+busybox-psmisc.f2434b74cd3e07ddea335da52c222567bc111b621f0f060afef8bcc26a8d96fd
     19 #+busybox-ash.039eb4051853cdde4d03b8dbd5d6128957bf933be5ac398471666e5db0d33dab
     20 #+busybox-bc.e731e83c11906525d676777835256a3f478779eafe7152701adfc46558d73009
     21 #+busybox-coreutils.a57a12f85d58388c284d4f93f6c485d4bc2a7eac0d0f4be57b20d2ddbd4c8b8f
     22 #+busybox-coreutils-extra.09de38ce2d65026888577e8314766e4b17205b2a99a4fecfdd5cd89c1cd82aed
     23 #+busybox-daemontools.d12e277e7154028f0beaae44ad1e2c7e1cd12d28549b6861604fc634c3e09aaf
     24 #+busybox-grep.474abd8ddad6afb320c55141078cb4507d02c4610181a4d72a4d98ba93434a60
     25 #+busybox-misc.ea211db457ee098923eeff82a4388d5864254a6c2718f38471b5b2867c73d158
     26 #+busybox-sh.49a7505969c9882c8a9a7ad3f5dba6d1382add3559f4da21ceafb2708d3fd4c8
     27 #+busybox-util-linux-unpriv.95b792cd49d1f00d5488b15d93809166916ef3b8a63a69ea11f3bf6e92a74f24
     28 #+busybox-findutils.db22f512240124b15d61cf8d0ceafebc98649f6f137608a2d1bd66f18e81ad8c
     29 #+nawk.ec8a7f9ea4618a151470a1c1a0026f688a5032eb06b8e459510fe82316c17a60
     30 #+diffutils.c44d0701c69295321eaa64bf7cf82233b2eec05a6c640cb8175af9a4e3ee7122
     31 #+musl-cross-make.4bca2cd43f4a72eaaeefc4befc0b0ce736a5906ec0245552a8db7dc56fa9e5ec
     32 #+gnu-make.fb4cff1c46827d02016d0f94d5256a263e7710025f7480fffb7580dc922a6069
     33 #+m4.3b766e732e3c57dd6ec18a8fa68d43ad094fca807d43cdcb68f8829a0c8f6905
     34 #+netbsd-curses.5a8c9e0f305a914f61d9d68494804f65a3d7d70c2a5dcffa1849dda6861f4ee5
     35 #+libbsd.355ebb7bca862f3ca057c952811e69029d7f0b6dd1d9fd983d92f18c3dc85c01
     36 #+patch.a77c8e315f380834752e2d22243a6276d4779f7f49c0a1ed7a01bd661a431898
     37 #@git:c73505cc47870bd09e8e204d98ac5976e0d4cb52:zsh_config
     38 #@sha256:02f8f8bc764f0bcb83c03675cd8bfd27ed7554563f01a1a96e567f8c1a517be7:skip-test-failing-on-musl.patch
     39 #@sha256:48d3480d96d2794b9ff91e510acade9b66917521f0fb07fec854ef511c1d945c:mrrl-testsuite.patch
     40 #@untar:-J:sha256:9b8d1ecedd5b5e81fbf1918e876752a7dd948e05c1a0dba10ab863842d45acd5:.
     41 
     42 
     43 # - build script start -
     44 
     45 autotools_config() {
     46 	prefix=/home/ccx/versions/$pthbs_package
     47 	./configure -C \
     48 		--prefix="$prefix" \
     49 		--build="$(${CC:-gcc} -dumpmachine)" \
     50 		--bindir="$prefix/command" \
     51 		--sbindir="$prefix/command" \
     52 		--infodir="$prefix/info" \
     53 		--localedir="$prefix/locale" \
     54 		--mandir="$prefix/man" \
     55 		--libdir="$prefix/library" \
     56 		--docdir="$prefix/doc/zsh" \
     57 		--datadir="$prefix/data" \
     58 		--datarootdir="$prefix/data" \
     59 		--localstatedir='/var/pthbs' \
     60 		"$@"
     61 
     62 }
     63 
     64 autotools_config_static() {
     65 	autotools_config "$@" --enable-static --disable-shared
     66 }
     67 
     68 build_env_static() {
     69 	export CFLAGS="-ffile-prefix-map=${pthbs_workdir}=builddir $CFLAGS"
     70 	export CXXFLAGS="-ffile-prefix-map=${pthbs_workdir}=builddir $CXXFLAGS"
     71 	export LDFLAGS="-static -L$pthbs_build_environment/library $LDFLAGS"
     72 }
     73 
     74 check_static() {
     75 	local exe || true
     76 	exe=$pthbs_destdir'/home/ccx/versions'/$pthbs_package/$1
     77 	if ! test -f $exe; then
     78 		printf '%s\n' "Error: file '$1' doesn't exist!"
     79 		exit 1
     80 	fi
     81 	local interp_info || true
     82 	interp_info=$(readelf --string-dump=.interp "$exe") || exit $?
     83 	if test x '!=' "x$interp_info"; then
     84 		printf '%s\n' "Error: '$1' is a dynamic binary!"
     85 		exit 1
     86 	fi
     87 }
     88 
     89 prefix=/home/ccx/versions/$pthbs_package
     90 dest=${pthbs_destdir%/}${prefix}
     91 cd 'zsh-5.9'
     92 patch -p1 <../skip-test-failing-on-musl.patch
     93 patch -p1 <../mrrl-testsuite.patch
     94 
     95 
     96 export CPATH=$pthbs_build_environment/'include'
     97 export LIBRARY_PATH=$pthbs_build_environment/'library'
     98 export LD_LIBRARY_PATH=$pthbs_build_environment/'library.so'
     99 build_env_static
    100 autotools_config \
    101 	--enable-datadir="${prefix}" \
    102 	--enable-datarootdir="${prefix}" \
    103 	--enable-etcdir="${prefix}/etc" \
    104 	--enable-scriptdir="${prefix}/zsh/scripts" \
    105 	--enable-site-scriptdir="${prefix}/zsh/site-scripts" \
    106 	--enable-fndir="${prefix}/zsh/functions" \
    107 	--enable-site-fndir="${prefix}/zsh/site-functions" \
    108 	--enable-runhelpdir="${prefix}/zsh/help" \
    109 	--disable-dynamic \
    110 	--disable-restricted-r \
    111 	--enable-locale \
    112 	--enable-maildir-support \
    113 	--disable-pcre \
    114 	--disable-gdbm \
    115 	--enable-cap \
    116 	--enable-multibyte \
    117 	--enable-unicode9 \
    118 	--enable-libc-musl \
    119 	--disable-dynamic-nss \
    120 	--with-tcsetpgrp
    121 
    122 # consider enabling:
    123 # name=zsh/attr modfile=Src/Modules/attr.mdd link=no auto=yes load=no
    124 # name=zsh/cap modfile=Src/Modules/cap.mdd link=no auto=yes load=no
    125 # name=zsh/curses modfile=Src/Modules/curses.mdd link=no auto=yes load=no
    126 # name=zsh/mathfunc modfile=Src/Modules/mathfunc.mdd link=no auto=yes load=no
    127 # name=zsh/zprof modfile=Src/Modules/zprof.mdd link=no auto=yes load=no
    128 sed -Ee '/name=zsh\/(files|stat|system|zselect|zutil|regex|net\/socket|net\/tcp) /s/link=[^ ]+/link=static/' -i config.modules
    129 cat config.modules
    130 
    131 
    132 make -j${JOBS:-1} -l$((1+${JOBS:-1}))
    133 
    134 cat Src/zshpaths.h
    135 make DESTDIR="$pthbs_destdir" install
    136 mv -v ../zsh_config/etc "${dest}/"
    137 mv -v ../zsh_config/zsh-functions/* "${dest}/zsh/site-functions/"
    138 
    139 
    140 
    141 make check
    142 check_static command/zsh
    143 
    144 
    145 mkdir -p "$dest/.env-template"
    146 printf '%s' >"$dest/.env-template"/'FPATH'  '@ENVROOT@/zsh/site-functions:@ENVROOT@/zsh/functions'
    147 
    148 cd "$pthbs_destdir/home/ccx/versions/$pthbs_package"
    149 find -type d -o -print | awk -F/ '
    150 BEGIN {
    151 	x["./command/zsh"]=1
    152 	x["./man/man1/zsh.1"]=1
    153 	x["./man/man1/zshall.1"]=1
    154 }
    155 
    156 function r1(s) {
    157 	sub("^[.]/[^/]*", ".", s)
    158 	return s
    159 }
    160 function s1(repl, s) {
    161 	sub("^[.]/[^/]*", "./"repl, s)
    162 	return s
    163 }
    164 function link(src) {
    165 	x[$0]=0
    166 	printf "%s\t%s\n", $0, src
    167 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
    168 }
    169 $1!="."{exit 1}
    170 $2 == "env" { link($0); next }
    171 $2 == ".env-template" { link($0); next }
    172 
    173 $2 == "command" { link($0); next }
    174 $2 == "command" { link($0); next }
    175 $2 == "bin" { link(s1("command", $0)); next }
    176 $2 == "sbin" { link(s1("command", $0)); next }
    177 
    178 $2 == "library.so" { link($0); next }
    179 $2 == "library" { link($0); next }
    180 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
    181 $2 == "lib" && $NF ~ /\.so(\..*)?$/ { link(s1("library.so", $0)); next }
    182 
    183 $2 == "share" && $3 == "info" { link(s1("info", r1($0))); next }
    184 $2 == "share" && $3 == "man" { link(s1("man", r1($0))); next }
    185 $2 == "share" && $3 == "doc" { link(s1("doc", r1($0))); next }
    186 
    187 $2 == "config" { link($0); next }
    188 $2 == "man" { link($0); next }
    189 $2 == "info" { link($0); next }
    190 $2 == "doc" { link($0); next }
    191 $2 == "data" { link($0); next }
    192 $2 == "include" { link($0); next }
    193 
    194 $2 == "share" && $3 ~ /^(icons|terminfo)$/ { link(r1($0)); next }
    195 
    196 $2 == "library.ocaml" { link($0); next }
    197 
    198 $2 == "keys" { link($0); next }
    199 $2 == "zsh" { link($0); next }
    200 $2 == "vimfiles" { link($0); next }
    201 $2 == "icons" { link($0); next }
    202 $2 == "terminfo" { link($0); next }
    203 
    204 
    205 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
    206 
    207 END {
    208 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
    209 	retcode = 0
    210 	for(fname in x) {
    211 		if(x[fname]) {
    212 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
    213 			retcode = 3
    214 		}
    215 	}
    216 	exit retcode
    217 }' >.install-links.new
    218 mv .install-links.new .install-links
    219