mrrl

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

zsh (4737B)


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