pthbs

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

mpc (3788B)


      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 #+gmp.aea94b561a1ad1011f5c1101819239e74aeaf2daf211b73ab23630e95b63f0cc
      8 #@untar:-z:sha256:6985c538143c1208dcb1ac42cedad6ff52e267b47e5f970183a3e75125b43c2e:.
      9 
     10 autotools() {
     11 	cd "$1"
     12 	shift
     13 	export LD_LIBRARY_PATH="$pthbs_build_environment/library:$pthbs_build_environment/library.so"
     14 	export CPATH="$pthbs_build_environment/include"
     15 	export CFLAGS="-L$pthbs_build_environment/library -D_GNU_SOURCE $CFLAGS"
     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/mpc" \
     27 		--localstatedir='/home/ccx/.local/var' \
     28 		"$@"
     29 		# --libexecdir=DIR        program executables [EPREFIX/libexec]
     30 		# --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
     31 		# --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
     32 		# --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
     33 		# --includedir=DIR        C header files [PREFIX/include]
     34 		# --oldincludedir=DIR     C header files for non-gcc [/usr/include]
     35 		# --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
     36 		# --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
     37 		
     38 	# ac_cv_func_malloc_0_nonnull=yes \
     39 	# ac_cv_func_realloc_0_nonnull=yes
     40 	make -j${JOBS:-1} -l$((1+${JOBS:-1}))
     41 	make DESTDIR="$pthbs_destdir" install
     42 }
     43 
     44 autotools_static() {
     45 	export LDFLAGS="-static -L$pthbs_build_environment/library $LDFLAGS"
     46 	autotools "$@" --enable-static --disable-shared
     47 }
     48 
     49 check_static() {
     50 	local exe || true
     51 	exe=$pthbs_destdir/'/home/ccx/versions'/$pthbs_package/$1
     52 	if ! test -f $exe; then
     53 		printf '%s\n' "Error: file '$1' doesn't exist!"
     54 		exit 1
     55 	fi
     56 	interp_info=$(readelf --string-dump=.interp "$exe") || exit $?
     57 	if test x '!=' "x$interp_info"; then
     58 		printf '%s\n' "Error: '$1' is a dynamic binary!"
     59 		exit 1
     60 	fi
     61 }
     62 
     63 
     64 autotools mpc-1.1.0 --disable-nls --enable-static --disable-shared
     65 
     66 
     67 cd "$pthbs_destdir/home/ccx/versions/$pthbs_package"
     68 find -type d -o -print | awk -F/ '
     69 BEGIN {
     70 }
     71 
     72 function r1(s) {
     73 	sub("^[.]/[^/]*", ".", s)
     74 	return s
     75 }
     76 function s1(repl, s) {
     77 	sub("^[.]/[^/]*", "./"repl, s)
     78 	return s
     79 }
     80 function link(src) {
     81 	x[$0]=0
     82 	printf "%s\t%s\n", $0, src
     83 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
     84 }
     85 $1!="."{exit 1}
     86 
     87 
     88 $2 == "command" { link($0); next }
     89 $2 == "bin" { link(s1("command", $0)); next }
     90 
     91 $2 == "library.so" { link($0); next }
     92 $2 == "library" { link($0); next }
     93 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
     94 $2 == "lib" && $NF ~ /\.so(|\..*)$/ { link(s1("library.so", $0)); next }
     95 
     96 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
     97 
     98 $2 == "man" { link($0); next }
     99 $2 == "info" { link($0); next }
    100 $2 == "doc" { link($0); next }
    101 $2 == "icons" { link($0); next }
    102 $2 == "terminfo" { link($0); next }
    103 
    104 $2 == "include" { link($0); next }
    105 
    106 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
    107 
    108 END {
    109 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
    110 	for(fname in x) {
    111 		if(x[fname]) {
    112 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
    113 			exit 3
    114 		}
    115 	}
    116 }' >.install-links.new
    117 mv .install-links.new .install-links