mrrl

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

curl (3670B)


      1 #!/usr/bin/env pthbs-build
      2 #+musl-cross-make.757bcca6771cad3395ae302e0fdc835ebf5b4a965c08e30d758e6149b0bacbcd
      3 #+gnu-make.529116171fecc2bdac7c70e109d28270d765379c8a52cf7c3ea7453195bbf42b
      4 #+busybox.3664b94c09ea6d35ce73985026762c142829e53fed4a38541af3afb00c37dd4a
      5 #+busybox-diffutils.a22698424a7618572314d3da6953bf6652138ec492d3a0d01c37072f74adefc4
      6 #+m4.b78d93922dc9dbf43dd31037c98271490db5d6d1919b69b12122cf55fa1fb515
      7 #+libressl.dc3d77c147487b10dba1c94c97c776418f4c5d798583f17754b647912ff70066
      8 #@untar:-J:sha256:3ccd55d91af9516539df80625f818c734dc6f2ecf9bada33c76765e99121db15:.
      9 
     10 build_env_static() {
     11 	export LD_LIBRARY_PATH="$pthbs_build_environment/library"
     12 	export CPATH="$pthbs_build_environment/include"
     13 	export LDFLAGS="-static -L$pthbs_build_environment/library $LDFLAGS"
     14 }
     15 autotools_config() {
     16 	prefix=/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() {
     35 	cd "$1"
     36 	shift
     37 	autotools_config "$@"
     38 	make -j${JOBS:-1} -l$((1+${JOBS:-1}))
     39 	make DESTDIR="$pthbs_destdir" install
     40 }
     41 
     42 autotools_static() {
     43 	build_env_static
     44 	autotools "$@" --enable-static --disable-shared
     45 }
     46 check_static() {
     47 	local exe || true
     48 	exe=$pthbs_destdir/'/versions'/$pthbs_package/$1
     49 	if ! test -f $exe; then
     50 		printf '%s\n' "Error: file '$1' doesn't exist!"
     51 		exit 1
     52 	fi
     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 
     61 # Do not generate manpages (requires Perl)
     62 (
     63 	cd curl-8.6.0
     64 	t=$(busybox which true)
     65 	for f in scripts/cd2nroff docs/cmdline-opts/*.pl; do
     66 		printf '#!%s\n' "$t" >$f
     67 	done
     68 ) || exit $?
     69 
     70 export LDFLAGS="--static"
     71 autotools_static curl-8.6.0 \
     72 	--with-zlib \
     73 	--enable-ipv6 \
     74 	--enable-unix-sockets \
     75 	--enable-static \
     76 	--with-openssl \
     77 	--disable-ldap \
     78 	--enable-websockets \
     79 	--without-libssh2 \
     80 	--without-libpsl \
     81 	--disable-manual
     82 check_static command/curl
     83 
     84 rm -r -v "$pthbs_destdir"'/versions'"/$pthbs_package/man"
     85 
     86 
     87 
     88 cd "$pthbs_destdir/versions/$pthbs_package"
     89 find -type d -o -print | awk -F/ '
     90 BEGIN {
     91 	x["./command/curl"]=1
     92 	x["./library/libcurl.a"]=1
     93 }
     94 
     95 function r1(s) {
     96 	sub("^[.]/[^/]*", ".", s)
     97 	return s
     98 }
     99 function s1(repl, s) {
    100 	sub("^[.]/[^/]*", "./"repl, s)
    101 	return s
    102 }
    103 function link(src) {
    104 	x[$0]=0
    105 	printf "%s\t%s\n", $0, src
    106 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
    107 }
    108 $1!="."{exit 1}
    109 
    110 
    111 $2 == "command" { link($0); next }
    112 $2 == "bin" { link(s1("command", $0)); next }
    113 
    114 $2 == "library.so" { link($0); next }
    115 $2 == "library" { link($0); next }
    116 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
    117 $2 == "lib" && $NF ~ /\.so(|\..*)$/ { link(s1("library.so", $0)); next }
    118 
    119 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
    120 
    121 $2 == "man" { link($0); next }
    122 $2 == "info" { link($0); next }
    123 $2 == "doc" { link($0); next }
    124 $2 == "icons" { link($0); next }
    125 $2 == "terminfo" { link($0); next }
    126 $2 == "data" { link($0); next }
    127 $2 == "include" { link($0); next }
    128 
    129 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
    130 
    131 END {
    132 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
    133 	for(fname in x) {
    134 		if(x[fname]) {
    135 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
    136 			exit 3
    137 		}
    138 	}
    139 }' >.install-links.new
    140 mv .install-links.new .install-links