pthbs

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

linux (3202B)


      1 #!/usr/bin/env pthbs-build
      2 #+busybox.e60885fe93ee85c01831673bb29f0e62a64903f4ce3094e3dc35bc8ec8887ad9
      3 #+gnu-make.782c9e6625fd7420e2cd38b847afed19db3b3844cae8a0426a0dbf73e10d78e5
      4 #+musl-cross-make.65f98305f5666435bf0c6b9ccedffae2179ff1b3286752756886f760cf7771d2
      5 #+diffutils.fd5fae528e3d092e2e30271e8e273cd7fdecce4642547308ca3356e654c3990b
      6 #+patch.c2f2ffe5c9b78dce8f2a1adeca76c83dd548ffcabed790bfb6e886e9d27474bb
      7 #+flex.1ec95ce5516c7871d0757dc9ffc02f3a8795a765ad7936c23a6e2688e7d3afd0
      8 #+bison.fed01ec0597b5f4443ca53edb88e09263e1edbec32cb3bdc2d7c8642c295ab64
      9 #+rsync.b356835b04c5d49533ce9cd7660fd7d61f50d1c1d527b123f46e3eb2f25d3989
     10 #+libelf-compat.192f3413736b61c6127bb367475f12a3ef052420fb740797580acc4af19a3c33
     11 #@untar:-J:sha256:2ca1f17051a430f6fed1196e4952717507171acfd97d96577212502703b25deb:.
     12 #@sha256:d9b01e4dac3dd140c394227603c8b3339bb2f1e10c97afd3607d84e3003ec75a:patch-6.1.34.xz
     13 #@sha256:cb8081499f316acdc7b31b486b8d68afd68094db8f420aba0eab2c3e8de13888:linux.config
     14 #@sha256:ff3ddd131d73fee6838b11a6c4773bdb85c5f60fdd4b9ac4120ced021c341417:noobjtool.patch
     15 
     16 export CFLAGS="-L$pthbs_build_environment/library -L$pthbs_build_environment/library.so"
     17 export LD_LIBRARY_PATH="$pthbs_build_environment/library:$pthbs_build_environment/library.so"
     18 export CPATH="$pthbs_build_environment/include"
     19 
     20 cd linux-6.1
     21 unxz -c < ../patch-6.1.34.xz | patch -p1 -N
     22 patch -p1 -N <../noobjtool.patch
     23 cp -v ../linux.config .config
     24 linux64 make -j${JOBS:-1} -l$((1+${JOBS:-1})) olddefconfig
     25 diff -u ../linux.config .config || true
     26 linux64 make -j${JOBS:-1} -l$((1+${JOBS:-1}))
     27 
     28 installdir="$pthbs_destdir//versions/$pthbs_package"
     29 mkdir -p "$installdir"
     30 cp -v .config "$installdir/config"
     31 mkdir -p "$installdir/doc"
     32 mv Documentation/* "$installdir/doc"
     33 linux64 make modules_install install \
     34 	INSTALL_MOD_PATH="$installdir" \
     35 	INSTALL_MOD_STRIP=1 \
     36 	INSTALL_PATH="$installdir"/boot \
     37 	INSTALL_DTBS_PATH="$installdir/boot/dtbs"
     38 
     39 cd "$pthbs_destdir/versions/$pthbs_package"
     40 find -type d -o -print | awk -F/ '
     41 BEGIN {
     42 }
     43 
     44 function r1(s) {
     45 	sub("^[.]/[^/]*", ".", s)
     46 	return s
     47 }
     48 function s1(repl, s) {
     49 	sub("^[.]/[^/]*", "./"repl, s)
     50 	return s
     51 }
     52 function link(src) {
     53 	x[$0]=0
     54 	printf "%s\t%s\n", $0, src
     55 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
     56 }
     57 $1!="."{exit 1}
     58 
     59 
     60 $2 == "command" { link($0); next }
     61 $2 == "bin" { link(s1("command", $0)); next }
     62 
     63 $2 == "library.so" { link($0); next }
     64 $2 == "library" { link($0); next }
     65 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
     66 $2 == "lib" && $NF ~ /\.so(|\..*)$/ { link(s1("library.so", $0)); next }
     67 
     68 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
     69 
     70 $2 == "man" { link($0); next }
     71 $2 == "info" { link($0); next }
     72 $2 == "doc" { link($0); next }
     73 $2 == "icons" { link($0); next }
     74 $2 == "terminfo" { link($0); next }
     75 $2 == "data" { link($0); next }
     76 $2 == "include" { link($0); next }
     77 
     78 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
     79 
     80 END {
     81 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
     82 	for(fname in x) {
     83 		if(x[fname]) {
     84 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
     85 			exit 3
     86 		}
     87 	}
     88 }' >.install-links.new
     89 mv .install-links.new .install-links