pthbs

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

git (3032B)


      1 #!/usr/bin/env pthbs-build
      2 #+musl-cross-make.65f98305f5666435bf0c6b9ccedffae2179ff1b3286752756886f760cf7771d2
      3 #+gnu-make.782c9e6625fd7420e2cd38b847afed19db3b3844cae8a0426a0dbf73e10d78e5
      4 #+busybox.e60885fe93ee85c01831673bb29f0e62a64903f4ce3094e3dc35bc8ec8887ad9
      5 #+busybox-diffutils.4f5a07b29246414b77a7d71b103263af8f1249d75ddcbd9864e00def3d6feded
      6 #+m4.d61a4ef6e5ca207e24ed8bbbd9931e1e0ac2359ed5aae4e384b49d71401b4840
      7 #+libressl.712d293b92e9b1beb4a8b5905c45ea20cab64e3ddd9796f9c2781577f04771ab
      8 #+curl.b82f818e85570a561ca20ca417adba2f1c3214ef5c3e01626c0a4aa099b90f0c
      9 #@untar:-J:sha256:f612c1abc63557d50ad3849863fc9109670139fc9901e574460ec76e0511adb9:.
     10 
     11 check_static() {
     12 	local exe || true
     13 	exe=$pthbs_destdir/'/versions'/$pthbs_package/$1
     14 	if ! test -f $exe; then
     15 		printf '%s\n' "Error: file '$1' doesn't exist!"
     16 		exit 1
     17 	fi
     18 	interp_info=$(readelf --string-dump=.interp "$exe") || exit $?
     19 	if test x '!=' "x$interp_info"; then
     20 		printf '%s\n' "Error: '$1' is a dynamic binary!"
     21 		exit 1
     22 	fi
     23 }
     24 
     25 prefix=/versions/$pthbs_package
     26 
     27 make -j${JOBS:-1} -l$((1+${JOBS:-1})) -C ./git-2.43.2 \
     28 	LD_LIBRARY_PATH="$pthbs_build_environment/library:$pthbs_build_environment/library.so" \
     29 	CPATH="$pthbs_build_environment/include" \
     30 	LDFLAGS="-static --static -L$pthbs_build_environment/library" \
     31 	CPPFLAGS="-D_GNU_SOURCE" \
     32 	NO_REGEX=NeedsStartEnd \
     33 	NO_TCLTK=1 NO_PYTHON=1 NO_EXPAT=1 NO_GETTEXT=1 \
     34 	DESTDIR="$pthbs_destdir" \
     35 	prefix="$prefix" \
     36 	gitexecdir="$prefix"/git-core \
     37 	bindir="$prefix/command" \
     38 	mandir="$prefix/man" \
     39 	infodir="$prefix/info" \
     40 	sharedir="$prefix/share" \
     41 	gitwebdir="$prefix/gitweb" \
     42 	V=1 all install
     43 
     44 check_static command/git
     45 
     46 
     47 cd "$pthbs_destdir/versions/$pthbs_package"
     48 find -type d -o -print | awk -F/ '
     49 BEGIN {
     50 	x["./command/git"]=1
     51 	x["./command/git-upload-archive"]=1
     52 	x["./command/git-receive-pack"]=1
     53 }
     54 
     55 function r1(s) {
     56 	sub("^[.]/[^/]*", ".", s)
     57 	return s
     58 }
     59 function s1(repl, s) {
     60 	sub("^[.]/[^/]*", "./"repl, s)
     61 	return s
     62 }
     63 function link(src) {
     64 	x[$0]=0
     65 	printf "%s\t%s\n", $0, src
     66 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
     67 }
     68 $1!="."{exit 1}
     69 
     70 
     71 $2 == "command" { link($0); next }
     72 $2 == "bin" { link(s1("command", $0)); next }
     73 
     74 $2 == "library.so" { link($0); next }
     75 $2 == "library" { link($0); next }
     76 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
     77 $2 == "lib" && $NF ~ /\.so(|\..*)$/ { link(s1("library.so", $0)); next }
     78 
     79 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
     80 
     81 $2 == "man" { link($0); next }
     82 $2 == "info" { link($0); next }
     83 $2 == "doc" { link($0); next }
     84 $2 == "icons" { link($0); next }
     85 $2 == "terminfo" { link($0); next }
     86 $2 == "data" { link($0); next }
     87 $2 == "include" { link($0); next }
     88 
     89 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
     90 
     91 END {
     92 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
     93 	for(fname in x) {
     94 		if(x[fname]) {
     95 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
     96 			exit 3
     97 		}
     98 	}
     99 }' >.install-links.new
    100 mv .install-links.new .install-links