mrrl

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

zsh (8120B)


      1 #!/usr/bin/env pthbs-build
      2 #+busybox.7f0e4d86f69de7624b0468018b9933c3e3c1757c8ff73938746c292196f916dd
      3 #+busybox-bzip2.52d2053dff44277d3c6f700eec6807d2c64c226e0f1bf589372ff5ff625be40e
      4 #+busybox-gzip.085fc42ce36be284c89a9dec6889cca59dedd07b9ba93a21d3198c4adcac5840
      5 #+busybox-lzop.bccd8f86de85a74d466d34f802ab1ea355f0a9d9886bdfa4d7bb4a785d695be6
      6 #+busybox-unzip.237a4ec36283b7fbdb85df583c7c77c0aaf70d335b1cbae09a40a9bb4b6c82bb
      7 #+busybox-xz.db25ed2ffbfc91e7b5cff54faf2e80de59ab5b15167c2c5bb338fa1ee62de122
      8 #+busybox-cpio.307e9495bcd9b79fd9559882115d55d22c5b687e08886e696f1e53d8db7eebcd
      9 #+busybox-dpkg.3aec8347093bb5b774a0c25795cdf9e624268a3b04cc48e867d74e4e06461db7
     10 #+busybox-rpm.8435251ea7058aea0cbcd41478b144b1a15c5aa121509af887847c0ef45bf5aa
     11 #+busybox-tar.c77139157bce13db8820740b756572c22e29cfbd8bb8c2a3b22b465b70e2eae9
     12 #+busybox-ed.4ac872215d7b9c8096c4cfd508434fbd2e825aebd9a9ea8589a0033b8e50aac2
     13 #+busybox-sed.14269a860b3706f7122b827818365fecaa0e62ce5bc3273e89948685c0953f2d
     14 #+busybox-vi.7e41b306c9c47aaaa281aa8347b9fa6dca260788fd73f53a7ba9260b315627ee
     15 #+busybox-xxd.9df3407fd75b89cb640d65870298eaba77327d6e387d25d8ce1ebab01cb47857
     16 #+busybox-process-extra.65afeaded3cb8fdeea327262f28f08e50f18d51a2b456ea97b293d200c7f558e
     17 #+busybox-procps.e5dc609521d29d8aec8253147269314439131c088a6beeacc172fc07594c4a37
     18 #+busybox-psmisc.7d760b69f45bb1b8d458f2f408b9cb3a42e919e8022f0508c440a5fd20ebb66f
     19 #+busybox-ash.fd5d266905d40248735e0e2e1ae22165b6f0d42c0bacb652660f69f39c1ee71e
     20 #+busybox-bc.6f2fe17efab2237c3036eba1c37d432d696d1b5dba130e21365016ceae0a3184
     21 #+busybox-coreutils.7e581faa6901f832a2a022d72b2858c3091f47afc80a4a463adb2f2a68f1843d
     22 #+busybox-coreutils-extra.5ab183b839676b0780a9a83d75cc345a06221fa34627c44aa3732c4a5a47f9b9
     23 #+busybox-daemontools.bcea69c867a61fe1d49d2f6a27e406959c484ed20d54fd7c0341828d3cdbd428
     24 #+busybox-grep.ac20e6a4295eb7fb0a09d700e10e5fe55e2009d2858e0a1525e461d4914e820b
     25 #+busybox-misc.7f0588b97809fac8061c489b686424de1a7dd17d8eb3431aae56513c7288f1e7
     26 #+busybox-sh.288f0583edc783a176bbbc59a3e854b186258ba2605291377a545cc3191c3d52
     27 #+busybox-util-linux-unpriv.5a286246aa7204f7fa8c9a247f1c93c751979690a65200030f29e255645c1eae
     28 #+busybox-findutils.207f73a9f41a8f9e279072e920cbf0c38ba6516734fa3cf2c1faf55565613487
     29 #+nawk.84c186be0a6d09a951a8c6a5377d16b0ba0a9e476e6b554c0c832d6407ebb5b2
     30 #+diffutils.fc3b1b10f669e9e7b906baeaccda743718beb2525f062132853123f854aa4cbf
     31 #+musl-cross-make.19d51dec5328ccacd41d47d7f24e33bac084aebefb839cb3fecb6573577b831a
     32 #+gnu-make.17b0037e8a3f24180cb7bb9ddb488039d540ba905aecca0315de313adfbae81c
     33 #+m4.615d99c28c6a4c9a2fab9b75c3ae68b6adf51a7afc4b03482077a284888aedb4
     34 #+netbsd-curses.c0684f88ec90e091f88a4712cede16b62997b00ae0fbf877d9f4e9f553aa4e25
     35 #+libbsd.3794cde304d13779c38e267a56f9b57267cff9b453d9ccfc1376f3c94ca54374
     36 #+patch.96351292cca51303a6659875ff00da38adbcc491e1966e0db30cea5469b8c123
     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=/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'/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=/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/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