commit: e85522d706dcd4060342e0f73262332429cda556
parent 189d930c5e1e6559aa7ab90be3bfd172781209cc
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sun, 15 Dec 2024 21:23:49 +0100
put unpacked tarballs and stubs into ./src
Diffstat:
8 files changed, 30 insertions(+), 20 deletions(-)
diff --git a/init.c b/init.c
@@ -5,7 +5,7 @@
#define _POSIX_C_SOURCE 200809L
#define _XOPEN_SOURCE 700 // mknod
-#include "loksh_tcc.h"
+#include "src/loksh_tcc.h"
#include <errno.h>
#include <fcntl.h> // O_RDONLY
@@ -46,7 +46,7 @@ exec_wait(char *args[])
static int
build_loksh()
{
- chdir("/loksh-7.6");
+ chdir("/src/loksh-7.6");
fprintf(stderr, "Compiling loksh-7.6\n");
diff --git a/init.sh b/init.sh
@@ -18,7 +18,7 @@ profile_export() {
}
build_awk() {
- cd /awk-*/
+ cd /src/awk-*/
yacc -d -b awkgram awkgram.y
pdpmake -e HOSTCC=$CC
cp -p a.out /bin/awk
@@ -27,7 +27,7 @@ build_awk() {
build_stubs() {
for i in ls grep cp getty mount
do
- $CC $CFLAGS -o "/bin/$i" "/${i}-stub.c" || die "Failed compiling $i stub"
+ $CC $CFLAGS -o "/bin/$i" "/src/${i}-stub.c" || die "Failed compiling $i stub"
done
}
@@ -38,12 +38,12 @@ build_stubs_symlinks() {
}
build_pdpmake() {
- cd /pdpmake-*/
+ cd /src/pdpmake-*/
$CC $CFLAGS -o /bin/pdpmake *.c
}
build_bzip2() {
- cd /bzip2-*/
+ cd /src/bzip2-*/
pdpmake -f Makefile-libbz2_so CC=$CC || die
ln -s libbz2.so.1.0.8 libbz2.so
pdpmake -f Makefile bzip2 CC=$CC || die
@@ -58,7 +58,7 @@ build_bzip2() {
}
build_zlib_libs() {
- cd /zlib-*/
+ cd /src/zlib-*/
./configure </dev/null
# generate crc32.h
@@ -70,7 +70,7 @@ build_zlib_libs() {
}
build_pigz() {
- cd /pigz-*/
+ cd /src/pigz-*/
# Makefile placeholders for zopfli/deflate.h and zopfli/util.h
touch deflate.h util.h
@@ -86,7 +86,7 @@ build_pigz() {
}
build_hierloom_devtools() {
- cd /heirloom-devtools-*/
+ cd /src/heirloom-devtools-*/
for cmd in lex m4
do
pdpmake "$cmd"/Makefile
@@ -97,7 +97,7 @@ build_hierloom_devtools() {
}
build_hierloom() {
- cd /heirloom-0*/
+ cd /src/heirloom-0*/
mkdir -p /usr/5bin /usr/5lib /etc/default /usr/5bin/s42 /usr/5bin/posix2001 /usr/ucb/
for cmd in libcommon diff tar sort comm find stty
do
@@ -111,7 +111,7 @@ build_hierloom() {
}
build_utils_std() {
- cd /utils-std-*/
+ cd /src/utils-std-*/
oldpath="$PATH"
export PATH="$PATH:$PWD/cmd/"
@@ -127,7 +127,7 @@ build_utils_std() {
}
build_sbase() {
- cd /sbase-*/
+ cd /src/sbase-*/
for i in ed sed
do
$CC -D_DEFAULT_SOURCE -D_NETBSD_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -D_FILE_OFFSET_BITS=64 -Os -o "/bin/${i}" "${i}.c" libutil/*.c libutf/*.c
@@ -135,7 +135,7 @@ build_sbase() {
}
build_oyacc() {
- cd /yacc-oyacc-*/
+ cd /src/yacc-oyacc-*/
# config.h wrote in make-root.sh due to lack of cat
diff --git a/make-root.sh b/make-root.sh
@@ -19,11 +19,11 @@ tarballs="
"
local_files="
init.sh
- ls-stub.c
- grep-stub.c
- cp-stub.c
- getty-stub.c
- mount-stub.c
+ src/ls-stub.c
+ src/grep-stub.c
+ src/cp-stub.c
+ src/getty-stub.c
+ src/mount-stub.c
"
distfiles="
make-4.4.1.tar.gz
@@ -87,12 +87,16 @@ fi
mkdir -p "$out_base" || die "Failed: mkdir $out_base"
cd "$out_base" || die "Failed: cd $out_base"
+mkdir -p src
+
+cd "${out_base}/src"
for i in $tarballs; do
tar xof "${WORKDIR}/distfiles/$i" || die "Failed extracting $i"
done
+cd -
for i in $local_files; do
- cp "${WORKDIR}/$i" ./ || die "Failed copying $i"
+ cp "${WORKDIR}/$i" ./"$i" || die "Failed copying $i"
done
if ! test "${EXCLUDE_EXTRAS:+y}" = "y"; then
@@ -146,6 +150,8 @@ done
# Allows to shave off ~9.1M from the binary seed
rm usr/lib/libc.a
+cd "${out_base}/src"
+
# For CLOCK_MONOTONIC and clock_gettime
sed -i -e '1a#include <time.h>' loksh-*/c_sh.c || die "Failed patching loksh/c_sh.c"
# For u_char
@@ -154,9 +160,11 @@ sed -i -e '1a#include <sys/types.h>' loksh-*/edit.c || die "Failed patching loks
sed -i -e '1a#include <stdint.h>' loksh-*/table.h || die "Failed patching loksh/table.h"
sed -i -e '1a#include <limits.h>' -e 's;_PW_NAME_LEN;LOGIN_NAME_MAX;' loksh-*/main.c || die "Failed patching loksh/main.c"
+ln -s loksh "${out_base}/bin/sh"
+
gen_loksh_tcc_h > loksh_tcc.h
-ln -s loksh bin/sh
+cd "${out_base}/src"
oyacc=$(echo ./yacc-oyacc-*/)
cat >"${oyacc}/config.h" <<EOF
@@ -244,6 +252,8 @@ done
rm -r awk-*/testdir || die
+cd "${out_base}/"
+
deblob -n -j "${WORKDIR}"/make-root-deblob.json || die
if command -v jq >/dev/null; then
diff --git a/cp-stub.c b/src/cp-stub.c
diff --git a/getty-stub.c b/src/getty-stub.c
diff --git a/grep-stub.c b/src/grep-stub.c
diff --git a/ls-stub.c b/src/ls-stub.c
diff --git a/mount-stub.c b/src/mount-stub.c