mrrl

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

curl (4090B)


      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 #+libressl.de7444026279c2cb27262bce64bc243cdfaab374282b63ad354f78cb0f04b311
     10 #@untar:-J:sha256:3ccd55d91af9516539df80625f818c734dc6f2ecf9bada33c76765e99121db15:.
     11 
     12 
     13 # - build script start -
     14 
     15 autotools_config() {
     16 	prefix=/home/ccx/versions/$pthbs_package
     17 	./configure -C \
     18 		--prefix="$prefix" \
     19 		--build="$(${CC:-gcc} -dumpmachine)" \
     20 		--bindir="$prefix/command" \
     21 		--sbindir="$prefix/command" \
     22 		--infodir="$prefix/info" \
     23 		--localedir="$prefix/locale" \
     24 		--mandir="$prefix/man" \
     25 		--libdir="$prefix/library" \
     26 		--docdir="$prefix/doc/curl" \
     27 		--datadir="$prefix/data" \
     28 		--datarootdir="$prefix/data" \
     29 		--localstatedir='/var/pthbs' \
     30 		"$@"
     31 
     32 }
     33 
     34 autotools_config_static() {
     35 	build_env_static
     36 	autotools_config "$@" --enable-static --disable-shared
     37 }
     38 
     39 build_env_static() {
     40 	export LD_LIBRARY_PATH="$pthbs_build_environment/library"
     41 	export CPATH="$pthbs_build_environment/include"
     42 	export LDFLAGS="-static -L$pthbs_build_environment/library $LDFLAGS"
     43 }
     44 
     45 check_static() {
     46 	local exe || true
     47 	exe=$pthbs_destdir'/home/ccx/versions'/$pthbs_package/$1
     48 	if ! test -f $exe; then
     49 		printf '%s\n' "Error: file '$1' doesn't exist!"
     50 		exit 1
     51 	fi
     52 	local interp_info || true
     53 	interp_info=$(readelf --string-dump=.interp "$exe") || exit $?
     54 	if test x '!=' "x$interp_info"; then
     55 		printf '%s\n' "Error: '$1' is a dynamic binary!"
     56 		exit 1
     57 	fi
     58 }
     59 
     60 prefix=/home/ccx/versions/$pthbs_package
     61 dest=${pthbs_destdir%/}${prefix}
     62 cd 'curl-8.6.0'
     63 
     64 
     65 
     66 # Do not generate manpages (requires Perl)
     67 (
     68 	t=$(busybox which true)
     69 	for f in scripts/cd2nroff docs/cmdline-opts/*.pl; do
     70 		printf '#!%s\n' "$t" >$f
     71 	done
     72 ) || exit $?
     73 
     74 export LDFLAGS="--static"
     75 autotools_config_static \
     76 	--with-zlib \
     77 	--enable-ipv6 \
     78 	--enable-unix-sockets \
     79 	--enable-static \
     80 	--with-openssl \
     81 	--disable-ldap \
     82 	--enable-websockets \
     83 	--without-libssh2 \
     84 	--without-libpsl \
     85 	--disable-manual
     86 
     87 
     88 make -j${JOBS:-1} -l$((1+${JOBS:-1}))
     89 
     90 
     91 make DESTDIR="$pthbs_destdir" install
     92 
     93 rm -r -v "$pthbs_destdir"'/home/ccx/versions'"/$pthbs_package/man"
     94 
     95 
     96 
     97 check_static command/curl
     98 
     99 
    100 
    101 cd "$pthbs_destdir/home/ccx/versions/$pthbs_package"
    102 find -type d -o -print | awk -F/ '
    103 BEGIN {
    104 	x["./command/curl"]=1
    105 	x["./library/libcurl.a"]=1
    106 }
    107 
    108 function r1(s) {
    109 	sub("^[.]/[^/]*", ".", s)
    110 	return s
    111 }
    112 function s1(repl, s) {
    113 	sub("^[.]/[^/]*", "./"repl, s)
    114 	return s
    115 }
    116 function link(src) {
    117 	x[$0]=0
    118 	printf "%s\t%s\n", $0, src
    119 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
    120 }
    121 $1!="."{exit 1}
    122 
    123 
    124 $2 == "config" { link($0); next }
    125 $2 == "keys" { link($0); next }
    126 $2 == "zsh" { link($0); next }
    127 $2 == "env" { link($0); next }
    128 $2 == "command" { link($0); next }
    129 $2 == "bin" { link(s1("command", $0)); next }
    130 
    131 $2 == "library.so" { link($0); next }
    132 $2 == "library" { link($0); next }
    133 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
    134 $2 == "lib" && $NF ~ /\.so(\..*)?$/ { link(s1("library.so", $0)); next }
    135 
    136 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
    137 
    138 $2 == "man" { link($0); next }
    139 $2 == "info" { link($0); next }
    140 $2 == "doc" { link($0); next }
    141 $2 == "icons" { link($0); next }
    142 $2 == "terminfo" { link($0); next }
    143 $2 == "data" { link($0); next }
    144 $2 == "include" { link($0); next }
    145 
    146 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
    147 
    148 END {
    149 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
    150 	for(fname in x) {
    151 		if(x[fname]) {
    152 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
    153 			exit 3
    154 		}
    155 	}
    156 }' >.install-links.new
    157 mv .install-links.new .install-links
    158