galeb

Једноставна статичка дистрибуција заснована на musl-у
git clone https://git.sr.ht/~strahinja/galeb
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

03-packages.sh (169910B)


      1 #!/bin/sh
      2 
      3 . ./lib/env.sh
      4 . ./lib/fun.sh
      5 
      6 HOST_COREUTILS=0
      7 HOST_FIND=0
      8 HOST_MD5SUM=0
      9 HOST_SED=0
     10 HOST_TAR=0
     11 export HOST_COREUTILS HOST_FIND HOST_MD5SUM HOST_SED HOST_TAR
     12 
     13 PATH=/${TLD}/bin:/local/bin:/bin:/sbin:/sucks/bin:/sucks/sbin:/plan9/bin
     14 export PATH
     15 
     16 trap exit_cleanup HUP PIPE INT QUIT TERM EXIT
     17 
     18 if [ ! -d /sucks ]; then
     19 	msg err "You must run this script from inside chroot"
     20 	exit 1
     21 elif [ "$(id -u)" -ne 0 ]; then
     22 	msg err "You must run this script as root"
     23 	exit 1
     24 fi
     25 
     26 export JN=-j1
     27 
     28 totalsteps=2
     29 step=1
     30 
     31 msg info "Creating symlinks"
     32 ./lib/createlinks 03-packages.sh
     33 
     34 begin_step "packages"
     35 
     36 totalsubsteps=138
     37 substep=1
     38 
     39 msg info "Creating temporary links"
     40 for cmd in cat dd echo env mksh lksh ln pwd rm stty install perl
     41 do
     42 	link_if_ne /${TLD}/bin/${cmd} /bin/${cmd}
     43 done
     44 for lib in gcc_s.so gcc_s.so.1 stdc++.a stdc++.so stdc++.so.6
     45 do
     46 	link_if_ne /${TLD}/lib/lib${lib} /lib/lib${lib}
     47 done
     48 
     49 msg info "Regenerating /etc/passwd"
     50 cat <<! >/etc/passwd
     51 root:x:0:0:root:/root:/bin/mksh
     52 daemon:x:6:6:Daemon User:/dev/null:/bin/false
     53 nobody:x:99:99:Unprivileged User:/dev/null:/bin/false
     54 !
     55 
     56 msg info "Regenerating /etc/group"
     57 cat <<! >/etc/group
     58 root:x:0:root
     59 bin:x:1:
     60 sys:x:2:
     61 kmem:x:3:
     62 tape:x:4:
     63 tty:x:5:
     64 daemon:x:6:
     65 floppy:x:7:
     66 disk:x:8:
     67 lp:x:9:
     68 dialout:x:10:
     69 audio:x:11:
     70 video:x:12:
     71 utmp:x:13:
     72 usb:x:14:
     73 cdrom:x:15:
     74 adm:x:16:
     75 messagebus:x:18:
     76 input:x:24:
     77 cron:x:33:
     78 mail:x:34:
     79 nogroup:x:99:
     80 metalog:x:983:
     81 rfkill:x:984:
     82 uucp:x:987:
     83 wheel:x:998:
     84 users:x:999:
     85 !
     86 
     87 for log in btmp lastlog faillog wtmp
     88 do
     89 	:>/var/log/${log}
     90 done
     91 
     92 msg info "Generating %s" "${G_PKGDB}"
     93 printf "Package\tVersion\tInstallation Timestamp\n" > ${G_PKGDB}
     94 
     95 begin_substep linux-headers-6.2.10 "Linux headers"
     96 if [ -e /include/linux/stddef.h ]; then
     97 	msg info "%s exists, skipping %s" \
     98 		/include/linux/stddef.h "${substepname}"
     99 else
    100 	extract_pkg ${G_SRC} linux-6.2.10 linux-6.2.10.tar.xz ${pkg}
    101 	(
    102 		cd_or_fail ${G_SRC}/${pkg}
    103 		run_make ${JN} ARCH=${G_ARCH} headers
    104 		check_dir /include
    105 		cp_or_fail -r "usr/include/*" /include/
    106 		msg info "Removing *.cmd"
    107 		find /include -name '.*.cmd' -exec rm -f {} \;
    108 		remove_file /include/Makefile
    109 		#remove_dir ${G_SRC}/${pkg}
    110 	) || exit 1
    111 fi
    112 end_substep
    113 
    114 begin_substep texinfo-7.0.3
    115 if [ -x ${TL}/bin/texi2dvi ]; then
    116 	msg info "%s exists, skipping %s" ${TL}/bin/texi2dvi ${pkg}
    117 else
    118 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
    119 	(
    120 		cd_or_fail ${G_SRC}/${pkg}
    121 		CC="${G_TARGET}-gcc"
    122 		CXX="${G_TARGET}-g++"
    123 		AR="${G_TARGET}-ar"
    124 		AS="${G_TARGET}-as"
    125 		RANLIB="${G_TARGET}-ranlib"
    126 		LD="${G_TARGET}-ld"
    127 		STRIP="${G_TARGET}-strip"
    128 		run_configure . --prefix=/${TLD}
    129 		run_make
    130 		run_make install
    131 		remove_dir ${G_SRC}/${pkg}
    132 	) || exit 1
    133 fi
    134 end_substep
    135 
    136 begin_substep musl-1.2.3
    137 if [ -e /lib/ld-musl-${G_ARCH_EXT_ALT}.so.1 ]; then
    138 	msg info "%s exists, skipping %s" /lib/ld-musl-${G_ARCH_EXT_ALT}.so.1 \
    139 		${pkg}
    140 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
    141 	unpack_pkg ${pkg} /
    142 else
    143 	if [ -e /${TLD}/bin/ld-old ]; then
    144 		msg err "ld-old exists, build will ultimately fail.          "
    145 		msg err "Rotate back ld to ld-new and ld-old to ld and rerun."
    146 		exit 1
    147 	fi
    148 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
    149 	(
    150 		cd_or_fail ${G_SRC}/${pkg}
    151 		for patch in i686-fix-rounding.patch \
    152 			     change-scheduler-functions-Linux-compatib.patch 
    153 		do
    154 			apply_patch packages -Np1 -i \
    155 				${G_PAT}/musl-mlfs/${patch}
    156 		done
    157 
    158 		for patch in 0001-Prevent-redefinition-warnings.patch \
    159 			0002-string_h-basename.patch
    160 		do
    161 			apply_patch packages -Np1 -i \
    162 				${G_PAT}/musl-galeb/${patch}
    163 		done
    164 		
    165 		for patch in handle-aux-at_base.patch
    166 		do
    167 			apply_patch packages -Np1 -i \
    168 				${G_PAT}/musl-alpine/${patch}
    169 		done
    170 		
    171 		cat <<! >MKPK
    172 mkpk_name()
    173 {
    174 	printf "%s" "${pkg}"
    175 }
    176 
    177 mkpk_install()
    178 {
    179 	(
    180 		CC=${G_TARGET}-gcc
    181 		CXX=${G_TARGET}-g++
    182 		CFLAGS='-Os -pipe -fPIC'
    183 		PATH=/${TLD}/bin:${PATH}
    184 		export CC CXX CFLAGS PATH
    185 
    186 		DESTDIR=../build
    187 		LDFLAGS='-Wl,-soname,libc.musl-${G_ARCH_EXT_ALT}.so.1'
    188 		export DESTDIR LDFLAGS
    189 
    190 		./configure \\
    191 			--prefix=/ \\
    192 			--sysconfdir=/etc \\
    193 			--localstatedir=/var \\
    194 			--disable-gcc-wrapper
    195 
    196 		make ${JN}
    197 		make install
    198 
    199 		mkdir -p ../build/lib
    200 		/${TLD}/bin/\${CC} \${CFLAGS} -fpie -c \\
    201 			../${FLD}/__stack_chk_fail_local.c \\
    202 			-o __stack_chk_fail_local.o
    203 		/${TLD}/bin/${G_TARGET}-gcc-ar r libssp_nonshared.a \\
    204 			__stack_chk_fail_local.o
    205 		cp libssp_nonshared.a ../build/lib
    206 
    207 		mkdir -p ../build/bin
    208 		ln -sf /lib/ld-musl-${G_ARCH_EXT_ALT}.so.1 ../build/bin/ldd
    209 		ln -sf libc.so ../build/lib/libc.musl-${G_ARCH_EXT_ALT}.so.1
    210 
    211 		sed -e 's,/usr/lib,/sucks/lib,g' \\
    212 		    -e 's,|/usr\(/local/lib/\*\),|\1,g' \\
    213 			../${FLD}/musl-alpine/ldconfig > ../build/bin/ldconfig
    214 
    215 		chmod a+x ../build/bin/ldconfig
    216 
    217 		mkdir -p ../build/etc
    218 		cat <<@ >../build/etc/ld-musl-${G_ARCH_EXT_ALT}.path
    219 /local/lib
    220 /lib
    221 /sucks/lib
    222 @
    223 
    224 	) || exit 1
    225 }
    226 !
    227 		mkpk ${pkg}
    228 		remove_dir ${G_SRC}/${pkg}
    229 		unpack_pkg ${pkg} /
    230 	) || exit 1
    231 fi
    232 timestamp=$(date +'%Y-%m-%d %T')
    233 printf "%s\t%s\t%s\n" musl 1.2.3 "${timestamp}" >>${G_PKGDB}
    234 end_substep
    235 
    236 msg info "Cleaning up environment"
    237 PATH=/local/bin:/bin:/sucks/bin:/${TLD}/bin:/plan9/bin
    238 export PATH
    239 unset CC CXX AR AS RANLIB LD STRIP
    240 
    241 if [ ! -e /${TLD}/bin/ld-old ]; then
    242 	msg info "Adjusting toolchain"
    243 	mv_or_fail /${TLD}/bin/ld /${TLD}/bin/ld-old
    244 	mv_or_fail /${TLD}/${G_TARGET}/bin/ld /${TLD}/${G_TARGET}/bin/ld-old
    245 	mv_or_fail /${TLD}/bin/ld-new /${TLD}/bin/ld
    246 	link_if_ne /${TLD}/bin/ld /${TLD}/${G_TARGET}/bin/ld
    247 fi
    248 
    249 msg warn "After this point, builds are repeatable"
    250 
    251 msg info "Adjusting specs"
    252 SPECFILE=$(realpath $(dirname $(gcc -print-libgcc-file-name)))/specs
    253 export SPECFILE
    254 gcc -dumpspecs | sed -e 's,/'${TLD}',,g' \
    255 	-e '/\*startfile_prefix_spec:/{n;s,.*,/local/lib/ /lib/ '\
    256 '/sucks/lib/ ,}' \
    257 	-e '/\*cpp:/{n;s,$, -I /local/include -I /include '\
    258 '-I /sucks/include ,}' > specs
    259 mv_or_fail specs ${SPECFILE}
    260 unset SPECFILE
    261 
    262 begin_substep zlib-ng-2.0.7
    263 if [ -e /lib/libz.so.1.2.11.zlib-ng ]; then
    264 	msg info "%s exists, skipping %s" /lib/libz.so.1.2.11.zlib-ng ${pkg}
    265 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
    266 	unpack_pkg ${pkg} /
    267 else
    268 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
    269 	(
    270 		cd_or_fail ${G_SRC}/${pkg}
    271 		apply_patch packages -Np1 -i \
    272 			${G_PAT}/zlib-ng-mlfs/configure-fix-interpreter.patch
    273 		cat <<! >MKPK
    274 mkpk_name()
    275 {
    276 	printf "%s" "${pkg}"
    277 }
    278 
    279 mkpk_install()
    280 {
    281 	CFLAGS='-Os -pipe -fPIC'
    282 	export CFLAGS
    283 	./configure --prefix=/ \\
    284 		    --libdir=/lib \\
    285 		    --zlib-compat \\
    286 		    --sharedlibdir=/lib
    287 	make ${JN} || exit 1
    288 	make DESTDIR=/build install
    289 
    290 	ln -s libz.so.1.2.11.zlib-ng ../build/lib/libz.so.1.2.11
    291 }
    292 !
    293 		mkpk ${pkg}
    294 		remove_dir ${G_SRC}/${pkg}
    295 		unpack_pkg ${pkg} /
    296 	) || exit 1
    297 fi
    298 timestamp=$(date +'%Y-%m-%d %T')
    299 printf "%s\t%s\t%s\n" zlib-ng 2.0.7 "${timestamp}" >>${G_PKGDB}
    300 end_substep
    301 
    302 begin_substep file-5.44
    303 if [ -e /bin/file ]; then
    304 	msg info "%s exists, skipping %s" /bin/file ${pkg}
    305 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
    306 	unpack_pkg ${pkg} /
    307 else
    308 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
    309 	(
    310 		cd_or_fail ${G_SRC}/${pkg}
    311 		cat <<! >MKPK
    312 mkpk_name()
    313 {
    314 	printf "%s" "${pkg}"
    315 }
    316 
    317 mkpk_install()
    318 {
    319 	./configure --prefix=/ \\
    320 		--enable-static \\
    321 		CFLAGS='-Os -pipe -static --static -fcommon -fPIC' \\
    322 		LDFLAGS='-static --static -fcommon'
    323 	make ${JN}
    324 	make DESTDIR=/build install-strip
    325 }
    326 !
    327 		mkpk ${pkg}
    328 		unpack_pkg ${pkg} /
    329 	) || exit 1
    330 	remove_dir ${G_SRC}/${pkg}
    331 fi
    332 timestamp=$(date +'%Y-%m-%d %T')
    333 printf "%s\t%s\t%s\n" file 5.44 "${timestamp}" >>${G_PKGDB}
    334 end_substep
    335 
    336 begin_substep readline-8.2
    337 if [ -e /lib/libreadline.a ]; then
    338 	msg info "%s exists, skipping %s" /lib/libreadline.a ${pkg}
    339 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
    340 	unpack_pkg ${pkg} /
    341 else
    342 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
    343 	(
    344 		cd_or_fail ${G_SRC}/${pkg}
    345 
    346 		sed -i '/MV.*old/d' Makefile.in
    347 		sed -i '/{OLDSUFF}/c:' support/shlib-install
    348 
    349 		cat <<! >MKPK
    350 mkpk_name()
    351 {
    352 	printf "%s" "${pkg}"
    353 }
    354 
    355 mkpk_install()
    356 {
    357 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
    358 	LDFLAGS='-static --static -fcommon -s'
    359 	PREFIX=/
    360 	DESTDIR=/build
    361 	export CFLAGS LDFLAGS PREFIX DESTDIR
    362 
    363 	./configure --prefix="\${PREFIX}" \\
    364 		--disable-shared \\
    365 		--docdir=/share/doc/readline-8.2
    366 
    367 	make ${JN}
    368 	make DESTDIR="\${DESTDIR}" install
    369 }
    370 !
    371 		mkpk ${pkg}
    372 		remove_dir ${G_SRC}/${pkg}
    373 		unpack_pkg ${pkg} /
    374 	) || exit 1
    375 fi
    376 timestamp=$(date +'%Y-%m-%d %T')
    377 printf "%s\t%s\t%s\n" readline 8.2 "${timestamp}" >>${G_PKGDB}
    378 end_substep
    379 
    380 begin_substep m4-1.4.19
    381 if [ -x /bin/m4 ]; then
    382 	msg info "%s exists, skipping %s" /bin/m4 ${pkg}
    383 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
    384 	unpack_pkg ${pkg} /
    385 else
    386 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
    387 	(
    388 		cd_or_fail ${G_SRC}/${pkg}
    389 
    390 		apply_patch packages -Np1 -i \
    391 			${G_PAT}/m4-alpine/musl-realpath.patch
    392 
    393 		cat <<! >MKPK
    394 mkpk_name()
    395 {
    396 	printf "%s" "${pkg}"
    397 }
    398 
    399 mkpk_install()
    400 {
    401 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
    402 	LDFLAGS='-static --static -fcommon -s'
    403 	PREFIX=/
    404 	DESTDIR=/build
    405 	export CFLAGS LDFLAGS PREFIX DESTDIR
    406 
    407 	./configure --prefix="\${PREFIX}" || exit 1
    408 
    409 	make ${JN} || exit 1
    410 	make DESTDIR="\${DESTDIR}" install-strip
    411 }
    412 !
    413 		mkpk ${pkg}
    414 		remove_dir ${G_SRC}/${pkg}
    415 		unpack_pkg ${pkg} /
    416 	) || exit 1
    417 fi
    418 timestamp=$(date +'%Y-%m-%d %T')
    419 printf "%s\t%s\t%s\n" m4 1.4.19 "${timestamp}" >>${G_PKGDB}
    420 end_substep
    421 
    422 begin_substep pkgconf-1.9.4
    423 if [ -L /bin/pkg-config ]; then
    424 	msg info "%s exists, skipping %s" /bin/pkg-config ${pkg}
    425 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
    426 	unpack_pkg ${pkg} /
    427 else
    428 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
    429 	(
    430 		cd_or_fail ${G_SRC}/${pkg}
    431 		cat <<! >MKPK
    432 mkpk_name()
    433 {
    434 	printf "%s" "${pkg}"
    435 }
    436 
    437 mkpk_install()
    438 {
    439 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
    440 	LDFLAGS='-static --static -fcommon -s'
    441 	PREFIX=/
    442 	DESTDIR=/build
    443 	export CFLAGS LDFLAGS PREFIX DESTDIR
    444 
    445 	./configure --prefix="\${PREFIX}" \\
    446 		    --docdir=/share/doc/pkgconf-1.9.4 \\
    447 		    --sysconfdir=/etc \\
    448 		    --localstatedir=/var \\
    449 		    --with-pkg-config-dir=/local/lib/pkgconfig:\\
    450 /local/share/pkgconfig:/lib/pkgconfig:/share/pkgconfig:\\
    451 /sucks/lib/pkgconfig:/sucks/share/pkgconfig:/opt/qt5/lib/pkgconfig \\
    452 		    --with-system-includedir=/local/include:/include:\\
    453 /sucks/include \\
    454 		    --with-system-libdir=/local/lib:/lib:/sucks/lib || exit 1
    455 
    456 	make ${JN} || exit 1
    457 	make DESTDIR="\${DESTDIR}" install || exit 1
    458 
    459 	mkdir -pv \${DESTDIR}\${PREFIX}/bin
    460 
    461 	ln -sv pkgconf \${DESTDIR}\${PREFIX}/bin/${G_TARGET}-pkg-config
    462 	ln -sv pkgconf \${DESTDIR}\${PREFIX}/bin/pkg-config
    463 
    464 	mkdir -pv \${DESTDIR}\${PREFIX}/share/man/man1
    465 
    466 	ln -sv pkgconf.1 \${DESTDIR}\${PREFIX}/share/man/man1/pkg-config.1
    467 
    468 	mkdir -p /build/sucks/share/aclocal
    469 	mv /build/share/aclocal/* /build/sucks/share/aclocal/
    470 	rmdir /build/share/aclocal || true
    471 	rmdir /build/share || true
    472 }
    473 !
    474 		mkpk ${pkg}
    475 		remove_dir ${G_SRC}/${pkg}
    476 		unpack_pkg ${pkg} /
    477 	) || exit 1
    478 fi
    479 timestamp=$(date +'%Y-%m-%d %T')
    480 printf "%s\t%s\t%s\n" pkgconf 1.9.4 "${timestamp}" >>${G_PKGDB}
    481 end_substep 
    482 
    483 begin_substep tzutils-20230412
    484 if [ -x /sbin/zic ]; then
    485 	msg info "%s exists, skipping %s" /sbin/zic ${pkg}
    486 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
    487 	unpack_pkg ${pkg} /
    488 else
    489 	check_dir ${G_SRC}/${pkg}
    490 	cd_or_fail ${G_SRC}/${pkg}
    491 	extract_pkg ${G_SRC}/${pkg} "" tzdata2023c.tar.gz
    492 	extract_pkg ${G_SRC}/${pkg} "" tzcode2023c.tar.gz
    493 	extract_pkg ${G_SRC}/${pkg} posixtz-0.5 posixtz-0.5.tar.xz
    494 	(
    495 		apply_patch packages -Np1 -i \
    496 			${G_PAT}/posixtz-adelie/0001-posixtz-fix-up-lseek.patch
    497 		cat <<! >MKPK
    498 mkpk_name()
    499 {
    500 	printf "%s" "${pkg}"
    501 }
    502 
    503 mkpk_install()
    504 {
    505 	DESTDIR=../build
    506 	prefix=''
    507 	CFLAGS='-Os -pipe -static -fcommon -DHAVE_STDINT_H=1'
    508 	LDFLAGS='-static -fcommon'
    509 	TZDIR=/share/zoneinfo
    510 	timezones='africa antarctica asia australasia europe northamerica'\\
    511 ' southamerica etcetera backward factory'
    512 	export DESTDIR prefix CFLAGS LDFLAGS TZDIR timezones
    513 
    514 	make CFLAGS="\${CFLAGS}" LDFLAGS="\${LDFLAGS}" prefix="\${prefix}" \\
    515 		TZDIR="\${TZDIR}" timezones="\${timezones}"
    516 	make CFLAGS="\${CFLAGS}" LDFLAGS="\${LDFLAGS}" prefix="\${prefix}" \\
    517 		TZDIR="\${TZDIR}" timezones="\${timezones}" \\
    518 		-C posixtz-0.5 posixtz
    519 
    520 	mkdir -p \${DESTDIR}/share/zoneinfo/right
    521 	mkdir -p \${DESTDIR}/bin
    522 	ln -s bin \${DESTDIR}/sbin
    523 
    524 	install -m 444 -t \${DESTDIR}/share/zoneinfo iso3166.tab zone1970.tab \\
    525 		zone.tab
    526 	install -m 755 zic zdump \${DESTDIR}/sbin
    527 	install -Dm 644 zic.8 zdump.8 -t \${DESTDIR}/share/man/man8
    528 	install -Dm 755 posixtz-0.5/posixtz \${DESTDIR}/bin/posixtz
    529 
    530 	./zic -b fat -y ./yearistype -d \${DESTDIR}/share/zoneinfo \${timezones}
    531 	./zic -b fat -y ./yearistype -d \${DESTDIR}/share/zoneinfo/right \\
    532 		-L leapseconds \${timezones}
    533 	./zic -b fat -y ./yearistype -d \${DESTDIR}/share/zoneinfo \\
    534 		-p America/New_York
    535 
    536 	mkdir -p \${DESTDIR}/etc
    537 	ln -sf /share/zoneinfo/Europe/Belgrade \${DESTDIR}/etc/localtime
    538 }
    539 !
    540 		mkpk ${pkg}
    541 		remove_dir ${G_SRC}/${pkg}
    542 		unpack_pkg ${pkg} /
    543 	) || exit 1
    544 fi
    545 timestamp=$(date +'%Y-%m-%d %T')
    546 printf "%s\t%s\t%s\n" tzutils 20230412 "${timestamp}" >>${G_PKGDB}
    547 end_substep
    548 
    549 begin_substep 9base-20230412
    550 if [ -x /plan9/bin/bc ]; then
    551 	msg info "%s exists, skipping %s" /plan9/bin/bc ${pkg}
    552 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
    553 	unpack_pkg ${pkg} /
    554 else
    555 	(
    556 		cd_or_fail ${G_SRC}/${pkg}
    557 
    558 		cp_or_fail ${G_FIL}/9base-galeb/fortunes fortune/fortunes
    559 
    560 		if [ ! -e config.mk.orig ]; then
    561 		cp config.mk config.mk.orig
    562 
    563 		SED=/${TLD}/bin/sed
    564 		${SED} -i -e 's,/usr/local\(/plan9\),\1,g' \
    565 			-e 's,^CFLAGS\s\++= ,&-static --static -fcommon ,g' \
    566 			-e 's,^LDFLAGS\s\++= ,&-static --static -fcommon ,g' \
    567 			-e 's,^OBJTYPE\s\+= 386,#&,g' \
    568 			-e 's,^#\(OBJTYPE\s\+= '${G_ARCH_EXT_ALT}'\),\1,' \
    569 			config.mk
    570 		fi
    571 		if [ ! -e std.mk.orig ]; then
    572 		cp std.mk std.mk.orig
    573 		${SED} -i -e 's,^#\(\s\+@strip.*\),\1,' std.mk
    574 		fi
    575 		cat <<! >MKPK
    576 mkpk_name()
    577 {
    578 	printf "%s" "${pkg}"
    579 }
    580 
    581 mkpk_install()
    582 {
    583 	DESTDIR=/build
    584 	export DESTDIR
    585 
    586 	make clean
    587 	make DESTDIR="\${DESTDIR}" ${JN} install
    588 	mkdir -p /build/lib
    589 	cp fortune/fortunes \${DESTDIR}/plan9/lib/fortunes
    590 }
    591 !
    592 		mkpk ${pkg}
    593 		unpack_pkg ${pkg} /
    594 	) || exit 1
    595 fi
    596 timestamp=$(date +'%Y-%m-%d %T')
    597 printf "%s\t%s\t%s\n" 9base 20230412 "${timestamp}" >>${G_PKGDB}
    598 end_substep
    599 
    600 msg info "Adjusting specs"
    601 SPECFILE=$(realpath $(dirname $(gcc -print-libgcc-file-name)))/specs
    602 export SPECFILE
    603 remove_file ${SPECFILE}
    604 gcc -dumpspecs | /${TLD}/bin/sed -e 's,/'${TLD}',,g' \
    605 	-e '/\*startfile_prefix_spec:/{n;s,.*,/lib/ ,}' > /tmp/specs
    606 mv_or_fail /tmp/specs ${SPECFILE}
    607 unset SPECFILE
    608 
    609 begin_substep binutils-2.40
    610 if [ -x /bin/ar ]; then
    611 	msg info "%s exists, skipping %s" /bin/ar ${pkg}
    612 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
    613 	unpack_pkg ${pkg} /
    614 else
    615 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
    616 	(
    617 		cd_or_fail ${G_SRC}/${pkg}
    618 
    619 		for patch in 0001-Revert-PR25882-.gnu.attributes-are-not-\
    620 checked-for-s.patch \
    621 			binutils-ld-fix-static-linking.patch
    622 		do
    623 			apply_patch packages -Np1 -i \
    624 				${G_PAT}/binutils-alpine/${patch}
    625 		done
    626 
    627 		msg info "Cleaning empty man pages"
    628 		/${TLD}/bin/find . -name '[a-z]*\.[0-9]*' -empty -exec rm -f {} \; 
    629 
    630 		cat <<! >MKPK
    631 mkpk_name()
    632 {
    633 	printf "%s" "${pkg}"
    634 }
    635 
    636 mkpk_install()
    637 {
    638 	CC=${G_TARGET}-gcc
    639 	CXX=${G_TARGET}-g++
    640 	CFLAGS='-Os -pipe -I/include -I/sucks/include '
    641 	CFLAGS+='-static --static -fcommon -fPIC'
    642 	CXXFLAGS=\${CFLAGS}
    643 	CPPFLAGS=''
    644 	LDFLAGS='-static --static -fcommon -s'
    645 	PATH=/${TLD}/bin:${PATH}
    646 	PREFIX=/
    647 	DESTDIR=/build
    648 	EXTRA_CONFIG=' --enable-targets=x86_64-pep '
    649 	TARGET_LIB_PATH=/local/lib:/lib:/sucks/lib
    650 	export CC CXX CFLAGS CXXFLAGS CPPFLAGS LDFLAGS DESTDIR EXTRA_CONFIG
    651 	export TARGET_LIB_PATH PATH PREFIX
    652 
    653 	./configure \\
    654 		--prefix="\${PREFIX}" \\
    655 		--enable-gold \\
    656 		--enable-ld=default \\
    657 		--enable-plugins \\
    658 		--enable-shared \\
    659 		--disable-werror \\
    660 		--includedir=/include \\
    661 		--with-system-zlib \\
    662 		--enable-relro \\
    663 		--enable-lto \\
    664 		--disable-nls \\
    665 		--enable-deterministic-archives \\
    666 		--enable-default-hash-style=gnu \\
    667 		--enable-threads \\
    668 		--disable-multilib \\
    669 		--with-mmap \\
    670 		--enable-64-bit-bfd \\
    671 		--with-pic $EXTRA_CONFIG || exit 1
    672 
    673 	make ${JN} tooldir=/sucks || exit 1
    674 	make tooldir=/sucks install-strip
    675 
    676 	ln -sf ld.bfd ../build/bin/ld
    677 	mkdir -p ../build/include
    678 	install -m 644 include/libiberty.h ../build/include/
    679 	install -m 644 include/demangle.h  ../build/include/
    680 
    681 	for m in dlltool nlmconv windres windmc
    682 	do
    683 		rm -f ../build/share/man/man1/$m.1
    684 	done
    685 }
    686 !
    687 		mkpk ${pkg}
    688 		remove_dir ${G_SRC}/${pkg}
    689 		unpack_pkg ${pkg} /
    690 	) || exit 1
    691 fi
    692 timestamp=$(date +'%Y-%m-%d %T')
    693 printf "%s\t%s\t%s\n" binutils 2.38 "${timestamp}" >>${G_PKGDB}
    694 end_substep
    695 
    696 begin_substep libgmp-6.2.1
    697 if [ -e /lib/libgmp.a ]; then
    698 	msg info "%s exists, skipping %s" /lib/libgmp.a ${pkg}
    699 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
    700 	unpack_pkg ${pkg} /
    701 else
    702 	extract_pkg ${G_SRC} ${pkg##lib} ${pkg}.tar.xz ${pkg}
    703 	(
    704 		cd_or_fail ${G_SRC}/${pkg}
    705 		cat <<! >MKPK
    706 mkpk_name()
    707 {
    708 	printf "%s" "${pkg}"
    709 }
    710 
    711 mkpk_install()
    712 {
    713 	CFLAGS='-Os -pipe -fPIC'
    714 	LDFLAGS='-s'
    715 	PREFIX=/
    716 	DESTDIR=/build
    717 	export CFLAGS DESTDIR
    718 
    719 	./configure \\
    720 		--prefix="\${PREFIX}" \\
    721 		--enable-cxx \\
    722 		--enable-static \\
    723 		--docdir=/share/doc/${pkg}
    724 
    725 	make ${JN}
    726 	make DESTDIR="\${DESTDIR}" install
    727 }
    728 !
    729 		mkpk ${pkg}
    730 		remove_dir ${G_SRC}/${pkg}
    731 		unpack_pkg ${pkg} /
    732 	) || exit 1
    733 fi
    734 timestamp=$(date +'%Y-%m-%d %T')
    735 printf "%s\t%s\t%s\n" libgmp 6.2.1 "${timestamp}" >>${G_PKGDB}
    736 end_substep
    737 
    738 begin_substep libmpfr-4.2.0
    739 if [ -e /lib/libmpfr.a ]; then
    740 	msg info "%s exists, skipping %s" /lib/libmpfr.a ${pkg}
    741 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
    742 	unpack_pkg ${pkg} /
    743 else
    744 	extract_pkg ${G_SRC} ${pkg##lib} ${pkg}.tar.xz ${pkg}
    745 	(
    746 		cd_or_fail ${G_SRC}/${pkg}
    747 		cat <<! >MKPK
    748 mkpk_name()
    749 {
    750 	printf "%s" "${pkg}"
    751 }
    752 
    753 mkpk_install()
    754 {
    755 	CFLAGS='-Os -pipe -fPIC'
    756 	LDFLAGS='-s'
    757 	PREFIX=/
    758 	DESTDIR=/build
    759 	export CFLAGS LDFLAGS PREFIX DESTDIR
    760 
    761 	CC=/${TLD}/bin/${G_TARGET}-gcc \\
    762 	CXX=/${TLD}/bin/${G_TARGET}-g++ \\
    763 	./configure \\
    764 		--prefix="\${PREFIX}" \\
    765 		--with-gmp-include=/include \\
    766 		--enable-static \\
    767 		--enable-thread-safe \\
    768 		--docdir=/share/doc/${pkg}
    769 
    770 	make ${JN}
    771 	make install
    772 }
    773 !
    774 		mkpk ${pkg}
    775 		remove_dir ${G_SRC}/${pkg}
    776 		unpack_pkg ${pkg} /
    777 	) || exit 1
    778 fi
    779 timestamp=$(date +'%Y-%m-%d %T')
    780 printf "%s\t%s\t%s\n" libmpfr 4.2.0 "${timestamp}" >>${G_PKGDB}
    781 end_substep
    782 
    783 begin_substep libmpc-1.3.1
    784 if [ -e /lib/libmpc.a ]; then
    785 	msg info "%s exists, skipping %s" /lib/libmpc.a ${pkg}
    786 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
    787 	unpack_pkg ${pkg} /
    788 else
    789 	extract_pkg ${G_SRC} ${pkg##lib} ${pkg}.tar.gz ${pkg}
    790 	(
    791 		cd_or_fail ${G_SRC}/${pkg}
    792 		cat <<! >MKPK
    793 mkpk_name()
    794 {
    795 	printf "%s" "${pkg}"
    796 }
    797 
    798 mkpk_install()
    799 {
    800 	CFLAGS='-Os -pipe -fPIC'
    801 	CPPFLAGS='-I/sucks/include -I/include'
    802 	LDFLAGS='-s'
    803 	PREFIX=/
    804 	DESTDIR=/build
    805 	export CFLAGS CPPFLAGS LDFLAGS PREFIX DESTDIR
    806 
    807 	CC=/${TLD}/bin/${G_TARGET}-gcc \\
    808 	./configure \\
    809 		--prefix="\${PREFIX}" \\
    810 		--with-gmp-include=/include \\
    811 		--docdir=/share/doc/${pkg}
    812 
    813 	make ${JN}
    814 	make install
    815 }
    816 !
    817 		mkpk ${pkg}
    818 		remove_dir ${G_SRC}/${pkg}
    819 		unpack_pkg ${pkg} /
    820 	) || exit 1
    821 fi
    822 timestamp=$(date +'%Y-%m-%d %T')
    823 printf "%s\t%s\t%s\n" libmpc 1.3.1 "${timestamp}" >>${G_PKGDB}
    824 end_substep
    825 
    826 begin_substep libisl-0.26
    827 if [ -e /lib/libisl.a ]; then
    828 	msg info "%s exists, skipping %s" /lib/libisl.a ${pkg}
    829 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
    830 	unpack_pkg ${pkg} /
    831 else
    832 	extract_pkg ${G_SRC} ${pkg##lib} ${pkg}.tar.xz ${pkg}
    833 	(
    834 		cd_or_fail ${G_SRC}/${pkg}
    835 		cat <<! >MKPK
    836 mkpk_name()
    837 {
    838 	printf "%s" "${pkg}"
    839 }
    840 
    841 mkpk_install()
    842 {
    843 	CFLAGS='-Os -pipe -fPIC'
    844 	CPPFLAGS='-I/sucks/include -I/include'
    845 	LDFLAGS='-s'
    846 	PREFIX=/
    847 	DESTDIR=/build
    848 	export CFLAGS CPPFLAGS LDFLAGS PREFIX DESTDIR
    849 
    850 	echo '#!/bin/sh' >missing
    851 
    852 	CC=/${TLD}/bin/${G_TARGET}-gcc \\
    853 	./configure \\
    854 		--prefix="\${PREFIX}" \\
    855 		--with-gmp=system \\
    856 		--with-gmp-prefix=/ \\
    857 		--docdir=/share/doc/${pkg}
    858 
    859 	make ${JN}
    860 	make install
    861 }
    862 !
    863 		mkpk ${pkg}
    864 		remove_dir ${G_SRC}/${pkg}
    865 		unpack_pkg ${pkg} /
    866 	) || exit 1
    867 fi
    868 timestamp=$(date +'%Y-%m-%d %T')
    869 printf "%s\t%s\t%s\n" libisl 0.26 "${timestamp}" >>${G_PKGDB}
    870 end_substep
    871 
    872 begin_substep shadow-4.13
    873 if [ -x /bin/groups ]; then
    874 	msg info "%s exists, skipping %s" /bin/groups ${pkg}
    875 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
    876 	unpack_pkg ${pkg} /
    877 else
    878 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
    879 	(
    880 		cd_or_fail ${G_SRC}/${pkg}
    881 		SED=/${TLD}/bin/sed
    882 		${SED} -i \
    883 			-e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@' \
    884 			etc/login.defs
    885 
    886 		# The limit has been lowered in musl, and it remained the same
    887 		# in shadow 4.9
    888 		# - *Not* fixed in 4.11.1, so this is still needed.
    889 		# - *Still* not fixed in 4.13, so it is likely intentional.
    890 		${SED} -i \
    891 			-e 's/^\(#define SHA_ROUNDS_MAX 9999999\)99/\1/' \
    892 			libmisc/salt.c
    893 
    894 		cat <<! >MKPK
    895 mkpk_name()
    896 {
    897 	printf "%s" "${pkg}"
    898 }
    899 
    900 mkpk_install()
    901 {
    902 	CFLAGS='-Os -pipe -static --static -fcommon '\
    903 '-DENCRYPTMETHOD_SELECT -fPIC'
    904 	LDFLAGS='-static --static -fcommon'
    905 	DESTDIR=/build
    906 	export CFLAGS LDFLAGS DESTDIR
    907 
    908 	CC=/${TLD}/bin/${G_TARGET}-gcc \\
    909 	./configure \\
    910 		--with-group-name-max-length=32 \\
    911 		--with-sha-crypt \\
    912 		--sysconfdir=/etc
    913 
    914 	make ${JN}
    915 	make install-strip
    916 
    917 	mkdir -p ../build/etc/default
    918 	:>../build/etc/default/useradd
    919 }
    920 !
    921 		mkpk ${pkg}
    922 		remove_dir ${G_SRC}/${pkg}
    923 		unpack_pkg ${pkg} /
    924 	) || exit 1
    925 fi
    926 timestamp=$(date +'%Y-%m-%d %T')
    927 printf "%s\t%s\t%s\n" shadow 4.13 "${timestamp}" >>${G_PKGDB}
    928 end_substep
    929 
    930 msg info "Setting up /etc/default/useradd"
    931 useradd -D --gid 999
    932 /${TLD}/bin/sed -i \
    933 	-e 's/yes/no/' \
    934 	-e 's,/bin/bash,/bin/mksh,' \
    935 	/etc/default/useradd
    936 
    937 msg info "Running pwconv and grpconv"
    938 /bin/pwconv
    939 /bin/grpconv
    940 
    941 if [ ! -e ${G_SRC}/pwchanged ]; then
    942 	:>${G_SRC}/pwchanged
    943 	msg warn "Set root password"
    944 	/bin/passwd
    945 fi
    946 
    947 begin_substep gcc-12.2.0
    948 if [ -x /bin/gcc ]; then
    949 	msg info "%s exists, skipping %s" /bin/gcc ${pkg}
    950 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
    951 	unpack_pkg ${pkg} /
    952 else
    953 	remove_dir ${G_SRC}/${pkg}
    954 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
    955 	(
    956 		cd_or_fail ${G_SRC}/${pkg}
    957 
    958 		msg info "Applying patches"
    959 		for n in 1 3 4 6 7 8 9 10 11 12 14 15 16 17 18 19 \
    960 			25 27 29 33 34 35 39
    961 		do
    962 			apply_patch packages -Np1 -i \
    963 				${G_PAT}/gcc-alpine/$(printf "%04d" $n)-*.patch
    964 		done
    965 
    966 		cat <<! >MKPK
    967 mkpk_name()
    968 {
    969 	printf "%s" "${pkg}"
    970 }
    971 
    972 mkpk_install()
    973 {
    974 	CFLAGS='-Os -pipe -static --static -fcommon '
    975 	# Needed to trick GCC into using *local* libiberty.h, which we hack
    976 	# into submission to *not* complain about missing PTR type
    977 	CFLAGS+='-I../../include -I../include -I./include '
    978 	CFLAGS+='-I/sucks/include -I/include '
    979 	CFLAGS+='-static-libgcc -static-libstdc++ -fPIC'
    980 	CXXFLAGS=\${CFLAGS}
    981 	CPPFLAGS=''
    982 	LDFLAGS='-L/sucks/lib -L/lib -static --static -fcommon -s '
    983 	#LDFLAGS+='-L./x86_64-linux-musl/libgcc'
    984 	PREFIX=/
    985 	DESTDIR=/build
    986 	export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS PREFIX DESTDIR
    987 
    988 	CC=/${TLD}/bin/${G_TARGET}-gcc \\
    989 	SED=/${TLD}/bin/sed libat_cv_have_ifunc=no \\
    990 	./configure \\
    991 		--prefix="\${PREFIX}" \\
    992 		--build=${GR_TRI} \\
    993 		--disable-shared \\
    994 		--enable-languages=c,c++,lto \\
    995 		--with-pkgversion='Galeb 2.2-20230412' \\
    996 		--with-arch=${G_ARCH_EXT} \\
    997 		--with-ppl=yes \\
    998 		--with-cloog=yes \\
    999 		--disable-libstdcxx-pch \\
   1000 		--disable-nls \\
   1001 		--disable-multilib \\
   1002 		--disable-bootstrap \\
   1003 		--disable-symvers \\
   1004 		--disable-libsanitizer \\
   1005 		--disable-libssp \\
   1006 		--disable-libmpx \\
   1007 		--disable-libmudflap \\
   1008 		--disable-fixed-point \\
   1009 		--disable-sjlj-exceptions \\
   1010 		--disable-werror \\
   1011 		--enable-threads=posix  \\
   1012 		--enable-clocale=generic  \\
   1013 		--enable-tls  \\
   1014 		--enable-libstdcxx-time  \\
   1015 		--enable-fully-dynamic-string  \\
   1016 		--enable-default-pie  \\
   1017 		--enable-default-ssp  \\
   1018 		--enable-linker-build-id  \\
   1019 		--enable-checking=release  \\
   1020 		--enable-cloog-backend  \\
   1021 		--enable-__cxa_atexit  \\
   1022 		--enable-lto  \\
   1023 		--enable-plugins \\
   1024 		--with-system-zlib  \\
   1025 		--with-linker-hash-style=gnu \\
   1026 		--with-isl || exit 1
   1027 
   1028 	cd libiberty
   1029 	SED=/${TLD}/bin/sed
   1030 	export SED
   1031 	CC=/${TLD}/bin/${G_TARGET}-gcc \\
   1032 	libat_cv_have_ifunc=no \\
   1033 	./configure \\
   1034 		--prefix="\${PREFIX}" \\
   1035 		--build=${GR_TRI} || exit 1
   1036 	cd - >/dev/null
   1037 
   1038 	# Hack libiberty.h
   1039 	cat <<@ >>include/libiberty.h
   1040 #ifndef PTR
   1041 #define PTR void*
   1042 #endif
   1043 @
   1044 
   1045 	# Hack offending .c files
   1046 	\${SED} -i 's,#include <libiberty.h>,#include "libiberty.h",g' \\
   1047 		libiberty/alloca.c || exit 1
   1048 
   1049 	\${SED} -i 's,#include <libiberty.h>,#include "libiberty.h",g' \\
   1050 		lto-plugin/lto-plugin.c || exit 1
   1051 
   1052 	make ${JN} || exit 1
   1053 	make install-strip || exit 1
   1054 
   1055 	#CFLAGS+='-static --static -fcommon'
   1056 	#LDFLAGS='-static --static -fcommon'
   1057 	#export CFLAGS LDFLAGS
   1058 	cc \${CFLAGS} ../${FLD}/musl/getent.c -o getent
   1059 	cc \${CFLAGS} ../${FLD}/musl/getconf.c -o getconf
   1060 	cc \${CFLAGS} ../${FLD}/musl/iconv.c -o iconv
   1061 
   1062 	install -dm 755 ../build/bin
   1063 	install -m  755 getent  ../build/bin/
   1064 	install -m  755 getconf ../build/bin/
   1065 	install -m  755 iconv   ../build/bin/
   1066 	install -dm 755 ../build/share/man/man1
   1067 	install -m  644 ../${FLD}/musl/getent.1  ../build/share/man/man1/
   1068 	install -m  644 ../${FLD}/musl/getconf.1 ../build/share/man/man1/
   1069 
   1070 	install -dm 755 ../build/lib
   1071 	ln -s ../bin/cpp ../build/lib
   1072 	ln -s gcc ../build/bin/cc
   1073 
   1074 	install -dm 755 ../build/lib/bfd-plugins
   1075 	ln -s ../../libexec/gcc/$(gcc -dumpmachine)/12.2.0/liblto_plugin.so \\
   1076 		../build/lib/bfd-plugins/
   1077 
   1078 	install -dm 755 ../build/share/gdb/auto-load/usr/lib
   1079 	find ../build -name '*gdb.py' -exec mv {} \\
   1080 		../build/share/gdb/auto-load/usr/lib \\;
   1081 
   1082 	mv ../build/lib64/* ../build/lib/
   1083 	rmdir ../build/lib64
   1084 }
   1085 !
   1086 		mkpk ${pkg}
   1087 		remove_dir ${G_SRC}/${pkg}
   1088 		unpack_pkg ${pkg} /
   1089 	) || exit 1
   1090 fi
   1091 timestamp=$(date +'%Y-%m-%d %T')
   1092 printf "%s\t%s\t%s\n" gcc 12.2.0 "${timestamp}" >>${G_PKGDB}
   1093 end_substep
   1094 
   1095 msg info "Setting up environment to use newly built GCC"
   1096 CC=gcc
   1097 CXX=g++
   1098 AR=ar
   1099 AS=as
   1100 RANLIB=ranlib
   1101 LD=ld
   1102 STRIP=strip
   1103 export CC CXX AR AS RANLIB LD STRIP
   1104 
   1105 msg info "Adjusting specs"
   1106 SPECFILE=$(realpath $(dirname $(gcc -print-libgcc-file-name)))/specs
   1107 export SPECFILE
   1108 remove_file ${SPECFILE}
   1109 gcc -dumpspecs | sed -e 's,/'${TLD}',,g' \
   1110 	-e '/\*startfile_prefix_spec:/{n;s,.*,/local/lib/ /lib/ /sucks/lib/ '\
   1111 ',}' \
   1112 	-e '/\*cpp:/{n;s,$, -I /local/include -I /include -I /sucks/include '\
   1113 ',}' \
   1114 	-e 's,lib64,lib,g'> specs
   1115 mv_or_fail specs ${SPECFILE}
   1116 unset SPECFILE
   1117 
   1118 PATH=/local/bin:/bin:/sucks/bin:/plan9/bin:/${TLD}/bin
   1119 export PATH
   1120 
   1121 #for lib in gcc_s.so gcc_s.so.1 stdc++.a stdc++.so stdc++.so.6
   1122 #do
   1123 #	remove_file /lib/lib${lib}
   1124 #done
   1125 
   1126 begin_substep tinycc-20230413
   1127 if [ -x /bin/tcc ]; then
   1128 	msg info "%s exists, skipping %s" /bin/tcc ${pkg}
   1129 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   1130 	unpack_pkg ${pkg} /
   1131 else
   1132 	(
   1133 		cd_or_fail ${G_SRC}/${pkg}
   1134 		cat <<! >MKPK
   1135 mkpk_name()
   1136 {
   1137 	printf "%s" "${pkg}"
   1138 }
   1139 
   1140 mkpk_install()
   1141 {
   1142 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   1143 	LDFLAGS='-static --static -fcommon'
   1144 	DESTDIR=/build
   1145 	export CFLAGS LDFLAGS DESTDIR
   1146 
   1147 	./configure \\
   1148 		--prefix=/ \\
   1149 		--bindir=/bin \\
   1150 		--libdir=/lib \\
   1151 		--tccdir=/lib/tcc \\
   1152 		--includedir=/include \\
   1153 		--docdir=/share/doc/${pkg} \\
   1154 		--sharedir=/share \\
   1155 		--config-musl \\
   1156 		--sysincludepaths=/lib/tcc/include:/local/include:/include:\\
   1157 /sucks/include \\
   1158 		--crtprefix=/lib \\
   1159 		--libpaths=/lib/tcc:/local/lib:/lib:/sucks/lib || exit 1
   1160 
   1161 	make clean || exit 1
   1162 	make ${JN} || exit 1
   1163 	
   1164 	make install-strip
   1165 }
   1166 !
   1167 		mkpk ${pkg}
   1168 		#remove_dir ${G_SRC}/${pkg}
   1169 		unpack_pkg ${pkg} /
   1170 	) || exit 1
   1171 fi
   1172 timestamp=$(date +'%Y-%m-%d %T')
   1173 printf "%s\t%s\t%s\n" tinycc 20230413 "${timestamp}" >>${G_PKGDB}
   1174 end_substep
   1175 
   1176 begin_substep grep-3.10
   1177 if [ -x /sucks/bin/grep ]; then
   1178 	msg info "%s exists, skipping %s" /sucks/bin/grep ${pkg}
   1179 elif [ -e ${G_SPKG}/gnu-grep-3.10.tar.xz ]; then
   1180 	unpack_pkg ${pkg} /
   1181 else
   1182 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz gnu-grep-3.10
   1183 	(
   1184 		cd_or_fail ${G_SRC}/gnu-grep-3.10
   1185 
   1186 		cat <<! >MKPK
   1187 mkpk_name()
   1188 {
   1189 	printf "%s" "gnu-grep-3.10"
   1190 }
   1191 
   1192 mkpk_install()
   1193 {
   1194 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   1195 	LDFLAGS='-static --static -fcommon'
   1196 	PREFIX=/sucks
   1197 	DESTDIR=/build
   1198 	export CFLAGS LDFLAGS PREFIX DESTDIR
   1199 
   1200 	./configure --prefix="\${PREFIX}" || exit 1
   1201 
   1202 	make ${JN} || exit 1
   1203 	make install-strip || exit 1
   1204 
   1205 	for m in \${DESTDIR}\${PREFIX}/share/man/man1/*.1
   1206 	do
   1207 		mv \$m \${DESTDIR}\${PREFIX}/share/man/man1/gnu-\${m##*/}
   1208 	done
   1209 }
   1210 !
   1211 		mkpk gnu-grep-3.10
   1212 		remove_dir ${G_SRC}/gnu-grep-3.10
   1213 		unpack_pkg gnu-grep-3.10 /
   1214 	) || exit 1
   1215 fi
   1216 timestamp=$(date +'%Y-%m-%d %T')
   1217 printf "%s\t%s\t%s\n" gnu-grep 3.10 "${timestamp}" >>${G_PKGDB}
   1218 end_substep
   1219 
   1220 begin_substep sed-4.9
   1221 if [ -x /sucks/bin/sed ]; then
   1222 	msg info "%s exists, skipping %s" /sucks/bin/sed ${pkg}
   1223 elif [ -e ${G_SPKG}/gnu-sed-4.9.tar.xz ]; then
   1224 	unpack_pkg ${pkg} /
   1225 else
   1226 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz gnu-sed-4.9
   1227 	(
   1228 		cd_or_fail ${G_SRC}/gnu-sed-4.9
   1229 
   1230 		cat <<! >MKPK
   1231 mkpk_name()
   1232 {
   1233 	printf "%s" "gnu-sed-4.9"
   1234 }
   1235 
   1236 mkpk_install()
   1237 {
   1238 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   1239 	LDFLAGS='-static --static -fcommon'
   1240 	PREFIX=/sucks
   1241 	DESTDIR=/build
   1242 	export CFLAGS LDFLAGS PREFIX DESTDIR
   1243 
   1244 	./configure --prefix="\${PREFIX}" || exit 1
   1245 
   1246 	make ${JN} || exit 1
   1247 	make install-strip || exit 1
   1248 
   1249 	mv \${DESTDIR}\${PREFIX}/share/man/man1/sed.1 \\
   1250 		\${DESTDIR}\${PREFIX}/share/man/man1/gnu-sed.1
   1251 }
   1252 !
   1253 		mkpk gnu-sed-4.9
   1254 		remove_dir ${G_SRC}/gnu-sed-4.9
   1255 		unpack_pkg gnu-sed-4.9 /
   1256 	) || exit 1
   1257 fi
   1258 timestamp=$(date +'%Y-%m-%d %T')
   1259 printf "%s\t%s\t%s\n" gnu-sed 4.9 "${timestamp}" >>${G_PKGDB}
   1260 end_substep
   1261 
   1262 begin_substep tar-1.34
   1263 if [ -x /sucks/bin/tar ]; then
   1264 	msg info "%s exists, skipping %s" /sucks/bin/tar ${pkg}
   1265 elif [ -e ${G_SPKG}/gnu-tar-1.34.tar.xz ]; then
   1266 	unpack_pkg ${pkg} /
   1267 else
   1268 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz gnu-tar-1.34
   1269 	(
   1270 		cd_or_fail ${G_SRC}/gnu-tar-1.34
   1271 
   1272 		cat <<! >MKPK
   1273 mkpk_name()
   1274 {
   1275 	printf "%s" "gnu-tar-1.34"
   1276 }
   1277 
   1278 mkpk_install()
   1279 {
   1280 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   1281 	LDFLAGS='-static --static -fcommon'
   1282 	PREFIX=/sucks
   1283 	DESTDIR=/build
   1284 	export CFLAGS LDFLAGS PREFIX DESTDIR
   1285 
   1286 	FORCE_UNSAFE_CONFIGURE=1 \\
   1287 	./configure --prefix="\${PREFIX}" || exit 1
   1288 
   1289 	make ${JN} || exit 1
   1290 	make install-strip || exit 1
   1291 
   1292 	mv \${DESTDIR}\${PREFIX}/share/man/man1/tar.1 \\
   1293 		\${DESTDIR}\${PREFIX}/share/man/man1/gnu-tar.1
   1294 }
   1295 !
   1296 		mkpk gnu-tar-1.34
   1297 		remove_dir ${G_SRC}/gnu-tar-1.34
   1298 		unpack_pkg gnu-tar-1.34 /
   1299 	) || exit 1
   1300 fi
   1301 timestamp=$(date +'%Y-%m-%d %T')
   1302 printf "%s\t%s\t%s\n" gnu-tar 1.34 "${timestamp}" >>${G_PKGDB}
   1303 end_substep
   1304 
   1305 begin_substep bzip2-1.0.8
   1306 if [ -x /bin/bzip2 ]; then
   1307 	msg info "%s exists, skipping %s" /bin/bzip2 ${pkg}
   1308 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   1309 	unpack_pkg ${pkg} /
   1310 else
   1311 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   1312 	(
   1313 		cd_or_fail ${G_SRC}/${pkg}
   1314 
   1315 		msg info "Applying patches"
   1316 		for n in 1 2
   1317 		do
   1318 			apply_patch packages -Np1 -i \
   1319 				${G_PAT}/bzip2-clear/$(printf "%04d" $n)-*.patch
   1320 		done
   1321 		apply_patch packages -Np1 -i \
   1322 			${G_PAT}/bzip2-mlfs/bzip2-reconfigured.patch
   1323 		chmod +x configure
   1324 			
   1325 		cat <<! >MKPK
   1326 mkpk_name()
   1327 {
   1328 	printf "%s" "${pkg}"
   1329 }
   1330 
   1331 mkpk_install()
   1332 {
   1333 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   1334 	LDFLAGS='-static --static -fcommon'
   1335 	PREFIX=/
   1336 	DESTDIR=/build
   1337 	export CFLAGS LDFLAGS PREFIX DESTDIR
   1338 
   1339 	./configure --prefix="\${PREFIX}" || exit 1
   1340 
   1341 	make ${JN} || exit 1
   1342 	make install-strip || exit 1
   1343 
   1344 	#mv ../build/lib/libbz2.so.1.0.0 ../build/lib/libbz2.so.1.0.8
   1345 	#rm ../build/lib/libbz2.so ../build/lib/libbz2.so.1
   1346 	#ln -s libbz2.so.1.0.8../build/lib/libbz2.so
   1347 	#ln -s libbz2.so.1.0.8../build/lib/libbz2.so.1
   1348 
   1349 	ln -s bzip2 ../build/bin/bunzip2
   1350 	ln -s bzip2 ../build/bin/bzcat
   1351 }
   1352 !
   1353 		mkpk ${pkg}
   1354 		remove_dir ${G_SRC}/${pkg}
   1355 		unpack_pkg ${pkg} /
   1356 	) || exit 1
   1357 fi
   1358 timestamp=$(date +'%Y-%m-%d %T')
   1359 printf "%s\t%s\t%s\n" bzip2 1.0.8 "${timestamp}" >>${G_PKGDB}
   1360 end_substep
   1361 
   1362 # Had to switch to ncurses for neomutt
   1363 # begin_substep netbsd-curses-0.3.2
   1364 # if [ -e /lib/libncurses.so ]; then
   1365 # 	msg info "%s exists, skipping %s" /lib/libncurses.so ${pkg}
   1366 # elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   1367 # 	unpack_pkg ${pkg} /
   1368 # else
   1369 # 	#extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   1370 # 	(
   1371 # 		cd_or_fail ${G_SRC}/${pkg}
   1372 # 
   1373 # 		cat <<! >MKPK
   1374 # mkpk_name()
   1375 # {
   1376 # 	printf "%s" "${pkg}"
   1377 # }
   1378 # 
   1379 # mkpk_install()
   1380 # {
   1381 # 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   1382 # 	LDFLAGS='-static --static -fcommon'
   1383 # 	DESTDIR=/build
   1384 # 	export CFLAGS DESTDIR LDFLAGS
   1385 # 
   1386 # 	make ${JN} PREFIX=/ all install || exit 1
   1387 # }
   1388 # !
   1389 # 		mkpk ${pkg}
   1390 # 		remove_dir ${G_SRC}/${pkg}
   1391 # 		unpack_pkg ${pkg} /
   1392 # 	) || exit 1
   1393 # fi
   1394 # 
   1395 # timestamp=$(date +'%Y-%m-%d %T')
   1396 # printf "%s\t%s\t%s\n" netbsd-curses 0.3.2 "${timestamp}" >>${G_PKGDB}
   1397 # end_substep
   1398 
   1399 
   1400 begin_substep ncurses-6.4
   1401 if [ -e /lib/libncursesw.a ]; then
   1402  	msg info "%s exists, skipping %s" /lib/libncursesw.a ${pkg}
   1403 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   1404 	unpack_pkg ${pkg} /
   1405 else
   1406 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   1407 	(
   1408 		cd_or_fail ${G_SRC}/${pkg}
   1409 
   1410 		cat <<! >MKPK
   1411 mkpk_name()
   1412 {
   1413 	printf "%s" "${pkg}"
   1414 }
   1415 
   1416 mkpk_install()
   1417 {
   1418 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   1419 	CXXFLAGS=\${CFLAGS}
   1420 	LDFLAGS='-static --static -fcommon -s'
   1421 	PREFIX=''
   1422 	DESTDIR=/build
   1423 	export CFLAGS CXXFLAGS LDFLAGS PREFIX DESTDIR
   1424 	SED=/sucks/bin/sed
   1425 
   1426 	\${SED} -i s/mawk// configure
   1427 
   1428 	./configure --prefix="\${PREFIX}" \\
   1429 			--without-shared \\
   1430 			--without-debug \\
   1431 			--without-ada \\
   1432 			--with-pkg-config-libdir=/lib/pkgconfig \\
   1433 			--with-termpath=/etc/termcap:/share/misc/termcap \\
   1434 			--enable-pc-files \\
   1435 			--enable-widec \\
   1436 			--enable-ext-colors \\
   1437 			--enable-ext-mouse \\
   1438 			--enable-sigwinch \\
   1439 			--enable-overwrite
   1440 
   1441 	make ${JN} PREFIX="\${PREFIX}" DESTDIR="\${DESTDIR}" all install \\
   1442 		|| exit 1
   1443 
   1444 	for lib in ncurses ncurses++ form panel menu
   1445 	do
   1446 		ln -s lib\${lib}w.a \${DESTDIR}/lib/lib\${lib}.a
   1447 		ln -s \${lib}w.pc \${DESTDIR}/lib/pkgconfig/\${lib}.pc
   1448 	done
   1449 
   1450 	ln -s libncursesw.a \${DESTDIR}/lib/libcursesw.a
   1451 	ln -s libncurses.a \${DESTDIR}/lib/libcurses.a
   1452 
   1453 	for lib in tic tinfo
   1454 	do
   1455 		ln -s ncursesw.pc \${DESTDIR}/lib/pkgconfig/\${lib}.pc
   1456 	done
   1457 }
   1458 !
   1459 		mkpk ${pkg}
   1460 		remove_dir ${G_SRC}/${pkg}
   1461 		unpack_pkg ${pkg} /
   1462 	) || exit 1
   1463 fi
   1464 timestamp=$(date +'%Y-%m-%d %T')
   1465 printf "%s\t%s\t%s\n" ncurses 6.4 "${timestamp}" >>${G_PKGDB}
   1466 end_substep
   1467 
   1468 begin_substep attr-2.5.1
   1469 if [ -x /bin/attr ]; then
   1470 	msg info "%s exists, skipping %s" /bin/attr ${pkg}
   1471 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   1472 	unpack_pkg ${pkg} /
   1473 else
   1474 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   1475 	(
   1476 		cd_or_fail ${G_SRC}/${pkg}
   1477 
   1478 		cat <<! >MKPK
   1479 mkpk_name()
   1480 {
   1481 	printf "%s" "${pkg}"
   1482 }
   1483 
   1484 mkpk_install()
   1485 {
   1486 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   1487 	LDFLAGS='-static --static -fcommon'
   1488 	DESTDIR=/build
   1489 	export CFLAGS LDFLAGS DESTDIR
   1490 
   1491 	./configure --prefix="\${PREFIX}" \\
   1492 		    --bindir=/bin \\
   1493 		    --sysconfdir=/etc \\
   1494 		    --docdir=/share/doc/${pkg}
   1495 
   1496 	make ${JN} || exit 1
   1497 	make install-strip
   1498 }
   1499 !
   1500 		mkpk ${pkg}
   1501 		remove_dir ${G_SRC}/${pkg}
   1502 		unpack_pkg ${pkg} /
   1503 	) || exit 1
   1504 fi
   1505 timestamp=$(date +'%Y-%m-%d %T')
   1506 printf "%s\t%s\t%s\n" attr 2.5.1 "${timestamp}" >>${G_PKGDB}
   1507 end_substep
   1508 
   1509 begin_substep acl-2.3.1
   1510 if [ -x /bin/getfacl ]; then
   1511 	msg info "%s exists, skipping %s" /bin/getfacl ${pkg}
   1512 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   1513 	unpack_pkg ${pkg} /
   1514 else
   1515 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   1516 	(
   1517 		cd_or_fail ${G_SRC}/${pkg}
   1518 
   1519 		cat <<! >MKPK
   1520 mkpk_name()
   1521 {
   1522 	printf "%s" "${pkg}"
   1523 }
   1524 
   1525 mkpk_install()
   1526 {
   1527 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   1528 	LDFLAGS='-static --static -fcommon'
   1529 	DESTDIR=/build
   1530 	export CFLAGS LDFLAGS DESTDIR
   1531 
   1532 	./configure --prefix="\${PREFIX}" \\
   1533 		    --bindir=/bin \\
   1534 		    --libexecdir=/lib \\
   1535 		    --docdir=/share/doc/${pkg}
   1536 
   1537 	make ${JN} || exit 1
   1538 	make install-strip
   1539 }
   1540 !
   1541 		mkpk ${pkg}
   1542 		remove_dir ${G_SRC}/${pkg}
   1543 		unpack_pkg ${pkg} /
   1544 	) || exit 1
   1545 fi
   1546 timestamp=$(date +'%Y-%m-%d %T')
   1547 printf "%s\t%s\t%s\n" acl 2.3.1 "${timestamp}" >>${G_PKGDB}
   1548 end_substep
   1549 
   1550 begin_substep libcap-2.68
   1551 if [ -x /bin/getcap ]; then
   1552 	msg info "%s exists, skipping %s" /bin/getcap ${pkg}
   1553 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   1554 	unpack_pkg ${pkg} /
   1555 else
   1556 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   1557 	(
   1558 		cd_or_fail ${G_SRC}/${pkg}
   1559 
   1560 		cat <<! >MKPK
   1561 mkpk_name()
   1562 {
   1563 	printf "%s" "${pkg}"
   1564 }
   1565 
   1566 mkpk_install()
   1567 {
   1568 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   1569 	LDFLAGS='-static --static -fcommon -s'
   1570 	DESTDIR=/build
   1571 	export CFLAGS LDFLAGS DESTDIR
   1572 
   1573 	# Fix Makefile to not shove dynamic libraries into a static libcap even
   1574 	# when explicitly instructed otherwise... -_-
   1575 	/sucks/bin/sed -i 's,^\\(LDFLAGS_SUFFIX =\\) .*,\\1,g' progs/Makefile
   1576 
   1577 	make ${JN} prefix="\${PREFIX}" lib=lib SHARED=no GOLANG=no \\
   1578 		DESTDIR="\${DESTDIR}" PKGCONFDIR=\${PREFIX}/lib/pkgconfig install
   1579 }
   1580 !
   1581 		mkpk ${pkg}
   1582 		remove_dir ${G_SRC}/${pkg}
   1583 		unpack_pkg ${pkg} /
   1584 	) || exit 1
   1585 fi
   1586 timestamp=$(date +'%Y-%m-%d %T')
   1587 printf "%s\t%s\t%s\n" libcap 2.68 "${timestamp}" >>${G_PKGDB}
   1588 end_substep
   1589 
   1590 # Needed for libxslt
   1591 begin_substep libxml2-2.9.12
   1592 if [ -e /lib/libxml2.a ]; then
   1593 	msg info "%s exists, skipping %s" /lib/libxml2.a ${pkg}
   1594 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   1595 	unpack_pkg ${pkg} /
   1596 else
   1597 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   1598 	(
   1599 		cd_or_fail ${G_SRC}/${pkg}
   1600 
   1601 		apply_patch packages -Np1 -i \
   1602 			${G_PAT}/libxml2-adelie/python-segfault-fix.patch
   1603 
   1604 		cat <<! >MKPK
   1605 mkpk_name()
   1606 {
   1607 	printf "%s" "${pkg}"
   1608 }
   1609 
   1610 mkpk_install()
   1611 {
   1612 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   1613 	LDFLAGS='-static --static -fcommon -s'
   1614 	PREFIX=/
   1615 	DESTDIR=/build
   1616 	export CFLAGS LDFLAGS PREFIX DESTDIR
   1617 
   1618 	autoreconf -vif
   1619 
   1620 	./configure --prefix="\${PREFIX}" \\
   1621 		--disable-shared \\
   1622 		--with-history \\
   1623 		--with-python=/bin/python3 \\
   1624 		--with-icu \\
   1625 		--with-threads
   1626 
   1627 	make ${JN} DESTDIR=\${DESTDIR} install || exit 1
   1628 
   1629 	mkdir -p /build/sucks/share/aclocal
   1630 	mv /build/share/aclocal/* /build/sucks/share/aclocal/
   1631 	rmdir /build/share/aclocal || true
   1632 	rmdir /build/share || true
   1633 }
   1634 !
   1635 		mkpk ${pkg}
   1636 		remove_dir ${G_SRC}/${pkg}
   1637 		unpack_pkg ${pkg} /
   1638 	) || exit 1
   1639 fi
   1640 timestamp=$(date +'%Y-%m-%d %T')
   1641 printf "%s\t%s\t%s\n" libxml2 2.9.12 "${timestamp}" >>${G_PKGDB}
   1642 end_substep
   1643 
   1644 begin_substep psmisc-23.6
   1645 if [ -x /bin/killall ]; then
   1646 	msg info "%s exists, skipping %s" /bin/killall ${pkg}
   1647 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   1648 	unpack_pkg ${pkg} /
   1649 else
   1650 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   1651 	(
   1652 		cd_or_fail ${G_SRC}/${pkg}
   1653 
   1654 		cat <<! >MKPK
   1655 mkpk_name()
   1656 {
   1657 	printf "%s" "${pkg}"
   1658 }
   1659 
   1660 mkpk_install()
   1661 {
   1662 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   1663 	LDFLAGS='-static --static -fcommon'
   1664 	PREFIX=''
   1665 	DESTDIR=/build
   1666 	export CFLAGS LDFLAGS DESTDIR
   1667 
   1668 	ac_cv_func_malloc_0_nonnull=yes  \
   1669 	ac_cv_func_realloc_0_nonnull=yes \
   1670 	./configure --prefix="\${PREFIX}" \
   1671 		--sysconfdir=/etc \
   1672 		--localstatedir=/var \
   1673 		--disable-selinux \
   1674 		--enable-harden-flags \
   1675 		--enable-ipv6
   1676 
   1677 	make ${JN} || exit 1
   1678 	make install-strip
   1679 }
   1680 !
   1681 		mkpk ${pkg}
   1682 		remove_dir ${G_SRC}/${pkg}
   1683 		unpack_pkg ${pkg} /
   1684 	) || exit 1
   1685 fi
   1686 timestamp=$(date +'%Y-%m-%d %T')
   1687 printf "%s\t%s\t%s\n" psmisc 23.6 "${timestamp}" >>${G_PKGDB}
   1688 end_substep
   1689 
   1690 begin_substep iana-etc-20230405
   1691 if [ -e /etc/services ]; then
   1692 	msg info "%s exists, skipping %s" /etc/services ${pkg}
   1693 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   1694 	unpack_pkg ${pkg} /
   1695 else
   1696 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   1697 	(
   1698 		cd_or_fail ${G_SRC}/${pkg}
   1699 
   1700 		cat <<! >MKPK
   1701 mkpk_name()
   1702 {
   1703 	printf "%s" "${pkg}"
   1704 }
   1705 
   1706 mkpk_install()
   1707 {
   1708 	mkdir -p ../build/etc
   1709 	cp services protocols ../build/etc
   1710 }
   1711 !
   1712 		mkpk ${pkg}
   1713 		remove_dir ${G_SRC}/${pkg}
   1714 		unpack_pkg ${pkg} /
   1715 	) || exit 1
   1716 fi
   1717 timestamp=$(date +'%Y-%m-%d %T')
   1718 printf "%s\t%s\t%s\n" iana-etc 20230405 "${timestamp}" >>${G_PKGDB}
   1719 end_substep
   1720 
   1721 begin_substep libtool-2.4.7
   1722 if [ -x /sucks/bin/libtool ]; then
   1723 	msg info "%s exists, skipping %s" /sucks/bin/libtool ${pkg}
   1724 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   1725 	unpack_pkg ${pkg} /
   1726 else
   1727 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   1728 	(
   1729 		cd_or_fail ${G_SRC}/${pkg}
   1730 
   1731 		cat <<! >MKPK
   1732 mkpk_name()
   1733 {
   1734 	printf "%s" "${pkg}"
   1735 }
   1736 
   1737 mkpk_install()
   1738 {
   1739 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   1740 	LDFLAGS='-static --static -fcommon'
   1741 	PREFIX=/sucks
   1742 	DESTDIR=/build
   1743 	export CFLAGS LDFLAGS PREFIX DESTDIR
   1744 
   1745 	./configure --prefix="\${PREFIX}" \\
   1746 		--disable-shared \\
   1747 		--enable-static
   1748 
   1749 	make ${JN} || exit 1
   1750 	make install-strip
   1751 
   1752 	mkdir -p /build/sucks/share/aclocal
   1753 }
   1754 !
   1755 		mkpk ${pkg}
   1756 		remove_dir ${G_SRC}/${pkg}
   1757 		unpack_pkg ${pkg} /
   1758 	) || exit 1
   1759 fi
   1760 timestamp=$(date +'%Y-%m-%d %T')
   1761 printf "%s\t%s\t%s\n" libtool 2.4.7 "${timestamp}" >>${G_PKGDB}
   1762 end_substep
   1763 
   1764 begin_substep pax-utils-1.3.4
   1765 if [ -x /bin/scanelf ]; then
   1766 	msg info "%s exists, skipping %s" /bin/scanelf ${pkg}
   1767 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   1768 	unpack_pkg ${pkg} /
   1769 else
   1770 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   1771 	(
   1772 		cd_or_fail ${G_SRC}/${pkg}
   1773 
   1774 		cat <<! >MKPK
   1775 mkpk_name()
   1776 {
   1777 	printf "%s" "${pkg}"
   1778 }
   1779 
   1780 mkpk_install()
   1781 {
   1782 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   1783 	LDFLAGS='-static --static -fcommon -s'
   1784 	PREFIX=''
   1785 	DESTDIR=/build
   1786 	export CFLAGS LDFLAGS PREFIX DESTDIR
   1787 
   1788 	./configure --prefix="\${PREFIX}" \\
   1789 		--disable-shared \\
   1790 		--enable-static
   1791 
   1792 	make ${JN} || exit 1
   1793 	make install-strip
   1794 }
   1795 !
   1796 		mkpk ${pkg}
   1797 		remove_dir ${G_SRC}/${pkg}
   1798 		unpack_pkg ${pkg} /
   1799 	) || exit 1
   1800 fi
   1801 timestamp=$(date +'%Y-%m-%d %T')
   1802 printf "%s\t%s\t%s\n" pax-utils 1.3.4 "${timestamp}" >>${G_PKGDB}
   1803 end_substep
   1804 
   1805 begin_substep less-608
   1806 if [ -x /bin/less ]; then
   1807 	msg info "%s exists, skipping %s" /bin/less ${pkg}
   1808 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   1809 	unpack_pkg ${pkg} /
   1810 else
   1811 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   1812 	(
   1813 		cd_or_fail ${G_SRC}/${pkg}
   1814 
   1815 		cat <<! >MKPK
   1816 mkpk_name()
   1817 {
   1818 	printf "%s" "${pkg}"
   1819 }
   1820 
   1821 mkpk_install()
   1822 {
   1823 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   1824 	LDFLAGS='-static --static -fcommon'
   1825 	PREFIX=''
   1826 	DESTDIR=/build
   1827 	export CFLAGS LDFLAGS PREFIX DESTDIR
   1828 
   1829 	./configure --prefix="\${PREFIX}" --sysconfdir=/etc
   1830 
   1831 	make ${JN} || exit 1
   1832 	make DESTDIR="\${DESTDIR}" install-strip
   1833 }
   1834 !
   1835 		mkpk ${pkg}
   1836 		remove_dir ${G_SRC}/${pkg}
   1837 		unpack_pkg ${pkg} /
   1838 	) || exit 1
   1839 fi
   1840 timestamp=$(date +'%Y-%m-%d %T')
   1841 printf "%s\t%s\t%s\n" less 608 "${timestamp}" >>${G_PKGDB}
   1842 end_substep
   1843 
   1844 begin_substep gdbm-1.23
   1845 if [ -x /bin/gdbmtool ]; then
   1846 	msg info "%s exists, skipping %s" /bin/gdbmtool ${pkg}
   1847 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   1848 	unpack_pkg ${pkg} /
   1849 else
   1850 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   1851 	(
   1852 		cd_or_fail ${G_SRC}/${pkg}
   1853 
   1854 		cat <<! >MKPK
   1855 mkpk_name()
   1856 {
   1857 	printf "%s" "${pkg}"
   1858 }
   1859 
   1860 mkpk_install()
   1861 {
   1862 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   1863 	LDFLAGS='-static --static -fcommon'
   1864 	DESTDIR=/build
   1865 	export CFLAGS LDFLAGS DESTDIR
   1866 
   1867 	./configure --prefix="\${PREFIX}" \\
   1868 		--disable-shared \\
   1869 		--enable-libgdbm-compat
   1870 
   1871 	make ${JN} || exit 1
   1872 	make install-strip
   1873 }
   1874 !
   1875 		mkpk ${pkg}
   1876 		remove_dir ${G_SRC}/${pkg}
   1877 		unpack_pkg ${pkg} /
   1878 	) || exit 1
   1879 fi
   1880 timestamp=$(date +'%Y-%m-%d %T')
   1881 printf "%s\t%s\t%s\n" gdbm 1.23 "${timestamp}" >>${G_PKGDB}
   1882 end_substep
   1883 
   1884 begin_substep gperf-3.1
   1885 if [ -x /bin/gperf ]; then
   1886 	msg info "%s exists, skipping %s" /bin/gperf ${pkg}
   1887 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   1888 	unpack_pkg ${pkg} /
   1889 else
   1890 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   1891 	(
   1892 		cd_or_fail ${G_SRC}/${pkg}
   1893 
   1894 		cat <<! >MKPK
   1895 mkpk_name()
   1896 {
   1897 	printf "%s" "${pkg}"
   1898 }
   1899 
   1900 mkpk_install()
   1901 {
   1902 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   1903 	CXXFLAGS=\${CFLAGS}
   1904 	LDFLAGS='-static --static -fcommon -s'
   1905 	PREFIX=''
   1906 	DESTDIR=/build
   1907 	export CFLAGS CXXFLAGS LDFLAGS PREFIX DESTDIR
   1908 
   1909 	./configure --prefix="\${PREFIX}" \\
   1910 		--docdir=/share/doc/${pkg}
   1911 
   1912 	make ${JN} || exit 1
   1913 	make install
   1914 }
   1915 !
   1916 		mkpk ${pkg}
   1917 		remove_dir ${G_SRC}/${pkg}
   1918 		unpack_pkg ${pkg} /
   1919 	) || exit 1
   1920 fi
   1921 timestamp=$(date +'%Y-%m-%d %T')
   1922 printf "%s\t%s\t%s\n" gperf 3.1 "${timestamp}" >>${G_PKGDB}
   1923 end_substep
   1924 
   1925 begin_substep expat-2.5.0
   1926 if [ -x /bin/xmlwf ]; then
   1927 	msg info "%s exists, skipping %s" /bin/xmlwf ${pkg}
   1928 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   1929 	unpack_pkg ${pkg} /
   1930 else
   1931 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   1932 	(
   1933 		cd_or_fail ${G_SRC}/${pkg}
   1934 
   1935 		cat <<! >MKPK
   1936 mkpk_name()
   1937 {
   1938 	printf "%s" "${pkg}"
   1939 }
   1940 
   1941 mkpk_install()
   1942 {
   1943 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   1944 	LDFLAGS='-static --static -fcommon'
   1945 	PREFIX=''
   1946 	DESTDIR=/build
   1947 	export CFLAGS LDFLAGS PREFIX DESTDIR
   1948 
   1949 	./configure --prefix="\${PREFIX}" \\
   1950 		--disable-shared \\
   1951 		--docdir=/share/doc/${pkg}
   1952 
   1953 	make ${JN} || exit 1
   1954 	make install-strip
   1955 }
   1956 !
   1957 		mkpk ${pkg}
   1958 		remove_dir ${G_SRC}/${pkg}
   1959 		unpack_pkg ${pkg} /
   1960 	) || exit 1
   1961 fi
   1962 timestamp=$(date +'%Y-%m-%d %T')
   1963 printf "%s\t%s\t%s\n" expat 2.5.0 "${timestamp}" >>${G_PKGDB}
   1964 end_substep
   1965 
   1966 begin_substep inetutils-2.4
   1967 if [ -x /bin/telnet ]; then
   1968 	msg info "%s exists, skipping %s" /bin/telnet ${pkg}
   1969 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   1970 	unpack_pkg ${pkg} /
   1971 else
   1972 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   1973 	(
   1974 		cd_or_fail ${G_SRC}/${pkg}
   1975 
   1976 		cat <<! >MKPK
   1977 mkpk_name()
   1978 {
   1979 	printf "%s" "${pkg}"
   1980 }
   1981 
   1982 mkpk_install()
   1983 {
   1984 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   1985 	LDFLAGS='-static --static -fcommon'
   1986 	PREFIX=''
   1987 	DESTDIR=/build
   1988 	export CFLAGS LDFLAGS PREFIX DESTDIR
   1989 	SED=/sucks/bin/sed
   1990 
   1991 	\${SED} -i 's|_GL_WARN_ON_USE (gets|//_GL_WARN_ON_USE (gets|' \\
   1992 		lib/stdio.in.h
   1993 	echo '#define PATH_PROCNET_DEV "/proc/net/dev"' \\
   1994 		>> ifconfig/system/linux.h
   1995 	\${SED} -i 's|port : "whois"|port : "nicname"|' whois/whois.c
   1996 
   1997 	./configure --prefix="\${PREFIX}" \\
   1998 		--localstatedir=/var \\
   1999 		--disable-logger \\
   2000 		--disable-whois \\
   2001 		--disable-rcp \\
   2002 		--disable-rexec \\
   2003 		--disable-rlogin \\
   2004 		--disable-rsh \\
   2005 		--disable-servers
   2006 
   2007 	make ${JN} || exit 1
   2008 	make install-strip
   2009 }
   2010 !
   2011 		mkpk ${pkg}
   2012 		remove_dir ${G_SRC}/${pkg}
   2013 		unpack_pkg ${pkg} /
   2014 	) || exit 1
   2015 fi
   2016 timestamp=$(date +'%Y-%m-%d %T')
   2017 printf "%s\t%s\t%s\n" inetutils 2.4 "${timestamp}" >>${G_PKGDB}
   2018 end_substep
   2019 
   2020 # Perl is in /sucks only because I couldn't find a straightforward way to create
   2021 # a fully static version myself, and didn't want to include something like
   2022 # https://github.com/pts/staticperl
   2023 # That, and one could argue that it overlaps with shell, awk etc.
   2024 begin_substep perl-5.36.0
   2025 if [ -x /sucks/bin/perl ] && [ ! -L /sucks/bin/perl ]; then
   2026 	msg info "%s exists, skipping %s" /sucks/bin/perl ${pkg}
   2027 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   2028 	unpack_pkg ${pkg} /
   2029 else
   2030 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   2031 	(
   2032 		cd_or_fail ${G_SRC}/${pkg}
   2033 
   2034 		for patch in musl-locale musl-stack-size
   2035 		do
   2036 			apply_patch packages -Np1 -i \
   2037 				${G_PAT}/perl-alpine/${patch}.patch
   2038 		done
   2039 
   2040 		cat <<! >MKPK
   2041 mkpk_name()
   2042 {
   2043 	printf "%s" "${pkg}"
   2044 }
   2045 
   2046 mkpk_install()
   2047 {
   2048 	CFLAGS='-DNO_POSIX_2008_LOCALE -D_GNU_SOURCE'
   2049 	LDFLAGS=
   2050 	DESTDIR=/build
   2051 	export CFLAGS LDFLAGS DESTDIR
   2052 
   2053 	BUILD_BZIP2=0
   2054 	BUILD_ZLIB=True
   2055 	export BUILD_BZIP2 BUILD_ZLIB
   2056 
   2057 	rm -rf cpan/Compress-Raw-Bzip2/bzip2-src
   2058 	/sucks/bin/sed -i '/\(bzip2\|zzz\)-src/d' MANIFEST
   2059 
   2060 	sh Configure \
   2061 		-des -Dprefix=/sucks                           \
   2062 		-Doptimize=-Os                                 \
   2063 		-Dvendorprefix=/sucks                          \
   2064 		-Dprivlib=/sucks/lib/perl5/5.36/core_perl      \
   2065 		-Darchlib=/sucks/lib/perl5/5.36/core_perl      \
   2066 		-Dsitelib=/sucks/lib/perl5/5.36/site_perl      \
   2067 		-Dsitearch=/sucks/lib/perl5/5.36/site_perl     \
   2068 		-Dvendorlib=/sucks/lib/perl5/5.36/vendor_perl  \
   2069 		-Dvendorarch=/sucks/lib/perl5/5.36/vendor_perl \
   2070 		-Dman1dir=/sucks/share/man/man1                \
   2071 		-Dman3dir=/sucks/share/man/man3                \
   2072 		-Dpager="/bin/less -isR"                       \
   2073 		-Dtar="/sucks/bin/tar"                         \
   2074 		-Duseshrplib                                   \
   2075 		-Dusethreads                                   \
   2076 		-Dcccdlflags='-fPIC' -Dccdlflags='-rdynamic'
   2077 
   2078 	make ${JN} || exit 1
   2079 	make install-strip
   2080 
   2081 	mkdir -p ../build/bin
   2082 	ln -s /sucks/bin/perl ../build/bin/perl
   2083 }
   2084 !
   2085 		mkpk ${pkg}
   2086 		remove_dir ${G_SRC}/${pkg}
   2087 		unpack_pkg ${pkg} /
   2088 	) || exit 1
   2089 fi
   2090 timestamp=$(date +'%Y-%m-%d %T')
   2091 printf "%s\t%s\t%s\n" perl 5.36.0 "${timestamp}" >>${G_PKGDB}
   2092 end_substep
   2093 
   2094 begin_substep XML-Parser-2.46
   2095 if [ -e /sucks/lib/perl5/5.36/site_perl/XML/Parser.pm ]; then
   2096 	msg info "%s exists, skipping %s" /sucks/lib/perl5/5.36/site_perl/\
   2097 XML/Parser.pm ${pkg}
   2098 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   2099 	unpack_pkg ${pkg} /
   2100 else
   2101 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz "" touch
   2102 	(
   2103 		cd_or_fail ${G_SRC}/${pkg}
   2104 
   2105 		cat <<! >MKPK
   2106 mkpk_name()
   2107 {
   2108 	printf "%s" "${pkg}"
   2109 }
   2110 
   2111 mkpk_install()
   2112 {
   2113 	perl Makefile.PL 
   2114 	make ${JN} DESTDIR=../build || exit 1
   2115 	make DESTDIR=../build install
   2116 
   2117 	find ../build -name perllocal.pod -exec rm -fv {} \;
   2118 }
   2119 !
   2120 		mkpk ${pkg}
   2121 		remove_dir ${G_SRC}/${pkg}
   2122 		unpack_pkg ${pkg} /
   2123 	) || exit 1
   2124 fi
   2125 timestamp=$(date +'%Y-%m-%d %T')
   2126 printf "%s\t%s\t%s\n" XML-Parser 2.46 "${timestamp}" >>${G_PKGDB}
   2127 end_substep
   2128 
   2129 begin_substep intltool-0.51.0
   2130 if [ -x /bin/intltoolize ]; then
   2131 	msg info "%s exists, skipping %s" /bin/intltoolize ${pkg}
   2132 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   2133 	unpack_pkg ${pkg} /
   2134 else
   2135 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   2136 	(
   2137 		cd_or_fail ${G_SRC}/${pkg}
   2138 
   2139 		cat <<! >MKPK
   2140 mkpk_name()
   2141 {
   2142 	printf "%s" "${pkg}"
   2143 }
   2144 
   2145 mkpk_install()
   2146 {
   2147 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   2148 	LDFLAGS='-static --static -fcommon'
   2149 	PREFIX=''
   2150 	DESTDIR=/build
   2151 	PERL=/sucks/bin/perl
   2152 	export CFLAGS LDFLAGS PREFIX DESTDIR PERL
   2153 	SED=/sucks/bin/sed
   2154 
   2155 	\${SED} -i 's:\\\${:\\\$\\{:' intltool-update.in
   2156 
   2157 	./configure --prefix="\${PREFIX}"
   2158 
   2159 	make ${JN} || exit 1
   2160 	make install-strip
   2161 
   2162 	mkdir -p /build/sucks/share/aclocal
   2163 	mv /build/share/aclocal/* /build/sucks/share/aclocal/
   2164 	rmdir /build/share/aclocal || true
   2165 	rmdir /build/share || true
   2166 }
   2167 !
   2168 		mkpk ${pkg}
   2169 		remove_dir ${G_SRC}/${pkg}
   2170 		unpack_pkg ${pkg} /
   2171 	) || exit 1
   2172 fi
   2173 timestamp=$(date +'%Y-%m-%d %T')
   2174 printf "%s\t%s\t%s\n" intltool 0.51.0 "${timestamp}" >>${G_PKGDB}
   2175 end_substep
   2176 
   2177 begin_substep help2man-1.49.3
   2178 if [ -x /bin/help2man ]; then
   2179 	msg info "%s exists, skipping %s" /bin/help2man ${pkg}
   2180 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   2181 	unpack_pkg ${pkg} /
   2182 else
   2183 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   2184 	(
   2185 		cd_or_fail ${G_SRC}/${pkg}
   2186 
   2187 		cat <<! >MKPK
   2188 mkpk_name()
   2189 {
   2190 	printf "%s" "${pkg}"
   2191 }
   2192 
   2193 mkpk_install()
   2194 {
   2195 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   2196 	LDFLAGS='-static --static -fcommon -s'
   2197 	PREFIX=''
   2198 	DESTDIR=/build
   2199 	export CFLAGS LDFLAGS PREFIX DESTDIR
   2200 
   2201 	./configure --prefix="\${PREFIX}"
   2202 
   2203 	make ${JN} || exit 1
   2204 	make DESTDIR="\${DESTDIR}" install
   2205 }
   2206 !
   2207 		mkpk ${pkg}
   2208 		remove_dir ${G_SRC}/${pkg}
   2209 		unpack_pkg ${pkg} /
   2210 	) || exit 1
   2211 fi
   2212 timestamp=$(date +'%Y-%m-%d %T')
   2213 printf "%s\t%s\t%s\n" help2man 1.49.3 "${timestamp}" >>${G_PKGDB}
   2214 end_substep
   2215 
   2216 begin_substep autoconf-2.71
   2217 if [ -x /sucks/bin/autoconf ]; then
   2218 	msg info "%s exists, skipping %s" /sucks/bin/autoconf ${pkg}
   2219 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   2220 	unpack_pkg ${pkg} /
   2221 else
   2222 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   2223 	(
   2224 		cd_or_fail ${G_SRC}/${pkg}
   2225 
   2226 		cat <<! >MKPK
   2227 mkpk_name()
   2228 {
   2229 	printf "%s" "${pkg}"
   2230 }
   2231 
   2232 mkpk_install()
   2233 {
   2234 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   2235 	LDFLAGS='-static --static -fcommon'
   2236 	PREFIX=/sucks
   2237 	DESTDIR=/build
   2238 	export CFLAGS LDFLAGS PREFIX DESTDIR
   2239 
   2240 	./configure --prefix="\${PREFIX}"
   2241 
   2242 	make ${JN} || exit 1
   2243 	make install-strip
   2244 }
   2245 !
   2246 		mkpk ${pkg}
   2247 		remove_dir ${G_SRC}/${pkg}
   2248 		unpack_pkg ${pkg} /
   2249 	) || exit 1
   2250 fi
   2251 timestamp=$(date +'%Y-%m-%d %T')
   2252 printf "%s\t%s\t%s\n" autoconf 2.71 "${timestamp}" >>${G_PKGDB}
   2253 end_substep
   2254 
   2255 begin_substep automake-1.16.5
   2256 if [ -x /sucks/bin/automake ]; then
   2257 	msg info "%s exists, skipping %s" /sucks/bin/automake ${pkg}
   2258 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   2259 	unpack_pkg ${pkg} /
   2260 else
   2261 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   2262 	(
   2263 		cd_or_fail ${G_SRC}/${pkg}
   2264 
   2265 		cat <<! >MKPK
   2266 mkpk_name()
   2267 {
   2268 	printf "%s" "${pkg}"
   2269 }
   2270 
   2271 mkpk_install()
   2272 {
   2273 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   2274 	LDFLAGS='-static --static -fcommon -s'
   2275 	PREFIX=/sucks
   2276 	DESTDIR=/build
   2277 	export CFLAGS LDFLAGS PREFIX DESTDIR
   2278 
   2279 	./configure --prefix="\${PREFIX}" \\
   2280 		--docdir=/sucks/share/doc/${pkg}
   2281 
   2282 	make ${JN} || exit 1
   2283 	make install-strip
   2284 }
   2285 !
   2286 		mkpk ${pkg}
   2287 		remove_dir ${G_SRC}/${pkg}
   2288 		unpack_pkg ${pkg} /
   2289 	) || exit 1
   2290 fi
   2291 timestamp=$(date +'%Y-%m-%d %T')
   2292 printf "%s\t%s\t%s\n" automake 1.16.5 "${timestamp}" >>${G_PKGDB}
   2293 end_substep
   2294 
   2295 begin_substep autoconf-archive-2023.02.20
   2296 if [ -e /sucks/share/aclocal/ax_absolute_header.m4 ]; then
   2297 	msg info "%s exists, skipping %s" \
   2298 		/sucks/share/aclocal/ax_absolute_header.m4 ${pkg}
   2299 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   2300 	unpack_pkg ${pkg} /
   2301 else
   2302 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   2303 	(
   2304 		cd_or_fail ${G_SRC}/${pkg}
   2305 
   2306 		cat <<! >MKPK
   2307 mkpk_name()
   2308 {
   2309 	printf "%s" "${pkg}"
   2310 }
   2311 
   2312 mkpk_install()
   2313 {
   2314 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   2315 	LDFLAGS='-static --static -fcommon -s'
   2316 	PREFIX=/sucks
   2317 	DESTDIR=/build
   2318 	export CFLAGS LDFLAGS PREFIX DESTDIR
   2319 
   2320 	./configure --prefix="\${PREFIX}"
   2321 
   2322 	make install
   2323 }
   2324 !
   2325 		mkpk ${pkg}
   2326 		remove_dir ${G_SRC}/${pkg}
   2327 		unpack_pkg ${pkg} /
   2328 	) || exit 1
   2329 fi
   2330 timestamp=$(date +'%Y-%m-%d %T')
   2331 printf "%s\t%s\t%s\n" autoconf-archive 2023.02.20 "${timestamp}" >>${G_PKGDB}
   2332 end_substep
   2333 
   2334 begin_substep musl-fts-1.2.7
   2335 if [ -e /lib/libfts.a ]; then
   2336 	msg info "%s exists, skipping %s" /lib/libfts.a ${pkg}
   2337 elif [ -e ${G_SPKG}/${pkg}.tar.gz ]; then
   2338 	unpack_pkg ${pkg} /
   2339 else
   2340 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   2341 	(
   2342 		cd_or_fail ${G_SRC}/${pkg}
   2343 
   2344 		cat <<! >MKPK
   2345 mkpk_name()
   2346 {
   2347 	printf "%s" "${pkg}"
   2348 }
   2349 
   2350 mkpk_install()
   2351 {
   2352 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   2353 	LDFLAGS='-static --static -fcommon'
   2354 	PREFIX=''
   2355 	DESTDIR=/build
   2356 	export CFLAGS LDFLAGS PREFIX DESTDIR
   2357 	SED=/sucks/bin/sed
   2358 
   2359 	\${SED} -i '/pkgconfig_DATA/i pkgconfigdir=/lib/pkgconfig' \\
   2360 		Makefile.am
   2361 	./bootstrap.sh
   2362 
   2363 	./configure --prefix="\${PREFIX}" \\
   2364 		--sysconfdir=/etc \\
   2365 		--localstatedir=/var
   2366 
   2367 	make ${JN} || exit 1
   2368 	make install-strip
   2369 }
   2370 !
   2371 		mkpk ${pkg}
   2372 		remove_dir ${G_SRC}/${pkg}
   2373 		unpack_pkg ${pkg} /
   2374 	) || exit 1
   2375 fi
   2376 timestamp=$(date +'%Y-%m-%d %T')
   2377 printf "%s\t%s\t%s\n" musl-fts 1.2.7 "${timestamp}" >>${G_PKGDB}
   2378 end_substep
   2379 
   2380 begin_substep musl-obstack-1.1
   2381 if [ -e /lib/libobstack.a ]; then
   2382 	msg info "%s exists, skipping %s" /lib/libobstack.a ${pkg}
   2383 elif [ -e ${G_SPKG}/${pkg}.tar.gz ]; then
   2384 	unpack_pkg ${pkg} /
   2385 else
   2386 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   2387 	(
   2388 		cd_or_fail ${G_SRC}/${pkg}
   2389 
   2390 		cat <<! >MKPK
   2391 mkpk_name()
   2392 {
   2393 	printf "%s" "${pkg}"
   2394 }
   2395 
   2396 mkpk_install()
   2397 {
   2398 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   2399 	LDFLAGS='-static --static -fcommon'
   2400 	PREFIX=''
   2401 	DESTDIR=/build
   2402 	export CFLAGS LDFLAGS PREFIX DESTDIR
   2403 	SED=/sucks/bin/sed
   2404 
   2405 	\${SED} -i '/pkgconfig_DATA/i pkgconfigdir=/lib/pkgconfig' \\
   2406 		Makefile.am
   2407 	./bootstrap.sh
   2408 
   2409 	./configure --prefix="\${PREFIX}" \\
   2410 		--sysconfdir=/etc \\
   2411 		--localstatedir=/var
   2412 
   2413 	make ${JN} || exit 1
   2414 	make install-strip
   2415 }
   2416 !
   2417 		mkpk ${pkg}
   2418 		remove_dir ${G_SRC}/${pkg}
   2419 		unpack_pkg ${pkg} /
   2420 	) || exit 1
   2421 fi
   2422 timestamp=$(date +'%Y-%m-%d %T')
   2423 printf "%s\t%s\t%s\n" musl-obstack 1.1 "${timestamp}" >>${G_PKGDB}
   2424 end_substep
   2425 
   2426 begin_substep xz-5.4.2
   2427 if [ -e /bin/xz ]; then
   2428 	msg info "%s exists, skipping %s" /bin/xz ${pkg}
   2429 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   2430 	unpack_pkg ${pkg} /
   2431 else
   2432 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   2433 	(
   2434 		cd_or_fail ${G_SRC}/${pkg}
   2435 
   2436 		cat <<! >MKPK
   2437 mkpk_name()
   2438 {
   2439 	printf "%s" "${pkg}"
   2440 }
   2441 
   2442 mkpk_install()
   2443 {
   2444 	CFLAGS='-Os -pipe -static --static -fcommon'
   2445 	LDFLAGS='-static --static -fcommon'
   2446 	DESTDIR=/build
   2447 	export CFLAGS LDFLAGS DESTDIR
   2448 
   2449 	./configure --prefix=/ --docdir=/share/doc/${pkg}
   2450 
   2451 	make ${JN} || exit 1
   2452 	make install-strip
   2453 }
   2454 !
   2455 		mkpk ${pkg}
   2456 		remove_dir ${G_SRC}/${pkg}
   2457 		unpack_pkg ${pkg} /
   2458 	) || exit 1
   2459 fi
   2460 timestamp=$(date +'%Y-%m-%d %T')
   2461 printf "%s\t%s\t%s\n" xz 5.4.2 "${timestamp}" >>${G_PKGDB}
   2462 end_substep
   2463 
   2464 begin_substep gettext-tiny-0.3.2
   2465 if [ -e /bin/msgfmt ]; then
   2466 	msg info "%s exists, skipping %s" /bin/msgfmt ${pkg}
   2467 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   2468 	unpack_pkg ${pkg} /
   2469 else
   2470 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   2471 	(
   2472 		cd_or_fail ${G_SRC}/${pkg}
   2473 
   2474 		apply_patch packages -Np1 -i \
   2475 			${G_PAT}/gettext-tiny-galeb/autopoint.patch
   2476 
   2477 		cat <<! >MKPK
   2478 mkpk_name()
   2479 {
   2480 	printf "%s" "${pkg}"
   2481 }
   2482 
   2483 mkpk_install()
   2484 {
   2485 	PREFIX=''
   2486 	DESTDIR=/build
   2487 	export PREFIX DESTDIR
   2488 
   2489 	cat <<@ >config.mak
   2490 CFLAGS=-Os -pipe -static --static -fcommon -fPIC
   2491 LDFLAGS=-static --static -fcommon -s
   2492 @
   2493 	/sucks/bin/sed -i 's,/usr/local,,g' Makefile
   2494 	make LIBINTL=MUSL ${JN} || exit 1
   2495 	make LIBINTL=MUSL DESTDIR="\${DESTDIR}" prefix="\${PREFIX}" install
   2496 
   2497 	mkdir -p /build/sucks/share/aclocal
   2498 	rm -fr /build/share/aclocal
   2499 	for f in /build/share/gettext-tiny/m4/*
   2500 	do
   2501 		ln -s ../../../share/gettext-tiny/m4/\${f##*/} \\
   2502 			/build/sucks/share/aclocal/\${f##*/}
   2503 	done
   2504 }
   2505 !
   2506 		mkpk ${pkg}
   2507 		remove_dir ${G_SRC}/${pkg}
   2508 		unpack_pkg ${pkg} /
   2509 	) || exit 1
   2510 fi
   2511 timestamp=$(date +'%Y-%m-%d %T')
   2512 printf "%s\t%s\t%s\n" gettext-tiny 0.3.2 "${timestamp}" >>${G_PKGDB}
   2513 end_substep
   2514 
   2515 begin_substep musl-legacy-compat-20230413
   2516 if [ -e /include/sys/cdefs.h ]; then
   2517 	msg info "%s exists, skipping %s" /include/sys/cdefs.h ${pkg}
   2518 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   2519 	unpack_pkg ${pkg} /
   2520 else
   2521 	check_dir ${G_SRC}/${pkg}
   2522 	cp_or_fail -r "${G_FIL}/musl-legacy-compat-void" ${G_SRC}/${pkg}/
   2523 	(
   2524 		cd_or_fail ${G_SRC}/${pkg}
   2525 
   2526 		cat <<! >MKPK
   2527 mkpk_name()
   2528 {
   2529 	printf "%s" "${pkg}"
   2530 }
   2531 
   2532 mkpk_install()
   2533 {
   2534 	for h in cdefs queue tree
   2535 	do
   2536 		install -Dm 644 musl-legacy-compat-void/\$h.h \
   2537 			/build/include/sys/\$h.h
   2538 	done
   2539 }
   2540 !
   2541 		mkpk ${pkg}
   2542 		remove_dir ${G_SRC}/${pkg}
   2543 		unpack_pkg ${pkg} /
   2544 	) || exit 1
   2545 fi
   2546 timestamp=$(date +'%Y-%m-%d %T')
   2547 printf "%s\t%s\t%s\n" musl-legacy-compat 20230413 "${timestamp}" >>${G_PKGDB}
   2548 end_substep
   2549 
   2550 begin_substep argp-standalone-1.4.1
   2551 if [ -e /lib/libargp.a ]; then
   2552 	msg info "%s exists, skipping %s" /lib/libargp.a ${pkg}
   2553 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   2554 	unpack_pkg ${pkg} /
   2555 else
   2556 	extract_pkg "${G_SRC}" "${pkg}" "${pkg}.tar.gz"
   2557 	(
   2558 		cd_or_fail ${G_SRC}/${pkg}
   2559 		apply_patch packages -Np1 -i \
   2560 			${G_PAT}/argp-standalone-adelie/gnu89-inline.patch
   2561 		apply_patch packages -Np1 -i \
   2562 			${G_PAT}/argp-standalone-mlfs/\
   2563 generate_configure_script.patch
   2564 		cat <<! >MKPK
   2565 mkpk_name()
   2566 {
   2567 	printf "%s" "${pkg}"
   2568 }
   2569 
   2570 mkpk_install()
   2571 {
   2572 	chmod +x configure
   2573 
   2574 	PREFIX=''
   2575 	export PREFIX
   2576 
   2577 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC' \\
   2578 	LDFLAGS='-static --static -fcommon -s' \\
   2579 	./configure --prefix="\${PREFIX}" \\
   2580 		    --sysconfdir=/etc \\
   2581 		    --localstatedir=/var
   2582 
   2583 	make ${JN} || exit 1
   2584 
   2585 	mkdir -p /build/lib
   2586 	mkdir -p /build/include
   2587 
   2588 	cp libargp.a /build/lib
   2589 	cp argp.h    /build/include
   2590 }
   2591 !
   2592 		mkpk ${pkg}
   2593 		remove_dir ${G_SRC}/${pkg}
   2594 		unpack_pkg ${pkg} /
   2595 	) || exit 1
   2596 fi
   2597 timestamp=$(date +'%Y-%m-%d %T')
   2598 printf "%s\t%s\t%s\n" argp-standalone 1.4.1 "${timestamp}" >>${G_PKGDB}
   2599 end_substep
   2600 
   2601 # libelf's autoconf script explicitly tests for __thread support
   2602 # by hardcoding -shared, thus: sucks.
   2603 begin_substep libelf-0.189
   2604 if [ -e /sucks/lib/libelf-0.189.so ]; then
   2605 	msg info "%s exists, skipping %s" /sucks/lib/libelf-0.189.so ${pkg}
   2606 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   2607 	unpack_pkg ${pkg} /
   2608 else
   2609 	extract_pkg ${G_SRC} elfutils-0.189 ${pkg}.tar.bz2 ${pkg}
   2610 	(
   2611 		cd_or_fail ${G_SRC}/${pkg}
   2612 		cp_or_fail ${G_FIL}/elfutils-void/error.h lib/
   2613 		cp_or_fail ${G_FIL}/elfutils-void/error.h src/
   2614 
   2615 		cat <<! >MKPK
   2616 mkpk_name()
   2617 {
   2618 	printf "%s" "${pkg}"
   2619 }
   2620 
   2621 mkpk_install()
   2622 {
   2623 	CFLAGS='-Os -pipe -fPIC'
   2624 	CFLAGS+=' -DFNM_EXTMATCH=0 -Wno-error -Wno-error=null-dereference'
   2625 	CFLAGS+=' -Wl,-z,stack-size=2097152'
   2626 	LDFLAGS='-s'
   2627 	PREFIX='/sucks'
   2628 	DESTDIR=/build
   2629 	export CFLAGS LDFLAGS DESTDIR
   2630 
   2631 	autoreconf -vif
   2632 
   2633 	./configure --prefix="\${PREFIX}" \\
   2634 		--disable-debuginfod \\
   2635 		--enable-libdebuginfod=dummy || exit 1
   2636 
   2637 	make ${JN} -C lib || exit 1
   2638 	make ${JN} -C libelf || exit 1
   2639 	make -C libelf DESTDIR=\${DESTDIR} install
   2640 
   2641 	mkdir -p /build/sucks/lib/pkgconfig
   2642 	install -vm644 config/libelf.pc /build/sucks/lib/pkgconfig/
   2643 }
   2644 !
   2645 		mkpk ${pkg}
   2646 		remove_dir ${G_SRC}/${pkg}
   2647 		unpack_pkg ${pkg} /
   2648 	) || exit 1
   2649 fi
   2650 timestamp=$(date +'%Y-%m-%d %T')
   2651 printf "%s\t%s\t%s\n" libelf 0.189 "${timestamp}" >>${G_PKGDB}
   2652 end_substep
   2653 
   2654 begin_substep libffi-3.4.4
   2655 if [ -e /lib/libffi.a ]; then
   2656 	msg info "%s exists, skipping %s" /lib/libffi.a ${pkg}
   2657 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   2658 	unpack_pkg ${pkg} /
   2659 else
   2660 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   2661 	(
   2662 		cd_or_fail ${G_SRC}/${pkg}
   2663 
   2664 		cat <<! >MKPK
   2665 mkpk_name()
   2666 {
   2667 	printf "%s" "${pkg}"
   2668 }
   2669 
   2670 mkpk_install()
   2671 {
   2672 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   2673 	LDFLAGS='-static --static -fcommon -s'
   2674 	PREFIX=''
   2675 	INCDIR=/include
   2676 	DESTDIR=/build
   2677 	export CFLAGS LDFLAGS PREFIX INCDIR DESTDIR
   2678 
   2679 	./configure --prefix="\${PREFIX}" \\
   2680 		--disable-shared \\
   2681 		--enable-static \\
   2682 		--includedir="\${INCDIR}" \\
   2683 		--disable-multi-os-directory \\
   2684 		--with-pic
   2685 
   2686 	make ${JN} || exit 1
   2687 	make install
   2688 }
   2689 !
   2690 		mkpk ${pkg}
   2691 		remove_dir ${G_SRC}/${pkg}
   2692 		unpack_pkg ${pkg} /
   2693 	) || exit 1
   2694 fi
   2695 timestamp=$(date +'%Y-%m-%d %T')
   2696 printf "%s\t%s\t%s\n" libffi 3.4.4 "${timestamp}" >>${G_PKGDB}
   2697 end_substep
   2698 
   2699 # Switched to OpenSSL because of (later potentially installed) fetchmail's legal
   2700 # requirements... -_-
   2701 begin_substep openssl-3.1.0
   2702 if [ -e /lib/libssl.a ]; then
   2703 	msg info "%s exists, skipping %s" /lib/libssl.a ${pkg}
   2704 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   2705 	unpack_pkg ${pkg} /
   2706 else
   2707 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   2708 	(
   2709 		cd_or_fail ${G_SRC}/${pkg}
   2710 
   2711 		cat <<! >MKPK
   2712 mkpk_name()
   2713 {
   2714 	printf "%s" "${pkg}"
   2715 }
   2716 
   2717 mkpk_install()
   2718 {
   2719 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   2720 	LDFLAGS='-static --static -fcommon -s'
   2721 	PREFIX=/	# deliberate (config requires absolute path)
   2722 	DESTDIR=/build
   2723 	export CFLAGS LDFLAGS PREFIX DESTDIR
   2724 	SED=/sucks/bin/sed
   2725 	
   2726 	./config --prefix="\${PREFIX}" \\
   2727 		--openssldir=/etc/ssl \\
   2728 		--libdir=/lib \\
   2729 		no-shared zlib
   2730 
   2731 	make ${JN} || exit 1
   2732 	\${SED} -i.bak 's/^\\(Requires: .*\\)/\\1 zlib/' openssl.pc
   2733 	make MANSUFFIX=ssl DESTDIR=\${DESTDIR} install
   2734 }
   2735 !
   2736 		mkpk ${pkg}
   2737 		#remove_dir ${G_SRC}/${pkg}
   2738 		unpack_pkg ${pkg} /
   2739 	) || exit 1
   2740 fi
   2741 timestamp=$(date +'%Y-%m-%d %T')
   2742 printf "%s\t%s\t%s\n" openssl 3.1.0 "${timestamp}" >>${G_PKGDB}
   2743 end_substep
   2744 
   2745 begin_substep libretls-3.7.0
   2746 if [ -e /lib/libtls.a ]; then
   2747 	msg info "%s exists, skipping %s" /lib/libtls.a ${pkg}
   2748 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   2749 	unpack_pkg ${pkg} /
   2750 else
   2751 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   2752 	(
   2753 		cd_or_fail ${G_SRC}/${pkg}
   2754 
   2755 		cat <<! >MKPK
   2756 mkpk_name()
   2757 {
   2758 	printf "%s" "${pkg}"
   2759 }
   2760 
   2761 mkpk_install()
   2762 {
   2763 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   2764 	LDFLAGS='-static --static -fcommon -s'
   2765 	PREFIX=''
   2766 	DESTDIR=/build
   2767 	export CFLAGS LDFLAGS PREFIX DESTDIR
   2768 	
   2769 	./configure --prefix="\${PREFIX}"
   2770 
   2771 	make ${JN} || exit 1
   2772 	make DESTDIR="\${DESTDIR}" install
   2773 }
   2774 !
   2775 		mkpk ${pkg}
   2776 		remove_dir ${G_SRC}/${pkg}
   2777 		unpack_pkg ${pkg} /
   2778 	) || exit 1
   2779 fi
   2780 timestamp=$(date +'%Y-%m-%d %T')
   2781 printf "%s\t%s\t%s\n" libretls 3.7.0 "${timestamp}" >>${G_PKGDB}
   2782 end_substep
   2783 
   2784 # # LibreSSL doesn't suck, even though technically IMHO it should belong in /sucks
   2785 # # since currently I don't see a clear way to produce both static and dynamic
   2786 # # libraries while keeping binaries static
   2787 # begin_substep libressl-3.4.2
   2788 # if [ -e /lib/libssl.a ]; then
   2789 # 	msg info "%s exists, skipping %s" /lib/libssl.a ${pkg}
   2790 # elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   2791 # 	unpack_pkg ${pkg} /
   2792 # else
   2793 # 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   2794 # 	(
   2795 # 		cd_or_fail ${G_SRC}/${pkg}
   2796 # 
   2797 # 		cat <<! >MKPK
   2798 # mkpk_name()
   2799 # {
   2800 # 	printf "%s" "${pkg}"
   2801 # }
   2802 # 
   2803 # mkpk_install()
   2804 # {
   2805 # 	CFLAGS='-Os -pipe'
   2806 # 	LDFLAGS=''
   2807 # 	DESTDIR=/build
   2808 # 	export CFLAGS LDFLAGS DESTDIR
   2809 # 
   2810 # 	autoreconf -vif
   2811 # 
   2812 # 	./configure --prefix=/ \\
   2813 # 		--sysconfdir=/etc \\
   2814 # 		--mandir=/share/man \\
   2815 # 		--localstatedir=/var
   2816 # 
   2817 # 	make ${JN} || exit 1
   2818 # 	make install-strip
   2819 # }
   2820 # !
   2821 # 		mkpk ${pkg}
   2822 # 		remove_dir ${G_SRC}/${pkg}
   2823 # 		unpack_pkg ${pkg} /
   2824 # 	) || exit 1
   2825 # fi
   2826 # timestamp=$(date +'%Y-%m-%d %T')
   2827 # printf "%s\t%s\t%s\n" libressl 3.4.2 "${timestamp}" >>${G_PKGDB}
   2828 # end_substep
   2829 
   2830 begin_substep ca-certificates-20230311
   2831 if [ -e /bin/update-ca-certificates ]; then
   2832 	msg info "%s exists, skipping %s" /bin/update-ca-certificates ${pkg}
   2833 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   2834 	unpack_pkg ${pkg} /
   2835 	mkdir -p /etc/ssl/certs
   2836 	update-ca-certificates
   2837 	chmod 0644 /share/ca-certificates/*.crt
   2838 else
   2839 	extract_pkg ${G_SRC} ${pkg%-*} ${pkg}.tar.xz ${pkg}
   2840 	(
   2841 		cd_or_fail ${G_SRC}/${pkg}
   2842 
   2843 		cp_or_fail ${G_FIL}/ca-certificates-bmlfs/certdata2pem.c \
   2844 			${G_SRC}/${pkg}
   2845 		cp_or_fail ${G_FIL}/ca-certificates-bmlfs/\
   2846 remove-expired-certs.sh ${G_SRC}/${pkg}/mozilla/
   2847 		chmod +x ${G_SRC}/${pkg}/mozilla/remove-expired-certs.sh
   2848 
   2849 		cat <<! >MKPK
   2850 mkpk_name()
   2851 {
   2852 	printf "%s" "${pkg}"
   2853 }
   2854 
   2855 mkpk_install()
   2856 {
   2857 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   2858 	LDFLAGS='-static --static -fcommon -s'
   2859 	DESTDIR=/build
   2860 	export CFLAGS LDFLAGS DESTDIR
   2861 	SED=/sucks/bin/sed
   2862 
   2863 	cc \${CFLAGS} -o mozilla/certdata2pem certdata2pem.c
   2864 
   2865 	\${SED} -i -e 's,python3 certdata2pem.py,./certdata2pem,g' \\
   2866 		mozilla/Makefile
   2867 	\${SED} -i -e 's,\(.*\)\(certdata2pem.*\),\1\2\n\1./'\
   2868 'remove-expired-certs.sh,' mozilla/Makefile
   2869 
   2870 	mkdir -p ../build
   2871 	ln -sf . ../build/usr
   2872 	mkdir -p ../build/bin
   2873 	ln -sf bin ../build/usr/sbin
   2874 	mkdir -p ../build/usr/share/ca-certificates/mozilla
   2875 	mkdir -p ../build/etc/ssl/certs
   2876 	mkdir -p ../build/share/man/man8
   2877 
   2878 	make ${JN} || exit 1
   2879 	make install
   2880 
   2881 
   2882 	/${TLD}/bin/install -Dm644 -v sbin/update-ca-certificates.8 \\
   2883 		../build/share/man/man8/update-ca-certificates.8
   2884 	/${TLD}/bin/mv -v ../build/share/ca-certificates/mozilla/* \\
   2885 		../build/share/ca-certificates/
   2886 	cd /build/share/ca-certificates
   2887 	/${TLD}/bin/find . -name '*.crt' | sort | cut -b3- > \\
   2888 		/build/etc/ca-certificates.conf
   2889 	\${SED} -i -e 's,--tmpdir,-p /tmp,g' \\
   2890 				/build/bin/update-ca-certificates
   2891 
   2892 	/${TLD}/bin/ln -sv /etc/ssl/certs/ca-certificates.crt \\
   2893 		/build/etc/ssl/certs.pem
   2894 
   2895 	chmod 0644 /build/share/ca-certificates/*.crt
   2896 }
   2897 !
   2898 		mkpk ${pkg}
   2899 		remove_dir ${G_SRC}/${pkg}
   2900 		unpack_pkg ${pkg} /
   2901 		mkdir -p /etc/ssl/certs
   2902 		update-ca-certificates
   2903 		chmod 0644 /share/ca-certificates/*.crt
   2904 	) || exit 1
   2905 fi
   2906 timestamp=$(date +'%Y-%m-%d %T')
   2907 printf "%s\t%s\t%s\n" ca-certificates 20230311 "${timestamp}" >>${G_PKGDB}
   2908 end_substep
   2909 
   2910 begin_substep Python-3.11.3
   2911 if [ -x /sucks/bin/python3 ]; then
   2912 	msg info "%s exists, skipping %s" /sucks/bin/python3 ${pkg}
   2913 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   2914 	unpack_pkg ${pkg} /
   2915 else
   2916 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   2917 	(
   2918 		cd_or_fail ${G_SRC}/${pkg}
   2919 
   2920 		apply_patch packages -Np0 -i \
   2921 			${G_PAT}/python3-void/musl-find_library.patch
   2922 		apply_patch packages -Np0 -i \
   2923 			${G_PAT}/python3-void/tweak-MULTIARCH-for-powerpc-\
   2924 linux-musl.patch
   2925 
   2926 		remove_dir Modules/expat
   2927 		remove_dir Modules/_ctypes/darwin
   2928 		remove_dir Modules/_ctypes/libffi
   2929 
   2930 		cat <<! >MKPK
   2931 mkpk_name()
   2932 {
   2933 	printf "%s" "${pkg}"
   2934 }
   2935 
   2936 mkpk_install()
   2937 {
   2938 	CFLAGS='-Os -pipe -fPIC'
   2939 	LDFLAGS='-s'
   2940 	PREFIX='/sucks'
   2941 	DESTDIR=/build
   2942 	export CFLAGS LDFLAGS PREFIX DESTDIR
   2943 
   2944 	ax_cv_c_float_words_bigendian=no \\
   2945 	./configure --prefix="\${PREFIX}" \\
   2946 		--disable-shared \\
   2947 		--with-system-expat \\
   2948 		--with-system-ffi \\
   2949 		--with-ensurepip=yes \\
   2950 		--enable-ipv6 \\
   2951 		--with-threads \\
   2952 		--enable-loadable-sqlite-extensions \\
   2953 		--with-computed-gotos \\
   2954 		--with-static-libpython
   2955 
   2956 	make ${JN} || exit 1
   2957 	make DESTDIR=\${DESTDIR} install
   2958 
   2959 	ln -s python3.11        /build/sucks/bin/python
   2960 	ln -s python3.11-config /build/sucks/bin/python-config
   2961 	ln -s idle3.11          /build/sucks/bin/idle
   2962 	ln -s pydoc3.11         /build/sucks/bin/pydoc
   2963 	ln -s python3.11.3      /build/sucks/share/man/man1/python.1
   2964 
   2965 	# Account for /usr/bin/python shebangs
   2966 	mkdir -p /build/bin
   2967 	ln -s /sucks/bin/python3.11 /build/bin/python
   2968 }
   2969 !
   2970 		mkpk ${pkg}
   2971 		remove_dir ${G_SRC}/${pkg}
   2972 		unpack_pkg ${pkg} /
   2973 	) || exit 1
   2974 fi
   2975 timestamp=$(date +'%Y-%m-%d %T')
   2976 printf "%s\t%s\t%s\n" Python 3.11.3 "${timestamp}" >>${G_PKGDB}
   2977 end_substep
   2978 
   2979 begin_substep samurai-1.2
   2980 if [ -e /bin/ninja ]; then
   2981 	msg info "%s exists, skipping %s" /bin/ninja ${pkg}
   2982 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   2983 	unpack_pkg ${pkg} /
   2984 else
   2985 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   2986 	(
   2987 		cd_or_fail ${G_SRC}/${pkg}
   2988 
   2989 		cat <<! >MKPK
   2990 mkpk_name()
   2991 {
   2992 	printf "%s" "${pkg}"
   2993 }
   2994 
   2995 mkpk_install()
   2996 {
   2997 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   2998 	LDFLAGS='-static --static -fcommon -s'
   2999 	PREFIX=''
   3000 	DESTDIR=/build
   3001 	export CFLAGS LDFLAGS PREFIX DESTDIR
   3002 
   3003 	make PREFIX="\${PREFIX}" ${JN} || exit 1
   3004 	make PREFIX="\${PREFIX}" install
   3005 
   3006 	/${TLD}/bin/ln -s samu /build/bin/ninja
   3007 	/${TLD}/bin/ln -s samu.1 /build/share/man/man1/ninja.1
   3008 }
   3009 !
   3010 		mkpk ${pkg}
   3011 		remove_dir ${G_SRC}/${pkg}
   3012 		unpack_pkg ${pkg} /
   3013 	) || exit 1
   3014 fi
   3015 timestamp=$(date +'%Y-%m-%d %T')
   3016 printf "%s\t%s\t%s\n" samurai 1.2 "${timestamp}" >>${G_PKGDB}
   3017 end_substep
   3018 
   3019 begin_substep meson-1.1.0
   3020 if [ -e /sucks/bin/meson ]; then
   3021 	msg info "%s exists, skipping %s" /sucks/bin/meson ${pkg}
   3022 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   3023 	unpack_pkg ${pkg} /
   3024 else
   3025 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   3026 	(
   3027 		cd_or_fail ${G_SRC}/${pkg}
   3028 
   3029 		cat <<! >MKPK
   3030 mkpk_name()
   3031 {
   3032 	printf "%s" "${pkg}"
   3033 }
   3034 
   3035 mkpk_install()
   3036 {
   3037 	CFLAGS='-Os -pipe -static --static -fcommon'
   3038 	LDFLAGS='-static --static -fcommon -s'
   3039 	DESTDIR=/build
   3040 	export CFLAGS LDFLAGS DESTDIR
   3041 
   3042 	python3 setup.py build
   3043 	python3 setup.py install --root="\${DESTDIR}"
   3044 }
   3045 !
   3046 		mkpk ${pkg}
   3047 		remove_dir ${G_SRC}/${pkg}
   3048 		unpack_pkg ${pkg} /
   3049 	) || exit 1
   3050 fi
   3051 timestamp=$(date +'%Y-%m-%d %T')
   3052 printf "%s\t%s\t%s\n" meson 1.1.0 "${timestamp}" >>${G_PKGDB}
   3053 end_substep
   3054 
   3055 # Needs meson
   3056 begin_substep zstd-1.5.5
   3057 if [ -x /bin/zstd ]; then
   3058 	msg info "%s exists, skipping %s" /bin/zstd ${pkg}
   3059 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   3060 	unpack_pkg ${pkg} /
   3061 else
   3062 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   3063 	(
   3064 		cd_or_fail ${G_SRC}/${pkg}
   3065 
   3066 		cat <<! >MKPK
   3067 mkpk_name()
   3068 {
   3069 	printf "%s" "${pkg}"
   3070 }
   3071 
   3072 mkpk_install()
   3073 {
   3074 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   3075 	LDFLAGS='-static --static -fcommon -s'
   3076 	CXXFLAGS=\${CFLAGS}
   3077 	PREFIX=/	# Deliberate for meson
   3078 	DESTDIR=/build
   3079 	LIBS=-lstdc++
   3080 	export CFLAGS LDFLAGS CXXFLAGS PREFIX DESTDIR LIBS
   3081 	SED=/sucks/bin/sed
   3082 
   3083 	(cd build/meson
   3084 	meson setup \\
   3085 		--prefix="\${PREFIX}" \\
   3086 		-Dbin_programs=true \\
   3087 		-Dbin_contrib=true \\
   3088 		-Ddefault_library=static \\
   3089 		-Dstatic_runtime=true \\
   3090 		b
   3091 
   3092 	cd b
   3093 	\${SED} -i 's,/lib/libz.so,/lib/libz.a,g' \\
   3094 		meson-info/intro-dependencies.json
   3095 	\${SED} -i 's,/lib/libz.so,/lib/libz.a,g' \\
   3096 		build.ninja
   3097 	ninja ${JN}
   3098 	ninja install)
   3099 }
   3100 !
   3101 		mkpk ${pkg}
   3102 		remove_dir ${G_SRC}/${pkg}
   3103 		unpack_pkg ${pkg} /
   3104 	) || exit 1
   3105 fi
   3106 timestamp=$(date +'%Y-%m-%d %T')
   3107 printf "%s\t%s\t%s\n" zstd 1.5.5 "${timestamp}" >>${G_PKGDB}
   3108 end_substep
   3109 
   3110 # Needs zstd
   3111 begin_substep kmod-30
   3112 if [ -e /bin/kmod ]; then
   3113 	msg info "%s exists, skipping %s" /bin/kmod ${pkg}
   3114 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   3115 	unpack_pkg ${pkg} /
   3116 else
   3117 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   3118 	(
   3119 		cd_or_fail ${G_SRC}/${pkg}
   3120 
   3121 		cat <<! >MKPK
   3122 mkpk_name()
   3123 {
   3124 	printf "%s" "${pkg}"
   3125 }
   3126 
   3127 mkpk_install()
   3128 {
   3129 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   3130 	LDFLAGS='-static --static -fcommon'
   3131 	PREFIX=''
   3132 	DESTDIR=/build
   3133 	export CFLAGS LDFLAGS PREFIX DESTDIR
   3134 
   3135 	./configure --prefix="\${PREFIX}" \\
   3136 		--sysconfdir=/etc \\
   3137 		--with-xz \\
   3138 		--with-zlib \\
   3139 		--with-zstd
   3140 
   3141 	make ${JN} || exit 1
   3142 	make install-strip
   3143 
   3144 	for p in depmod insmod lsmod modinfo modprobe rmmod
   3145 	do
   3146 	  ln -sf kmod /build/bin/\$p
   3147 	done
   3148 }
   3149 !
   3150 		mkpk ${pkg}
   3151 		remove_dir ${G_SRC}/${pkg}
   3152 		unpack_pkg ${pkg} /
   3153 	) || exit 1
   3154 fi
   3155 timestamp=$(date +'%Y-%m-%d %T')
   3156 printf "%s\t%s\t%s\n" kmod 30 "${timestamp}" >>${G_PKGDB}
   3157 end_substep
   3158 
   3159 begin_substep curl-8.0.1
   3160 if [ -e /bin/curl ]; then
   3161 	msg info "%s exists, skipping %s" /bin/curl ${pkg}
   3162 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   3163 	unpack_pkg ${pkg} /
   3164 else
   3165 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   3166 	(
   3167 		cd_or_fail ${G_SRC}/${pkg}
   3168 
   3169 		cat <<! >MKPK
   3170 mkpk_name()
   3171 {
   3172 	printf "%s" "${pkg}"
   3173 }
   3174 
   3175 mkpk_install()
   3176 {
   3177 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   3178 	CFLAGS+=' -D_FORTIFY_SOURCE=2 -I/include'
   3179 	CPPFLAGS='-D_FORTIFY_SOURCE=2'
   3180 	LDFLAGS='-static --static -fcommon'
   3181 	PREFIX=''
   3182 	DESTDIR=/build
   3183 	export CFLAGS LDFLAGS PREFIX DESTDIR
   3184 
   3185 
   3186 	autoreconf -vif || exit 1
   3187 
   3188 	ac_cv_sizeof_off_t=8 \\
   3189 	./configure --prefix="\${PREFIX}" \\
   3190 		--enable-threaded-resolver \\
   3191 		--with-ca-bundle=/etc/ssl/certs.pem \\
   3192 		--enable-ipv6 \\
   3193 		--enable-unix-sockets \\
   3194 		--with-pic \\
   3195 		--with-openssl \\
   3196 		--disable-shared \\
   3197 		--without-libssh2 || exit 1
   3198 
   3199 	make ${JN} || exit 1
   3200 	make install-strip
   3201 
   3202 	mkdir -p /build/sucks/share/aclocal
   3203 	mv /build/share/aclocal/* /build/sucks/share/aclocal/
   3204 	rmdir /build/share/aclocal || true
   3205 	rmdir /build/share || true
   3206 }
   3207 !
   3208 		mkpk ${pkg}
   3209 		remove_dir ${G_SRC}/${pkg}
   3210 		unpack_pkg ${pkg} /
   3211 	) || exit 1
   3212 fi
   3213 timestamp=$(date +'%Y-%m-%d %T')
   3214 printf "%s\t%s\t%s\n" curl 8.0.1 "${timestamp}" >>${G_PKGDB}
   3215 end_substep
   3216 
   3217 # Needed for PRoot
   3218 # Requires Python
   3219 begin_substep libxslt-1.1.37
   3220 if [ -e /lib/libxslt.a ]; then
   3221 	msg info "%s exists, skipping %s" /lib/libxslt.a ${pkg}
   3222 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   3223 	unpack_pkg ${pkg} /
   3224 else
   3225 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   3226 	(
   3227 		cd_or_fail ${G_SRC}/${pkg}
   3228 
   3229 		cat <<! >MKPK
   3230 mkpk_name()
   3231 {
   3232 	printf "%s" "${pkg}"
   3233 }
   3234 
   3235 mkpk_install()
   3236 {
   3237 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   3238 	LDFLAGS='-static --static -fcommon -s'
   3239 	PREFIX=/
   3240 	DESTDIR=/build
   3241 	export CFLAGS LDFLAGS PREFIX DESTDIR
   3242 	SED=/sucks/bin/sed
   3243 
   3244 	\${SED} -i s/3000/5000/ libxslt/transform.c doc/xsltproc.1 \\
   3245 		doc/xsltproc.xml
   3246 
   3247 	./configure --prefix="\${PREFIX}" --disable-shared || exit 1
   3248 
   3249 	make ${JN} DESTDIR=\${DESTDIR} install || exit 1
   3250 
   3251 	mkdir -p /build/sucks/share/aclocal
   3252 	mv /build/share/aclocal/* /build/sucks/share/aclocal/
   3253 	rmdir /build/share/aclocal || true
   3254 	rmdir /build/share || true
   3255 }
   3256 !
   3257 		mkpk ${pkg}
   3258 		remove_dir ${G_SRC}/${pkg}
   3259 		unpack_pkg ${pkg} /
   3260 	) || exit 1
   3261 fi
   3262 timestamp=$(date +'%Y-%m-%d %T')
   3263 printf "%s\t%s\t%s\n" libxslt 1.1.37 "${timestamp}" >>${G_PKGDB}
   3264 end_substep
   3265 
   3266 begin_substep procps-ng-4.0.3
   3267 if [ -e /bin/top ]; then
   3268 	msg info "%s exists, skipping %s" /bin/top ${pkg}
   3269 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   3270 	unpack_pkg ${pkg} /
   3271 else
   3272 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   3273 	(
   3274 		cd_or_fail ${G_SRC}/${pkg}
   3275 
   3276 		cat <<! >MKPK
   3277 mkpk_name()
   3278 {
   3279 	printf "%s" "${pkg}"
   3280 }
   3281 
   3282 mkpk_install()
   3283 {
   3284 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   3285 	# Fix utmp
   3286 	CFLAGS+=' -DUT_NAMESIZE=0   -DUT_LINESIZE=0   -DUT_HOSTSIZE=0'
   3287 	CFLAGS+=' -D__UT_NAMESIZE=0 -D__UT_LINESIZE=0 -D__UT_HOSTSIZE=0'
   3288 	LDFLAGS='-static --static -fcommon -fPIC -s'
   3289 	PREFIX=''
   3290 	DESTDIR=/build
   3291 	export CFLAGS LDFLAGS DESTDIR
   3292 	SED=/sucks/bin/sed
   3293 
   3294 	\${SED} -i '1i#include <langinfo.h>' proc/escape.c
   3295 
   3296 	ac_cv_func_malloc_0_nonnull=yes  \
   3297 	ac_cv_func_realloc_0_nonnull=yes \
   3298 	./configure --prefix="\${PREFIX}" \\
   3299 		--exec-prefix='' \\
   3300 		--libdir=/lib \\
   3301 		--docdir=/share/doc/${pkg} \\
   3302 		--disable-kill \\
   3303 		--without-systemd \\
   3304 		--disable-modern-top
   3305 
   3306 	make ${JN} || exit 1
   3307 	make DESTDIR=\${DESTDIR} install
   3308 
   3309 	# Overlap with ubase
   3310 	for duplicate in free pidof ps pwdx sysctl uptime watch
   3311 	do
   3312 		rm -f /build/bin/\${duplicate}
   3313 		rm -f /build/share/man/man1/\${duplicate}.1
   3314 	done
   3315 }
   3316 !
   3317 		mkpk ${pkg}
   3318 		remove_dir ${G_SRC}/${pkg}
   3319 		unpack_pkg ${pkg} /
   3320 	) || exit 1
   3321 fi
   3322 timestamp=$(date +'%Y-%m-%d %T')
   3323 printf "%s\t%s\t%s\n" procps-ng 4.0.3 "${timestamp}" >>${G_PKGDB}
   3324 end_substep
   3325 
   3326 begin_substep awk-20230412
   3327 if [ -e /bin/awk ]; then
   3328 	msg info "%s exists, skipping %s" /bin/awk ${pkg}
   3329 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   3330 	unpack_pkg ${pkg} /
   3331 else
   3332 	(
   3333 		cd_or_fail ${G_SRC}/${pkg}
   3334 
   3335 		cat <<! >MKPK
   3336 mkpk_name()
   3337 {
   3338 	printf "%s" "${pkg}"
   3339 }
   3340 
   3341 mkpk_install()
   3342 {
   3343 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   3344 	LDFLAGS='-static --static -fcommon -s'
   3345 	DESTDIR=/build
   3346 	export CFLAGS LDFLAGS DESTDIR
   3347 	SED=/sucks/bin/sed
   3348 
   3349 	\${SED} -i -e 's/^HOSTCC =.*/HOSTCC = gcc -Wall/' \\
   3350 	       -e 's/^CFLAGS =/#&/' \\
   3351 	       -e "s/^#CFLAGS =\\$/CFLAGS = \${CFLAGS}&/" \\
   3352 	       -e 's/^#\( YACC = yacc.*\)/\1/' \\
   3353 	       -e 's/^\(YACC = bison.*\)/# \1/' \\
   3354 	       makefile
   3355 
   3356 	make clean
   3357 	make ${JN} || exit 1
   3358 
   3359 	install -dm 755 /build/bin
   3360 	install -dm 755 /build/share/man/man1
   3361 	install -m 755 a.out /build/bin/awk
   3362 	install -m 644 awk.1 /build/share/man/man1/
   3363 }
   3364 !
   3365 		mkpk ${pkg}
   3366 		unpack_pkg ${pkg} /
   3367 	) || exit 1
   3368 fi
   3369 timestamp=$(date +'%Y-%m-%d %T')
   3370 printf "%s\t%s\t%s\n" awk 20230412 "${timestamp}" >>${G_PKGDB}
   3371 end_substep
   3372 
   3373 begin_substep check-0.15.2
   3374 if [ -e /bin/checkmk ]; then
   3375 	msg info "%s exists, skipping %s" /bin/checkmk ${pkg}
   3376 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   3377 	unpack_pkg ${pkg} /
   3378 else
   3379 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   3380 	(
   3381 		cd_or_fail ${G_SRC}/${pkg}
   3382 
   3383 		cat <<! >MKPK
   3384 mkpk_name()
   3385 {
   3386 	printf "%s" "${pkg}"
   3387 }
   3388 
   3389 mkpk_install()
   3390 {
   3391 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   3392 	LDFLAGS='-static --static -fcommon'
   3393 	PREFIX=''
   3394 	DESTDIR=/build
   3395 	export CFLAGS LDFLAGS PREFIX DESTDIR
   3396 	SED=/sucks/bin/sed
   3397 
   3398 	./configure --prefix="\${PREFIX}" --disable-shared
   3399 
   3400 	make ${JN} || exit 1
   3401 	make install-strip
   3402 
   3403 	\${SED} -i '1s,/tools,,' /build/bin/checkmk
   3404 
   3405 	mkdir -p /build/sucks/share/aclocal
   3406 	mv /build/share/aclocal/* /build/sucks/share/aclocal/
   3407 	rmdir /build/share/aclocal || true
   3408 	rmdir /build/share || true
   3409 }
   3410 !
   3411 		mkpk ${pkg}
   3412 		remove_dir ${G_SRC}/${pkg}
   3413 		unpack_pkg ${pkg} /
   3414 	) || exit 1
   3415 fi
   3416 timestamp=$(date +'%Y-%m-%d %T')
   3417 printf "%s\t%s\t%s\n" check 0.15.2 "${timestamp}" >>${G_PKGDB}
   3418 end_substep
   3419 
   3420 begin_substep diffutils-3.9
   3421 if [ -e /bin/diff ]; then
   3422 	msg info "%s exists, skipping %s" /bin/diff ${pkg}
   3423 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   3424 	unpack_pkg ${pkg} /
   3425 else
   3426 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   3427 	(
   3428 		cd_or_fail ${G_SRC}/${pkg}
   3429 
   3430 		cat <<! >MKPK
   3431 mkpk_name()
   3432 {
   3433 	printf "%s" "${pkg}"
   3434 }
   3435 
   3436 mkpk_install()
   3437 {
   3438 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   3439 	LDFLAGS='-static --static -fcommon -s'
   3440 	PREFIX=''
   3441 	DESTDIR=/build
   3442 	export CFLAGS LDFLAGS PREFIX DESTDIR
   3443 
   3444 	./configure --prefix="\${PREFIX}"
   3445 
   3446 	make ${JN} || exit 1
   3447 	make DESTDIR="\${DESTDIR}" install
   3448 }
   3449 !
   3450 		mkpk ${pkg}
   3451 		remove_dir ${G_SRC}/${pkg}
   3452 		unpack_pkg ${pkg} /
   3453 	) || exit 1
   3454 fi
   3455 timestamp=$(date +'%Y-%m-%d %T')
   3456 printf "%s\t%s\t%s\n" diffutils 3.9 "${timestamp}" >>${G_PKGDB}
   3457 end_substep
   3458 
   3459 begin_substep libuv-1.44.2
   3460 if [ -e /lib/libuv.a ]; then
   3461 	msg info "%s exists, skipping %s" /lib/libuv.a ${pkg}
   3462 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   3463 	unpack_pkg ${pkg} /
   3464 else
   3465 	extract_pkg ${G_SRC} libuv-v1.44.2 ${pkg}.tar.gz ${pkg}
   3466 	(
   3467 		cd_or_fail ${G_SRC}/${pkg}
   3468 
   3469 		cat <<! >MKPK
   3470 mkpk_name()
   3471 {
   3472 	printf "%s" "${pkg}"
   3473 }
   3474 
   3475 mkpk_install()
   3476 {
   3477 
   3478 	CFLAGS='-pipe '
   3479 	CFLAGS+='-Os -ffat-lto-objects -flto=4 '
   3480 	LDFLAGS='-flto=4 -Wl,-O2 -Wl,--as-needed -pthread '
   3481 	PREFIX=''
   3482 	DESTDIR=/build
   3483 	export CFLAGS LDFLAGS PREFIX DESTDIR
   3484 
   3485 	NOCONFIGURE=1 ./autogen.sh || exit 1
   3486 	./configure --prefix="\${PREFIX}" \\
   3487 		--disable-shared
   3488 
   3489 	make ${JN} || exit 1
   3490 	make install
   3491 }
   3492 !
   3493 		mkpk ${pkg}
   3494 		remove_dir ${G_SRC}/${pkg}
   3495 		unpack_pkg ${pkg} /
   3496 	) || exit 1
   3497 fi
   3498 timestamp=$(date +'%Y-%m-%d %T')
   3499 printf "%s\t%s\t%s\n" libuv 1.44.2 "${timestamp}" >>${G_PKGDB}
   3500 end_substep
   3501 
   3502 # - Can't be (easily) statically compiled
   3503 # When using "Unix Makefiles" (ninja only makes the situation slightly better):
   3504 # - Recompiling takes _ages_, comparable to GCC!
   3505 # - SO. MUCH. SLOOOWW, UNNECESSARY, ABSTRACT, OOP, C++ CODE!
   3506 # - No, eye candy ANSI colors during compilation don't make up for it.
   3507 # - cmake is a huge mess; "sucks" is an understatement!
   3508 # - Did I already mention how much C++ sucks? Yes? Well, one can never emphasize
   3509 #   that too much!
   3510 # - Even with all the supposed "intelligence", build system still can't figure
   3511 #   out static library dependencies, and needs manual hacks
   3512 begin_substep cmake-3.26.3
   3513 if [ -e /sucks/bin/cmake ]; then
   3514 	msg info "%s exists, skipping %s" /sucks/bin/cmake ${pkg}
   3515 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   3516 	unpack_pkg ${pkg} /
   3517 else
   3518 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   3519 	(
   3520 		cd_or_fail ${G_SRC}/${pkg}
   3521 
   3522 		cat <<! >MKPK
   3523 mkpk_name()
   3524 {
   3525 	printf "%s" "${pkg}"
   3526 }
   3527 
   3528 mkpk_install()
   3529 {
   3530 # 	CFLAGS='-O3 -pipe -ffat-lto-objects -flto=auto '
   3531 # 	CXXFLAGS=\${CFLAGS}
   3532 # 	LDFLAGS='-flto=auto -Wl,-O3 -Wl,--as-needed -s '
   3533  	PREFIX=/sucks
   3534  	DESTDIR=/build
   3535 # 	export CFLAGS CXXFLAGS LDFLAGS DESTDIR
   3536 	LIBS='-lcurl -lssl -lcrypto'
   3537 	LDLIBS=\${LIBS}
   3538  	export PREFIX DESTDIR LIBS LDLIBS
   3539 	SED=/${TLD}/bin/sed
   3540 
   3541 	\${SED} -i.bak '/"lib64"/s,lib64,lib,' \\
   3542 		Modules/GNUInstallDirs.cmake
   3543 
   3544 	./bootstrap --prefix="\${PREFIX}" \\
   3545 		--datadir="share/${pkg}" \\
   3546 		--system-libs \\
   3547 		--mandir=share/man \\
   3548 		--system-curl \\
   3549 		--no-system-jsoncpp \\
   3550 		--no-system-librhash \\
   3551 		--no-system-nghttp2 \\
   3552 		--no-system-libarchive \\
   3553 		--generator=Ninja \\
   3554 		--parallel="${JN}" \\
   3555 		--docdir=/share/doc/${pkg}
   3556 
   3557 	# Need to explicitly hack in libcurl static library dependencies
   3558 	\${SED} -i.bak 's,\\(/lib/libcurl.a\\),\\1 /lib/libssl.a '\\
   3559 '/lib/libcrypto.a,g' build.ninja
   3560 
   3561 	ninja || exit 1
   3562 	DESTDIR="\${DESTDIR}" ninja install || exit 1
   3563 }
   3564 !
   3565 		mkpk ${pkg}
   3566 		remove_dir ${G_SRC}/${pkg}
   3567 		unpack_pkg ${pkg} /
   3568 	) || exit 1
   3569 fi
   3570 timestamp=$(date +'%Y-%m-%d %T')
   3571 printf "%s\t%s\t%s\n" cmake 3.26.3 "${timestamp}" >>${G_PKGDB}
   3572 end_substep
   3573 
   3574 # Needed for groff
   3575 begin_substep uchardet-0.0.8
   3576 if [ -e /bin/groff ]; then
   3577 	msg info "%s exists, skipping %s" /sucks/bin/groff ${pkg}
   3578 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   3579 	unpack_pkg ${pkg} /
   3580 else
   3581 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   3582 	(
   3583 		cd_or_fail ${G_SRC}/${pkg}
   3584 
   3585 		cat <<! >MKPK
   3586 mkpk_name()
   3587 {
   3588 	printf "%s" "${pkg}"
   3589 }
   3590 
   3591 mkpk_install()
   3592 {
   3593 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   3594 	CXXFLAGS=\${CFLAGS}
   3595 	LDFLAGS='-static --static -fcommon -fPIC -s'
   3596 	PREFIX=''
   3597 	DESTDIR=/build
   3598 	LIBDIR=lib
   3599 	export CFLAGS CXXFLAGS LDFLAGS PREFIX DESTDIR
   3600 
   3601 	cmake -DCMAKE_INSTALL_PREFIX="\${PREFIX}" -DCMAKE_BUILD_TYPE=Release \\
   3602 		-DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_LIBDIR="\${LIBDIR}" \\
   3603 		|| exit 1
   3604 
   3605 	make || exit 1
   3606 	make DESTDIR="\${DESTDIR}" install
   3607 
   3608 	mv /build/usr/* /build/
   3609 	rm -fr /build/usr
   3610 }
   3611 !
   3612 		mkpk ${pkg}
   3613 		remove_dir ${G_SRC}/${pkg}
   3614 		unpack_pkg ${pkg} /
   3615 	) || exit 1
   3616 fi
   3617 timestamp=$(date +'%Y-%m-%d %T')
   3618 printf "%s\t%s\t%s\n" uchardet 0.0.8 "${timestamp}" >>${G_PKGDB}
   3619 end_substep
   3620 
   3621 # Needed for groff to convert fonts to pfb
   3622 begin_substep ttf2pt1-3.4.4
   3623 if [ -e /bin/ttf2pt1 ]; then
   3624 	msg info "%s exists, skipping %s" /bin/ttf2pt1 ${pkg}
   3625 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   3626 	unpack_pkg ${pkg} /
   3627 else
   3628 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tgz
   3629 	(
   3630 		cd_or_fail ${G_SRC}/${pkg}
   3631 		cp ${G_PAT}/ttf2pt1-galeb/fix-makefile-malformed-utf-8.patch .
   3632 
   3633 		cat <<! >MKPK
   3634 mkpk_name()
   3635 {
   3636 	printf "%s" "${pkg}"
   3637 }
   3638 
   3639 mkpk_install()
   3640 {
   3641 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   3642 	LDFLAGS='-static --static -fcommon -fPIC -s'
   3643 	DESTDIR=/build
   3644 	MANDIR='\$(INSTDIR)/share/man'
   3645 	export CFLAGS LDFLAGS DESTDIR
   3646 	SED=/sucks/bin/sed
   3647 
   3648 	\${SED} -i 's,^\\(CFLAGS_SYS= \\).*,\\1'"\${CFLAGS}"',;'\
   3649 's,^\\(INSTDIR = \\).*,\\1'"\${DESTDIR}"',;'\
   3650 's,^\\(MANDIR = \\).*,\\1'"\${MANDIR}"',;'\
   3651 's,^\\(\\s\\)\\+sed ,\\1'"\${SED}"' ,g' Makefile
   3652 	patch -Np1 -i fix-makefile-malformed-utf-8.patch
   3653 	make all || exit 1
   3654 	make install
   3655 }
   3656 !
   3657 		mkpk ${pkg}
   3658 		remove_dir ${G_SRC}/${pkg}
   3659 		unpack_pkg ${pkg} /
   3660 	) || exit 1
   3661 fi
   3662 timestamp=$(date +'%Y-%m-%d %T')
   3663 printf "%s\t%s\t%s\n" ttf2pt1 3.4.4 "${timestamp}" >>${G_PKGDB}
   3664 end_substep
   3665 
   3666 # # Required for groff (TODO)
   3667 # begin_substep ghostscript
   3668 # end_substep
   3669 
   3670 begin_substep groff-1.22.4
   3671 if [ -e /bin/groff ]; then
   3672 	msg info "%s exists, skipping %s" /sucks/bin/groff ${pkg}
   3673 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   3674 	unpack_pkg ${pkg} /
   3675 else
   3676 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   3677 	extract_pkg ${G_SRC} urw-base35-fonts-20200910 urw-base35-20200910.tar.gz
   3678 	(
   3679 		cd_or_fail ${G_SRC}/${pkg}
   3680 
   3681 		cat <<! >MKPK
   3682 mkpk_name()
   3683 {
   3684 	printf "%s" "${pkg}"
   3685 }
   3686 
   3687 mkpk_install()
   3688 {
   3689 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   3690 	CXXFLAGS=\${CFLAGS}
   3691 	LDFLAGS='-static --static -fcommon -fPIC -s'
   3692 	PREFIX=''
   3693 	DESTDIR=/build
   3694 	export CFLAGS CXXFLAGS LDFLAGS PREFIX DESTDIR
   3695 
   3696 	mkdir -p /build/share/fonts/type1/gsfonts
   3697 	cp -r ../urw-base35-fonts-20200910/fonts/* \\
   3698 		/build/share/fonts/type1/gsfonts || exit 1
   3699 	for f in /build/share/fonts/type1/gsfonts/*.ttf
   3700 	do
   3701 		ttf2pt1 -b \$f
   3702 	done
   3703 	mkdir -p /build/share/legal/${PKG}/urw-base35-fonts
   3704 	cp ../urw-base35-fonts-20200910/LICENSE \\
   3705 		../urw-base35-fonts-20200910/COPYING \\
   3706 		/build/share/legal/${PKG}/urw-base35-fonts/ || exit 1
   3707 	mkdir -p /build/etc/fonts/conf.avail
   3708 	cp -r ../urw-base35-fonts-20200910/fontconfig/* \\
   3709 		/build/etc/fonts/conf.avail/ || exit 1
   3710 	rm /build/etc/fonts/conf.avail/README.md
   3711 
   3712 	# TODO: Add ghostscript, because the URW fonts aren't properly
   3713 	#       recognized without it
   3714 	
   3715 	PAGE=A4 \\
   3716 	./configure --prefix="\${PREFIX}" \\
   3717 		--with-urw-fonts-dir=/build/share/fonts/type1/gsfonts || exit 1
   3718 
   3719 	make || exit 1
   3720 	make install
   3721 }
   3722 !
   3723 		mkpk ${pkg}
   3724 		remove_dir ${G_SRC}/${pkg}
   3725 		remove_dir ${G_SRC}/urw-base35-fonts-20200910
   3726 		unpack_pkg ${pkg} /
   3727 	) || exit 1
   3728 fi
   3729 timestamp=$(date +'%Y-%m-%d %T')
   3730 printf "%s\t%s\t%s\n" groff 1.22.4 "${timestamp}" >>${G_PKGDB}
   3731 end_substep
   3732 
   3733 begin_substep musl-locales-20230413
   3734 if [ -x /bin/locale ]; then
   3735 	msg info "%s exists, skipping %s" /bin/locale ${pkg}
   3736 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   3737 	unpack_pkg ${pkg} /
   3738 else
   3739 	(
   3740 		cd_or_fail ${G_SRC}/${pkg}
   3741 
   3742 		cat <<! >MKPK
   3743 mkpk_name()
   3744 {
   3745 	printf "%s" "${pkg}"
   3746 }
   3747 
   3748 mkpk_install()
   3749 {
   3750 	CFLAGS='-Os -pipe -static --static -fcommon'
   3751 	LDFLAGS='-static --static -fcommon'
   3752 	PREFIX=''
   3753 	DESTDIR=/build
   3754 	export CFLAGS LDFLAGS PREFIX DESTDIR
   3755 
   3756 	mkdir /cmake-build
   3757 	cd /cmake-build
   3758 	cmake -DCMAKE_INSTALL_PREFIX="\${PREFIX}" \\
   3759 	      -DCMAKE_BUILD_TYPE=Release \\
   3760 	      ../${pkg} || exit 1
   3761 	make -C /cmake-build ${JN} || exit 1
   3762 
   3763 	sed -i -e 's,/usr/local,,' \\
   3764 			   -e 's,/usr,,' \\
   3765 			   -e 's,//,,g' 00locale.sh
   3766 
   3767 	make -C /cmake-build DESTDIR="\${DESTDIR}" install
   3768 
   3769 	rm -fr /cmake-build
   3770 }
   3771 !
   3772 		mkpk ${pkg}
   3773 		#remove_dir ${G_SRC}/${pkg}
   3774 		unpack_pkg ${pkg} /
   3775 	) || exit 1
   3776 fi
   3777 timestamp=$(date +'%Y-%m-%d %T')
   3778 printf "%s\t%s\t%s\n" musl-locales 20230413 "${timestamp}" >>${G_PKGDB}
   3779 end_substep
   3780 
   3781 # Depends on locale(1)
   3782 begin_substep man-pages-6.04
   3783 if [ -e /share/man/man2/fork.2 ]; then
   3784 	msg info "%s exists, skipping %s" /share/man/man2/fork.2 ${pkg}
   3785 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   3786 	unpack_pkg ${pkg} /
   3787 	timestamp=$(date +'%Y-%m-%d %T')
   3788 	printf "%s\t%s\t%s\n" texinfo 7.0.3 "${timestamp}" >>${G_PKGDB}
   3789 else
   3790 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   3791 	(
   3792 		cd_or_fail ${G_SRC}/${pkg}
   3793 		cat <<! >MKPK
   3794 mkpk_name()
   3795 {
   3796 	printf "%s" "${pkg}"
   3797 }
   3798 
   3799 mkpk_install()
   3800 {
   3801 	make DESTDIR=../build prefix= install
   3802 }
   3803 !
   3804 		mkpk ${pkg}
   3805 		remove_dir ${G_SRC}/${pkg}
   3806 		unpack_pkg ${pkg} /
   3807 	) || exit 1
   3808 fi
   3809 timestamp=$(date +'%Y-%m-%d %T')
   3810 printf "%s\t%s\t%s\n" man-pages 6.04 "${timestamp}" >>${G_PKGDB}
   3811 end_substep
   3812 
   3813 begin_substep mandoc-1.14.6
   3814 if [ -x /bin/mandoc ]; then
   3815 	msg info "%s exists, skipping %s" /bin/mandoc ${pkg}
   3816 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   3817 	unpack_pkg ${pkg} /
   3818 	msg warn "You need to  run  \`makewhatis [dir]\`  for  every direc-"
   3819 	msg warn "tory in MANPATH_*:                                     "
   3820 	msg warn "/share/man:/X11R6/man:/sucks/share/man:/plan9/share/man"
   3821 else
   3822 	#https://mandoc.bsd.lv/snapshots/mdocml-1.14.1.tar.gz		07db67f437ee894e7e4b18b305d53ca1
   3823 	#extract_pkg ${G_SRC} mdocml-1.14.1 mdocml-1.14.1.tar.gz
   3824 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   3825 	(
   3826 		cd_or_fail ${G_SRC}/${pkg}
   3827 
   3828 		# mandoc passes NULL to recvmsg, which it shouldn't
   3829 		apply_patch packages -Np0 -i \
   3830 			${G_PAT}/mandoc-galeb/test-recvmsg.patch
   3831 
   3832 		cat <<! >MKPK
   3833 mkpk_name()
   3834 {
   3835 	printf "%s" "${pkg}"
   3836 }
   3837 
   3838 mkpk_install()
   3839 {
   3840 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   3841 	LDFLAGS='-static --static -fcommon -s'
   3842 	DESTDIR=/build
   3843 	export CFLAGS LDFLAGS DESTDIR
   3844 
   3845 	cat <<@ >configure.local
   3846 MANPATH_DEFAULT=/share/man:/X11R6/man:/sucks/share/man:/plan9/share/man
   3847 MANPATH_BASE=/share/man:/X11R6/man:/sucks/share/man:/plan9/share/man
   3848 OSNAME='Galeb 2.2'
   3849 PREFIX=''
   3850 SBINDIR=/bin
   3851 MANDIR=/share/man
   3852 BINM_SOELIM=msoelim
   3853 MANM_ROFF=mandoc_roff
   3854 CFLAGS="\${CFLAGS}"
   3855 LDFLAGS="\${LDFLAGS}"
   3856 STATIC='-static --static -fcommon -s'
   3857 BUILD_CATMAN=1
   3858 @
   3859 	./configure || exit 1
   3860 
   3861 	make ${JN} || exit 1
   3862 	make install
   3863 }
   3864 !
   3865 		mkpk ${pkg}
   3866 		remove_dir ${G_SRC}/${pkg}
   3867 		unpack_pkg ${pkg} /
   3868 		msg warn "You need to  run  \`makewhatis [dir]\`  for  every direc-"
   3869 		msg warn "tory in MANPATH_*:                                     "
   3870 		msg warn "/share/man:/X11R6/man:/sucks/share/man:/plan9/share/man"
   3871 	) || exit 1
   3872 fi
   3873 timestamp=$(date +'%Y-%m-%d %T')
   3874 printf "%s\t%s\t%s\n" mandoc 1.14.6 "${timestamp}" >>${G_PKGDB}
   3875 end_substep
   3876 
   3877 begin_substep pigz-2.7
   3878 if [ -e /bin/gzip ]; then
   3879 	msg info "%s exists, skipping %s" /bin/gzip ${pkg}
   3880 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   3881 	unpack_pkg ${pkg} /
   3882 else
   3883 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   3884 	(
   3885 		cd_or_fail ${G_SRC}/${pkg}
   3886 
   3887 		cat <<! >MKPK
   3888 mkpk_name()
   3889 {
   3890 	printf "%s" "${pkg}"
   3891 }
   3892 
   3893 mkpk_install()
   3894 {
   3895 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   3896 	CXXFLAGS=\${CFLAGS}
   3897 	LDFLAGS='-static --static -fcommon -s'
   3898 	DESTDIR=/build
   3899 	export CFLAGS CXXFLAGS LDFLAGS DESTDIR
   3900 
   3901 	make CC=cc CFLAGS="\${CFLAGS}" LDFLAGS="\${LDFLAGS}" \\
   3902 		${JN} || exit 1
   3903 
   3904 	mkdir -p ../build/bin ../build/share/man/man1 ../build/share/doc/${pkg}
   3905 	cp pigz ../build/bin
   3906 	ln -s pigz ../build/bin/unpigz
   3907 	ln -s pigz ../build/bin/gzip
   3908 	ln -s pigz ../build/bin/gunzip
   3909 	cp pigz.1 ../build/share/man/man1
   3910 	ln -s pigz.1 ../build/share/man/man1/unpigz.1
   3911 	ln -s pigz.1 ../build/share/man/man1/gzip.1
   3912 	ln -s pigz.1 ../build/share/man/man1/gunzip.1
   3913 	cp pigz.pdf README ../build/share/doc/${pkg}
   3914 }
   3915 !
   3916 		mkpk ${pkg}
   3917 		remove_dir ${G_SRC}/${pkg}
   3918 		unpack_pkg ${pkg} /
   3919 	) || exit 1
   3920 fi
   3921 timestamp=$(date +'%Y-%m-%d %T')
   3922 printf "%s\t%s\t%s\n" pigz 2.7 "${timestamp}" >>${G_PKGDB}
   3923 end_substep
   3924 
   3925 begin_substep mksh-20230412
   3926 if [ -e /bin/mksh ] && [ ! -L /bin/mksh ]; then
   3927 	msg info "%s exists, skipping %s" /bin/mksh ${pkg}
   3928 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   3929 	unpack_pkg ${pkg} /
   3930 else
   3931 	(
   3932 		cd_or_fail ${G_SRC}/${pkg}
   3933 
   3934 		cat <<! >MKPK
   3935 mkpk_name()
   3936 {
   3937 	printf "%s" "${pkg}"
   3938 }
   3939 
   3940 mkpk_install()
   3941 {
   3942 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   3943 	LDSTATIC='-static --static -fcommon -s'
   3944 	TARGET_OS=Linux
   3945 	DESTDIR=/build
   3946 	export CFLAGS LDSTATIC TARGET_OS DESTDIR
   3947 	
   3948 	cp()    { /${TLD}/bin/cp \$*;    }
   3949 	mkdir() { /${TLD}/bin/mkdir \$*; }
   3950 	mv()    { /${TLD}/bin/mv \$*;    }
   3951 
   3952 	mkdir -v build-mksh
   3953 	cd build-mksh
   3954 	sh ../Build.sh || exit 1
   3955 
   3956 	mkdir -pv /build/bin
   3957 	mkdir -pv /build/share/doc/${pkg}/examples
   3958 	ln -s ${pkg} /build/share/doc/mksh
   3959 	mkdir -pv /build/share/man/man1
   3960 
   3961 	install -c -s -o root -g root -m 555 mksh /build/bin/mksh
   3962 	install -c    -o root -g root -m 444 ../dot.mkshrc \\
   3963 		/build/share/doc/mksh/examples/
   3964 	install -c    -o root -g root -m 444 FAQ.htm \\
   3965 		/build/share/doc/mksh/
   3966 	install -c    -o root -g root -m 444 ../lksh.1 ../mksh.1 \\
   3967 		/build/share/man/man1/
   3968 
   3969 	cd ..
   3970 	CPPFLAGS=-DMKSH_BINSHPOSIX
   3971 	export CPPFLAGS
   3972 	mkdir -v build-lksh
   3973 	cd build-lksh
   3974 	sh ../Build.sh -L || exit 1
   3975 
   3976 	install -c -s -o root -g root  -m 555 lksh /build/bin/lksh
   3977 	ln -sf lksh /build/bin/sh
   3978 }
   3979 !
   3980 		mkpk ${pkg}
   3981 		#remove_dir ${G_SRC}/${pkg}
   3982 		unpack_pkg ${pkg} /
   3983 	) || exit 1
   3984 fi
   3985 timestamp=$(date +'%Y-%m-%d %T')
   3986 printf "%s\t%s\t%s\n" mksh 20230412 "${timestamp}" >>${G_PKGDB}
   3987 end_substep
   3988 
   3989 begin_substep galeb-howtos-0.2
   3990 if [ -e /share/doc/howtos ]; then
   3991 	msg info "%s exists, skipping %s" /share/doc/howtos ${pkg}
   3992 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   3993 	unpack_pkg ${pkg} /
   3994 else
   3995 	remove_dir ${G_SRC}/${pkg}
   3996 	extract_pkg ${G_SRC} galeb-howtos-v0.2 ${pkg}.tar.gz ${pkg}
   3997 	(
   3998 		cd_or_fail ${G_SRC}/${pkg}
   3999 
   4000 		cat <<! >MKPK
   4001 mkpk_name()
   4002 {
   4003 	printf "%s" "${pkg}"
   4004 }
   4005 
   4006 mkpk_install()
   4007 {
   4008 	DESTDIR=/build
   4009 	export DESTDIR
   4010 
   4011 	mkdir -p \${DESTDIR}/share/legal/${pkg}
   4012 	cp LICENSE \${DESTDIR}/share/legal/${pkg}/
   4013 
   4014 	mkdir -p \${DESTDIR}/share/doc/${pkg}
   4015 	cp *.howto \${DESTDIR}/share/doc/${pkg}/
   4016 	ln -sf ${pkg} \${DESTDIR}/share/doc/howtos
   4017 }
   4018 !
   4019 		mkpk ${pkg}
   4020 		remove_dir ${G_SRC}/${pkg}
   4021 		unpack_pkg ${pkg} /
   4022 	) || exit 1
   4023 fi
   4024 timestamp=$(date +'%Y-%m-%d %T')
   4025 printf "%s\t%s\t%s\n" galeb-howtos 0.2 "${timestamp}" >>${G_PKGDB}
   4026 end_substep
   4027 
   4028 begin_substep sled-0.11.5
   4029 if [ -x /bin/sled ]; then
   4030 	msg info "%s exists, skipping %s" /bin/sled ${pkg}
   4031 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   4032 	unpack_pkg ${pkg} /
   4033 else
   4034 	remove_dir ${G_SRC}/${pkg}
   4035 	extract_pkg ${G_SRC} sled-v0.11.5 ${pkg}.tar.gz ${pkg}
   4036 	(
   4037 		cd_or_fail ${G_SRC}/${pkg}
   4038 
   4039 		cat <<! >MKPK
   4040 mkpk_name()
   4041 {
   4042 	printf "%s" "${pkg}"
   4043 }
   4044 
   4045 mkpk_install()
   4046 {
   4047 	SLED_CC='tcc -static -fcommon'
   4048 	FALLBACKVER=${pkg##*-}
   4049 	FALLBACKDATE="12 Apr 2023"
   4050 	PREFIX=/build
   4051 	export SLED_CC FALLBACKVER FALLBACKDATE PREFIX
   4052 	SED=/sucks/bin/sed
   4053 
   4054 	if [ ! -e do.orig ]; then
   4055 		cp do do.orig
   4056 		\${SED} -i -e "s,\\<xargs\\>,/${TLD}/bin/xargs,g" do
   4057 	fi
   4058 	./do clean install
   4059 }
   4060 !
   4061 		mkpk ${pkg}
   4062 		remove_dir ${G_SRC}/${pkg}
   4063 		unpack_pkg ${pkg} /
   4064 	) || exit 1
   4065 fi
   4066 timestamp=$(date +'%Y-%m-%d %T')
   4067 printf "%s\t%s\t%s\n" sled 0.11.5 "${timestamp}" >>${G_PKGDB}
   4068 end_substep
   4069 
   4070 begin_substep dcron-4.5
   4071 if [ -x /bin/crond ]; then
   4072 	msg info "%s exists, skipping %s" /bin/crond ${pkg}
   4073 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   4074 	unpack_pkg ${pkg} /
   4075 else
   4076 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   4077 	(
   4078 		cd_or_fail ${G_SRC}/${pkg}
   4079 
   4080 		apply_patch packages -Np0 -i \
   4081 			${G_PAT}/dcron-galeb/reopen_after_editfile.patch
   4082 
   4083 		cat <<! >MKPK
   4084 mkpk_name()
   4085 {
   4086 	printf "%s" "${pkg}"
   4087 }
   4088 
   4089 mkpk_install()
   4090 {
   4091 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   4092 	LDFLAGS='-static --static -fcommon -s'
   4093 	PREFIX=''
   4094 	DESTDIR=/build
   4095 	export CFLAGS LDFLAGS PREFIX DESTDIR
   4096 	
   4097 	mkdir -p \${DESTDIR}/etc/cron.d \\
   4098 		\${DESTDIR}/var/spool/cron/crontabs \\
   4099 		\${DESTDIR}/var/spool/cron/cronstamps
   4100 
   4101 	# Badly marked source for copyright (it's GPL*)
   4102 	sed 11q main.c > COPYING
   4103 
   4104 	make ${JN} CFLAGS="\${CFLAGS}" LDFLAGS="\${LDFLAGS}" \\
   4105 		DESTDIR=\${DESTDIR} PREFIX="\${PREFIX}" CRONTAB_GROUP=cron \\
   4106 		|| exit 1
   4107 	make CFLAGS="\${CFLAGS}" LDFLAGS="\${LDFLAGS}" DESTDIR=\${DESTDIR} \\
   4108 		PREFIX="\${PREFIX}" CRONTAB_GROUP=cron install || exit 1
   4109 
   4110 	chmod 4750 ../build/bin/crontab
   4111 	chmod 4700 ../build/sbin/crond	
   4112 }
   4113 !
   4114 		mkpk ${pkg}
   4115 		remove_dir ${G_SRC}/${pkg}
   4116 		unpack_pkg ${pkg} /
   4117 	) || exit 1
   4118 fi
   4119 timestamp=$(date +'%Y-%m-%d %T')
   4120 printf "%s\t%s\t%s\n" dcron 4.5 "${timestamp}" >>${G_PKGDB}
   4121 end_substep
   4122 
   4123 # Needed for PRoot
   4124 begin_substep docutils-0.19
   4125 if [ -e /sucks/bin/rst2man.py ]; then
   4126 	msg info "%s exists, skipping %s" /sucks/bin/rst2man.py ${pkg}
   4127 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   4128 	unpack_pkg ${pkg} /
   4129 else
   4130 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz "" touch
   4131 	(
   4132 		cd_or_fail ${G_SRC}/${pkg}
   4133 
   4134 		cat <<! >MKPK
   4135 mkpk_name()
   4136 {
   4137 	printf "%s" "${pkg}"
   4138 }
   4139 
   4140 mkpk_install()
   4141 {
   4142 	sleep 1
   4143 
   4144 	CFLAGS='-Os -pipe'
   4145 	LDFLAGS='-s'
   4146 	PREFIX=/sucks
   4147 	DESTDIR=/build
   4148 	export CFLAGS LDFLAGS PREFIX DESTDIR
   4149 	
   4150 	python3 setup.py build || exit 1
   4151 	python3 setup.py install --optimize=1 \\
   4152 		--prefix="\${PREFIX}" --root="\${DESTDIR}"
   4153 	for py in \$(find \${DESTDIR}\${PREFIX}/bin -name '*.py')
   4154 	do
   4155 		ln -s \${py##*/} \${py%%.py}
   4156 	done
   4157 }
   4158 !
   4159 		mkpk ${pkg}
   4160 		remove_dir ${G_SRC}/${pkg}
   4161 		unpack_pkg ${pkg} /
   4162 	) || exit 1
   4163 fi
   4164 timestamp=$(date +'%Y-%m-%d %T')
   4165 printf "%s\t%s\t%s\n" docutils 0.19 "${timestamp}" >>${G_PKGDB}
   4166 end_substep
   4167 
   4168 begin_substep dosfstools-4.2
   4169 if [ -e /bin/fsck.vfat ]; then
   4170 	msg info "%s exists, skipping %s" /bin/fsck.vfat ${pkg}
   4171 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   4172 	unpack_pkg ${pkg} /
   4173 else
   4174 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   4175 	(
   4176 		cd_or_fail ${G_SRC}/${pkg}
   4177 
   4178 		cat <<! >MKPK
   4179 mkpk_name()
   4180 {
   4181 	printf "%s" "${pkg}"
   4182 }
   4183 
   4184 mkpk_install()
   4185 {
   4186 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   4187 	LDFLAGS='-static --static -fcommon -s'
   4188 	PREFIX=''
   4189 	DESTDIR=/build
   4190 	export CFLAGS LDFLAGS PREFIX DESTDIR
   4191 	
   4192 	./configure --prefix="\${PREFIX}" \\
   4193 		--enable-compat-symlinks \\
   4194 		--mandir=/share/man \\
   4195 		--docdir=/share/doc/${pkg} || exit 1
   4196 
   4197 	make ${JN} || exit 1
   4198 	make install || exit 1
   4199 }
   4200 !
   4201 		mkpk ${pkg}
   4202 		remove_dir ${G_SRC}/${pkg}
   4203 		unpack_pkg ${pkg} /
   4204 	) || exit 1
   4205 fi
   4206 timestamp=$(date +'%Y-%m-%d %T')
   4207 printf "%s\t%s\t%s\n" dosfstools 4.2 "${timestamp}" >>${G_PKGDB}
   4208 end_substep
   4209 
   4210 begin_substep pcre-8.45
   4211 if [ -e /lib/libpcre.a ]; then
   4212 	msg info "%s exists, skipping %s" /lib/libpcre.a ${pkg}
   4213 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   4214 	unpack_pkg ${pkg} /
   4215 else
   4216 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.bz2
   4217 	(
   4218 		cd_or_fail ${G_SRC}/${pkg}
   4219 
   4220 		cat <<! >MKPK
   4221 mkpk_name()
   4222 {
   4223 	printf "%s" "${pkg}"
   4224 }
   4225 
   4226 mkpk_install()
   4227 {
   4228 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   4229 	LDFLAGS='-static --static -fcommon -s'
   4230 	PREFIX=''
   4231 	DESTDIR=/build
   4232 	export CFLAGS LDFLAGS PREFIX DESTDIR
   4233 
   4234 	./configure --prefix="\${PREFIX}" \\
   4235 		--docdir=/share/doc/${pkg} \\
   4236 		--enable-static \\
   4237 		--disable-shared \\
   4238 		--enable-unicode-properties \\
   4239 		--enable-pcre16 \\
   4240 		--enable-pcre32 \\
   4241 		--enable-pcregrep-libz \\
   4242 		--enable-pcregrep-libbz2 \\
   4243 		--enable-pcretest-libreadline \\
   4244 		--enable-jit
   4245 	
   4246 	make ${JN} || exit 1
   4247 	make install
   4248 }
   4249 !
   4250 		mkpk ${pkg}
   4251 		remove_dir ${G_SRC}/${pkg}
   4252 		unpack_pkg ${pkg} /
   4253 	) || exit 1
   4254 fi
   4255 timestamp=$(date +'%Y-%m-%d %T')
   4256 printf "%s\t%s\t%s\n" pcre 8.45 "${timestamp}" >>${G_PKGDB}
   4257 end_substep
   4258 
   4259 begin_substep pcre2-10.42
   4260 if [ -e /lib/libpcre2-32.a ]; then
   4261 	msg info "%s exists, skipping %s" /lib/libpcre2-32.a ${pkg}
   4262 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   4263 	unpack_pkg ${pkg} /
   4264 else
   4265 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.bz2
   4266 	(
   4267 		cd_or_fail ${G_SRC}/${pkg}
   4268 
   4269 		cat <<! >MKPK
   4270 mkpk_name()
   4271 {
   4272 	printf "%s" "${pkg}"
   4273 }
   4274 
   4275 mkpk_install()
   4276 {
   4277 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   4278 	LDFLAGS='-static --static -fcommon -s'
   4279 	PREFIX=''
   4280 	DESTDIR=/build
   4281 	export CFLAGS LDFLAGS PREFIX DESTDIR
   4282 
   4283 	./configure --prefix="\${PREFIX}" \\
   4284 		--docdir=/share/doc/${pkg} \\
   4285 		--enable-static \\
   4286 		--disable-shared \\
   4287 		--enable-unicode \\
   4288 		--enable-pcre2-16 \\
   4289 		--enable-pcre2-32 \\
   4290 		--enable-pcre2grep-libz \\
   4291 		--enable-pcre2grep-libbz2 \\
   4292 		--enable-pcre2test-libreadline \\
   4293 		--enable-jit
   4294 	
   4295 	make ${JN} || exit 1
   4296 	make install
   4297 }
   4298 !
   4299 		mkpk ${pkg}
   4300 		remove_dir ${G_SRC}/${pkg}
   4301 		unpack_pkg ${pkg} /
   4302 	) || exit 1
   4303 fi
   4304 timestamp=$(date +'%Y-%m-%d %T')
   4305 printf "%s\t%s\t%s\n" pcre2 10.42 "${timestamp}" >>${G_PKGDB}
   4306 end_substep
   4307 
   4308 begin_substep git-2.40.0
   4309 if [ -x /bin/git ]; then
   4310 	msg info "%s exists, skipping %s" /bin/git ${pkg}
   4311 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   4312 	unpack_pkg ${pkg} /
   4313 else
   4314 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   4315 	(
   4316 		cd_or_fail ${G_SRC}/${pkg}
   4317 
   4318 		cat <<! >MKPK
   4319 mkpk_name()
   4320 {
   4321 	printf "%s" "${pkg}"
   4322 }
   4323 
   4324 mkpk_install()
   4325 {
   4326 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   4327 	LDFLAGS='-static --static -fcommon -s'
   4328 	PREFIX=''
   4329 	DESTDIR=/build
   4330 	TAR=/${TLD}/bin/tar
   4331 	export CFLAGS LDFLAGS PREFIX DESTDIR TAR
   4332 	
   4333 	# Have to trick sucky configure into not believing we don't have curl
   4334 	# (which we *do* have) -_-
   4335 	ac_cv_lib_curl_curl_global_init=yes \\
   4336 	./configure --prefix="\${PREFIX}" \\
   4337 		--with-curl \\
   4338 		--with-expat \\
   4339 		--with-openssl \\
   4340 		--with-libpcre2 \\
   4341 		--with-gitconfig=/etc/gitconfig || exit 1
   4342 
   4343 	make ${JN} || exit 1
   4344 	make DESTDIR=\${DESTDIR} perllibdir=/sucks/lib/perl5/5.36/site_perl \\
   4345 		TAR=\${TAR} install
   4346 
   4347 	# Without this, complains about SSL certificate and refuses to clone
   4348 	# https:// URLs
   4349 	mkdir -p \${DESTDIR}\${PREFIX}/etc
   4350 	cat <<'@' >\${DESTDIR}\${PREFIX}/etc/gitconfig
   4351 [http]
   4352 	sslCAinfo = /etc/ssl/certs/ca-certificates.crt
   4353 @
   4354 }
   4355 !
   4356 		mkpk ${pkg}
   4357 		remove_dir ${G_SRC}/${pkg}
   4358 		unpack_pkg ${pkg} /
   4359 	) || exit 1
   4360 fi
   4361 timestamp=$(date +'%Y-%m-%d %T')
   4362 printf "%s\t%s\t%s\n" git 2.40.0 "${timestamp}" >>${G_PKGDB}
   4363 end_substep
   4364 
   4365 begin_substep iproute2-5.19.0
   4366 if [ -x /bin/ss ]; then
   4367 	msg info "%s exists, skipping %s" /bin/ss ${pkg}
   4368 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   4369 	unpack_pkg ${pkg} /
   4370 else
   4371 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   4372 	(
   4373 		cd_or_fail ${G_SRC}/${pkg}
   4374 
   4375 		apply_patch packages -Np0 -i \
   4376 			${G_PAT}/iproute2-galeb/0001-ipstats_c-define-MIN.patch
   4377 
   4378 		cat <<! >MKPK
   4379 mkpk_name()
   4380 {
   4381 	printf "%s" "${pkg}"
   4382 }
   4383 
   4384 mkpk_install()
   4385 {
   4386 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   4387 	LDFLAGS='-static --static -fcommon -s'
   4388 	PREFIX=''
   4389 	DESTDIR=\${PREFIX}/build
   4390 	DOCDIR=\${DESTDIR}/share/doc/${pkg}
   4391 	LIBDIR=/lib
   4392 	YACC=yacc
   4393 	export CFLAGS LDFLAGS PREFIX DESTDIR DOCDIR LIBDIR YACC
   4394 	SED=/sucks/bin/sed
   4395 	
   4396 	\${SED} -i -e '/ARPD/d' -e 's,^\\(PREFIX.*=\\).*,\\1'\${PREFIX}',g' \\
   4397 		Makefile || exit 1
   4398 	\${SED} -i 's,\$(DESTDIR)\$(LIBDIR)/tc,'\${DESTDIR}\${LIBDIR}'/tc,g' \\
   4399 		netem/Makefile || exit 1
   4400 	rm -f  man/man8/arpd.8
   4401 	\${SED} -i 's/.m_ipt.o//' tc/Makefile || exit 1
   4402 	\${SED} -i 's/^LDLIBS\\s*+=.*/& -lz/' Makefile || exit 1
   4403 
   4404 	make NETNS_RUN_DIR=/run/netns ${JN}
   4405 	make install
   4406 }
   4407 !
   4408 		mkpk ${pkg}
   4409 		remove_dir ${G_SRC}/${pkg}
   4410 		unpack_pkg ${pkg} /
   4411 	) || exit 1
   4412 fi
   4413 timestamp=$(date +'%Y-%m-%d %T')
   4414 printf "%s\t%s\t%s\n" iproute2 5.19.0 "${timestamp}" >>${G_PKGDB}
   4415 end_substep
   4416 
   4417 # Needed for PRoot
   4418 begin_substep libarchive-3.6.2
   4419 if [ -e /lib/libarchive.a ]; then
   4420 	msg info "%s exists, skipping %s" /lib/libarchive.a ${pkg}
   4421 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   4422 	unpack_pkg ${pkg} /
   4423 else
   4424 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   4425 	(
   4426 		cd_or_fail ${G_SRC}/${pkg}
   4427 
   4428 		cat <<! >MKPK
   4429 mkpk_name()
   4430 {
   4431 	printf "%s" "${pkg}"
   4432 }
   4433 
   4434 mkpk_install()
   4435 {
   4436 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   4437 	LDFLAGS='-static --static -fcommon -s'
   4438 	PREFIX=''
   4439 	DESTDIR=/build
   4440 	export CFLAGS LDFLAGS PREFIX DESTDIR
   4441 
   4442 	./configure --prefix="\${PREFIX}" \\
   4443 		--disable-bsdcat \\
   4444 		--disable-bsdcpio \\
   4445 		--disable-bsdtar || exit 1
   4446 
   4447 	make ${JN} || exit 1
   4448 	make install || exit 1
   4449 }
   4450 !
   4451 		mkpk ${pkg}
   4452 		remove_dir ${G_SRC}/${pkg}
   4453 		unpack_pkg ${pkg} /
   4454 	) || exit 1
   4455 fi
   4456 timestamp=$(date +'%Y-%m-%d %T')
   4457 printf "%s\t%s\t%s\n" libarchive 3.6.2 "${timestamp}" >>${G_PKGDB}
   4458 end_substep
   4459 
   4460 begin_substep kbd-2.5.1
   4461 if [ -x /bin/loadkeys ]; then
   4462 	msg info "%s exists, skipping %s" /bin/loadkeys ${pkg}
   4463 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   4464 	unpack_pkg ${pkg} /
   4465 else
   4466 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   4467 	(
   4468 		cd_or_fail ${G_SRC}/${pkg}
   4469 
   4470 		apply_patch packages -Np1 -i \
   4471 			${G_PAT}/kbd-lfs/kbd-2.3.0-backspace-1.patch
   4472 
   4473 		sed -i 's/\(RESIZECONS_PROGS=\)yes/\1no/g' \
   4474 			configure
   4475 		sed -i 's/resizecons.8 //' docs/man/man8/Makefile.in
   4476 
   4477 		mv data/keymaps/i386/qwertz/cz.map \
   4478 			data/keymaps/i386/qwertz/cz-qwertz.map
   4479 		mv data/keymaps/i386/olpc/es.map \
   4480 			data/keymaps/i386/olpc/es-olpc.map
   4481 		mv data/keymaps/i386/olpc/pt.map \
   4482 			data/keymaps/i386/olpc/pt-olpc.map
   4483 		mv data/keymaps/i386/fgGIod/trf.map \
   4484 			data/keymaps/i386/fgGIod/trf-fgGIod.map
   4485 		mv data/keymaps/i386/colemak/en-latin9.map \
   4486 			data/keymaps/i386/colemak/colemak.map
   4487 
   4488 		cd data/keymaps/i386
   4489 		cp qwerty/pt-latin9.map qwerty/pt.map
   4490 		cp qwerty/sv-latin1.map qwerty/se-latin1.map
   4491 
   4492 		mv azerty/fr.map azerty/fr-old.map
   4493 		cp azerty/fr-latin9.map azerty/fr.map
   4494 
   4495 		cp azerty/fr-latin9.map azerty/fr-latin0.map # legacy alias
   4496 		cd - >/dev/null 2>&1
   4497 
   4498 		cp -v ${G_FIL}/kbd-void/error.h .
   4499 
   4500 
   4501 		cat <<! >MKPK
   4502 mkpk_name()
   4503 {
   4504 	printf "%s" "${pkg}"
   4505 }
   4506 
   4507 mkpk_install()
   4508 {
   4509 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   4510 	LDFLAGS='-static --static -fcommon -s'
   4511 	DESTDIR=/build
   4512 	YACC=yacc
   4513 	export CFLAGS LDFLAGS DESTDIR YACC
   4514 	SED=/sucks/bin/sed
   4515 	
   4516 	autoreconf -fvi || exit 1
   4517 
   4518 	\${SED} -e '/^PKG_CHECK_MODULES.*/d' -i configure.ac
   4519 	\${SED} -e 's,tests ,,g' -i Makefile.am
   4520 
   4521 	./configure --prefix=/ --disable-vlock || exit 1
   4522 
   4523 	make ${JN} || exit 1
   4524 	make install
   4525 
   4526 	for f in sun amiga atari; do
   4527 		rm -rf /build/share/kbd/keymaps/$f
   4528 	done
   4529 
   4530 	find /build \\( -name libtswrap.a -o -name libtswrap.la \\
   4531 		-o -name 'libtswrap.so*' \\) -exec rm {} \\;
   4532 }
   4533 !
   4534 		mkpk ${pkg}
   4535 		remove_dir ${G_SRC}/${pkg}
   4536 		unpack_pkg ${pkg} /
   4537 	) || exit 1
   4538 fi
   4539 timestamp=$(date +'%Y-%m-%d %T')
   4540 printf "%s\t%s\t%s\n" kbd 2.5.1 "${timestamp}" >>${G_PKGDB}
   4541 end_substep
   4542 
   4543 begin_substep make-4.4
   4544 if [ -x /bin/make ]; then
   4545 	msg info "%s exists, skipping %s" /bin/make ${pkg}
   4546 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   4547 	unpack_pkg ${pkg} /
   4548 else
   4549 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   4550 	(
   4551 		cd_or_fail ${G_SRC}/${pkg}
   4552 
   4553 		cat <<! >MKPK
   4554 mkpk_name()
   4555 {
   4556 	printf "%s" "${pkg}"
   4557 }
   4558 
   4559 mkpk_install()
   4560 {
   4561 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   4562 	LDFLAGS='-static --static -fcommon -s'
   4563 	PREFIX=''
   4564 	DESTDIR=/build
   4565 	export CFLAGS LDFLAGS PREFIX DESTDIR
   4566 	
   4567 	./configure --prefix="\${PREFIX}"
   4568 
   4569 	make ${JN}
   4570 	make install
   4571 }
   4572 !
   4573 		mkpk ${pkg}
   4574 		remove_dir ${G_SRC}/${pkg}
   4575 		unpack_pkg ${pkg} /
   4576 	) || exit 1
   4577 fi
   4578 timestamp=$(date +'%Y-%m-%d %T')
   4579 printf "%s\t%s\t%s\n" make 4.4 "${timestamp}" >>${G_PKGDB}
   4580 end_substep
   4581 
   4582 begin_substep patch-2.7.6
   4583 if [ -x /bin/patch ]; then
   4584 	msg info "%s exists, skipping %s" /bin/patch ${pkg}
   4585 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   4586 	unpack_pkg ${pkg} /
   4587 else
   4588 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   4589 	(
   4590 		cd_or_fail ${G_SRC}/${pkg}
   4591 
   4592 		cat <<! >MKPK
   4593 mkpk_name()
   4594 {
   4595 	printf "%s" "${pkg}"
   4596 }
   4597 
   4598 mkpk_install()
   4599 {
   4600 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   4601 	LDFLAGS='-static --static -fcommon -s'
   4602 	PREFIX=''
   4603 	DESTDIR=/build
   4604 	export CFLAGS LDFLAGS PREFIX DESTDIR
   4605 	
   4606 	./configure --prefix="\${PREFIX}"
   4607 
   4608 	make ${JN}
   4609 	make install
   4610 }
   4611 !
   4612 		mkpk ${pkg}
   4613 		remove_dir ${G_SRC}/${pkg}
   4614 		unpack_pkg ${pkg} /
   4615 	) || exit 1
   4616 fi
   4617 timestamp=$(date +'%Y-%m-%d %T')
   4618 printf "%s\t%s\t%s\n" patch 2.7.6 "${timestamp}" >>${G_PKGDB}
   4619 end_substep
   4620 
   4621 begin_substep metalog-20220214
   4622 if [ -x /sbin/metalog ]; then
   4623 	msg info "%s exists, skipping %s" /sbin/metalog ${pkg}
   4624 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   4625 	unpack_pkg ${pkg} /
   4626 else
   4627 	extract_pkg ${G_SRC} metalog-${pkg} ${pkg}.tar.gz ${pkg}
   4628 	(
   4629 		cd_or_fail ${G_SRC}/${pkg}
   4630 
   4631 		cat <<! >MKPK
   4632 mkpk_name()
   4633 {
   4634 	printf "%s" "${pkg}"
   4635 }
   4636 
   4637 mkpk_install()
   4638 {
   4639 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   4640 	LDFLAGS='-static --static -fcommon'
   4641 	PREFIX=''
   4642 	DESTDIR=/build
   4643 	export CFLAGS LDFLAGS PREFIX DESTDIR
   4644 
   4645 	autoreconf -vif
   4646 
   4647 	./configure --prefix="\${PREFIX}" \\
   4648 		--sysconfdir=/etc || exit 1
   4649 
   4650 	make ${JN} || exit 1
   4651 	make install-strip
   4652 }
   4653 !
   4654 		mkpk ${pkg}
   4655 		remove_dir ${G_SRC}/${pkg}
   4656 		unpack_pkg ${pkg} /
   4657 	) || exit 1
   4658 fi
   4659 timestamp=$(date +'%Y-%m-%d %T')
   4660 printf "%s\t%s\t%s\n" metalog 20220214 "${timestamp}" >>${G_PKGDB}
   4661 end_substep
   4662 
   4663 begin_substep reflex-20230206
   4664 if [ -x /bin/reflex ]; then
   4665 	msg info "%s exists, skipping %s" /bin/reflex ${pkg}
   4666 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   4667 	unpack_pkg ${pkg} /
   4668 else
   4669 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tgz
   4670 	(
   4671 		cd_or_fail ${G_SRC}/${pkg}
   4672 
   4673 		cat <<! >MKPK
   4674 mkpk_name()
   4675 {
   4676 	printf "%s" "${pkg}"
   4677 }
   4678 
   4679 mkpk_install()
   4680 {
   4681 	CFLAGS='-Os -static --static -fcommon -fPIC'
   4682 	LDFLAGS='-static --static -fcommon -s'
   4683 	PREFIX=''
   4684 	DESTDIR=/build
   4685 	export CFLAGS LDFLAGS PREFIX DESTDIR
   4686 
   4687 	./configure --prefix="\${PREFIX}"
   4688 
   4689 	make ${JN}
   4690 	make install
   4691 	ln -s reflex /build/bin/flex
   4692 	ln -s reflex.1 /build/share/man/man1/flex.1
   4693 	ln -s reflex++.1 /build/share/man/man1/flex++.1
   4694 }
   4695 !
   4696 		mkpk ${pkg}
   4697 		remove_dir ${G_SRC}/${pkg}
   4698 		unpack_pkg ${pkg} /
   4699 	) || exit 1
   4700 fi
   4701 timestamp=$(date +'%Y-%m-%d %T')
   4702 printf "%s\t%s\t%s\n" reflex 20230206 "${timestamp}" >>${G_PKGDB}
   4703 end_substep
   4704 
   4705 begin_substep table-0.6.10
   4706 if [ -x /bin/table ]; then
   4707 	msg info "%s exists, skipping %s" /bin/table ${pkg}
   4708 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   4709 	unpack_pkg ${pkg} /
   4710 else
   4711 	remove_dir ${G_SRC}/${pkg}
   4712 	extract_pkg ${G_SRC} table-v0.6.10 ${pkg}.tar.gz ${pkg}
   4713 	(
   4714 		cd_or_fail ${G_SRC}/${pkg}
   4715 
   4716 		cat <<! >MKPK
   4717 mkpk_name()
   4718 {
   4719 	printf "%s" "${pkg}"
   4720 }
   4721 
   4722 mkpk_install()
   4723 {
   4724 	TABLE_CC='tcc -static -fcommon'
   4725 	FALLBACKVER=${pkg##*-}
   4726 	FALLBACKDATE="10 Apr 2023"
   4727 	PREFIX=/build
   4728 	export TABLE_CC FALLBACKVER FALLBACKDATE PREFIX
   4729 	SED=/sucks/bin/sed
   4730 
   4731 	if [ ! -e do.orig ]; then
   4732 		cp do do.orig
   4733 		\${SED} -i -e "s,\\<xargs\\>,/${TLD}/bin/xargs,g" do
   4734 	fi
   4735 	patch -Np1 -i tcc-unicode-string-literals.patch
   4736 	./do clean install
   4737 	mv "\${PREFIX}/share/doc/table" "\${PREFIX}/share/doc/${pkg}"
   4738 }
   4739 !
   4740 		mkpk ${pkg}
   4741 		remove_dir ${G_SRC}/${pkg}
   4742 		unpack_pkg ${pkg} /
   4743 	) || exit 1
   4744 fi
   4745 timestamp=$(date +'%Y-%m-%d %T')
   4746 printf "%s\t%s\t%s\n" table 0.6.10 "${timestamp}" >>${G_PKGDB}
   4747 end_substep
   4748 
   4749 # Needed for PRoot
   4750 begin_substep talloc-2.4.0
   4751 if [ -e /sucks/lib/libtalloc.a ]; then
   4752 	msg info "%s exists, skipping %s" /sucks/lib/libtalloc.a ${pkg}
   4753 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   4754 	unpack_pkg ${pkg} /
   4755 else
   4756 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   4757 	(
   4758 		cd_or_fail ${G_SRC}/${pkg}
   4759 
   4760 		cat <<! >MKPK
   4761 mkpk_name()
   4762 {
   4763 	printf "%s" "${pkg}"
   4764 }
   4765 
   4766 mkpk_install()
   4767 {
   4768 	CFLAGS='-Os -pipe -fPIC'
   4769 	LDFLAGS='-s'
   4770 	PREFIX=/sucks
   4771 	DESTDIR=/build
   4772 	export CFLAGS LDFLAGS PREFIX DESTDIR
   4773 	
   4774 	./configure --prefix="\${PREFIX}" \\
   4775 		--disable-rpath \\
   4776 		--disable-python || exit 1
   4777 	make install || exit 1
   4778 
   4779 	# Thanks:
   4780 	# https://github.com/green-green-avk/build-proot-android/blob/master/\
   4781 	# make-talloc-static.sh
   4782 	mkdir -p dummy-bin
   4783 	PATH="dummy-bin:\${PATH}"
   4784 	export PATH
   4785 
   4786 	CFLAGS='-Os -static --static -fcommon -pipe'
   4787 	LDFLAGS='-Wl,-Bstatic -static-libgcc -static --static -fcommon'
   4788 	export CFLAGS LDFLAGS
   4789 
   4790 	./configure --prefix=\${PREFIX} \\
   4791 		--disable-rpath \\
   4792 		--disable-python || exit 1
   4793 	ar rcs \${DESTDIR}\${PREFIX}/lib/libtalloc.a bin/default/talloc*.o
   4794 }
   4795 !
   4796 		mkpk ${pkg}
   4797 		remove_dir ${G_SRC}/${pkg}
   4798 		unpack_pkg ${pkg} /
   4799 	) || exit 1
   4800 fi
   4801 timestamp=$(date +'%Y-%m-%d %T')
   4802 printf "%s\t%s\t%s\n" talloc 2.4.0 "${timestamp}" >>${G_PKGDB}
   4803 end_substep
   4804 
   4805 begin_substep proot-5.3.1
   4806 if [ -x /bin/proot ]; then
   4807 	msg info "%s exists, skipping %s" /bin/proot ${pkg}
   4808 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   4809 	unpack_pkg ${pkg} /
   4810 else
   4811 	extract_pkg ${G_SRC} proot-v5.3.1 ${pkg}.tar.bz2 ${pkg}
   4812 	(
   4813 		cd_or_fail ${G_SRC}/${pkg}
   4814 
   4815 		# PRoot's makefile sucks
   4816 		apply_patch packages -Np0 -i \
   4817 			${G_PAT}/proot-galeb/proot-makefile.patch
   4818 
   4819 		cat <<! >MKPK
   4820 mkpk_name()
   4821 {
   4822 	printf "%s" "${pkg}"
   4823 }
   4824 
   4825 mkpk_install()
   4826 {
   4827 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   4828 	LDFLAGS='-static --static -fcommon -s'
   4829 	PREFIX=''
   4830 	DESTDIR=/build
   4831 	export CFLAGS LDFLAGS PREFIX DESTDIR
   4832 
   4833 	make -C src loader.elf loader-m32.elf build.h || exit 1
   4834 	make -C src proot || exit 1
   4835 	make -C doc || exit 1
   4836 
   4837 	install -Dm755 src/proot \${DESTDIR}\${PREFIX}/bin/proot
   4838 	install -Dm644 doc/proot/man.1 \\
   4839 		\${DESTDIR}\${PREFIX}/share/man/man1/proot.1
   4840 	install -Dm644 doc/proot/index.html \\
   4841 		\${DESTDIR}\${PREFIX}/share/doc/${pkg}/index.html
   4842 	install -dm755 \${DESTDIR}\${PREFIX}/share/doc/${pkg}/stylesheets
   4843 	install -m644  doc/proot/stylesheets/* \\
   4844 		\${DESTDIR}\${PREFIX}/share/doc/${pkg}/stylesheets/
   4845 }
   4846 !
   4847 		mkpk ${pkg}
   4848 		remove_dir ${G_SRC}/${pkg}
   4849 		unpack_pkg ${pkg} /
   4850 	) || exit 1
   4851 fi
   4852 timestamp=$(date +'%Y-%m-%d %T')
   4853 printf "%s\t%s\t%s\n" proot 5.3.1 "${timestamp}" >>${G_PKGDB}
   4854 end_substep
   4855 
   4856 begin_substep texinfo-7.0.3
   4857 if [ -x /bin/texi2dvi ]; then
   4858 	msg info "%s exists, skipping %s" /bin/texi2dvi ${pkg}
   4859 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   4860 	unpack_pkg ${pkg} /
   4861 else
   4862 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   4863 	(
   4864 		cd_or_fail ${G_SRC}/${pkg}
   4865 
   4866 		cat <<! >MKPK
   4867 mkpk_name()
   4868 {
   4869 	printf "%s" "${pkg}"
   4870 }
   4871 
   4872 mkpk_install()
   4873 {
   4874 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   4875 	LDFLAGS='-static --static -fcommon -s'
   4876 	PREFIX=''
   4877 	DESTDIR=/build
   4878 	export CFLAGS LDFLAGS PREFIX DESTDIR
   4879 	
   4880 	./configure --prefix="\${PREFIX}"
   4881 	make ${JN}
   4882 	make install
   4883 }
   4884 !
   4885 		mkpk ${pkg}
   4886 		remove_dir ${G_SRC}/${pkg}
   4887 		unpack_pkg ${pkg} /
   4888 	) || exit 1
   4889 fi
   4890 timestamp=$(date +'%Y-%m-%d %T')
   4891 printf "%s\t%s\t%s\n" texinfo 7.0.3 "${timestamp}" >>${G_PKGDB}
   4892 end_substep
   4893 
   4894 begin_substep strace-6.2
   4895 if [ -x /bin/strace ]; then
   4896 	msg info "%s exists, skipping %s" /bin/strace ${pkg}
   4897 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   4898 	unpack_pkg ${pkg} /
   4899 else
   4900 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   4901 	(
   4902 		cd_or_fail ${G_SRC}/${pkg}
   4903 
   4904 		cat <<! >MKPK
   4905 mkpk_name()
   4906 {
   4907 	printf "%s" "${pkg}"
   4908 }
   4909 
   4910 mkpk_install()
   4911 {
   4912 	CFLAGS='-Os -static --static -fcommon -fPIC'
   4913 	LDFLAGS='-static --static -fcommon'
   4914 	PREFIX=''
   4915 	DESTDIR=/build
   4916 	export CFLAGS LDFLAGS PREFIX DESTDIR
   4917 	
   4918 	./configure --prefix="\${PREFIX}" \\
   4919 		--enable-mpers=no
   4920 
   4921 	make ${JN}
   4922 	make install-strip
   4923 }
   4924 !
   4925 		mkpk ${pkg}
   4926 		remove_dir ${G_SRC}/${pkg}
   4927 		unpack_pkg ${pkg} /
   4928 	) || exit 1
   4929 fi
   4930 timestamp=$(date +'%Y-%m-%d %T')
   4931 printf "%s\t%s\t%s\n" strace 6.2 "${timestamp}" >>${G_PKGDB}
   4932 end_substep
   4933 
   4934 begin_substep usleep-20230414
   4935 if [ -x /bin/usleep ]; then
   4936 	msg info "%s exists, skipping %s" /bin/usleep ${pkg}
   4937 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   4938 	unpack_pkg ${pkg} /
   4939 else
   4940 	(
   4941 		cd_or_fail ${G_SRC}/${pkg}
   4942 
   4943 		cat <<! >MKPK
   4944 mkpk_name()
   4945 {
   4946 	printf "%s" "${pkg}"
   4947 }
   4948 
   4949 mkpk_install()
   4950 {
   4951 	CFLAGS='-Os -static --static -fcommon -fPIC'
   4952 	LDFLAGS='-static --static -fcommon -s'
   4953 	PREFIX=/build/bin	# Deliberate; usleep's makefile is not using
   4954 				# the usual DESTDIR/PREFIX
   4955 	export CFLAGS LDFLAGS PREFIX
   4956 	
   4957 	make ${JN} CFLAGS="\${CFLAGS}" LDFLAGS="\${LDFLAGS}" || exit 1
   4958 	make PREFIX="\${PREFIX}" install
   4959 }
   4960 !
   4961 		mkpk ${pkg}
   4962 		#remove_dir ${G_SRC}/${pkg}
   4963 		unpack_pkg ${pkg} /
   4964 	) || exit 1
   4965 fi
   4966 timestamp=$(date +'%Y-%m-%d %T')
   4967 printf "%s\t%s\t%s\n" usleep 20230414 "${timestamp}" >>${G_PKGDB}
   4968 end_substep
   4969 
   4970 # Unfortunately, gives "Out of memory - too many lines in file"
   4971 # https://github.com/n-t-roff/heirloom-ex-vi/issues/3
   4972 # begin_substep vi-050325
   4973 # if [ -x /bin/vi ]; then
   4974 # 	msg info "%s exists, skipping %s" /bin/vi ${pkg}
   4975 # elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   4976 # 	unpack_pkg ${pkg} /
   4977 # else
   4978 # 	extract_pkg ${G_SRC} ex-050325 ${pkg}.tar.bz2 ${pkg}
   4979 # https://prdownloads.sourceforge.net/ex-vi/ex-050325.tar.bz2	vi-050325.tar.bz2	e668595254233e4d96811083a3e4e2f3
   4980 # 	(
   4981 # 		cd_or_fail ${G_SRC}/${pkg}
   4982 # 
   4983 # 		cat <<! >MKPK
   4984 # mkpk_name()
   4985 # {
   4986 # 	printf "%s" "${pkg}"
   4987 # }
   4988 # 
   4989 # mkpk_install()
   4990 # {
   4991 # 	CFLAGS='-Os -static --static -fcommon'
   4992 # 	LDFLAGS='-static --static -fcommon'
   4993 # 	DESTDIR=/build
   4994 # 	export CFLAGS LDFLAGS DESTDIR
   4995 # 	
   4996 # 
   4997 # 	sed -i -e '/^PREFIX/s,/usr/local,,' \\
   4998 # 	       -e '/^PRESERVEDIR/s,/var/preserve,/var/lib/vi' \\
   4999 # 	       -e '/^DESTDIR/s,=,= /build,' \\
   5000 # 		Makefile
   5001 # 	make PREFIX= PRESERVEDIR=/var/lib/vi DESTDIR=/build \\
   5002 # 	     TERMLIB='ncurses -lterminfo' INSTALL=/${TLD}/bin/install \\
   5003 # 	     FEATURES='-DCHDIR -DFASTTAG -DUCVISUAL -DMB -DBIT8' ${JN}
   5004 # 	make PREFIX= PRESERVEDIR=/var/lib/vi DESTDIR=/build \\
   5005 # 	     TERMLIB='ncurses -lterminfo' INSTALL=/${TLD}/bin/install \\
   5006 # 	     FEATURES='-DCHDIR -DFASTTAG -DUCVISUAL -DMB -DBIT8' install
   5007 # 
   5008 # 	mkdir -p /build/var/lib/vi
   5009 # 	chmod 1777 /build/var/lib/vi
   5010 # 	:>/build/var/lib/vi/preservedir
   5011 # }
   5012 # !
   5013 # 		mkpk ${pkg}
   5014 # 		remove_dir ${G_SRC}/${pkg}
   5015 # 		unpack_pkg ${pkg} /
   5016 # 	) || exit 1
   5017 # fi
   5018 # end_substep
   5019 
   5020 begin_substep libtermkey-0.22
   5021 if [ -e /lib/libtermkey.a ]; then
   5022 	msg info "%s exists, skipping %s" /lib/libtermkey.a ${pkg}
   5023 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   5024 	unpack_pkg ${pkg} /
   5025 else
   5026 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   5027 	(
   5028 		cd_or_fail ${G_SRC}/${pkg}
   5029 
   5030 		cat <<! >MKPK
   5031 mkpk_name()
   5032 {
   5033 	printf "%s" "${pkg}"
   5034 }
   5035 
   5036 mkpk_install()
   5037 {
   5038 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   5039 	LDFLAGS='-static --static -fcommon -s'
   5040 	PREFIX=''
   5041 	DESTDIR=/build
   5042 	export CFLAGS LDFLAGS PREFIX DESTDIR
   5043 	SED=/sucks/bin/sed
   5044 	
   5045 	\${SED} -i -e '/^PREFIX/s,/usr/local,,' Makefile
   5046 
   5047 	make ${JN}
   5048 	make DESTDIR="\${DESTDIR}" install
   5049 }
   5050 !
   5051 		mkpk ${pkg}
   5052 		remove_dir ${G_SRC}/${pkg}
   5053 		unpack_pkg ${pkg} /
   5054 	) || exit 1
   5055 fi
   5056 timestamp=$(date +'%Y-%m-%d %T')
   5057 printf "%s\t%s\t%s\n" libtermkey 0.22 "${timestamp}" >>${G_PKGDB}
   5058 end_substep
   5059 
   5060 # Needed for vis
   5061 # begin_substep lua-5.3.6
   5062 # if [ -e /sucks/lib/liblua5.3.a ]; then
   5063 # 	msg info "%s exists, skipping %s" /sucks/lib/liblua5.3.a ${pkg}
   5064 # elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   5065 # 	unpack_pkg ${pkg} /
   5066 # else
   5067 # 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   5068 # 	(
   5069 # 		cd_or_fail ${G_SRC}/${pkg}
   5070 # 
   5071 # 		apply_patch packages -Np0 -i \
   5072 # 			${G_PAT}/lua53-void/liblua.so.patch
   5073 # 
   5074 # 		cp_or_fail ${G_FIL}/lua53-galeb/lua.pc ${G_SRC}/${pkg}
   5075 # 
   5076 # 		cat <<! >MKPK
   5077 # mkpk_name()
   5078 # {
   5079 # 	printf "%s" "${pkg}"
   5080 # }
   5081 # 
   5082 # mkpk_install()
   5083 # {
   5084 # 	CFLAGS='-Os'
   5085 # 	LDFLAGS='-s'
   5086 # 	DESTDIR=/build
   5087 # 	export CFLAGS LDFLAGS DESTDIR
   5088 # 	
   5089 # 	/${TLD}/bin/sed -Ei src/Makefile \\
   5090 # 		-e '/^LUA_(SO|A|T)=/ s,lua,lua5.3,' \\
   5091 # 		-e '/LUAC_T=/ s,luac,luac5.3,'
   5092 # 
   5093 # 	make MYCFLAGS="\${CFLAGS} -fPIC" \\
   5094 # 		INSTALL_DATA="/${TLD}/bin/cp -d" \\
   5095 # 		LUA_SO=liblua5.3.so ${JN} linux || exit 1
   5096 # 
   5097 # 	make INSTALL=/${TLD}/bin/install INSTALL_DATA="/${TLD}/bin/cp -d" \\
   5098 # 		INSTALL_TOP="/build/sucks" \\
   5099 # 		TO_BIN="lua5.3 luac5.3" \\
   5100 # 		TO_LIB="liblua5.3.a liblua5.3.so" \\
   5101 # 		INSTALL_INC="/build/sucks/include/lua5.3" \\
   5102 # 		INSTALL_LMOD="/build/sucks/share/lua5.3" \\
   5103 # 		INSTALL_CMOD="/build/sucks/lib/lua5.3" \\
   5104 # 		INSTALL_MAN="/build/sucks/share/man/man1" install || exit 1
   5105 # 
   5106 # 	/${TLD}/bin/ln -s liblua5.4.so.5.3.6 /build/sucks/lib/liblua5.3.so.5.3
   5107 # 	/${TLD}/bin/install -Dm644 lua.pc /build/sucks/lib/pkgconfig/lua.pc
   5108 # 	/${TLD}/bin/install -Dm644 lua.pc /build/sucks/lib/pkgconfig/lua5.3.pc
   5109 # }
   5110 # !
   5111 # 		mkpk ${pkg}
   5112 # 		remove_dir ${G_SRC}/${pkg}
   5113 # 		unpack_pkg ${pkg} /
   5114 # 	) || exit 1
   5115 # fi
   5116 # end_substep
   5117 
   5118 # Needed for vis
   5119 # begin_substep lpeg-1.0.2
   5120 # if [ -e /sucks/lib/lua5.3/lpeg.a ]; then
   5121 # 	msg info "%s exists, skipping %s" /sucks/lib/lua5.3/lpeg.a ${pkg}
   5122 # elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   5123 # 	unpack_pkg ${pkg} /
   5124 # else
   5125 # 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   5126 # 	(
   5127 # 		cd_or_fail ${G_SRC}/${pkg}
   5128 # 
   5129 # 		cp_or_fail ${G_FIL}/lpeg-galeb/lpeg.pc ${G_SRC}/${pkg}
   5130 # 
   5131 # 		cat <<! >MKPK
   5132 # mkpk_name()
   5133 # {
   5134 # 	printf "%s" "${pkg}"
   5135 # }
   5136 # 
   5137 # mkpk_install()
   5138 # {
   5139 # 	CFLAGS='-Os'
   5140 # 	LDFLAGS='-s'
   5141 # 	DESTDIR=/build
   5142 # 	export CFLAGS LDFLAGS DESTDIR
   5143 # 	
   5144 # 	/${TLD}/bin/sed -i makefile \\
   5145 # 		-e '/^LUADIR =/ s,\.\./lua/,/sucks/include/lua5.3,' \\
   5146 # 		-e "/^COPT =/ s,=.*,= \${CFLAGS} -DNDEBUG,"
   5147 # 	printf 'lpeg.a: \$(FILES)\n' >> makefile
   5148 # 	printf "\tar cru lpeg.a *.o\n" >> makefile
   5149 # 
   5150 # 	make ${JN} || exit 1
   5151 # 	make ${JN} lpeg.a || exit 1
   5152 # 
   5153 # 	/${TLD}/bin/install -Dm755 lpeg.so /build/sucks/lib/lua5.3/lpeg.so
   5154 # 	/${TLD}/bin/install -Dm755 lpeg.a /build/sucks/lib/lua5.3/lpeg.a
   5155 # 	/${TLD}/bin/install -Dm644 lpeg.pc /build/sucks/lib/pkgconfig/lpeg.pc
   5156 # 	/${TLD}/bin/install -Dm644 re.lua /build/sucks/share/lua5.3/re.lua
   5157 # }
   5158 # !
   5159 # 		mkpk ${pkg}
   5160 # 		remove_dir ${G_SRC}/${pkg}
   5161 # 		unpack_pkg ${pkg} /
   5162 # 	) || exit 1
   5163 # fi
   5164 # end_substep
   5165 
   5166 # Doesn't work properly with netbsd-curses+tmux
   5167 # begin_substep vis-0.7
   5168 # if [ -x /bin/vis ]; then
   5169 # 	msg info "%s exists, skipping %s" /bin/vis ${pkg}
   5170 # elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   5171 # 	unpack_pkg ${pkg} /
   5172 # else
   5173 # 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   5174 # 	(
   5175 # 		cd_or_fail ${G_SRC}/${pkg}
   5176 # 
   5177 # 		cat <<! >MKPK
   5178 # mkpk_name()
   5179 # {
   5180 # 	printf "%s" "${pkg}"
   5181 # }
   5182 # 
   5183 # mkpk_install()
   5184 # {
   5185 # 	CFLAGS='-Os -static --static -fcommon'
   5186 # 	LDFLAGS='-static --static -fcommon'
   5187 # 	DESTDIR=/build
   5188 # 	export CFLAGS LDFLAGS DESTDIR
   5189 # 	
   5190 # 	./configure --prefix=/
   5191 # 
   5192 # 	make ${JN}
   5193 # 	make install-strip
   5194 # 
   5195 # 	ln -s vis /build/bin/vi
   5196 # 	ln -s vis.1 /build/share/man/man1/vi.1
   5197 # }
   5198 # !
   5199 # 		mkpk ${pkg}
   5200 # 		remove_dir ${G_SRC}/${pkg}
   5201 # 		unpack_pkg ${pkg} /
   5202 # 	) || exit 1
   5203 # fi
   5204 # end_substep
   5205 
   5206 begin_substep vim-9.0
   5207 if [ -x /bin/vim ]; then
   5208 	msg info "%s exists, skipping %s" /bin/vim ${pkg}
   5209 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   5210 	unpack_pkg ${pkg} /
   5211 else
   5212 	extract_pkg ${G_SRC} vim90 ${pkg}.tar.bz2 ${pkg}
   5213 	(
   5214 		cd_or_fail ${G_SRC}/${pkg}
   5215 
   5216 		cat <<! >MKPK
   5217 mkpk_name()
   5218 {
   5219 	printf "%s" "${pkg}"
   5220 }
   5221 
   5222 mkpk_install()
   5223 {
   5224 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   5225 	LDFLAGS='-static --static -fcommon -s'
   5226 	PREFIX=''
   5227 	DESTDIR=/build
   5228 	export CFLAGS LDFLAGS PREFIX DESTDIR
   5229 	SED=/sucks/bin/sed
   5230 	
   5231 	./configure --prefix="\${PREFIX}" \\
   5232 		--sysconfdir=/etc \\
   5233 		--docdir=/share/doc/${pkg} \\
   5234 		--disable-selinux \\
   5235 		--disable-netbeans \\
   5236 		--without-x || exit 1
   5237 
   5238 	\${SED} -i -e '/#define SYS_VIMRC/s,/\*.*\(#define.*"\) '\
   5239 '\*/,\1,' src/feature.h
   5240 
   5241 	make ${JN} || exit 1
   5242 	make install || exit 1
   5243 	
   5244 	rm ../build/share/applications/gvim.desktop
   5245 	mkdir -p ../build/etc
   5246 	cat <<@ >../build/etc/vimrc
   5247 " Galeb /etc/vimrc
   5248 
   5249 syntax on
   5250 set hidden
   5251 set fileformat=unix
   5252 set fileformats=unix,dos
   5253 set showcmd
   5254 set encoding=utf-8
   5255 set termencoding=utf-8
   5256 set fileencoding=utf-8
   5257 set tabstop=8
   5258 set softtabstop=0
   5259 set shiftwidth=0
   5260 set noexpandtab
   5261 set textwidth=80
   5262 set cinoptions=:0,l1,g0,t0,U1,Ws,ks
   5263 set switchbuf+=usetab
   5264 
   5265 " don't try at home, kids!
   5266 nmap 	 :bnext
   5267 nmap <Tab> :bnext<CR>
   5268 nmap <S-Tab> :bprevious<CR>
   5269 
   5270 cabbrev h only <bar> vertical botright help
   5271 
   5272 " End /etc/vimrc
   5273 @
   5274 }
   5275 !
   5276 		mkpk ${pkg}
   5277 		remove_dir ${G_SRC}/${pkg}
   5278 		unpack_pkg ${pkg} /
   5279 	) || exit 1
   5280 fi
   5281 timestamp=$(date +'%Y-%m-%d %T')
   5282 printf "%s\t%s\t%s\n" vim 9.0 "${timestamp}" >>${G_PKGDB}
   5283 end_substep
   5284 
   5285 # ERROR: You must have bison installed to build the util-linux.
   5286 # 	- Riiiight.
   5287 begin_substep util-linux-2.38.1
   5288 if [ -x /bin/lsblk ]; then
   5289 	msg info "%s exists, skipping %s" /bin/lsblk ${pkg}
   5290 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   5291 	unpack_pkg ${pkg} /
   5292 else
   5293 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   5294 	(
   5295 		cd_or_fail ${G_SRC}/${pkg}
   5296 
   5297 		if [ -d "${G_FIL}/util-linux-galeb/man" ]; then
   5298 			cp_or_fail -R ${G_FIL}/util-linux-galeb/man .
   5299 		fi
   5300 		apply_patch packages -Np0 -i \
   5301 			${G_PAT}/util-linux-void/fix-musl.patch
   5302 
   5303 # 		apply_patch packages -Np1 -i \
   5304 # 			${G_PAT}/util-linux-mlfs/use-tiparm-when-compiling-\
   5305 # with-netbsd_curses.patch
   5306 
   5307 		cp ${G_FIL}/util-linux-adelie/ttydefaults.h \
   5308 			include/ttydefaults.h
   5309 
   5310 		cat <<! >MKPK
   5311 mkpk_name()
   5312 {
   5313 	printf "%s" "${pkg}"
   5314 }
   5315 
   5316 mkpk_install()
   5317 {
   5318 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   5319 	CFLAGS+=' -D_DIRENT_HAVE_D_TYPE '
   5320 	LDFLAGS='-static --static -fcommon'
   5321 	PREFIX=''
   5322 	DESTDIR=/build
   5323 	YACC=/${TLD}/bin/yacc
   5324 	export CFLAGS LDFLAGS PREFIX DESTDIR YACC
   5325 
   5326 	mkdir -p /build/var/lib/hwclock
   5327 
   5328 	:>config/config.rpath
   5329 	:>config.h.in
   5330 
   5331 	NOCONFIGURE=1 ./autogen.sh || exit 1
   5332 
   5333 	#--disable-mount       \\
   5334 	./configure \\
   5335 		--prefix="\${PREFIX}" \\
   5336 		ADJTIME_PATH=/var/lib/hwclock/adjtime   \\
   5337 		--docdir=\${PREFIX}/share/doc/util-linux-2.37.4 \\
   5338 		--disable-cal         \\
   5339 		--disable-chfn-chsh   \\
   5340 		--disable-eject       \\
   5341 		--disable-fallocate   \\
   5342 		--disable-kill        \\
   5343 		--disable-last        \\
   5344 		--disable-logger      \\
   5345 		--disable-login       \\
   5346 		--disable-mesg        \\
   5347 		--disable-mountpoint  \\
   5348 		--disable-nologin     \\
   5349 		--disable-pivot_root  \\
   5350 		--disable-setpriv     \\
   5351 		--disable-su          \\
   5352 		--disable-swapon      \\
   5353 		--disable-switch_root \\
   5354 		--disable-runuser     \\
   5355 		--disable-pylibmount  \\
   5356 		--disable-unshare     \\
   5357 		--disable-shared      \\
   5358 		--without-python      \\
   5359 		--without-systemd     \\
   5360 		--without-systemdsystemunitdir \\
   5361 		--sbindir=\${PREFIX}/sbin \\
   5362 		--bindir=\${PREFIX}/bin   \\
   5363 		--libdir=\${PREFIX}/lib || exit 1
   5364 
   5365 	make ${JN} || exit 1
   5366 	make install-strip
   5367 
   5368 	# Overlap with sbase/ubase
   5369 	for prog in blkdiscard ctrlaltdel dmesg flock fsfreeze look mkswap \\
   5370 	    renice rev setsid swaplabel swapoff umount
   5371 	do
   5372 		find "\${DESTDIR}" -name \${prog} -exec rm {} \\;
   5373 	done
   5374 
   5375 	# Copy manpages
   5376 	if [ -d man ]; then
   5377 		cp -R man "\${DESTDIR}/share/"
   5378 	fi
   5379 }
   5380 !
   5381 		mkpk ${pkg}
   5382 		remove_dir ${G_SRC}/${pkg}
   5383 		unpack_pkg ${pkg} /
   5384 	) || exit 1
   5385 fi
   5386 timestamp=$(date +'%Y-%m-%d %T')
   5387 printf "%s\t%s\t%s\n" util-linux 2.38.1 "${timestamp}" >>${G_PKGDB}
   5388 end_substep
   5389 
   5390 # sbase lacks stty as of the making of this script, so using what is available
   5391 begin_substep stty-9.2
   5392 #if [ -x /bin/stty ]; then
   5393 #	msg info "%s exists, skipping %s" /bin/stty ${pkg}
   5394 #elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   5395 if [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   5396 	remove_file /bin/stty
   5397 	unpack_pkg ${pkg} /
   5398 else
   5399 	extract_pkg ${G_SRC} coreutils-9.2 coreutils-9.2.tar.xz ${pkg}
   5400 	(
   5401 		cd_or_fail ${G_SRC}/${pkg}
   5402 
   5403 		cat <<! >MKPK
   5404 mkpk_name()
   5405 {
   5406 	printf "%s" "${pkg}"
   5407 }
   5408 
   5409 mkpk_install()
   5410 {
   5411 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   5412 	LDFLAGS='-static --static -fcommon -s'
   5413 	PREFIX=''
   5414 	DESTDIR=/build
   5415 	YACC=/${TLD}/bin/yacc
   5416 	CFLAGS+=' -DLOCALEDIR="\"\${PREFIX}/share/locale\""'
   5417 	CFLAGS+=' -DO_BINARY=0 -DO_TEXT=0'
   5418 	export CFLAGS LDFLAGS PREFIX DESTDIR YACC
   5419 
   5420 	autoreconf -v
   5421 
   5422 	FORCE_UNSAFE_CONFIGURE=1 \\
   5423 	./configure --prefix="\${PREFIX}" \\
   5424 		--datarootdir="\${PREFIX}/share" \\
   5425 		--localedir="\${PREFIX}/share/locale" \\
   5426 		|| exit 1
   5427 
   5428 	CFLAGS+=' -I../lib '
   5429 	export CFLAGS
   5430 	SED=/sucks/bin/sed
   5431 	
   5432 	make || true
   5433 
   5434 	# Hack sucky auto*hell
   5435 	\${SED} -i 's/^\\(# *if \\)\$/\\10/g' lib/stdint.h
   5436 	\${SED} -i \\
   5437 		-e 's/^\\(# *if \\)\$/\\10/g' \\
   5438 		-e 's/^\\(# *if defined __MINGW32__ && !\\)\$/\\11/g' \\
   5439 		lib/wctype.h
   5440 	\${SED} -i 's/^\\(# *if \\)\$/\\10/g' lib/wchar.h
   5441 
   5442 	# This should be enough, but it doesn't work, so have to 'make all'
   5443 	#make src/stty || exit 1
   5444 	make || exit 1
   5445 
   5446 	# All that for one binary
   5447 	mkdir -p \${DESTDIR}\${PREFIX}/bin
   5448 	cp src/stty \${DESTDIR}\${PREFIX}/bin
   5449 }
   5450 !
   5451 		mkpk ${pkg}
   5452 		remove_dir ${G_SRC}/${pkg}
   5453 		remove_file /bin/stty
   5454 		unpack_pkg ${pkg} /
   5455 	) || exit 1
   5456 fi
   5457 timestamp=$(date +'%Y-%m-%d %T')
   5458 printf "%s\t%s\t%s\n" stty 9.2 "${timestamp}" >>${G_PKGDB}
   5459 end_substep
   5460 
   5461 begin_substep e2fsprogs-1.47.0
   5462 if [ -x /sucks/sbin/e2fsck ]; then
   5463 	msg info "%s exists, skipping %s" /sucks/sbin/e2fsck ${pkg}
   5464 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   5465 	unpack_pkg ${pkg} /
   5466 else
   5467 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   5468 	(
   5469 		cd_or_fail ${G_SRC}/${pkg}
   5470 
   5471 		cat <<! >MKPK
   5472 mkpk_name()
   5473 {
   5474 	printf "%s" "${pkg}"
   5475 }
   5476 
   5477 mkpk_install()
   5478 {
   5479 	CFLAGS='-Os -pipe -fPIC'
   5480 	LDFLAGS='-s'
   5481 	PREFIX=/sucks
   5482 	DESTDIR=/build
   5483 	export CFLAGS LDFLAGS PREFIX DESTDIR
   5484 	
   5485 	./configure --prefix="\${PREFIX}" \\
   5486 		--with-root-prefix=""     \\
   5487 		--enable-elf-shlibs       \\
   5488 		--disable-libblkid        \\
   5489 		--disable-libuuid         \\
   5490 		--disable-uuidd           \\
   5491 		--disable-fsck		  \\
   5492 		--enable-e2initrd-helper  \\
   5493 		--disable-rpath		  \\
   5494 		--sbindir=\${PREFIX}/sbin \\
   5495 		--libdir=\${PREFIX}/lib
   5496 
   5497 	make ${JN}
   5498 	make install-strip
   5499 	make install-libs
   5500 
   5501 	for lib in libcom_err libe2p libext2fs libss
   5502 	do
   5503 		chmod u+w \${DESTDIR}\${PREFIX}/lib/\${lib}.a
   5504 	done
   5505 
   5506 	gunzip -v \${DESTDIR}\${PREFIX}/share/info/libext2fs.info.gz
   5507 	install-info --dir-file=\${DESTDIR}\${PREFIX}/share/info/dir \\
   5508 		\${DESTDIR}\${PREFIX}/share/info/libext2fs.info
   5509 }
   5510 !
   5511 		mkpk ${pkg}
   5512 		remove_dir ${G_SRC}/${pkg}
   5513 		unpack_pkg ${pkg} /
   5514 	) || exit 1
   5515 fi
   5516 timestamp=$(date +'%Y-%m-%d %T')
   5517 printf "%s\t%s\t%s\n" e2fsprogs 1.47.0 "${timestamp}" >>${G_PKGDB}
   5518 end_substep
   5519 
   5520 begin_substep cpio-2.13
   5521 if [ -x /bin/cpio ]; then
   5522 	msg info "%s exists, skipping %s" /bin/cpio ${pkg}
   5523 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   5524 	unpack_pkg ${pkg} /
   5525 else
   5526 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.bz2
   5527 	(
   5528 		cd_or_fail ${G_SRC}/${pkg}
   5529 
   5530 		cat <<! >MKPK
   5531 mkpk_name()
   5532 {
   5533 	printf "%s" "${pkg}"
   5534 }
   5535 
   5536 mkpk_install()
   5537 {
   5538 	CFLAGS='-Os -static --static -fcommon -fPIC'
   5539 	LDFLAGS='-static --static -fcommon -s'
   5540 	PREFIX=''
   5541 	DESTDIR=/build
   5542 	export CFLAGS LDFLAGS PREFIX DESTDIR
   5543 	SED=/sucks/bin/sed
   5544 	
   5545 	autoreconf -vif
   5546 
   5547 	\${SED} -i '/The name/,+2 d' src/global.c
   5548 
   5549 	./configure --prefix="\${PREFIX}"   \\
   5550 		--bindir=/bin 	 \\
   5551 		--enable-mt	 \\
   5552 		--with-rmt=/libexec/rmt
   5553 
   5554 	make ${JN}
   5555 	make install-strip
   5556 }
   5557 !
   5558 		mkpk ${pkg}
   5559 		remove_dir ${G_SRC}/${pkg}
   5560 		unpack_pkg ${pkg} /
   5561 	) || exit 1
   5562 fi
   5563 timestamp=$(date +'%Y-%m-%d %T')
   5564 printf "%s\t%s\t%s\n" cpio 2.13 "${timestamp}" >>${G_PKGDB}
   5565 end_substep
   5566 
   5567 begin_substep sdhcp-20230414
   5568 if [ -x /bin/sdhcp ]; then
   5569 	msg info "%s exists, skipping %s" /bin/sdhcp ${pkg}
   5570 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   5571 	unpack_pkg ${pkg} /
   5572 else
   5573 	(
   5574 		cd_or_fail ${G_SRC}/${pkg}
   5575 
   5576 		apply_patch packages -Np0 -i \
   5577 			${G_PAT}/sdhcp-galeb/sdhcp-pid-file.patch
   5578 
   5579 		cat <<! >MKPK
   5580 mkpk_name()
   5581 {
   5582 	printf "%s" "${pkg}"
   5583 }
   5584 
   5585 mkpk_install()
   5586 {
   5587 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   5588 	LDFLAGS='-static --static -fcommon -s'
   5589 	LDLIBS=-lc
   5590 	export CFLAGS LDFLAGS LDLIBS
   5591 	SED=/sucks/bin/sed
   5592 
   5593 	if [ ! -e config.mk.orig ]; then
   5594 		cp config.mk config.mk.orig
   5595 		\${SED} -i -e "s,^\\(PREFIX\\s*=\\s*\\).*,PREFIX = ," \\
   5596 		       -e "s,^\\(CC\\s*=\\s*\\).*,CC = \${CC}," \\
   5597 			config.mk
   5598 	fi
   5599 
   5600 	make clean
   5601 	make ${JN} CFLAGS="\${CFLAGS}" LDFLAGS="\${LDFLAGS}" || exit 1
   5602 	make DESTDIR=/build install
   5603 }
   5604 !
   5605 		mkpk ${pkg}
   5606 		#remove_dir ${G_SRC}/${pkg}
   5607 		unpack_pkg ${pkg} /
   5608 	) || exit 1
   5609 fi
   5610 timestamp=$(date +'%Y-%m-%d %T')
   5611 printf "%s\t%s\t%s\n" sdhcp 20230414 "${timestamp}" >>${G_PKGDB}
   5612 end_substep
   5613 
   5614 begin_substep sinit-20230414
   5615 if [ -x /sbin/init ]; then
   5616 	msg info "%s exists, skipping %s" /sbin/init ${pkg}
   5617 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   5618 	unpack_pkg ${pkg} /
   5619 else
   5620 	(
   5621 		cd_or_fail ${G_SRC}/${pkg}
   5622 
   5623 		cat <<! >MKPK
   5624 mkpk_name()
   5625 {
   5626 	printf "%s" "${pkg}"
   5627 }
   5628 
   5629 mkpk_install()
   5630 {
   5631 	AR=ar
   5632 	CC=tcc
   5633 	CFLAGS='-Os -static -fcommon'
   5634 	LDFLAGS='-static -fcommon'
   5635 	LDLIBS=-lc
   5636 	export AR CC CFLAGS LDFLAGS LDLIBS
   5637 	SED=/sucks/bin/sed
   5638 
   5639 	if [ ! -e config.mk.orig ]; then
   5640 		cp config.mk config.mk.orig
   5641 		\${SED} -i -e "s,^\\(PREFIX\\s*=\\s*\\).*,PREFIX = ," \\
   5642 		       -e "s,^\\(CC\\s*=\\s*\\).*,CC = \${CC}," \\
   5643 			config.mk
   5644 	fi
   5645 
   5646 	make clean
   5647 	make ${JN} || exit 1
   5648 	make DESTDIR=/build install
   5649 
   5650 	ln -sf bin ../build/sbin
   5651 	cd ../build/sbin
   5652 	ln -sf sinit init
   5653 }
   5654 !
   5655 		mkpk ${pkg}
   5656 		#remove_dir ${G_SRC}/${pkg}
   5657 		unpack_pkg ${pkg} /
   5658 	) || exit 1
   5659 fi
   5660 timestamp=$(date +'%Y-%m-%d %T')
   5661 printf "%s\t%s\t%s\n" sinit 20230414 "${timestamp}" >>${G_PKGDB}
   5662 end_substep
   5663 
   5664 begin_substep dropbear-2022.83
   5665 if [ -x /bin/dropbear ]; then
   5666 	msg info "%s exists, skipping %s" /bin/dropbear ${pkg}
   5667 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   5668 	unpack_pkg ${pkg} /
   5669 else
   5670 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.bz2
   5671 	(
   5672 		cd_or_fail ${G_SRC}/${pkg}
   5673 	
   5674 		cat <<! >MKPK
   5675 mkpk_name()
   5676 {
   5677 	printf "%s" "${pkg}"
   5678 }
   5679 
   5680 mkpk_install()
   5681 {
   5682 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   5683 	LDFLAGS='-static --static -fcommon -s'
   5684 	PREFIX=''
   5685 	DESTDIR=/build
   5686 	PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp"
   5687 	export CFLAGS LDFLAGS PREFIX DESTDIR PROGRAMS
   5688 
   5689 	./configure --prefix="\${PREFIX}" \\
   5690 		--sysconfdir=/etc \\
   5691 		--localstatedir=/var \\
   5692 		--enable-static
   5693 
   5694 	make ${JN} PROGRAMS="\${PROGRAMS}" MULTI=1 || exit 1
   5695 	make DESTDIR="\${DESTDIR}" PROGRAMS="\${PROGRAMS}" MULTI=1 install
   5696 }
   5697 !
   5698 		mkpk ${pkg}
   5699 		remove_dir ${G_SRC}/${pkg}
   5700 		unpack_pkg ${pkg} /
   5701 	) || exit 1
   5702 fi
   5703 timestamp=$(date +'%Y-%m-%d %T')
   5704 printf "%s\t%s\t%s\n" dropbear 2022.83 "${timestamp}" >>${G_PKGDB}
   5705 end_substep
   5706 
   5707 # Doesn't support HTTPS (yet?)
   5708 # begin_substep snarf-7.0
   5709 # if [ -x /bin/snarf ]; then
   5710 # 	msg info "%s exists, skipping %s" /bin/snarf ${pkg}
   5711 # elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   5712 # 	unpack_pkg ${pkg} /
   5713 # else
   5714 # 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   5715 # 	(
   5716 # 		cd_or_fail ${G_SRC}/${pkg}
   5717 # 
   5718 # 		cat <<! >MKPK
   5719 # mkpk_name()
   5720 # {
   5721 # 	printf "%s" "${pkg}"
   5722 # }
   5723 # 
   5724 # mkpk_install()
   5725 # {
   5726 # 	AR=ar
   5727 # 	CC=tcc
   5728 # 	CFLAGS='-static -fcommon'
   5729 # 	LDFLAGS='-static -fcommon -L/lib/tcc'
   5730 # 	LIBS='-lc -ltcc1'
   5731 # 	export AR CC CFLAGS LDFLAGS LIBS
   5732 # 
   5733 # 	./configure --prefix=/ --mandir=/share/man
   5734 # 
   5735 # 	make ${JN} || exit 1
   5736 # 	make DESTDIR=/build install
   5737 # }
   5738 # !
   5739 # 		mkpk ${pkg}
   5740 # 		remove_dir ${G_SRC}/${pkg}
   5741 # 		unpack_pkg ${pkg} /
   5742 # 	) || exit 1
   5743 # fi
   5744 # end_substep
   5745 
   5746 # Needed for efibootmgr
   5747 begin_substep popt-1.19
   5748 if [ -e /lib/libpopt.a ]; then
   5749 	msg info "%s exists, skipping %s" /lib/libpopt.a ${pkg}
   5750 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   5751 	unpack_pkg ${pkg} /
   5752 else
   5753 	extract_pkg ${G_SRC} popt-popt-1.19-release ${pkg}.tar.gz ${pkg}
   5754 	(
   5755 		cd_or_fail ${G_SRC}/${pkg}
   5756 	
   5757 		cat <<! >MKPK
   5758 mkpk_name()
   5759 {
   5760 	printf "%s" "${pkg}"
   5761 }
   5762 
   5763 mkpk_install()
   5764 {
   5765 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC '
   5766 	CFLAGS+='-fdata-sections -ffunction-sections '
   5767 	CFLAGS+='-fno-lto -fno-semantic-interposition '
   5768 	LDFLAGS='-static --static -fcommon -s'
   5769 	PREFIX=''
   5770 	DESTDIR=/build
   5771 	export CFLAGS LDFLAGS PREFIX DESTDIR
   5772 
   5773 	mkdir -p build-aux
   5774 	:>build-aux/config.rpath
   5775 
   5776 	autoreconf -vif
   5777 
   5778 	./configure --prefix="\${PREFIX}" \\
   5779 		--disable-shared
   5780 
   5781 	make ${JN} || exit 1
   5782 	make DESTDIR=/build install
   5783 }
   5784 !
   5785 		mkpk ${pkg}
   5786 		remove_dir ${G_SRC}/${pkg}
   5787 		unpack_pkg ${pkg} /
   5788 	) || exit 1
   5789 fi
   5790 timestamp=$(date +'%Y-%m-%d %T')
   5791 printf "%s\t%s\t%s\n" popt 1.19 "${timestamp}" >>${G_PKGDB}
   5792 end_substep
   5793 
   5794 # Needed for efibootmgr
   5795 #
   5796 # Note: I couldn't get efivar-38 to compile statically. `make efivar-static`
   5797 # reports undefined symbol `efi_well_known_guids` even if I modify the
   5798 # compilation command to explicitly include the object file holding that symbol,
   5799 # src/guid-symbols.static.o, at the end. I have no clue why is that and how to
   5800 # solve that, so using efivar-37 until the version which I can compile
   5801 # statically.
   5802 begin_substep efivar-37
   5803 if [ -e /lib/libefivar.a ]; then
   5804 	msg info "%s exists, skipping %s" /lib/libefivar.a ${pkg}
   5805 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   5806 	unpack_pkg ${pkg} /
   5807 else
   5808 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.bz2
   5809 	(
   5810 		cd_or_fail ${G_SRC}/${pkg}
   5811 
   5812 		apply_patch packages -Np1 -i \
   5813 			${G_PAT}/efivar-void/0001-Support-custom-cflags-for-\
   5814 CC_FOR_BUILD-and-CCLD_FOR_.patch
   5815 		apply_patch packages -Np1 -i \
   5816 			${G_PAT}/efivar-void/0002-Replace-call-to-strncpy-by-\
   5817 memcpy-to-fix-some-GCC8-w.patch
   5818 	
   5819 		cat <<! >MKPK
   5820 mkpk_name()
   5821 {
   5822 	printf "%s" "${pkg}"
   5823 }
   5824 
   5825 mkpk_install()
   5826 {
   5827 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC '
   5828 	CFLAGS+='-D_GNU_SOURCE -Wno-error=address-of-packed-member '
   5829 	#        v-------- Because of basename(char*)...
   5830 	CFLAGS+='-Wno-discarded-qualifiers '
   5831 	LDFLAGS='-static --static -fcommon'
   5832 	PREFIX=''
   5833 	DESTDIR=/build
   5834 	export CFLAGS LDFLAGS PREFIX DESTDIR
   5835 	SED=/sucks/bin/sed
   5836 
   5837 	make ${JN} PREFIX="\${PREFIX}" DESTDIR="\${DESTDIR}" \\
   5838 		-C src \\
   5839 		libefiboot.a libefivar.a \\
   5840 		efiboot.pc efivar.pc
   5841 
   5842 	LDFLAGS+=' -s'
   5843 	export LDFLAGS
   5844 	make ${JN} PREFIX="\${PREFIX}" DESTDIR="\${DESTDIR}" \\
   5845 		efivar-static
   5846 
   5847 	\${SED} -i 's,/lib64,/lib,g' src/efiboot.pc
   5848 	\${SED} -i 's,/lib64,/lib,g' src/efivar.pc
   5849 
   5850 	mkdir -p \${DESTDIR}\${PREFIX}/bin
   5851 	install -Dm0755 src/efivar-static \${DESTDIR}\${PREFIX}/bin/efivar
   5852 
   5853 	mkdir -p \${DESTDIR}\${PREFIX}/include/efivar
   5854 	for f in src/include/efivar/*.h
   5855 	do
   5856 		install -Dm0644 \$f \\
   5857 			\${DESTDIR}\${PREFIX}/include/efivar/\${f##*/}
   5858 	done
   5859 
   5860 	mkdir -p \${DESTDIR}\${PREFIX}/lib/pkgconfig
   5861 	install -Dm0644 src/efiboot.pc \\
   5862 		\${DESTDIR}\${PREFIX}/lib/pkgconfig/efiboot.pc
   5863 	install -Dm0644 src/efivar.pc \\
   5864 		\${DESTDIR}\${PREFIX}/lib/pkgconfig/efivar.pc
   5865 
   5866 	install -Dm0644 src/libefiboot.a \${DESTDIR}\${PREFIX}/lib/libefiboot.a
   5867 	install -Dm0644 src/libefivar.a \${DESTDIR}\${PREFIX}/lib/libefivar.a
   5868 
   5869 	mkdir -p \${DESTDIR}\${PREFIX}/share/man/man1
   5870 	mkdir -p \${DESTDIR}\${PREFIX}/share/man/man3
   5871 
   5872 	for manpage in \$(find docs -name '*.1')
   5873 	do
   5874 		install -Dm0644 \${manpage} \\
   5875 			\${DESTDIR}\${PREFIX}/share/man/man1/\${manpage##*/}
   5876 	done
   5877 
   5878 	for manpage in \$(find docs -name '*.3')
   5879 	do
   5880 		install -Dm0644 \${manpage} \\
   5881 			\${DESTDIR}\${PREFIX}/share/man/man3/\${manpage##*/}
   5882 	done
   5883 }
   5884 !
   5885 		mkpk ${pkg}
   5886 		remove_dir ${G_SRC}/${pkg}
   5887 		unpack_pkg ${pkg} /
   5888 	) || exit 1
   5889 fi
   5890 timestamp=$(date +'%Y-%m-%d %T')
   5891 printf "%s\t%s\t%s\n" efivar 37 "${timestamp}" >>${G_PKGDB}
   5892 end_substep
   5893 
   5894 begin_substep efibootmgr-17
   5895 if [ -x /sbin/efibootmgr ]; then
   5896 	msg info "%s exists, skipping %s" /sbin/efibootmgr ${pkg}
   5897 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   5898 	unpack_pkg ${pkg} /
   5899 else
   5900 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   5901 	(
   5902 		cd_or_fail ${G_SRC}/${pkg}
   5903 
   5904 		cat <<! >MKPK
   5905 mkpk_name()
   5906 {
   5907 	printf "%s" "${pkg}"
   5908 }
   5909 
   5910 mkpk_install()
   5911 {
   5912 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   5913 	LDFLAGS='-static --static -fcommon -s'
   5914 	PREFIX=''
   5915 	DESTDIR=/build
   5916 	EFI_LOADER='grubx64.efi'
   5917 	export CFLAGS LDFLAGS PREFIX DESTDIR EFILOADER
   5918 	SED=/sucks/bin/sed
   5919 
   5920 	\${SED} -e '/extern int efi_set_verbose/d' -i src/efibootmgr.c
   5921 
   5922 	make ${JN} PREFIX="\${PREFIX}" EXTRA_FLAGS="\${CFLAGS}" EFIDIR=GALEB \\
   5923 		EFI_LOADER="\${EFI_LOADER}" || { sh; exit 1; }
   5924 
   5925 	make ${JN} PREFIX="\${PREFIX}" DESTDIR="\${DESTDIR}" \\
   5926 		EXTRA_FLAGS="\${CFLAGS}" EFIDIR=GALEB \\
   5927 		EFI_LOADER="\${EFI_LOADER}" install || exit 1
   5928 
   5929 	mkdir -p \${DESTDIR}\${PREFIX}/share
   5930 	mv \${DESTDIR}/usr/share/* \${DESTDIR}\${PREFIX}/share/
   5931 	mkdir -p \${DESTDIR}\${PREFIX}/sbin
   5932 	mv \${DESTDIR}/usr/sbin/* \${DESTDIR}\${PREFIX}/sbin/
   5933 }
   5934 !
   5935 		mkpk ${pkg}
   5936 		remove_dir ${G_SRC}/${pkg}
   5937 		unpack_pkg ${pkg} /
   5938 	) || exit 1
   5939 fi
   5940 timestamp=$(date +'%Y-%m-%d %T')
   5941 printf "%s\t%s\t%s\n" efibootmgr 17 "${timestamp}" >>${G_PKGDB}
   5942 end_substep
   5943 
   5944 # Hardcodes shared lib generation = sucks
   5945 begin_substep gpm-1.20.7
   5946 if [ -x /sucks/bin/gpm ]; then
   5947 	msg info "%s exists, skipping %s" /sucks/bin/gpm ${pkg}
   5948 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   5949 	unpack_pkg ${pkg} /
   5950 else
   5951 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.bz2
   5952 	(
   5953 		cd_or_fail ${G_SRC}/${pkg}
   5954 
   5955 		for p in musl-fcntl.patch musl-gpm_h.patch \
   5956 			musl-linux_major_h.patch musl-select.patch \
   5957 			musl-sigaction.patch
   5958 		do
   5959 			apply_patch packages -Np0 -i ${G_PAT}/gpm-void/$p
   5960 		done
   5961 		cp ${G_PAT}/gpm-mlfs/fix-doc.patch .
   5962 
   5963 		cat <<! >MKPK
   5964 mkpk_name()
   5965 {
   5966 	printf "%s" "${pkg}"
   5967 }
   5968 
   5969 mkpk_install()
   5970 {
   5971 	CFLAGS='-Os -pipe -fcommon -fPIC'
   5972 	LDFLAGS='-fcommon -zmuldefs -s'
   5973 	PREFIX=/sucks
   5974 	DESTDIR=/build
   5975 	export CFLAGS LDFLAGS PREFIX DESTDIR
   5976 
   5977 	./autogen.sh
   5978 
   5979 	./configure --prefix="\${PREFIX}" \\
   5980 		--disable-shared \\
   5981 		--enable-static \\
   5982 		--sysconfdir=/etc || exit 1
   5983 
   5984 	patch -Np1 -i fix-doc.patch || exit 1
   5985 
   5986 	make ${JN} || exit 1
   5987 	make install-strip || exit 1
   5988 
   5989 	#install-info --dir-file=../build/sucks/share/info/dir \\
   5990 	#	../build/sucks/share/info/gpm.info
   5991 
   5992 	install -dm755 \${DESTDIR}\${PREFIX}/share/doc/${pkg}/support
   5993 	install -m644 doc/support/* \${DESTDIR}\${PREFIX}/share/doc/${pkg}/support
   5994 	install -m644 doc/FAQ \${DESTDIR}\${PREFIX}/share/doc/${pkg}
   5995 	install -m644 doc/HACK_GPM \${DESTDIR}\${PREFIX}/share/doc/${pkg}
   5996 	install -m644 doc/README* \${DESTDIR}\${PREFIX}/share/doc/${pkg}
   5997 }
   5998 !
   5999 		mkpk ${pkg}
   6000 		remove_dir ${G_SRC}/${pkg}
   6001 		unpack_pkg ${pkg} /
   6002 	) || exit 1
   6003 fi
   6004 timestamp=$(date +'%Y-%m-%d %T')
   6005 printf "%s\t%s\t%s\n" gpm 1.20.7 "${timestamp}" >>${G_PKGDB}
   6006 end_substep
   6007 
   6008 begin_substep elinks-0.17.GIT
   6009 if [ -e /bin/elinks ]; then
   6010 	msg info "%s exists, skipping %s" /bin/nasm ${pkg}
   6011 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   6012 	unpack_pkg ${pkg} /
   6013 else
   6014 	(
   6015 		cd_or_fail ${G_SRC}/${pkg}
   6016 
   6017 		cat <<! >MKPK
   6018 mkpk_name()
   6019 {
   6020 	printf "%s" "${pkg}"
   6021 }
   6022 
   6023 mkpk_install()
   6024 {
   6025 	CFLAGS='-Os -pipe -static --static -fcommon -DVA_COPY=va_copy -fPIC'
   6026 	CPPFLAGS=\${CFLAGS}
   6027 	LDFLAGS='-static --static -fcommon -s'
   6028 	PREFIX=''
   6029 	DESTDIR=/build
   6030 	export CFLAGS CPPFLAGS LDFLAGS PREFIX DESTDIR
   6031 
   6032 	./autogen.sh
   6033 
   6034 	CC='cc -static' \\
   6035 	./configure --prefix="\${PREFIX}" \\
   6036 		--sysconfdir=/etc \\
   6037 		--mandir=/share/man \\
   6038 		--localstatedir=/var \\
   6039 		--localedir=/share/locale \\
   6040 		--docdir=/share/doc/${pkg} \\
   6041 		--disable-shared \\
   6042 		--disable-bittorrent \\
   6043 		--disable-cgi \\
   6044 		--disable-finger \\
   6045 		--disable-smb \\
   6046 		--disable-nntp \\
   6047 		--without-ruby \\
   6048 		--without-perl \\
   6049 		--without-lua \\
   6050 		--without-tre \\
   6051 		--with-gpm \\
   6052 		--with-openssl \\
   6053 		--with-zlib \\
   6054 		--with-bzlib \\
   6055 		--enable-mouse \\
   6056 		--enable-gopher \\
   6057 		--enable-ipv6 \\
   6058 		--enable-mailcap \\
   6059 		--enable-256-colors \\
   6060 		--enable-static || exit 1
   6061 
   6062 	# Sucky Makefile
   6063 	for p in po/*.po; do
   6064 		msgfmt -o \${p//.po/.gmo} \$p
   6065 	done
   6066 	
   6067 	make ${JN} CC='cc -static' \\
   6068 		X_CFLAGS='' CFLAGS="\${CFLAGS}" \\
   6069 		LDFLAGS="\${LDFLAGS}" || exit 1
   6070 	make ${JN} CC='cc -static' \\
   6071 		X_CFLAGS='' CFLAGS="\${CFLAGS}" \\
   6072 		LDFLAGS="\${LDFLAGS}" DESTDIR="\${DESTDIR}" install
   6073 }
   6074 !
   6075 		mkpk ${pkg}
   6076 		#remove_dir ${G_SRC}/${pkg}
   6077 		unpack_pkg ${pkg} /
   6078 	) || exit 1
   6079 fi
   6080 timestamp=$(date +'%Y-%m-%d %T')
   6081 printf "%s\t%s\t%s\n" elinks 0.17.GIT "${timestamp}" >>${G_PKGDB}
   6082 end_substep
   6083 
   6084 begin_substep nasm-2.16.01
   6085 if [ -e /bin/nasm ]; then
   6086 	msg info "%s exists, skipping %s" /bin/nasm ${pkg}
   6087 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   6088 	unpack_pkg ${pkg} /
   6089 else
   6090 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   6091 	(
   6092 		cd_or_fail ${G_SRC}/${pkg}
   6093 
   6094 		cat <<! >MKPK
   6095 mkpk_name()
   6096 {
   6097 	printf "%s" "${pkg}"
   6098 }
   6099 
   6100 mkpk_install()
   6101 {
   6102 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   6103 	LDFLAGS='-static --static -fcommon -s'
   6104 	PREFIX=''
   6105 	DESTDIR=/build
   6106 	export CFLAGS LDFLAGS PREFIX DESTDIR
   6107 
   6108 	./configure --prefix="\${PREFIX}" || exit 1
   6109 
   6110 	make ${JN} || exit 1
   6111 	make install
   6112 }
   6113 !
   6114 		mkpk ${pkg}
   6115 		remove_dir ${G_SRC}/${pkg}
   6116 		unpack_pkg ${pkg} /
   6117 	) || exit 1
   6118 fi
   6119 timestamp=$(date +'%Y-%m-%d %T')
   6120 printf "%s\t%s\t%s\n" nasm 2.16.01 "${timestamp}" >>${G_PKGDB}
   6121 end_substep
   6122 
   6123 begin_substep libjpeg-turbo-2.1.5.1
   6124 if [ -e /lib/libturbojpeg.a ]; then
   6125 	msg info "%s exists, skipping %s" /lib/libturbojpeg.a ${pkg}
   6126 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   6127 	unpack_pkg ${pkg} /
   6128 else
   6129 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   6130 	(
   6131 		cd_or_fail ${G_SRC}/${pkg}
   6132 
   6133 		cat <<! >MKPK
   6134 mkpk_name()
   6135 {
   6136 	printf "%s" "${pkg}"
   6137 }
   6138 
   6139 mkpk_install()
   6140 {
   6141 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   6142 	LDFLAGS='-static --static -fcommon -s'
   6143 	PREFIX=''
   6144 	DESTDIR=/build
   6145 	export CFLAGS LDFLAGS PREFIX DESTDIR
   6146 
   6147 	mkdir b
   6148 	cd b
   6149 
   6150 	cmake -DCMAKE_INSTALL_PREFIX="\${PREFIX}" \\
   6151 		-DCMAKE_BUILD_TYPE=RELEASE        \\
   6152 		-DENABLE_SHARED=False             \\
   6153 		-DENABLE_STATIC=True              \\
   6154 		-DWITH_JPEG8=1                    \\
   6155 		-DBUILD_SHARED_LIBS=False         \\
   6156 		-DCMAKE_INSTALL_DOCDIR=\${PREFIX}/share/doc/${pkg} \\
   6157 		-DCMAKE_INSTALL_DEFAULT_LIBDIR=lib  \\
   6158 		..
   6159 
   6160 	make ${JN} || exit 1
   6161 	make DESTDIR="\${DESTDIR}" install
   6162 
   6163 	cd - >/dev/null
   6164 }
   6165 !
   6166 		mkpk ${pkg}
   6167 		remove_dir ${G_SRC}/${pkg}
   6168 		unpack_pkg ${pkg} /
   6169 	) || exit 1
   6170 fi
   6171 timestamp=$(date +'%Y-%m-%d %T')
   6172 printf "%s\t%s\t%s\n" libjpeg-turbo 2.1.5.1 "${timestamp}" >>${G_PKGDB}
   6173 end_substep
   6174 
   6175 begin_substep libpng-1.6.39
   6176 if [ -e /lib/libpng16.a ]; then
   6177 	msg info "%s exists, skipping %s" /lib/libpng16.a ${pkg}
   6178 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   6179 	unpack_pkg ${pkg} /
   6180 else
   6181 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   6182 	(
   6183 		cd_or_fail ${G_SRC}/${pkg}
   6184 
   6185 		apply_patch final -Np1 -i \
   6186 			${G_PAT}/libpng-lfs/apng.patch
   6187 
   6188 		cat <<! >MKPK
   6189 mkpk_name()
   6190 {
   6191 	printf "%s" "${pkg}"
   6192 }
   6193 
   6194 mkpk_install()
   6195 {
   6196 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   6197 	LDFLAGS='-static --static -fcommon -s'
   6198 	PREFIX=''
   6199 	DESTDIR=/build
   6200 	export CFLAGS LDFLAGS PREFIX DESTDIR
   6201 
   6202 	LIBS=-lpthread \\
   6203 	./configure --prefix="\${PREFIX}" \\
   6204 		--enable-static \\
   6205 		--disable-shared || exit 1
   6206 
   6207 	make ${JN} || exit 1
   6208 	make install-strip
   6209 }
   6210 !
   6211 		mkpk ${pkg}
   6212 		remove_dir ${G_SRC}/${pkg}
   6213 		unpack_pkg ${pkg} /
   6214 	) || exit 1
   6215 fi
   6216 timestamp=$(date +'%Y-%m-%d %T')
   6217 printf "%s\t%s\t%s\n" libpng 1.6.39 "${timestamp}" >>${G_PKGDB}
   6218 end_substep
   6219 
   6220 # Didn't work; `chown root:root` in fakeroot was just noop, inside fakeroot.  I
   6221 # suspect this was due to the necessity of having dynamic executables, but I got
   6222 # the same result even after subsequently creating and using a separate set of
   6223 # dynamically-linked sbase/ubase/9base, Probably this went deeper to
   6224 # /lib/ld-musl* being a static-pie executable instead of dynamic, which was just
   6225 # too much hassle to tinker with for me.
   6226 #
   6227 # Replaced with PRoot, which "Just Werks™", even with static executables.
   6228 
   6229 # https://deb.debian.org/debian/pool/main/f/fakeroot/fakeroot_1.29.orig.tar.gz	fakeroot-1.29.tar.gz	cab9604a7dc1d58346e0d15bb285bd0f
   6230 
   6231 # begin_substep fakeroot-1.29
   6232 # if [ -x /sucks/bin/fakeroot ]; then
   6233 # 	msg info "%s exists, skipping %s" /sucks/bin/fakeroot ${pkg}
   6234 # elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   6235 # 	unpack_pkg ${pkg} /
   6236 # else
   6237 # 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   6238 # 	(
   6239 # 		cd_or_fail ${G_SRC}/${pkg}
   6240 # 
   6241 # 		apply_patch packages -Np1 -i \
   6242 # 			${G_PAT}/fakeroot-alpine/fakeroot-stdint.patch
   6243 # 		apply_patch packages -Np1 -i \
   6244 # 			${G_PAT}/fakeroot-openwrt/400-alpine-libc.musl-fix.patch
   6245 # 
   6246 # 		cat <<! >MKPK
   6247 # mkpk_name()
   6248 # {
   6249 # 	printf "%s" "${pkg}"
   6250 # }
   6251 # 
   6252 # mkpk_install()
   6253 # {
   6254 # 	CFLAGS='-Os -pipe'
   6255 # 	CFLAGS+=' -D_STAT_VER=0'
   6256 # 	LDFLAGS='-s'
   6257 # 	DESTDIR=/build
   6258 # 	export CFLAGS LDFLAGS DESTDIR
   6259 # 
   6260 # 	./configure --prefix=/sucks \\
   6261 # 		--with-sysconfdir=/etc \\
   6262 # 		--with-localstatedir=/var \\
   6263 # 		--with-docdir=/sucks/share/doc/${pkg} \\
   6264 # 		--enable-shared || exit 1
   6265 # 	make ${JN} || exit 1
   6266 # 	make install-strip || exit 1
   6267 # }
   6268 # !
   6269 # 		mkpk ${pkg}
   6270 # 		remove_dir ${G_SRC}/${pkg}
   6271 # 		unpack_pkg ${pkg} /
   6272 # 	) || exit 1
   6273 # fi
   6274 # end_substep
   6275 
   6276 begin_substep farbfeld-20230415
   6277 if [ -e /bin/2ff ]; then
   6278 	msg info "%s exists, skipping %s" /bin/2ff ${pkg}
   6279 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   6280 	unpack_pkg ${pkg} /
   6281 else
   6282 	(
   6283 		cd_or_fail ${G_SRC}/${pkg}
   6284 
   6285 		cat <<! >MKPK
   6286 mkpk_name()
   6287 {
   6288 	printf "%s" "${pkg}"
   6289 }
   6290 
   6291 mkpk_install()
   6292 {
   6293 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   6294 	LDFLAGS='-static --static -fcommon -s'
   6295 	PREFIX=''
   6296 	DESTDIR=/build
   6297 	export CFLAGS LDFLAGS PREFIX DESTDIR
   6298 	SED=/sucks/bin/sed
   6299 
   6300 	if [ ! -e config.mk.orig ]; then
   6301 		cp config.mk config.mk.orig
   6302 		\${SED} -i -e "s,/usr/local,,g" \\
   6303 		       -e "s,^CFLAGS\\s\\+= ,&\${CFLAGS} ,g" \\
   6304 		       -e "s,^LDFLAGS\\s\\+= ,&\${LDFLAGS} ,g" \\
   6305 		       -e 's,^PNG.*=.*,& -lz ,g' \\
   6306 			config.mk
   6307 	fi
   6308 
   6309 	make LDLIBS=-lz ${JN} || exit 1
   6310 	make DESTDIR=\${DESTDIR} install
   6311 }
   6312 !
   6313 		mkpk ${pkg}
   6314 		#remove_dir ${G_SRC}/${pkg}
   6315 		unpack_pkg ${pkg} /
   6316 	) || exit 1
   6317 fi
   6318 timestamp=$(date +'%Y-%m-%d %T')
   6319 printf "%s\t%s\t%s\n" farbfeld 20230415 "${timestamp}" >>${G_PKGDB}
   6320 end_substep
   6321 
   6322 # Needed fpr gnupg
   6323 begin_substep libtasn1-4.19.0
   6324 if [ -e /lib/libtasn1.a ]; then
   6325 	msg info "%s exists, skipping %s" /lib/libtasn1.a ${pkg}
   6326 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   6327 	unpack_pkg ${pkg} /
   6328 else
   6329 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   6330 	(
   6331 		cd_or_fail ${G_SRC}/${pkg}
   6332 
   6333 		cat <<! >MKPK
   6334 mkpk_name()
   6335 {
   6336 	printf "%s" "${pkg}"
   6337 }
   6338 
   6339 mkpk_install()
   6340 {
   6341 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   6342 	LDFLAGS='-static --static -fcommon -s'
   6343 	PREFIX=/
   6344 	DESTDIR=/build
   6345 	export CFLAGS LDFLAGS PREFIX DESTDIR
   6346 
   6347 	./configure --prefix="\${PREFIX}" \\
   6348 		--disable-shared \\
   6349 		--enable-static || exit 1
   6350 
   6351 	make ${JN} || exit 1
   6352 	make DESTDIR="\${DESTDIR}" install
   6353 }
   6354 !
   6355 		mkpk ${pkg}
   6356 		remove_dir ${G_SRC}/${pkg}
   6357 		unpack_pkg ${pkg} /
   6358 	) || exit 1
   6359 fi
   6360 timestamp=$(date +'%Y-%m-%d %T')
   6361 printf "%s\t%s\t%s\n" libtasn1 4.19.0 "${timestamp}" >>${G_PKGDB}
   6362 end_substep
   6363 
   6364 # Needed fpr gnupg
   6365 begin_substep nettle-3.8.1
   6366 if [ -e /bin/nettle-hash ]; then
   6367 	msg info "%s exists, skipping %s" /bin/nettle-hash ${pkg}
   6368 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   6369 	unpack_pkg ${pkg} /
   6370 else
   6371 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   6372 	(
   6373 		cd_or_fail ${G_SRC}/${pkg}
   6374 
   6375 		cat <<! >MKPK
   6376 mkpk_name()
   6377 {
   6378 	printf "%s" "${pkg}"
   6379 }
   6380 
   6381 mkpk_install()
   6382 {
   6383 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   6384 	LDFLAGS='-static --static -fcommon -zmuldefs -s'
   6385 	PREFIX=''
   6386 	DESTDIR=/build
   6387 	export CFLAGS LDFLAGS PREFIX DESTDIR
   6388 
   6389 	./configure --prefix="\${PREFIX}" \\
   6390 		--disable-shared || exit 1
   6391 
   6392 	make ${JN} || exit 1
   6393 	make install
   6394 }
   6395 !
   6396 		mkpk ${pkg}
   6397 		remove_dir ${G_SRC}/${pkg}
   6398 		unpack_pkg ${pkg} /
   6399 	) || exit 1
   6400 fi
   6401 timestamp=$(date +'%Y-%m-%d %T')
   6402 printf "%s\t%s\t%s\n" nettle 3.8.1 "${timestamp}" >>${G_PKGDB}
   6403 end_substep
   6404 
   6405 # Needed fpr gnupg
   6406 begin_substep libunistring-1.1
   6407 if [ -e /lib/libunistring.a ]; then
   6408 	msg info "%s exists, skipping %s" /lib/libunistring.a \
   6409 		${pkg}
   6410 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   6411 	unpack_pkg ${pkg} /
   6412 else
   6413 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   6414 	(
   6415 		cd_or_fail ${G_SRC}/${pkg}
   6416 
   6417 		cat <<! >MKPK
   6418 mkpk_name()
   6419 {
   6420 	printf "%s" "${pkg}"
   6421 }
   6422 
   6423 mkpk_install()
   6424 {
   6425 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   6426 	LDFLAGS='-static --static -fcommon -s'
   6427 	PREFIX=/
   6428 	DESTDIR=/build
   6429 	export CFLAGS LDFLAGS PREFIX DESTDIR
   6430 
   6431 	./configure --prefix="\${PREFIX}" \\
   6432 		--enable-static \\
   6433 		--disable-shared \\
   6434 		--docdir=/share/doc/${pkg} || exit 1
   6435 
   6436 	make ${JN} || exit 1
   6437 	make DESTDIR="\${DESTDIR}" install
   6438 }
   6439 !
   6440 		mkpk ${pkg}
   6441 		remove_dir ${G_SRC}/${pkg}
   6442 		unpack_pkg ${pkg} /
   6443 	) || exit 1
   6444 fi
   6445 timestamp=$(date +'%Y-%m-%d %T')
   6446 printf "%s\t%s\t%s\n" libunistring 1.1 "${timestamp}" >>${G_PKGDB}
   6447 end_substep
   6448 
   6449 # Needed fpr gnupg
   6450 begin_substep p11-kit-0.24.1
   6451 if [ -x /bin/p11-kit ]; then
   6452 	msg info "%s exists, skipping %s" /bin/p11-kit ${pkg}
   6453 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   6454 	unpack_pkg ${pkg} /
   6455 else
   6456 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   6457 	(
   6458 		cd_or_fail ${G_SRC}/${pkg}
   6459 
   6460 		cat <<! >MKPK
   6461 mkpk_name()
   6462 {
   6463 	printf "%s" "${pkg}"
   6464 }
   6465 
   6466 mkpk_install()
   6467 {
   6468 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   6469 	LDFLAGS='-static --static -fcommon -s'
   6470 	PREFIX=/
   6471 	DESTDIR=/build
   6472 	export CFLAGS LDFLAGS PREFIX DESTDIR
   6473 
   6474 	NOCONFIGURE=1 autoreconf -vif || exit 1
   6475 
   6476 	./configure --prefix="\${PREFIX}" \\
   6477 		--sysconfdir=/etc \\
   6478 		--with-trust-paths=/etc/pki/anchors || exit 1
   6479 
   6480 	make ${JN} || exit 1
   6481 	make DESTDIR="\${DESTDIR}" install
   6482 }
   6483 !
   6484 		mkpk ${pkg}
   6485 		remove_dir ${G_SRC}/${pkg}
   6486 		unpack_pkg ${pkg} /
   6487 	) || exit 1
   6488 fi
   6489 timestamp=$(date +'%Y-%m-%d %T')
   6490 printf "%s\t%s\t%s\n" p11-kit 0.24.1 "${timestamp}" >>${G_PKGDB}
   6491 end_substep
   6492 
   6493 # Needed fpr gnupg
   6494 begin_substep gnutls-3.8.0
   6495 if [ -x /bin/gnutls-cli ]; then
   6496 	msg info "%s exists, skipping %s" /bin/gnutls-cli ${pkg}
   6497 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   6498 	unpack_pkg ${pkg} /
   6499 else
   6500 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   6501 	(
   6502 		cd_or_fail ${G_SRC}/${pkg}
   6503 
   6504 		cat <<! >MKPK
   6505 mkpk_name()
   6506 {
   6507 	printf "%s" "${pkg}"
   6508 }
   6509 
   6510 mkpk_install()
   6511 {
   6512 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC -Wl,-z,muldefs '
   6513 	CXXFLAGS=\${CFLAGS}
   6514 	LDFLAGS='-static --static -fcommon -zmuldefs -s '
   6515 	PREFIX=/
   6516 	DESTDIR=/build
   6517 	GMP_LIBS='-l:libgmp.a'
   6518 	HOGWEED_LIBS='-lhogweed -l:libgmp.a -lnettle'
   6519 	export CFLAGS CXXFLAGS LDFLAGS PREFIX DESTDIR
   6520 	export GMP_LIBS HOGWEED_LIBS
   6521 
   6522 	./configure --prefix="\${PREFIX}" \\
   6523 		--enable-static \\
   6524 		--disable-shared \\
   6525 		--with-default-trust-store-pkcs11="pkcs11:" \\
   6526 		--enable-openssl-compatibility \\
   6527 		--with-zlib \\
   6528 		--disable-guile \\
   6529 		--disable-valgrind-tests \\
   6530 		--disable-rpath || exit 1
   6531 
   6532 	make V=1 ${JN} || exit 1
   6533 	make DESTDIR="\${DESTDIR}" install-strip
   6534 }
   6535 !
   6536 		mkpk ${pkg}
   6537 		remove_dir ${G_SRC}/${pkg}
   6538 		unpack_pkg ${pkg} /
   6539 	) || exit 1
   6540 fi
   6541 timestamp=$(date +'%Y-%m-%d %T')
   6542 printf "%s\t%s\t%s\n" gnutls 3.8.0 "${timestamp}" >>${G_PKGDB}
   6543 end_substep
   6544 
   6545 # Needed fpr gnupg
   6546 begin_substep libgpg-error-1.47
   6547 if [ -x /bin/gpg-error ]; then
   6548 	msg info "%s exists, skipping %s" /bin/gpg-error ${pkg}
   6549 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   6550 	unpack_pkg ${pkg} /
   6551 else
   6552 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.bz2
   6553 	(
   6554 		cd_or_fail ${G_SRC}/${pkg}
   6555 
   6556 		cat <<! >MKPK
   6557 mkpk_name()
   6558 {
   6559 	printf "%s" "${pkg}"
   6560 }
   6561 
   6562 mkpk_install()
   6563 {
   6564 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   6565 	CXXFLAGS=\${CFLAGS}
   6566 	LDFLAGS='-static --static -fcommon -s'
   6567 	PREFIX=/
   6568 	DESTDIR=/build
   6569 	export CFLAGS CXXFLAGS LDFLAGS DESTDIR
   6570 
   6571 	./configure --prefix="\${PREFIX}" \\
   6572 		--enable-static \\
   6573 		--disable-shared \\
   6574 		--disable-nls || exit 1
   6575 
   6576 	make ${JN} || exit 1
   6577 	make DESTDIR="\${DESTDIR}" install
   6578 }
   6579 !
   6580 		mkpk ${pkg}
   6581 		remove_dir ${G_SRC}/${pkg}
   6582 		unpack_pkg ${pkg} /
   6583 	) || exit 1
   6584 fi
   6585 timestamp=$(date +'%Y-%m-%d %T')
   6586 printf "%s\t%s\t%s\n" libgpg-error 1.47 "${timestamp}" >>${G_PKGDB}
   6587 end_substep
   6588 
   6589 # Needed fpr gnupg
   6590 begin_substep libassuan-2.5.5
   6591 if [ -e /lib/libassuan.a ]; then
   6592 	msg info "%s exists, skipping %s" /lib/libassuan.a ${pkg}
   6593 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   6594 	unpack_pkg ${pkg} /
   6595 else
   6596 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.bz2
   6597 	(
   6598 		cd_or_fail ${G_SRC}/${pkg}
   6599 
   6600 		cat <<! >MKPK
   6601 mkpk_name()
   6602 {
   6603 	printf "%s" "${pkg}"
   6604 }
   6605 
   6606 mkpk_install()
   6607 {
   6608 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   6609 	LDFLAGS='-static --static -fcommon -s'
   6610 	PREFIX=/
   6611 	DESTDIR=/build
   6612 	export CFLAGS LDFLAGS PREFIX DESTDIR
   6613 
   6614 	./configure --prefix="\${PREFIX}" \\
   6615 		--disable-shared \\
   6616 		--enable-static || exit 1
   6617 
   6618 	make ${JN} || exit 1
   6619 	make DESTDIR="\${DESTDIR}" install
   6620 }
   6621 !
   6622 		mkpk ${pkg}
   6623 		remove_dir ${G_SRC}/${pkg}
   6624 		unpack_pkg ${pkg} /
   6625 	) || exit 1
   6626 fi
   6627 timestamp=$(date +'%Y-%m-%d %T')
   6628 printf "%s\t%s\t%s\n" libassuan 2.5.5 "${timestamp}" >>${G_PKGDB}
   6629 end_substep
   6630 
   6631 # Needed fpr gnupg
   6632 begin_substep libgcrypt-1.10.2
   6633 if [ -e /lib/libgcrypt.a ]; then
   6634 	msg info "%s exists, skipping %s" /lib/libgcrypt.a ${pkg}
   6635 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   6636 	unpack_pkg ${pkg} /
   6637 else
   6638 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.bz2
   6639 	(
   6640 		cd_or_fail ${G_SRC}/${pkg}
   6641 
   6642 		cat <<! >MKPK
   6643 mkpk_name()
   6644 {
   6645 	printf "%s" "${pkg}"
   6646 }
   6647 
   6648 mkpk_install()
   6649 {
   6650 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   6651 	LDFLAGS='-static --static -fcommon -s'
   6652 	PREFIX=/
   6653 	DESTDIR=/build
   6654 	export CFLAGS LDFLAGS PREFIX DESTDIR
   6655 
   6656 	./configure --prefix="\${PREFIX}" \\
   6657 		--enable-static \\
   6658 		--disable-shared \\
   6659 		--enable-padlock-support || exit 1
   6660 
   6661 	make ${JN} || exit 1
   6662 	make DESTDIR="\${DESTDIR}" install-strip
   6663 }
   6664 !
   6665 		mkpk ${pkg}
   6666 		remove_dir ${G_SRC}/${pkg}
   6667 		unpack_pkg ${pkg} /
   6668 	) || exit 1
   6669 fi
   6670 timestamp=$(date +'%Y-%m-%d %T')
   6671 printf "%s\t%s\t%s\n" libgcrypt 1.10.2 "${timestamp}" >>${G_PKGDB}
   6672 end_substep
   6673 
   6674 # Needed fpr gnupg
   6675 begin_substep libksba-1.6.3
   6676 if [ -e /lib/libksba.a ]; then
   6677 	msg info "%s exists, skipping %s" /lib/libksba.a ${pkg}
   6678 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   6679 	unpack_pkg ${pkg} /
   6680 else
   6681 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.bz2
   6682 	(
   6683 		cd_or_fail ${G_SRC}/${pkg}
   6684 
   6685 		cat <<! >MKPK
   6686 mkpk_name()
   6687 {
   6688 	printf "%s" "${pkg}"
   6689 }
   6690 
   6691 mkpk_install()
   6692 {
   6693 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   6694 	LDFLAGS='-static --static -fcommon -s'
   6695 	PREFIX=''
   6696 	DESTDIR=/build
   6697 	export CFLAGS LDFLAGS PREFIX DESTDIR
   6698 
   6699 	./configure --prefix="\${PREFIX}" \\
   6700 		--disable-shared \\
   6701 		--enable-static || exit 1
   6702 
   6703 	make ${JN} || exit 1
   6704 	make install
   6705 }
   6706 !
   6707 		mkpk ${pkg}
   6708 		remove_dir ${G_SRC}/${pkg}
   6709 		unpack_pkg ${pkg} /
   6710 	) || exit 1
   6711 fi
   6712 timestamp=$(date +'%Y-%m-%d %T')
   6713 printf "%s\t%s\t%s\n" libksba 1.6.3 "${timestamp}" >>${G_PKGDB}
   6714 end_substep
   6715 
   6716 # Needed fpr gnupg
   6717 begin_substep npth-1.6
   6718 if [ -e /lib/libnpth.a ]; then
   6719 	msg info "%s exists, skipping %s" /lib/libnpth.a ${pkg}
   6720 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   6721 	unpack_pkg ${pkg} /
   6722 else
   6723 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.bz2
   6724 	(
   6725 		cd_or_fail ${G_SRC}/${pkg}
   6726 
   6727 		cat <<! >MKPK
   6728 mkpk_name()
   6729 {
   6730 	printf "%s" "${pkg}"
   6731 }
   6732 
   6733 mkpk_install()
   6734 {
   6735 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   6736 	LDFLAGS='-static --static -fcommon -s'
   6737 	PREFIX=''
   6738 	DESTDIR=/build
   6739 	export CFLAGS LDFLAGS PREFIX DESTDIR
   6740 
   6741 	./configure --prefix="\${PREFIX}" \\
   6742 		--disable-shared \\
   6743 		--enable-static || exit 1
   6744 
   6745 	make ${JN} || exit 1
   6746 	make install
   6747 }
   6748 !
   6749 		mkpk ${pkg}
   6750 		remove_dir ${G_SRC}/${pkg}
   6751 		unpack_pkg ${pkg} /
   6752 	) || exit 1
   6753 fi
   6754 timestamp=$(date +'%Y-%m-%d %T')
   6755 printf "%s\t%s\t%s\n" npth 1.6 "${timestamp}" >>${G_PKGDB}
   6756 end_substep
   6757 
   6758 # Needed fpr gnupg
   6759 begin_substep pinentry-1.2.1
   6760 if [ -x /bin/pinentry-tty ]; then
   6761 	msg info "%s exists, skipping %s" /bin/pinentry-tty ${pkg}
   6762 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   6763 	unpack_pkg ${pkg} /
   6764 else
   6765 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.bz2
   6766 	(
   6767 		cd_or_fail ${G_SRC}/${pkg}
   6768 
   6769 		cat <<! >MKPK
   6770 mkpk_name()
   6771 {
   6772 	printf "%s" "${pkg}"
   6773 }
   6774 
   6775 mkpk_install()
   6776 {
   6777 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   6778 	LDFLAGS='-static --static -fcommon -s'
   6779 	PREFIX=''
   6780 	DESTDIR=/build
   6781 	export CFLAGS LDFLAGS PREFIX DESTDIR
   6782 
   6783 	./configure --prefix="\${PREFIX}" \\
   6784 		--enable-pinentry-tty \\
   6785 		--enable-pinentry-qt=no \\
   6786 		--enable-pinentry-gtk2=no \\
   6787 		--enable-pinentry-gnome3=no \\
   6788 		--enable-pinentry-curses \\
   6789 		--enable-libsecret \\
   6790 		--enable-pinentry-fltk=no || exit 1
   6791 
   6792 	make ${JN} || exit 1
   6793 	make install
   6794 
   6795 	ln -sf pinentry-tty \${DESTDIR}\${PREFIX}/bin/pinentry
   6796 }
   6797 !
   6798 		mkpk ${pkg}
   6799 		remove_dir ${G_SRC}/${pkg}
   6800 		unpack_pkg ${pkg} /
   6801 	) || exit 1
   6802 fi
   6803 timestamp=$(date +'%Y-%m-%d %T')
   6804 printf "%s\t%s\t%s\n" pinentry 1.2.1 "${timestamp}" >>${G_PKGDB}
   6805 end_substep
   6806 
   6807 begin_substep gnupg-2.4.0
   6808 if [ -x /bin/gpg ]; then
   6809 	msg info "%s exists, skipping %s" /bin/gpg ${pkg}
   6810 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   6811 	unpack_pkg ${pkg} /
   6812 else
   6813 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.bz2
   6814 	(
   6815 		cd_or_fail ${G_SRC}/${pkg}
   6816 
   6817 		apply_patch final -Np1 -i \
   6818 			${G_PAT}/gnupg-alpine/0001-Include-sys-select.h-for-\
   6819 FD_SETSIZE.patch
   6820 
   6821 		cat <<! >MKPK
   6822 mkpk_name()
   6823 {
   6824 	printf "%s" "${pkg}"
   6825 }
   6826 
   6827 mkpk_install()
   6828 {
   6829 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   6830 	LDFLAGS='-static --static -fcommon -zmuldefs'
   6831 	PREFIX=''
   6832 	DESTDIR=/build
   6833 	export CFLAGS LDFLAGS PREFIX DESTDIR
   6834 	SED=/sucks/bin/sed
   6835 
   6836 	\${SED} -e '/noinst_SCRIPTS = gpg-zip/c '\\
   6837 'sbin_SCRIPTS += gpg-zip' -i tools/Makefile.in
   6838 
   6839 	# ,--- This is why pkg-config sucks: static linking requires to manually
   6840 	# |    add dependencies of dependencies. It is cleaner to just add
   6841 	# v    everything manually from the get-go.
   6842 	LIBS="\$(pkg-config --libs --static gnutls) -lffi" \\
   6843 	./configure --prefix="\${PREFIX}" \\
   6844 		--sysconfdir=/etc \\
   6845 		--disable-scdaemon \\
   6846 		--localstatedir=/var \\
   6847 		--docdir=/share/doc/${pkg} \\
   6848 		--disable-nls \\
   6849 		--enable-bzip2 || exit 1
   6850 
   6851 	make ${JN} || exit 1
   6852 	make install-strip
   6853 }
   6854 !
   6855 		mkpk ${pkg}
   6856 		remove_dir ${G_SRC}/${pkg}
   6857 		unpack_pkg ${pkg} /
   6858 	) || exit 1
   6859 fi
   6860 timestamp=$(date +'%Y-%m-%d %T')
   6861 printf "%s\t%s\t%s\n" gnupg 2.4.0 "${timestamp}" >>${G_PKGDB}
   6862 end_substep
   6863 
   6864 begin_substep gpgme-1.19.0
   6865 if [ -x /bin/gpgme-config ]; then
   6866 	msg info "%s exists, skipping %s" /bin/gpgme-config ${pkg}
   6867 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   6868 	unpack_pkg ${pkg} /
   6869 else
   6870 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.bz2
   6871 	(
   6872 		cd_or_fail ${G_SRC}/${pkg}
   6873 
   6874 		cat <<! >MKPK
   6875 mkpk_name()
   6876 {
   6877 	printf "%s" "${pkg}"
   6878 }
   6879 
   6880 mkpk_install()
   6881 {
   6882 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   6883 	LDFLAGS='-static --static -fcommon'
   6884 	PREFIX=''
   6885 	DESTDIR=/build
   6886 	export CFLAGS LDFLAGS PREFIX DESTDIR
   6887 
   6888 	./configure --prefix="\${PREFIX}" \\
   6889 		--enable-static \\
   6890 		--disable-shared \\
   6891 		--disable-gpg-test \\
   6892 		--enable-languages=cl,cpp || exit 1
   6893 
   6894 	make ${JN} || exit 1
   6895 	make install-strip
   6896 }
   6897 !
   6898 		mkpk ${pkg}
   6899 		remove_dir ${G_SRC}/${pkg}
   6900 		unpack_pkg ${pkg} /
   6901 	) || exit 1
   6902 fi
   6903 timestamp=$(date +'%Y-%m-%d %T')
   6904 printf "%s\t%s\t%s\n" gpgme 1.19.0 "${timestamp}" >>${G_PKGDB}
   6905 end_substep
   6906 
   6907 begin_substep opendoas-6.8.2
   6908 if [ -x /bin/doas ]; then
   6909 	msg info "%s exists, skipping %s" /bin/doas ${pkg}
   6910 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   6911 	unpack_pkg ${pkg} /
   6912 else
   6913 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   6914 	(
   6915 		cd_or_fail ${G_SRC}/${pkg}
   6916 
   6917 		cat <<! >MKPK
   6918 mkpk_name()
   6919 {
   6920 	printf "%s" "${pkg}"
   6921 }
   6922 
   6923 mkpk_install()
   6924 {
   6925 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   6926 	LDFLAGS='-static --static -fcommon -s'
   6927 	PREFIX=''
   6928 	DESTDIR=/build
   6929 	export CFLAGS LDFLAGS PREFIX DESTDIR
   6930 
   6931 	BINDIR=\${PREFIX}/bin \\
   6932 	SHAREDIR=\${PREFIX}/share \\
   6933 	MANDIR=\${PREFIX}/share/man \\
   6934 	./configure --prefix="\${PREFIX}" \\
   6935 		--with-timestamp || exit 1
   6936 
   6937 	make ${JN} || exit 1
   6938 	make DESTDIR="\${DESTDIR}" install
   6939 
   6940 	mkdir -p \${DESTDIR}/etc
   6941 
   6942 	# Adjust as necessary
   6943 	cat <<@ >\${DESTDIR}/etc/doas.conf
   6944 deny root
   6945 permit nopass setenv { PATH=/local/bin:/bin:/sucks/bin:/plan9/bin EDITOR } :wheel
   6946 @
   6947 
   6948 	chmod 4755 \${DESTDIR}\${PREFIX}/bin/doas
   6949 }
   6950 !
   6951 		mkpk ${pkg}
   6952 		remove_dir ${G_SRC}/${pkg}
   6953 		unpack_pkg ${pkg} /
   6954 	) || exit 1
   6955 fi
   6956 timestamp=$(date +'%Y-%m-%d %T')
   6957 printf "%s\t%s\t%s\n" opendoas 6.8.2 "${timestamp}" >>${G_PKGDB}
   6958 end_substep
   6959 
   6960 begin_substep pass-20230415
   6961 if [ -x /bin/pass ]; then
   6962 	msg info "%s exists, skipping %s" /bin/pass ${pkg}
   6963 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   6964 	unpack_pkg ${pkg} /
   6965 else
   6966 	(
   6967 		cd_or_fail ${G_SRC}/${pkg}
   6968 
   6969 		cat <<! >MKPK
   6970 mkpk_name()
   6971 {
   6972 	printf "%s" "${pkg}"
   6973 }
   6974 
   6975 mkpk_install()
   6976 {
   6977 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   6978 	LDFLAGS='-static --static -fcommon -s'
   6979 	PREFIX=''
   6980 	DESTDIR=/build
   6981 	export CFLAGS LDFLAGS PREFIX DESTDIR
   6982 	SED=/sucks/bin/sed
   6983 
   6984 	\${SED} -i -e 's,\\<encrypt\\>,pass_encrypt,g' pass.c
   6985 
   6986 	cat <<@ >config.mk
   6987 PREFIX=\${PREFIX}
   6988 MANPREFIX=\${PREFIX}/share/man
   6989 
   6990 CFLAGS=\${CFLAGS} -DVERSION=\\"\\\${VERSION}\\"
   6991 LDFLAGS=\${LDFLAGS}
   6992 
   6993 LIBS += -lgpgme -lassuan -lgpg-error
   6994 @
   6995 	make ${JN} || exit 1
   6996 	make install
   6997 }
   6998 !
   6999 		mkpk ${pkg}
   7000 		#remove_dir ${G_SRC}/${pkg}
   7001 		unpack_pkg ${pkg} /
   7002 	) || exit 1
   7003 fi
   7004 timestamp=$(date +'%Y-%m-%d %T')
   7005 printf "%s\t%s\t%s\n" pass 20230415 "${timestamp}" >>${G_PKGDB}
   7006 end_substep
   7007 
   7008 # Don't need this if we are going for exclusively root-usable script
   7009 # begin_substep galeb-utils-20220717
   7010 # if [ ! -x /bin/umountall ]; then
   7011 # 	(
   7012 # 		cd_or_fail ${G_SRC}/${pkg}
   7013 # 
   7014 # 		remove_file remountroot
   7015 # 		remove_file umountall
   7016 # 
   7017 # 		cc -Os -pipe -static --static -fcommon -o remountroot \
   7018 # 			remountroot.c || exit 1
   7019 # 		cc -Os -pipe -static --static -fcommon -o umountall \
   7020 # 			umountall.c || exit 1
   7021 # 
   7022 # 		cp_or_fail remountroot /bin/remountroot
   7023 # 		cp_or_fail umountall /bin/umountall
   7024 # 	) || exit 1
   7025 # fi
   7026 # end_substep
   7027 
   7028 # Needed for rsync
   7029 begin_substep xxhash-0.8.1
   7030 if [ -x /sucks/lib/libxxhash.so.0.8.1 ]; then
   7031 	msg info "%s exists, skipping %s" /sucks/lib/libxxhash.so.0.8.1 ${pkg}
   7032 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   7033 	unpack_pkg ${pkg} /
   7034 else
   7035 	extract_pkg ${G_SRC} xxHash-0.8.1 ${pkg}.tar.gz ${pkg}
   7036 	(
   7037 		cd_or_fail ${G_SRC}/${pkg}
   7038 
   7039 		cat <<! >MKPK
   7040 mkpk_name()
   7041 {
   7042 	printf "%s" "${pkg}"
   7043 }
   7044 
   7045 mkpk_install()
   7046 {
   7047 	CFLAGS='-Os -pipe'
   7048 	LDFLAGS='-s'
   7049 	PREFIX=/sucks
   7050 	DESTDIR=/build
   7051 	SED=/sucks/bin/sed
   7052 	export CFLAGS LDFLAGS PREFIX DESTDIR SED
   7053 
   7054 	make ${JN} PREFIX="\${PREFIX}" DESTDIR="\${DESTDIR}" SED="\${SED}" \\
   7055 		-C . install || exit 1
   7056 }
   7057 !
   7058 		mkpk ${pkg}
   7059 		remove_dir ${G_SRC}/${pkg}
   7060 		unpack_pkg ${pkg} /
   7061 	) || exit 1
   7062 fi
   7063 timestamp=$(date +'%Y-%m-%d %T')
   7064 printf "%s\t%s\t%s\n" xxhash 0.8.1 "${timestamp}" >>${G_PKGDB}
   7065 end_substep
   7066  
   7067 # begin_substep cmarkgfm-20221027
   7068 # if [ -x /bin/cmarkgfm ]; then
   7069 # 	msg info "%s exists, skipping %s" /bin/cmarkgfm ${pkg}
   7070 # elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   7071 # 	unpack_pkg ${pkg} /
   7072 # else
   7073 # 	extract_pkg ${G_SRC} cmarkgfm-2022.10.27 ${pkg}.tar.gz ${pkg}
   7074 # 	(
   7075 # 		cd_or_fail ${G_SRC}/${pkg}
   7076 # 
   7077 # 		cat <<! >MKPK
   7078 # mkpk_name()
   7079 # {
   7080 # 	printf "%s" "${pkg}"
   7081 # }
   7082 # 
   7083 # mkpk_install()
   7084 # {
   7085 # 	python3 setup.py build
   7086 # 	sh
   7087 # 	exit 1
   7088 # }
   7089 # !
   7090 # 		mkpk ${pkg}
   7091 # 		remove_dir ${G_SRC}/${pkg}
   7092 # 		unpack_pkg ${pkg} /
   7093 # 	) || exit 1
   7094 # fi
   7095 # timestamp=$(date +'%Y-%m-%d %T')
   7096 # printf "%s\t%s\t%s\n" cmarkgfm 20221027 "${timestamp}" >>${G_PKGDB}
   7097 # end_substep
   7098 
   7099 # Documentation for rsync requires Python manpage generator (wow, is it really
   7100 # so hard to write manpage directly?), which would require the above cmarkgfm
   7101 # package or commonmark (which is obsolete according to its Github repo), and a
   7102 # number of other packages for Python (wheel, cffi, SSL module...)
   7103 # - Ultimately, it is perhaps better to leave manpage generation to the
   7104 #   galeb-mkfiles package, and have it depend on some Docbook -> manpage
   7105 #   generator, and solve this there.
   7106 begin_substep rsync-3.2.7
   7107 if [ -x /bin/rsync ]; then
   7108 	msg info "%s exists, skipping %s" /bin/rsync ${pkg}
   7109 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   7110 	unpack_pkg ${pkg} /
   7111 else
   7112 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   7113 	(
   7114 		cd_or_fail ${G_SRC}/${pkg}
   7115 
   7116 		cat <<! >MKPK
   7117 mkpk_name()
   7118 {
   7119 	printf "%s" "${pkg}"
   7120 }
   7121 
   7122 mkpk_install()
   7123 {
   7124 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   7125 	LDFLAGS='-static --static -fcommon -s'
   7126 	PREFIX=''
   7127 	DESTDIR=/build
   7128 	export CFLAGS LDFLAGS PREFIX DESTDIR
   7129 
   7130 
   7131 	./configure --prefix="\${PREFIX}" \\
   7132 		--disable-md2man \\
   7133 		--disable-lz4 || exit 1
   7134 	make ${JN} || exit 1
   7135 	make install
   7136 }
   7137 !
   7138 		mkpk ${pkg}
   7139 		remove_dir ${G_SRC}/${pkg}
   7140 		unpack_pkg ${pkg} /
   7141 	) || exit 1
   7142 fi
   7143 timestamp=$(date +'%Y-%m-%d %T')
   7144 printf "%s\t%s\t%s\n" rsync 3.2.7 "${timestamp}" >>${G_PKGDB}
   7145 end_substep
   7146 
   7147 begin_substep shim-15.7
   7148 if [ -e /share/shim-15.7/shimx64.efi ]; then
   7149 	msg info "%s exists, skipping %s" /share/shim-15.7/shimx64.efi \
   7150 		${pkg}
   7151 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   7152 	unpack_pkg ${pkg} /
   7153 else
   7154 	(
   7155 		cd_or_fail ${G_SRC}/${pkg}
   7156 
   7157 		git config --global --add safe.directory "${G_SRC}/${pkg}"
   7158 		git config --global protocol.file.allow always
   7159 		git checkout 15.7
   7160 		git submodule init
   7161 		git config submodule.gnu-efi.url "${G_SRC}/${pkg}/rhboot-gnu-efi"
   7162 		git submodule update || exit 1
   7163 
   7164 		git apply ${G_PAT}/shim-galeb/shim-isystem.patch
   7165 
   7166 		cd gnu-efi
   7167 		git apply ${G_PAT}/shim-galeb/gnu-efi-isystem.patch
   7168 		cd - >/dev/null
   7169 
   7170 		cat <<! >MKPK
   7171 mkpk_name()
   7172 {
   7173 	printf "%s" "${pkg}"
   7174 }
   7175 
   7176 mkpk_install()
   7177 {
   7178 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   7179 	LDFLAGS='-static --static -fcommon -s'
   7180 	PREFIX=''
   7181 	DESTDIR=/build
   7182 	export CFLAGS LDFLAGS PREFIX DESTDIR
   7183 
   7184 	if [ -e \${HOME}/.gitconfig ]; then
   7185 		mv \${HOME}/.gitconfig \${HOME}/.gitconfig-old
   7186 	fi
   7187 
   7188 	mkdir -p \${HOME}
   7189 	touch \${HOME}/.gitconfig
   7190 	git config --global --add safe.directory "/${pkg}"
   7191 
   7192 	make ${JN} EFIDIR='GALEB' || exit 1
   7193 	make DATATARGETDIR=/share/${pkg} DESTDIR=\${DESTDIR} install-as-data
   7194 	install -Dm0644 BUILDING	\${DESTDIR}/share/doc/${pkg}
   7195 	install -Dm0644 README.md	\${DESTDIR}/share/doc/${pkg}
   7196 	install -Dm0644 README.fallback \${DESTDIR}/share/doc/${pkg}
   7197 	install -Dm0644 README.tpm	\${DESTDIR}/share/doc/${pkg}
   7198 	install -Dm0644 TODO		\${DESTDIR}/share/doc/${pkg}
   7199 
   7200 	rm \${HOME}/.gitconfig
   7201 	if [ -e \${HOME}/.gitconfig-old ]; then
   7202 		mv \${HOME}/.gitconfig-old \${HOME}/.gitconfig
   7203 	fi
   7204 }
   7205 !
   7206 		mkpk ${pkg}
   7207 		#remove_dir ${G_SRC}/${pkg}
   7208 		unpack_pkg ${pkg} /
   7209 	) || exit 1
   7210 fi
   7211 timestamp=$(date +'%Y-%m-%d %T')
   7212 printf "%s\t%s\t%s\n" shim 15.7 "${timestamp}" >>${G_PKGDB}
   7213 end_substep
   7214 
   7215 begin_substep libevent-2.1.12
   7216 if [ -e /lib/libevent.a ]; then
   7217 	msg info "%s exists, skipping %s" /lib/libevent.a ${pkg}
   7218 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   7219 	unpack_pkg ${pkg} /
   7220 else
   7221 	extract_pkg ${G_SRC} libevent-2.1.12-stable ${pkg}.tar.gz ${pkg}
   7222 	(
   7223 		cd_or_fail ${G_SRC}/${pkg}
   7224 
   7225 		cat <<! >MKPK
   7226 mkpk_name()
   7227 {
   7228 	printf "%s" "${pkg}"
   7229 }
   7230 
   7231 mkpk_install()
   7232 {
   7233 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   7234 	LDFLAGS='-static --static -fcommon -s'
   7235 	PREFIX=''
   7236 	DESTDIR=/build
   7237 	export CFLAGS LDFLAGS PREFIX DESTDIR
   7238 	SED=/sucks/bin/sed
   7239 
   7240 	./configure --prefix="\${PREFIX}" \\
   7241 		--enable-static \\
   7242 		--disable-shared || exit 1
   7243 
   7244 	# Needs to be hacked in?
   7245 	\${SED} -i 's/\(-lssl -lcrypto\)/\1 -lz/g' Makefile
   7246 
   7247 	make V=1 ${JN} || exit 1
   7248 	make install
   7249 }
   7250 !
   7251 		mkpk ${pkg}
   7252 		remove_dir ${G_SRC}/${pkg}
   7253 		unpack_pkg ${pkg} /
   7254 	) || exit 1
   7255 fi
   7256 timestamp=$(date +'%Y-%m-%d %T')
   7257 printf "%s\t%s\t%s\n" libevent 2.1.12 "${timestamp}" >>${G_PKGDB}
   7258 end_substep
   7259 
   7260 begin_substep tmux-3.3a
   7261 if [ -x /bin/tmux ]; then
   7262 	msg info "%s exists, skipping %s" /bin/tmux ${pkg}
   7263 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   7264 	unpack_pkg ${pkg} /
   7265 else
   7266 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   7267 	(
   7268 		cd_or_fail ${G_SRC}/${pkg}
   7269 
   7270 		cat <<! >MKPK
   7271 mkpk_name()
   7272 {
   7273 	printf "%s" "${pkg}"
   7274 }
   7275 
   7276 mkpk_install()
   7277 {
   7278 	CFLAGS='-Os -pipe -static --static -fcommon -fPIC'
   7279 	LDFLAGS='-static --static -fcommon'
   7280 	PREFIX=''
   7281 	DESTDIR=/build
   7282 	export CFLAGS LDFLAGS PREFIX DESTDIR
   7283 
   7284 	./configure --prefix="\${PREFIX}" \\
   7285 		--enable-static \\
   7286 		--datarootdir=\${PREFIX}/share || exit 1
   7287 
   7288 	make ${JN} || exit 1
   7289 	make install-strip
   7290 }
   7291 !
   7292 		mkpk ${pkg}
   7293 		remove_dir ${G_SRC}/${pkg}
   7294 		unpack_pkg ${pkg} /
   7295 	) || exit 1
   7296 fi
   7297 timestamp=$(date +'%Y-%m-%d %T')
   7298 printf "%s\t%s\t%s\n" tmux 3.3a "${timestamp}" >>${G_PKGDB}
   7299 end_substep
   7300 
   7301 begin_substep tree-2.1.0
   7302 if [ -x /bin/tree ]; then
   7303 	msg info "%s exists, skipping %s" /bin/tree ${pkg}
   7304 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   7305 	unpack_pkg ${pkg} /
   7306 else
   7307 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tgz
   7308 	(
   7309 		cd_or_fail ${G_SRC}/${pkg}
   7310 
   7311 		cat <<! >MKPK
   7312 mkpk_name()
   7313 {
   7314 	printf "%s" "${pkg}"
   7315 }
   7316 
   7317 mkpk_install()
   7318 {
   7319 	CFLAGS='-Os -pipe -static --static -fcommon'
   7320 	LDFLAGS='-static --static -fcommon -s'
   7321 	PREFIX=''
   7322 	DESTDIR=/build
   7323 	export CFLAGS LDFLAGS PREFIX DESTDIR
   7324 	SED=/sucks/bin/sed
   7325 
   7326 	\${SED} -i -e 's,/usr/local,'\${DESTDIR}',' \\
   7327 		-e '/^MANDIR/s,/man,/share&,' \\
   7328 		-e "/^CFLAGS/s,\\(CFLAGS=\\).*,\\1\${CFLAGS}," \\
   7329 		-e "/^LDFLAGS/s,\\(LDFLAGS=\\).*,\\1\${LDFLAGS}," \\
   7330 		Makefile
   7331 	make ${JN} || exit 1
   7332 	make install
   7333 }
   7334 !
   7335 		mkpk ${pkg}
   7336 		remove_dir ${G_SRC}/${pkg}
   7337 		unpack_pkg ${pkg} /
   7338 	) || exit 1
   7339 fi
   7340 timestamp=$(date +'%Y-%m-%d %T')
   7341 printf "%s\t%s\t%s\n" tree 2.1.0 "${timestamp}" >>${G_PKGDB}
   7342 end_substep
   7343 
   7344 # Only needed for wpa_supplicant below
   7345 begin_substep libnl-3.7.0
   7346 if [ -e /sucks/lib/libnl-3.so.200.26.0 ]; then
   7347 	msg info "%s exists, skipping %s" /sucks/lib/libnl-3.so.200.26.0 ${pkg}
   7348 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   7349 	unpack_pkg ${pkg} /
   7350 else
   7351 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   7352 	(
   7353 		cd_or_fail ${G_SRC}/${pkg}
   7354 
   7355 		cat <<! >MKPK
   7356 mkpk_name()
   7357 {
   7358 	printf "%s" "${pkg}"
   7359 }
   7360 
   7361 mkpk_install()
   7362 {
   7363 	CFLAGS='-Os -pipe'
   7364 	LDFLAGS=''
   7365 	DESTDIR=/build
   7366 	FLEX=/${TLD}/bin/flex 
   7367 	export CFLAGS LDFLAGS DESTDIR FLEX
   7368 	SED=/sucks/bin/sed
   7369 
   7370 	autoreconf -vif
   7371 
   7372 	#\${SED} -i '/<linux\/if_bridge.h>/i#define _LINUX_ING_H' \\
   7373 	#	lib/route/link/bridge.c
   7374 
   7375 	./configure --prefix=/sucks \\
   7376 		--sysconfdir=/etc \\
   7377 		--disable-static || exit 1
   7378 
   7379 	make ${JN} || exit 1
   7380 	make install-strip
   7381 }
   7382 !
   7383 		mkpk ${pkg}
   7384 		remove_dir ${G_SRC}/${pkg}
   7385 		unpack_pkg ${pkg} /
   7386 	) || exit 1
   7387 fi
   7388 timestamp=$(date +'%Y-%m-%d %T')
   7389 printf "%s\t%s\t%s\n" libnl 3.7.10 "${timestamp}" >>${G_PKGDB}
   7390 end_substep
   7391 
   7392 begin_substep wpa_supplicant-2.10
   7393 if [ -x /sucks/bin/wpa_supplicant ]; then
   7394 	msg info "%s exists, skipping %s" /sucks/bin/wpa_supplicant ${pkg}
   7395 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   7396 	unpack_pkg ${pkg} /
   7397 else
   7398 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   7399 	(
   7400 		cd_or_fail ${G_SRC}/${pkg}
   7401 
   7402 		#Get the filthy dbus and systemd files out!
   7403 		cp_or_fail ${G_FIL}/wpa_supplicant-galeb/wpa_supplicant.config \
   7404 			${G_SRC}/${pkg}/wpa_supplicant/.config
   7405 		cp_or_fail ${G_FIL}/wpa_supplicant-galeb/Makefile \
   7406 			${G_SRC}/${pkg}/wpa_supplicant/Makefile
   7407 
   7408 		apply_patch final -Np0 -i \
   7409 			${G_PAT}/wpa_supplicant-void/wpa_supplicant-2.8-void-\
   7410 patch-src_utils_eloop_c.diff
   7411 
   7412 		cat <<! >MKPK
   7413 mkpk_name()
   7414 {
   7415 	printf "%s" "${pkg}"
   7416 }
   7417 
   7418 mkpk_install()
   7419 {
   7420 	CFLAGS='-Os -pipe'
   7421 	LDFLAGS='-s'
   7422 	LIBS='-lz'
   7423 	DESTDIR=/build
   7424 	PREFIX=/sucks
   7425 	export CFLAGS LDFLAGS LIBS DESTDIR PREFIX
   7426 	SED=/sucks/bin/sed
   7427 
   7428 	cd wpa_supplicant
   7429 
   7430 	\${SED} -i '/DBUS/s/^/#/' defconfig
   7431 
   7432 	make ${JN} || exit 1
   7433 	make DESTDIR="\${DESTDIR}" PREFIX="\${PREFIX}" install
   7434 
   7435 	mkdir -p "\${DESTDIR}/var/run/wpa_supplicant"
   7436 	mkdir -p "\${DESTDIR}/etc"
   7437 	cat <<@ >"\${DESTDIR}/etc/wpa_supplicant.conf"
   7438 ctrl_interface=DIR=/var/run/wpa_supplicant
   7439 update_config=1
   7440 @
   7441 }
   7442 !
   7443 		mkpk ${pkg}
   7444 		remove_dir ${G_SRC}/${pkg}
   7445 		unpack_pkg ${pkg} /
   7446 	) || exit 1
   7447 fi
   7448 timestamp=$(date +'%Y-%m-%d %T')
   7449 printf "%s\t%s\t%s\n" wpa_supplicant 2.10 "${timestamp}" >>${G_PKGDB}
   7450 end_substep
   7451 
   7452 begin_substep mkinitramfs-0.4
   7453 if [ -x /bin/mkinitramfs ]; then
   7454 	msg info "%s exists, skipping %s" /bin/mkinitramfs ${pkg}
   7455 elif [ -e ${G_SPKG}/${pkg}.tar.xz ]; then
   7456 	unpack_pkg ${pkg} /
   7457 else
   7458 	extract_pkg ${G_SRC} galeb-mkinitramfs-v0.4 ${pkg}.tar.gz ${pkg}
   7459 	(
   7460 		cd_or_fail ${G_SRC}/${pkg}
   7461 		cat <<! >MKPK
   7462 mkpk_name()
   7463 {
   7464 	printf "%s" "${pkg}"
   7465 }
   7466 
   7467 mkpk_install()
   7468 {
   7469 	FALLBACKVER=0.4
   7470 	DESTDIR=/build
   7471 	export FALLBACKVER DESTDIR
   7472 
   7473 	mk
   7474 }
   7475 !
   7476 		mkpk ${pkg}
   7477 		remove_dir ${G_SRC}/${pkg}
   7478 		unpack_pkg ${pkg} /
   7479 	) || exit 1
   7480 fi
   7481 timestamp=$(date +'%Y-%m-%d %T')
   7482 printf "%s\t%s\t%s\n" mkinitramfs 0.4 "${timestamp}" >>${G_PKGDB}
   7483 end_substep
   7484 
   7485 end_step # packages
   7486 
   7487 # X can be built from within Galeb if needed
   7488 # begin_step X
   7489 # 
   7490 # totalsubsteps=100
   7491 # substep=1
   7492 # 
   7493 # begin_substep pixman-0.40.0
   7494 # if [ -x /sucks/lib/libpixman-1.so.0.40.0 ]; then
   7495 # 	msg info "%s exists, skipping %s" /sucks/lib/libpixman-1.so.0.40.0 \
   7496 # 		${pkg}
   7497 # elif [ -e ${G_SPKG}/X/${pkg}.tar.xz ]; then
   7498 # 	unpack_pkg X/${pkg} /
   7499 # else
   7500 # 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.gz
   7501 # 	(
   7502 # 		cd_or_fail ${G_SRC}/${pkg}
   7503 # 
   7504 # 		cat <<! >MKPK
   7505 # mkpk_name()
   7506 # {
   7507 # 	printf "%s" "${pkg}"
   7508 # }
   7509 # 
   7510 # mkpk_install()
   7511 # {
   7512 # 	CFLAGS='-Os -pipe'
   7513 # 	LDFLAGS=''
   7514 # 	DESTDIR=/build
   7515 # 	export CFLAGS LDFLAGS DESTDIR
   7516 # 
   7517 # 	mkdir b
   7518 # 	cd b
   7519 # 	meson --prefix=/sucks .. || exit 1
   7520 # 	ninja ${JN} || exit 1
   7521 # 	ninja install
   7522 # }
   7523 # !
   7524 # 		mkpk ${pkg}
   7525 # 		mv_or_fail ${G_SPKG}/${pkg}.* ${G_SPKG}/X/
   7526 # 		remove_dir ${G_SRC}/${pkg}
   7527 # 		unpack_pkg X/${pkg} /
   7528 # 	) || exit 1
   7529 # fi
   7530 # end_substep
   7531 # 
   7532 # end_step # X
   7533 
   7534 begin_step Linux
   7535 
   7536 totalsubsteps=1
   7537 substep=1
   7538 
   7539 begin_substep linux-6.2.10
   7540 	extract_pkg ${G_SRC} ${pkg} ${pkg}.tar.xz
   7541 	remove_file ${G_SRC}/linux
   7542 	link_if_ne ${pkg} ${G_SRC}/linux
   7543 	cd_or_fail ${G_SRC}/${pkg}
   7544 
   7545 	if [ -n "${INCLUDE_FIRMWARE}" ]; then
   7546 		msg info "Cloning %s" \
   7547 	https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
   7548 
   7549 		git_clone linux-firmware \
   7550 	https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git \
   7551 		1
   7552 
   7553 		link_if_ne linux-firmware ${G_SRC}/firmware
   7554 		remove_dir ${GR}/lib/firmware
   7555 		check_dir ${GR}/lib/firmware
   7556 
   7557 		msg info "Copying firmware"
   7558 		eval rsync -arv --numeric-ids \
   7559 			${INCLUDE_FIRMWARE} \
   7560 			--exclude="*" \
   7561 			${G_SRC}/firmware/ ${GR}/lib/firmware/ || exit 1
   7562 	fi
   7563 
   7564 	cp_or_fail ${G_FIL}/linux/config-20230417-gl22 .config
   7565 	HOSTLDLIBS=-lz
   7566 	export HOSTLDLIBS
   7567 
   7568 msg warn "Next, configure Linux by using:                                 "
   7569 msg warn "       mv /bin/ln /bin/_ln                                      "
   7570 msg warn "       export PATH=/local/bin:/bin:/sucks/bin:/tools/bin        "
   7571 msg warn "       make LEX=/${TLD}/bin/flex menuconfig   &&  \\\\              "
   7572 msg warn "       make CFLAGS=-fPIE LDFLAGS=-fPIE LEX=/${TLD}/bin/flex     \\\\"
   7573 msg warn "           BC=/${TLD}/bin/bc bzImage modules modules_install && \\\\"
   7574 msg warn "       cp arch/x86/boot/bzImage /boot/vmlinuz && \\\\              "
   7575 msg warn "       cp System.map /boot/                   && \\\\              "
   7576 msg warn "       cp .config /boot/config                                  "
   7577 msg warn "       mv /bin/_ln /bin/ln                                      "
   7578 msg warn "You might want to then use efibootmgr to add efistub to EFI.    "
   7579 msg warn "See BOOTING.                                                    "
   7580 
   7581 	PATH=/local/bin:/bin:/sucks/bin:/plan9/bin:/tools/bin
   7582 	export PATH
   7583 	/bin/mksh -l +h
   7584 
   7585 	unset HOSTLDLIBS
   7586 end_substep
   7587 
   7588 end_step
   7589 
   7590 cd /
   7591 04-finale.sh