summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach van Rijn <me@zv.io>2023-09-19 14:24:30 -0500
committerZach van Rijn <me@zv.io>2023-09-19 14:24:30 -0500
commit3f43b0d62e71aaa626a287aabdbe47a465a38929 (patch)
tree4a0a12eba348444973738ff4d7e7f670e9a24879
parent135bec19fccffe70a9a180bb4cf8474359b8ead6 (diff)
downloadbootstrap-3f43b0d62e71aaa626a287aabdbe47a465a38929.tar.gz
bootstrap-3f43b0d62e71aaa626a287aabdbe47a465a38929.tar.bz2
bootstrap-3f43b0d62e71aaa626a287aabdbe47a465a38929.tar.xz
bootstrap-3f43b0d62e71aaa626a287aabdbe47a465a38929.zip
Miscellaneous updates/improvements. Fixes #1.
-rwxr-xr-xbootstrap46
-rwxr-xr-xsetup-abuild20
2 files changed, 45 insertions, 21 deletions
diff --git a/bootstrap b/bootstrap
index 42db383..009e2f9 100755
--- a/bootstrap
+++ b/bootstrap
@@ -5,7 +5,7 @@
# Purpose : Bootstraps Adélie from source for any architecture.
# Authors : Zach van Rijn <me@zv.io>
# License : MIT
-# Revision : 20221225
+# Revision : 20230919
#===============================================================
#===============================================================
@@ -37,7 +37,7 @@
#
# * One-click bootstrap. Just start the script and walk away.
#
-# $ ./bootstrap.sh ppc64 /path/to/new/scratch/dir
+# $ ./bootstrap ppc64 /path/to/new/scratch/dir
#
# * Can be done without root privileges: no 'chroot(8)'.
#
@@ -334,6 +334,9 @@ case "${1}" in
riscv64) m=riscv64: ; q=riscv64 ; ;;
x86_64) m=x86_64: ; q=x86_64 ; ;;
pmmx) m=i586: ; q=i386 ; ;;
+
+ s390x) m=s390x: ; q=s390x ; ;;
+
*) usage ;;
esac
shift;
@@ -405,7 +408,7 @@ if ! test -d "${MTOOLS}"/sys/emus/bin; then # FIXME: no hard code
test -d bootstrap \
|| git clone ${CHAINS}/bootstrap.git;
cd bootstrap;
- git checkout 6834829d499e823e776368ce02691be2caac1727;
+ git checkout f7a470d4a6a56991af44d64419d59d6b58130429;
## seed rootfs
#
@@ -485,8 +488,21 @@ if ! test -d "${MTOOLS}"/sys/tc/native; then # FIXME: no hard code
##
# Ensure consistent 'config.mak' for all toolchain builds.
+ # Everything remains the same except for build/host/target.
#
cp "${MTOOLS}"/config.mak config.mak;
+ sed -i \
+ -E 's/(--(build|host|target)=)[-_[:alnum:]]+(\s|$)/\1 /g' \
+ config.mak \
+ ;
+ sed -i \
+ -E 's/(--(build|host|target)=)/\1__TARGET__/g' \
+ config.mak \
+ ;
+ sed -i \
+ -e "s/__TARGET__/${TARGET}/g" \
+ config.mak \
+ ;
## musl toolchains
#
@@ -659,13 +675,14 @@ fi
##
# Some paths are hard-coded into various binaries. Since we need
-# to "relocate" everything to run at '/', we can decompress the
-# '.tar' file and perform the appropriate substititons at once.
+# to "relocate" everything to run at '/' but patching the '.tar'
+# file at once is apparently not valid, we must patch each file
+# individually and compress the output to a usable rootfs image.
#
cd "${BASE}";
if ! test -f rootfs-${TARGET}-patched.tgz; then
- rm -f rootfs-${TARGET}.tar;
- gzip -dk rootfs-${TARGET}.tgz;
+ t=$(mktemp -d);
+ tar -C "${t}" -xf rootfs-${TARGET}.tgz;
##
# Build 'binsub', a string patch tool.
@@ -680,13 +697,16 @@ if ! test -f rootfs-${TARGET}-patched.tgz; then
# of the empty string) to avoid gotchas. Assumes '//' is the
# same as '/'. I can't think of a counterexample.
#
- ./binsub rootfs-${TARGET}.tar \
- "${BASE}"/mcmtools-${TARGET}/sys \
- / \
- ;
+ x="${BASE}"/mcmtools-${TARGET}/sys;
+ grep -rl "${x}" ${t} | while read k; do
+ ./binsub ${k} "${x}" "/";
+ done
- gzip -c9 rootfs-${TARGET}.tar > rootfs-${TARGET}-patched.tgz;
- rm -f rootfs-${TARGET}.tar;
+ tar -C "${t}" \
+ -pczf rootfs-${TARGET}-patched.tgz \
+ . \
+ ;
+ rm -fr "${t}";
fi
diff --git a/setup-abuild b/setup-abuild
index 97745ed..46122c8 100755
--- a/setup-abuild
+++ b/setup-abuild
@@ -41,7 +41,7 @@ rm -fr ${nmus}-${vmus};
# OpenSSL
#
nssl=openssl;
-vssl=1.1.1s;
+vssl=1.1.1v;
test ! -f ._${nssl}-${vssl} && \
(
test ! -d ${nssl}-${vssl} \
@@ -66,7 +66,7 @@ rm -fr ${nssl}-${vssl};
# zlib
#
nzlb=zlib;
-vzlb=1.2.13;
+vzlb=1.3;
test ! -f ._${nzlb}-${vzlb} && \
(
test ! -d ${nzlb}-${vzlb} \
@@ -199,6 +199,7 @@ test ! -f ._${nsam}-${vsam} &&
cd ${nsam}-${vsam};
make -j$(nproc) install \
PREFIX="" \
+ LDFLAGS="-static" \
DESTDIR="${DEST}" \
;
@@ -211,7 +212,7 @@ rm -fr ${nsam}-${vsam};
# muon (meson replacement)
#
nmun=muon;
-vmun=62ce4561b4444e5020dc39aad0381655afeda0d6;
+vmun=34953adc6bd14851fe6fa5f5d469f7ef28ee3b32;
test ! -f ._${nmun}-${vmun} &&
(
test ! -d ${nmun}-${vmun} \
@@ -224,14 +225,14 @@ test ! -f ._${nmun}-${vmun} &&
./bootstrap.sh \
bootstrap \
;
- bootstrap/muon setup \
- -Dstatic=true \
- build \
+ bootstrap/muon setup \
+ -Dstatic=true \
+ build \
;
sed -i build/build.ninja \
-e "s@\bar\b@${AR}@g" \
;
- samu -C build;
+ samu -C build;
cp build/muon "${DEST}/bin";
)
touch ._${nmun}-${vmun};
@@ -330,9 +331,10 @@ EOF
cat libfakeroot.c >> ${f};
mv ${f} libfakeroot.c;
rm -fr x; mkdir x; cd x;
- CFLAGS="-D_STAT_VER=0 $CFLAGS" \
+ CFLAGS="-static -D_STAT_VER=0 $CFLAGS" \
../configure \
--prefix="${DEST}" \
+ --host="$(${CC} -dumpmachine)" \
;
sed -i Makefile \
-e '/^SUBDIRS =/ s/doc//g' \
@@ -356,8 +358,10 @@ test ! -f ._${natt}-${vatt} &&
cd ${natt}-${vatt};
git checkout ${vatt};
./autogen.sh;
+ CFLAGS="-static" \
./configure \
--prefix="${DEST}" \
+ --host="$(${CC} -dumpmachine)" \
--enable-static \
--disable-shared \
;