pthbs

Packaging Through Hashed Build Scripts
git clone https://ccx.te2000.cz/git/pthbs
Log | Files | Refs | Submodules | README

gmp (3717B)


      1 #!/usr/bin/env pthbs-build
      2 #+musl-cross-make.6377e568aa49eae6525f0f5ed4a7d2505704941ef74850d2f208da7b12c7865d
      3 #+gnu-make.1d42a93ec73db6119517d6554dbd49317209dc527295acb4ea8e804be913b9a3
      4 #+busybox.a41e637082cdc82c38a093db7af3615cc2f417a0e8034f7a7ba88d64e852e101
      5 #+busybox-diffutils.28aa9a4a515da839eaf2e9873bccf363e8eb4829bff3307d2f000204690dfc82
      6 #+m4.b4d536e5f08f9c11575bfc61d943c9714bc556ed473eedb0520288720ff13871
      7 #@untar:-j:sha256:5275bb04f4863a13516b2f39392ac5e272f5e1bb8057b18aec1c9b79d73d8fb2:.
      8 
      9 autotools() {
     10 	cd "$1"
     11 	shift
     12 	export LD_LIBRARY_PATH="$pthbs_build_environment/library:$pthbs_build_environment/library.so"
     13 	export CPATH="$pthbs_build_environment/include"
     14 	export CFLAGS="-L$pthbs_build_environment/library -D_GNU_SOURCE $CFLAGS"
     15 	prefix=/home/ccx/versions/$pthbs_package
     16 	./configure -C \
     17 		--prefix="$prefix" \
     18 		--build="$(${CC:-gcc} -dumpmachine)" \
     19 		--bindir="$prefix/command" \
     20 		--sbindir="$prefix/command" \
     21 		--infodir="$prefix/info" \
     22 		--localedir="$prefix/locale" \
     23 		--mandir="$prefix/man" \
     24 		--libdir="$prefix/library" \
     25 		--docdir="$prefix/doc/gmp" \
     26 		--localstatedir='/home/ccx/.local/var' \
     27 		"$@"
     28 		# --libexecdir=DIR        program executables [EPREFIX/libexec]
     29 		# --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
     30 		# --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
     31 		# --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
     32 		# --includedir=DIR        C header files [PREFIX/include]
     33 		# --oldincludedir=DIR     C header files for non-gcc [/usr/include]
     34 		# --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
     35 		# --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
     36 		
     37 	# ac_cv_func_malloc_0_nonnull=yes \
     38 	# ac_cv_func_realloc_0_nonnull=yes
     39 	make -j${JOBS:-1} -l$((1+${JOBS:-1}))
     40 	make DESTDIR="$pthbs_destdir" install
     41 }
     42 
     43 autotools_static() {
     44 	export LDFLAGS="-static -L$pthbs_build_environment/library $LDFLAGS"
     45 	autotools "$@" --enable-static --disable-shared
     46 }
     47 
     48 check_static() {
     49 	local exe || true
     50 	exe=$pthbs_destdir/'/home/ccx/versions'/$pthbs_package/$1
     51 	if ! test -f $exe; then
     52 		printf '%s\n' "Error: file '$1' doesn't exist!"
     53 		exit 1
     54 	fi
     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 
     63 autotools gmp-6.1.2 --disable-nls --enable-static --disable-shared
     64 
     65 
     66 cd "$pthbs_destdir/home/ccx/versions/$pthbs_package"
     67 find -type d -o -print | awk -F/ '
     68 BEGIN {
     69 }
     70 
     71 function r1(s) {
     72 	sub("^[.]/[^/]*", ".", s)
     73 	return s
     74 }
     75 function s1(repl, s) {
     76 	sub("^[.]/[^/]*", "./"repl, s)
     77 	return s
     78 }
     79 function link(src) {
     80 	x[$0]=0
     81 	printf "%s\t%s\n", $0, src
     82 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
     83 }
     84 $1!="."{exit 1}
     85 
     86 
     87 $2 == "command" { link($0); next }
     88 $2 == "bin" { link(s1("command", $0)); next }
     89 
     90 $2 == "library.so" { link($0); next }
     91 $2 == "library" { link($0); next }
     92 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
     93 $2 == "lib" && $NF ~ /\.so(|\..*)$/ { link(s1("library.so", $0)); next }
     94 
     95 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
     96 
     97 $2 == "man" { link($0); next }
     98 $2 == "info" { link($0); next }
     99 $2 == "doc" { link($0); next }
    100 $2 == "icons" { link($0); next }
    101 $2 == "terminfo" { link($0); next }
    102 
    103 $2 == "include" { link($0); next }
    104 
    105 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
    106 
    107 END {
    108 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
    109 	for(fname in x) {
    110 		if(x[fname]) {
    111 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
    112 			exit 3
    113 		}
    114 	}
    115 }' >.install-links.new
    116 mv .install-links.new .install-links