pthbs

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

netbsd-curses (2260B)


      1 #!/usr/bin/env pthbs-build
      2 #+busybox.e60885fe93ee85c01831673bb29f0e62a64903f4ce3094e3dc35bc8ec8887ad9
      3 #+gnu-make.782c9e6625fd7420e2cd38b847afed19db3b3844cae8a0426a0dbf73e10d78e5
      4 #+musl-cross-make.65f98305f5666435bf0c6b9ccedffae2179ff1b3286752756886f760cf7771d2
      5 #@git:5874f9b1ced9c29d7d590d95e254b252f657a160:curses
      6 
      7 export CFLAGS="-L$pthbs_build_environment/library -L$pthbs_build_environment/library.so"
      8 export LDFLAGS="-static -L$pthbs_build_environment/library $LDFLAGS"
      9 export LD_LIBRARY_PATH="$pthbs_build_environment/library:$pthbs_build_environment/library.so"
     10 export CPATH="$pthbs_build_environment/include"
     11 
     12 cd curses
     13 prefix=/versions/$pthbs_package
     14 make -j${JOBS:-1} -l$((1+${JOBS:-1}))
     15 cat << EOF > config.mak
     16 PREFIX=$prefix
     17 PREFIX="$prefix"
     18 BINDIR="$prefix/command"
     19 INCDIR="$prefix/include"
     20 LIBDIR="$prefix/library"
     21 MANDIR="$prefix/man"
     22 DESTDIR="$pthbs_destdir"
     23 EOF
     24 
     25 make -j${JOBS:-1} -l$((1+${JOBS:-1}))
     26 make install-static
     27 
     28 cd "$pthbs_destdir/versions/$pthbs_package"
     29 find -type d -o -print | awk -F/ '
     30 BEGIN {
     31 	x["./library/libncurses.a"]=1
     32 }
     33 
     34 function r1(s) {
     35 	sub("^[.]/[^/]*", ".", s)
     36 	return s
     37 }
     38 function s1(repl, s) {
     39 	sub("^[.]/[^/]*", "./"repl, s)
     40 	return s
     41 }
     42 function link(src) {
     43 	x[$0]=0
     44 	printf "%s\t%s\n", $0, src
     45 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
     46 }
     47 $1!="."{exit 1}
     48 
     49 
     50 $2 == "command" { link($0); next }
     51 $2 == "bin" { link(s1("command", $0)); next }
     52 
     53 $2 == "library.so" { link($0); next }
     54 $2 == "library" { link($0); next }
     55 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
     56 $2 == "lib" && $NF ~ /\.so(|\..*)$/ { link(s1("library.so", $0)); next }
     57 
     58 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
     59 
     60 $2 == "man" { link($0); next }
     61 $2 == "info" { link($0); next }
     62 $2 == "doc" { link($0); next }
     63 $2 == "icons" { link($0); next }
     64 $2 == "terminfo" { link($0); next }
     65 $2 == "data" { link($0); next }
     66 $2 == "include" { link($0); next }
     67 
     68 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
     69 
     70 END {
     71 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
     72 	for(fname in x) {
     73 		if(x[fname]) {
     74 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
     75 			exit 3
     76 		}
     77 	}
     78 }' >.install-links.new
     79 mv .install-links.new .install-links