From 7493b86f41abca4224865f841cdc17f164f433aa Mon Sep 17 00:00:00 2001 From: Alexander Hill Date: Fri, 16 Jan 2026 21:59:51 -0500 Subject: [PATCH] Merged build and package in treetap --- bootstrap.sh | 12 ++-- rootbuild.sh | 3 +- sources/autoconf/autoconf.spec | 8 --- sources/automake/automake.spec | 8 --- sources/bc/bc.spec | 6 +- sources/byacc/byacc.spec | 8 --- sources/bzip2/bzip2.spec | 10 +--- sources/cmake/cmake.spec | 10 +--- sources/coreutils/coreutils.spec | 8 --- sources/dash/dash.spec | 8 --- sources/diffutils/diffutils.spec | 4 -- sources/findutils/findutils.spec | 8 --- sources/flex/flex.spec | 8 --- sources/fortune-mod/fortune-mod.spec | 5 +- sources/grep/grep.spec | 4 -- sources/groff/groff.spec | 10 +--- sources/gzip/gzip.spec | 4 -- sources/initramfs-tools/initramfs-tools.spec | 8 --- sources/kmod/kmod.spec | 6 +- sources/libarchive/libarchive.spec | 10 +--- sources/libcap2/libcap2.spec | 6 +- sources/libelf/libelf.spec | 12 +--- sources/libressl/libressl.spec | 10 +--- sources/libtool/libtool.spec | 10 +--- sources/limine/limine.spec | 6 +- sources/linux/linux.spec | 6 +- sources/m4/m4.spec | 8 --- sources/make/make.spec | 8 --- sources/mawk/mawk.spec | 4 -- sources/muon/muon.spec | 10 +--- sources/musl/musl.spec | 10 +--- sources/nano/nano.spec | 6 +- sources/nasm/nasm.spec | 10 +--- sources/ncurses/ncurses.spec | 6 +- sources/openrc/openrc.spec | 6 +- sources/patch/patch.spec | 4 -- sources/perl/perl.spec | 10 +--- sources/pkgconf/pkgconf.spec | 8 --- sources/sed/sed.spec | 4 -- sources/tar/tar.spec | 4 -- sources/xz/xz.spec | 10 +--- sources/zlib/zlib.spec | 4 -- sources/zsh/zsh.spec | 6 +- treetap | 62 ++++++++++++-------- 44 files changed, 65 insertions(+), 313 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index f7ddc62..2d52b9b 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -80,7 +80,7 @@ EOF fi # Install headers for Linux -LINUX_VERSION=$(sed -En "s/SRC_VERSION=\"?(.+)\"/\1/p" $SPEC/linux/linux.spec) +LINUX_VERSION=$($TREETAP variable $SPEC/linux/linux.spec SRC_VERSION) tar xf $SOURCES/linux/$LINUX_VERSION/linux-*.tar* cd linux-*/ # NOTE: LLVM=1 is required here because GCC and other GNU tools are required in @@ -95,7 +95,7 @@ cp -r usr/include $BOOTSTRAP/root/usr cd .. # Install headers for musl -MUSL_VERSION=$(sed -En "s/SRC_VERSION=\"?(.+)\"/\1/p" $SPEC/musl/musl.spec) +MUSL_VERSION=$($TREETAP variable $SPEC/musl/musl.spec SRC_VERSION) tar xf $SOURCES/musl/$MUSL_VERSION/musl-*.tar* cd musl-*/ # NOTE: Patch for musl 1.2.5 to prevent a character encoding vulnerability. This @@ -118,7 +118,7 @@ make -O -j $PROCS install-headers DESTDIR=$BOOTSTRAP/root cd .. # Build and install compiler-rt builtins -LLVM_VERSION=$(sed -En "s/SRC_VERSION=\"?(.+)\"/\1/p" $SPEC/llvm/llvm.spec) +LLVM_VERSION=$($TREETAP variable $SPEC/llvm/llvm.spec SRC_VERSION) LLVM_MAJOR_VERSION=$(echo $LLVM_VERSION | cut -d"." -f1) tar xf $SOURCES/llvm/$LLVM_VERSION/llvm-project-*.tar* cd llvm-project-*/ @@ -136,8 +136,7 @@ cd .. # system's runtime if this is not specified. ~ahill LIBCC="$BOOTSTRAP/root/lib/clang/$LLVM_MAJOR_VERSION/lib/linux/libclang_rt.builtins-x86_64.a" \ $TREETAP build $SPEC/musl/musl.spec -$TREETAP package $SPEC/musl/musl.spec -$TREETAP install $TT_DIR/packages/$MICROARCH/musl-*.cpio.xz $BOOTSTRAP/root +$TREETAP install $($TREETAP variable $SPEC/musl/musl.spec TT_PACKAGE) $BOOTSTRAP/root # Include compiler-rt and musl in our environment export CFLAGS="$CFLAGS -Qunused-arguments -rtlib=compiler-rt -Wl,--dynamic-linker=/lib/ld-musl-$ARCH.so.1" @@ -228,8 +227,7 @@ SOURCES=(coreutils dash diffutils findutils grep gzip make mawk patch sed tar) for name in $SOURCES; do $TREETAP fetch $SPEC/$name/$name.spec $TREETAP build $SPEC/$name/$name.spec - $TREETAP package $SPEC/$name/$name.spec - $TREETAP install $TT_DIR/packages/$MICROARCH/$name-*.cpio.xz $BOOTSTRAP/root + $TREETAP install $($TREETAP variable $SPEC/$name/$name.spec TT_PACKAGE) $BOOTSTRAP/root done # Install Treetap diff --git a/rootbuild.sh b/rootbuild.sh index 72888bb..2bd733c 100755 --- a/rootbuild.sh +++ b/rootbuild.sh @@ -50,6 +50,5 @@ PACKAGES="$LAYER0 $LAYER1 $LAYER2" for pkg in $PACKAGES; do treetap fetch /maple/sources/$pkg/$pkg.spec treetap build /maple/sources/$pkg/$pkg.spec - treetap package /maple/sources/$pkg/$pkg.spec - treetap install /maple/.treetap/packages/*/$pkg-*.cpio.xz + treetap install $(treetap variable /maple/sources/$pkg/$pkg.spec TT_PACKAGE) done diff --git a/sources/autoconf/autoconf.spec b/sources/autoconf/autoconf.spec index 317d458..141044e 100644 --- a/sources/autoconf/autoconf.spec +++ b/sources/autoconf/autoconf.spec @@ -9,13 +9,5 @@ build() { cd autoconf-*/ ./configure $TT_AUTOCONF_COMMON make -O -j $TT_PROCS -} - -clean() { - rm -rf autoconf-*/ -} - -package() { - cd autoconf-*/ make -O -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR } \ No newline at end of file diff --git a/sources/automake/automake.spec b/sources/automake/automake.spec index 5ba1f74..caff8f1 100644 --- a/sources/automake/automake.spec +++ b/sources/automake/automake.spec @@ -9,13 +9,5 @@ build() { cd automake-*/ ./configure $TT_AUTOCONF_COMMON make -j $TT_PROCS -} - -clean() { - rm -rf automake-*/ -} - -package() { - cd automake-*/ make -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR } \ No newline at end of file diff --git a/sources/bc/bc.spec b/sources/bc/bc.spec index c1b5fb2..04b0783 100644 --- a/sources/bc/bc.spec +++ b/sources/bc/bc.spec @@ -13,9 +13,5 @@ build() { # package on Maple Linux, so it doesn't make sense to include it for # the sole purpose of building bc. ~ahill make -O -j $TT_PROCS MAKEINFO=true -} - -package() { - cd bc-$SRC_VERSION/ make -O -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR MAKEINFO=true -} +} \ No newline at end of file diff --git a/sources/byacc/byacc.spec b/sources/byacc/byacc.spec index e859572..fa43bc7 100644 --- a/sources/byacc/byacc.spec +++ b/sources/byacc/byacc.spec @@ -9,14 +9,6 @@ build() { cd byacc-*/ ./configure $TT_AUTOCONF_COMMON make -O -j $TT_PROCS -} - -clean() { - rm -rf byacc-*/ -} - -package() { - cd byacc-*/ # NOTE: byacc's "make install" calls diff -c, which is unsupported by # Busybox. Unfortunately, our other implementation of diff requires # byacc to build, meaning we'll need to do a manual install to prevent diff --git a/sources/bzip2/bzip2.spec b/sources/bzip2/bzip2.spec index 55a9a0f..e0ef636 100644 --- a/sources/bzip2/bzip2.spec +++ b/sources/bzip2/bzip2.spec @@ -19,14 +19,6 @@ build() { # NOTE: bzip2recover is part of the first Makefile, so we need to invoke # that to build the command. ~ahill make -O -j $TT_PROCS bzip2recover CC=$CC CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64" -} - -clean() { - rm -rf bzip2-*/ -} - -package() { - cd bzip2-*/ # NOTE: The shared Makefile doesn't have an "install" target, so we just # copy the files over ourselves. ~ahill mkdir -p $TT_INSTALLDIR$TT_BINDIR @@ -52,4 +44,4 @@ package() { ln -sf $SO_NAME $TT_INSTALLDIR$TT_LIBDIR/libbz2.so mkdir -p $TT_INSTALLDIR$TT_INCLUDEDIR cp bzlib.h $TT_INSTALLDIR$TT_INCLUDEDIR/ -} +} \ No newline at end of file diff --git a/sources/cmake/cmake.spec b/sources/cmake/cmake.spec index f2d87c1..c539bfa 100644 --- a/sources/cmake/cmake.spec +++ b/sources/cmake/cmake.spec @@ -22,13 +22,5 @@ build() { --system-zlib \ --xdgdatadir=$TT_DATADIR make -O -j $TT_PROCS -} - -clean() { - rm -rf cmake-*/ -} - -package() { - cd cmake-*/ make -O -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR -} +} \ No newline at end of file diff --git a/sources/coreutils/coreutils.spec b/sources/coreutils/coreutils.spec index b597a62..471e7bd 100644 --- a/sources/coreutils/coreutils.spec +++ b/sources/coreutils/coreutils.spec @@ -9,13 +9,5 @@ build() { cd coreutils-*/ ./configure $TT_AUTOCONF_COMMON --disable-year2038 make -j $TT_PROCS -} - -clean() { - rm -rf coreutils-*/ -} - -package() { - cd coreutils-*/ make -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR } \ No newline at end of file diff --git a/sources/dash/dash.spec b/sources/dash/dash.spec index 02b57f5..deb1446 100644 --- a/sources/dash/dash.spec +++ b/sources/dash/dash.spec @@ -10,14 +10,6 @@ build() { cd dash-*/ ./configure $TT_AUTOCONF_COMMON make -j $TT_PROCS -} - -clean() { - rm -rf dash-*/ -} - -package() { - cd dash-*/ make -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR ln -s dash $TT_INSTALLDIR/bin/sh } \ No newline at end of file diff --git a/sources/diffutils/diffutils.spec b/sources/diffutils/diffutils.spec index 28eb121..19f4284 100644 --- a/sources/diffutils/diffutils.spec +++ b/sources/diffutils/diffutils.spec @@ -15,9 +15,5 @@ build() { # See also: https://lists.gnu.org/archive/html/bug-gnulib/2025-04/msg00056.html ./configure $TT_AUTOCONF_COMMON gl_cv_func_strcasecmp_works=y make -j $TT_PROCS -} - -package() { - cd diffutils-$SRC_VERSION/ make -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR } \ No newline at end of file diff --git a/sources/findutils/findutils.spec b/sources/findutils/findutils.spec index 0bde17e..3241708 100644 --- a/sources/findutils/findutils.spec +++ b/sources/findutils/findutils.spec @@ -9,13 +9,5 @@ build() { cd findutils-*/ ./configure $TT_AUTOCONF_COMMON make -j $TT_PROCS -} - -clean() { - rm -rf findutils-*/ -} - -package() { - cd findutils-*/ make -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR } \ No newline at end of file diff --git a/sources/flex/flex.spec b/sources/flex/flex.spec index dbf0ee6..c259d6f 100644 --- a/sources/flex/flex.spec +++ b/sources/flex/flex.spec @@ -9,13 +9,5 @@ build() { cd flex-*/ ./configure $TT_AUTOCONF_COMMON --disable-static make -O -j $TT_PROCS -} - -clean() { - rm -rf flex-*/ -} - -package() { - cd flex-*/ make -O -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR } \ No newline at end of file diff --git a/sources/fortune-mod/fortune-mod.spec b/sources/fortune-mod/fortune-mod.spec index 246e426..5d0290b 100644 --- a/sources/fortune-mod/fortune-mod.spec +++ b/sources/fortune-mod/fortune-mod.spec @@ -30,11 +30,8 @@ build() { # NOTE: Is there a better way to do this? This probably won't survive # cross-compilation. ~ahill ./build-$SRC_VERSION/strfile maple -} - -package() { cmake --install build-$SRC_VERSION --parallel $TT_PROCS cp maple $TT_INSTALLDIR/usr/share/games/fortunes/ cp maple.dat $TT_INSTALLDIR/usr/share/games/fortunes/ ln -sf maple $TT_INSTALLDIR/usr/share/games/fortunes/maple.u8 -} +} \ No newline at end of file diff --git a/sources/grep/grep.spec b/sources/grep/grep.spec index 62ace69..1d9fc86 100644 --- a/sources/grep/grep.spec +++ b/sources/grep/grep.spec @@ -9,9 +9,5 @@ build() { cd grep-$SRC_VERSION/ ./configure $TT_AUTOCONF_COMMON make -j $TT_PROCS -} - -package() { - cd grep-$SRC_VERSION/ make -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR } \ No newline at end of file diff --git a/sources/groff/groff.spec b/sources/groff/groff.spec index 22cc353..1df8ef3 100644 --- a/sources/groff/groff.spec +++ b/sources/groff/groff.spec @@ -9,13 +9,5 @@ build() { cd groff-*/ ./configure $TT_AUTOCONF_COMMON make -j $TT_PROCS -} - -clean() { - rm -rf groff-*/ -} - -package() { - cd groff-*/ make -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR -} +} \ No newline at end of file diff --git a/sources/gzip/gzip.spec b/sources/gzip/gzip.spec index 0b95edc..c421d86 100644 --- a/sources/gzip/gzip.spec +++ b/sources/gzip/gzip.spec @@ -9,9 +9,5 @@ build() { cd gzip-$SRC_VERSION/ ./configure $TT_AUTOCONF_COMMON make -j $TT_PROCS -} - -package() { - cd gzip-$SRC_VERSION/ make -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR } \ No newline at end of file diff --git a/sources/initramfs-tools/initramfs-tools.spec b/sources/initramfs-tools/initramfs-tools.spec index c38d512..fa51232 100644 --- a/sources/initramfs-tools/initramfs-tools.spec +++ b/sources/initramfs-tools/initramfs-tools.spec @@ -10,14 +10,6 @@ build() { cd initramfs-tools-*/ # NOTE: Since this is for a single file, we don't pass TT_PROC. ~ahill make -} - -clean() { - rm -rf initramfs-tools-*/ -} - -package() { - cd initramfs-tools-*/ # NOTE: There's no make install! ~ahill mkdir -p $TT_INSTALLDIR/bin diff --git a/sources/kmod/kmod.spec b/sources/kmod/kmod.spec index ebbd947..8c5f0bb 100644 --- a/sources/kmod/kmod.spec +++ b/sources/kmod/kmod.spec @@ -14,9 +14,5 @@ build() { # ~ahill ./configure $TT_AUTOCONF_COMMON --disable-manpages --enable-year2038 make -j $TT_PROCS -} - -package() { - cd kmod-$SRC_VERSION/ make -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR -} +} \ No newline at end of file diff --git a/sources/libarchive/libarchive.spec b/sources/libarchive/libarchive.spec index 9711617..d4e8c2c 100644 --- a/sources/libarchive/libarchive.spec +++ b/sources/libarchive/libarchive.spec @@ -9,13 +9,5 @@ build() { cd libarchive-*/ ./configure $TT_AUTOCONF_COMMON --disable-static --enable-year2038 make -j $TT_PROCS -} - -clean() { - rm -rf libarchive-*/ -} - -package() { - cd libarchive-*/ make -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR -} +} \ No newline at end of file diff --git a/sources/libcap2/libcap2.spec b/sources/libcap2/libcap2.spec index 40e6861..ff21098 100644 --- a/sources/libcap2/libcap2.spec +++ b/sources/libcap2/libcap2.spec @@ -17,10 +17,6 @@ build() { INCDIR=$TT_INCLUDEDIR \ exec_prefix=$TT_PREFIX \ prefix=$TT_PREFIX -} - -package() { - cd libcap-$SRC_VERSION/ make -O \ -C libcap \ -j $TT_PROCS \ @@ -30,4 +26,4 @@ package() { INCDIR=$TT_INCLUDEDIR \ exec_prefix=$TT_PREFIX \ prefix=$TT_PREFIX -} +} \ No newline at end of file diff --git a/sources/libelf/libelf.spec b/sources/libelf/libelf.spec index 876cc90..db60e79 100644 --- a/sources/libelf/libelf.spec +++ b/sources/libelf/libelf.spec @@ -19,13 +19,5 @@ build() { sed -i "s/-lzstd//" Makefile sed -i "/#define USE_ZSTD/d" src/config.h make -O -j $TT_PROCS -} - -clean() { - rm -rf libelf-$SRC_VERSION/ -} - -package() { - cd libelf-$SRC_VERSION/ - make -O -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR INCDIR=/usr/include -} + make -O -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR INCDIR=$TT_INCLUDEDIR +} \ No newline at end of file diff --git a/sources/libressl/libressl.spec b/sources/libressl/libressl.spec index dc3783d..c47318d 100644 --- a/sources/libressl/libressl.spec +++ b/sources/libressl/libressl.spec @@ -15,13 +15,5 @@ build() { # ~ahill ./configure $TT_AUTOCONF_COMMON --disable-static make -j $TT_PROCS -} - -clean() { - rm -rf libressl-*/ -} - -package() { - cd libressl-*/ make -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR -} +} \ No newline at end of file diff --git a/sources/libtool/libtool.spec b/sources/libtool/libtool.spec index ad794dd..e9e2c49 100644 --- a/sources/libtool/libtool.spec +++ b/sources/libtool/libtool.spec @@ -15,13 +15,5 @@ build() { # libtoolize. Strangely enough, libtool is hard-coded to /bin/sh, so # I don't know why libtoolize uses /usr/bin/env. ~ahill sed -i "s|/usr/bin/env sh|/bin/sh|" libtoolize -} - -clean() { - rm -rf libtool-*/ -} - -package() { - cd libtool-*/ make -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR -} +} \ No newline at end of file diff --git a/sources/limine/limine.spec b/sources/limine/limine.spec index 2a292c0..2b64995 100644 --- a/sources/limine/limine.spec +++ b/sources/limine/limine.spec @@ -10,9 +10,5 @@ build() { # TODO: How should other architectures be handled? ~ahill ./configure $TT_AUTOCONF_COMMON --enable-uefi-x86-64 make -O -j $TT_PROCS -} - -package() { - cd limine-$SRC_VERSION/ make -O -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR -} +} \ No newline at end of file diff --git a/sources/linux/linux.spec b/sources/linux/linux.spec index c00d911..397773a 100755 --- a/sources/linux/linux.spec +++ b/sources/linux/linux.spec @@ -15,11 +15,7 @@ build() { # where to find the parser generator manually. ~ahill LLVM=1 make -j $TT_PROCS defconfig YACC=byacc LLVM=1 make -j $TT_PROCS YACC=byacc -} - -package() { - cd linux-$SRC_VERSION/ make -j $TT_PROCS install INSTALL_PATH=$TT_INSTALLDIR/boot make -j $TT_PROCS modules_install INSTALL_MOD_PATH=$TT_INSTALLDIR # TODO: Run dtbs_install on non-x86 systems ~ahill -} +} \ No newline at end of file diff --git a/sources/m4/m4.spec b/sources/m4/m4.spec index 0697fec..cca90d7 100644 --- a/sources/m4/m4.spec +++ b/sources/m4/m4.spec @@ -9,13 +9,5 @@ build() { cd m4-*/ ./configure $TT_AUTOCONF_COMMON --enable-year2038 make -j $TT_PROCS -} - -clean() { - rm -rf m4-*/ -} - -package() { - cd m4-*/ make -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR } \ No newline at end of file diff --git a/sources/make/make.spec b/sources/make/make.spec index 0b6f226..ac1f89d 100644 --- a/sources/make/make.spec +++ b/sources/make/make.spec @@ -9,13 +9,5 @@ build() { cd make-*/ ./configure $TT_AUTOCONF_COMMON --enable-year2038 make -O -j $TT_PROCS -} - -clean() { - rm -rf make-*/ -} - -package() { - cd make-*/ make -O -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR } \ No newline at end of file diff --git a/sources/mawk/mawk.spec b/sources/mawk/mawk.spec index 043512b..044b433 100644 --- a/sources/mawk/mawk.spec +++ b/sources/mawk/mawk.spec @@ -10,10 +10,6 @@ build() { cd mawk-$SRC_VERSION/ ./configure $TT_AUTOCONF_COMMON make -O -j $TT_PROCS -} - -package() { - cd mawk-$SRC_VERSION/ make -O -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR ln -s mawk $TT_INSTALLDIR/bin/awk } \ No newline at end of file diff --git a/sources/muon/muon.spec b/sources/muon/muon.spec index 0de3bdd..17edc39 100644 --- a/sources/muon/muon.spec +++ b/sources/muon/muon.spec @@ -14,13 +14,5 @@ build() { CC="clang -std=c99" ./bootstrap.sh build ./build/muon-bootstrap setup $TT_MESON_COMMON build ./build/muon-bootstrap -C build samu -} - -clean() { - rm -rf muon-*/ -} - -package() { - cd muon-*/ DESTDIR=$TT_INSTALLDIR ./build/muon -C build install -} +} \ No newline at end of file diff --git a/sources/musl/musl.spec b/sources/musl/musl.spec index 455bb7f..688e1de 100755 --- a/sources/musl/musl.spec +++ b/sources/musl/musl.spec @@ -18,17 +18,9 @@ build() { patch -p1 < ../CVE-2025-26519.patch ./configure $TT_AUTOCONF_COMMON make -O -j $TT_PROCS -} - -clean() { - rm -rf musl-*/ -} - -package() { - cd musl-*/ DESTDIR=$TT_INSTALLDIR make install # NOTE: Apparently, the linker library has an entry point that we can use as # ldd. What kind of black magic is this? ~ahill mkdir -p $TT_INSTALLDIR/bin ln -sf /lib/ld-musl-$TT_ARCH.so.1 $TT_INSTALLDIR/bin/ldd -} +} \ No newline at end of file diff --git a/sources/nano/nano.spec b/sources/nano/nano.spec index eaed708..45e3c13 100644 --- a/sources/nano/nano.spec +++ b/sources/nano/nano.spec @@ -9,9 +9,5 @@ build() { cd nano-$SRC_VERSION/ ./configure $TT_AUTOCONF_COMMON --enable-utf8 --enable-year2038 make -O -j $TT_PROCS -} - -package() { - cd nano-$SRC_VERSION/ make -O -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR -} +} \ No newline at end of file diff --git a/sources/nasm/nasm.spec b/sources/nasm/nasm.spec index b5be466..8653f8f 100644 --- a/sources/nasm/nasm.spec +++ b/sources/nasm/nasm.spec @@ -14,13 +14,5 @@ build() { # attempting to redefine a C++ keyword in include/compiler.h. sed -i "/# ifdef bool/,/# endif/d" include/compiler.h make -O -j $TT_PROCS -} - -clean() { - rm -rf nasm-$SRC_VERSION/ -} - -package() { - cd nasm-$SRC_VERSION/ make -O -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR -} +} \ No newline at end of file diff --git a/sources/ncurses/ncurses.spec b/sources/ncurses/ncurses.spec index 117823c..23273f2 100644 --- a/sources/ncurses/ncurses.spec +++ b/sources/ncurses/ncurses.spec @@ -13,9 +13,5 @@ build() { --without-normal \ --with-shared make -O -j $TT_PROCS -} - -package() { - cd ncurses-$SRC_VERSION/ make -O -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR -} +} \ No newline at end of file diff --git a/sources/openrc/openrc.spec b/sources/openrc/openrc.spec index 2eb5521..036143e 100644 --- a/sources/openrc/openrc.spec +++ b/sources/openrc/openrc.spec @@ -14,9 +14,5 @@ build() { -Dzsh-completions=true \ build muon samu -C build -} - -package() { - cd openrc-$SRC_VERSION/ muon -C build install -d $TT_INSTALLDIR -} +} \ No newline at end of file diff --git a/sources/patch/patch.spec b/sources/patch/patch.spec index aac3192..43ff880 100644 --- a/sources/patch/patch.spec +++ b/sources/patch/patch.spec @@ -9,9 +9,5 @@ build() { cd patch-$SRC_VERSION/ ./configure $TT_AUTOCONF_COMMON make -j $TT_PROCS -} - -package() { - cd patch-$SRC_VERSION/ make -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR } \ No newline at end of file diff --git a/sources/perl/perl.spec b/sources/perl/perl.spec index 310694c..5293653 100644 --- a/sources/perl/perl.spec +++ b/sources/perl/perl.spec @@ -20,13 +20,5 @@ build() { -D usrinc=$TT_INCLUDEDIR \ -D vendorprefix=$TT_PREFIX make -O -j $TT_PROCS -} - -clean() { - rm -rf perl-*/ -} - -package() { - cd perl-*/ make -O -j $TT_PROCS install.perl DESTDIR=$TT_INSTALLDIR -} +} \ No newline at end of file diff --git a/sources/pkgconf/pkgconf.spec b/sources/pkgconf/pkgconf.spec index 470921e..b6a470d 100644 --- a/sources/pkgconf/pkgconf.spec +++ b/sources/pkgconf/pkgconf.spec @@ -9,14 +9,6 @@ build() { cd pkgconf-*/ ./configure $TT_AUTOCONF_COMMON --disable-static --enable-year2038 make -j $TT_PROCS -} - -clean() { - rm -rf pkgconf-*/ -} - -package() { - cd pkgconf-*/ make -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR # NOTE: Symlink for compatibility's sake. Currently being used by Muon. # ~ahill diff --git a/sources/sed/sed.spec b/sources/sed/sed.spec index 5f417a9..11b0b6e 100644 --- a/sources/sed/sed.spec +++ b/sources/sed/sed.spec @@ -9,9 +9,5 @@ build() { cd sed-$SRC_VERSION/ ./configure $TT_AUTOCONF_COMMON make -j $TT_PROCS -} - -package() { - cd sed-$SRC_VERSION/ make -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR } \ No newline at end of file diff --git a/sources/tar/tar.spec b/sources/tar/tar.spec index 4ff8017..a625f20 100644 --- a/sources/tar/tar.spec +++ b/sources/tar/tar.spec @@ -9,9 +9,5 @@ build() { cd tar-$SRC_VERSION/ ./configure $TT_AUTOCONF_COMMON make -j $TT_PROCS -} - -package() { - cd tar-$SRC_VERSION/ make -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR } \ No newline at end of file diff --git a/sources/xz/xz.spec b/sources/xz/xz.spec index 05a10f6..4c405b0 100644 --- a/sources/xz/xz.spec +++ b/sources/xz/xz.spec @@ -13,13 +13,5 @@ build() { cd xz-*/ ./configure $TT_AUTOCONF_COMMON --disable-static --enable-year2038 make -O -j $TT_PROCS -} - -clean() { - rm -rf xz-*/ -} - -package() { - cd xz-*/ make -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR -} +} \ No newline at end of file diff --git a/sources/zlib/zlib.spec b/sources/zlib/zlib.spec index 0a06773..b816008 100644 --- a/sources/zlib/zlib.spec +++ b/sources/zlib/zlib.spec @@ -24,9 +24,5 @@ build() { --prefix=/usr \ --shared make -O -j $TT_PROCS -} - -package() { - cd zlib-$SRC_VERSION/ make -O -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR } \ No newline at end of file diff --git a/sources/zsh/zsh.spec b/sources/zsh/zsh.spec index db4db80..8dc2e37 100644 --- a/sources/zsh/zsh.spec +++ b/sources/zsh/zsh.spec @@ -19,10 +19,6 @@ build() { --enable-multibyte \ --enable-libc-musl make -O -j $TT_PROCS -} - -package() { - cd zsh-$SRC_VERSION/ make -O -j $TT_PROCS install DESTDIR=$TT_INSTALLDIR ln -sf zsh $TT_INSTALLDIR/bin/bash -} +} \ No newline at end of file diff --git a/treetap b/treetap index 6c76371..476404b 100755 --- a/treetap +++ b/treetap @@ -18,6 +18,14 @@ # Changelog # ############# +# January 16, 2026 (1.5.0) +# + Added TT_PACKAGE [ahill] +# + Added variable subcommand [ahill] +# * Converted the build log path to an absolute path [ahill] +# * Merged the functionality of the package verb into the build command [ahill] +# * Packages are no longer built if the package file exists already [ahill] +# - Removed the purge subcommand in favor of clean [ahill] + # January 4, 2026 (1.4.1) # * Set LD to ld.lld after mold was removed from Maple Linux. [ahill] # - Replaced clean with purge, since the current implementation of clean isn't @@ -79,8 +87,7 @@ # of useful variables to take advantage of. ~ahill # Specification Functions: -# build - Builds the package -# package - Installs the package contents to $TT_INSTALLDIR +# build - Builds the package and installs it to $TT_INSTALLDIR # Specification Variables: # SRC_FILENAME - The name of the tarball to extract (optional) @@ -126,6 +133,8 @@ # [scope: source] # TT_MICROARCH - The microarchitecture to optimize for # [scope: source] +# TT_PACKAGE - The path to the package being built +# [scope: source] # TT_PKGDIR - The path to the package directory # [scope: global] # TT_PREFIX - The desired prefix for the package @@ -150,7 +159,7 @@ [ -z "$TT_DIR" ] && TT_DIR="$(pwd)/.treetap" [ -z "$TT_PKGDIR" ] && TT_PKGDIR="$TT_DIR/packages" [ -z "$TT_SYSROOT" ] && TT_SYSROOT=/ -TT_VERSION="1.4.1" +TT_VERSION="1.5.0" ######################### # Environment Variables # @@ -183,8 +192,7 @@ help_message() { echo " $0 build " echo " $0 clean " echo " $0 fetch " - echo " $0 package " - echo " $0 purge " + echo " $0 variable " exit 1 } @@ -257,6 +265,7 @@ source_spec() { # occur and where to put the artifacts. ~ahill TT_BUILDDIR="$TT_DIR/sources/$SRC_NAME/$SRC_VERSION/$TT_MICROARCH" TT_INSTALLDIR="$TT_BUILDDIR/install" + TT_PACKAGE="$TT_PKGDIR/$TT_MICROARCH/$SRC_NAME-$SRC_FULLVERSION-$TT_MICROARCH.cpio.xz" # Create convenience variables TT_AUTOCONF_COMMON=$(echo "--bindir=$TT_BINDIR \ @@ -363,7 +372,12 @@ package_uninstall() { # Builds the source from the previously fetched tarball source_build() { source_spec $1 + if [ -f "$TT_PACKAGE" ]; then + echo "Skipping build for $SRC_NAME $SRC_FULLVERSION" + exit 0 + fi mkdir -p $TT_BUILDDIR + mkdir -p $TT_INSTALLDIR if [ ! -z "$SRC_PATCHES" ]; then echo -n "Validating patches for $SRC_NAME $SRC_FULLVERSION... " cd $(dirname $1) @@ -383,12 +397,18 @@ source_build() { cd $TT_BUILDDIR # Please don't use this in your build script. This is meant for # troubleshooting purposes. ~ahill - TT_BUILD_LOG=build-$(date +%Y%m%d%H%M%S).log + TT_BUILD_LOG=$TT_BUILDDIR/build-$(date +%Y%m%d%H%M%S).log echo "Build started with treetap $TT_VERSION at $(date)" > $TT_BUILD_LOG build >> $TT_BUILD_LOG 2>&1 echo "Build finished at $(date)" >> $TT_BUILD_LOG - cd $PUSHD echo "Done!" + cd $TT_INSTALLDIR + echo -n "Archiving $SRC_NAME $SRC_FULLVERSION for $TT_MICROARCH... " + mkdir -p $TT_PKGDIR/$TT_MICROARCH + find | bsdcpio -Jo > $TT_PACKAGE + rm -rf $TT_INSTALLDIR + echo "Done!" + cd $PUSHD exit 0 } @@ -416,27 +436,18 @@ source_fetch() { exit 0 } -# Packages the built artifacts for distribution -source_package() { +# Purges the entire build directory for a source +source_clean() { source_spec $1 - mkdir -p $TT_BUILDDIR - mkdir -p $TT_INSTALLDIR - mkdir -p $TT_PKGDIR/$TT_MICROARCH - PUSHD=$(pwd) - cd $TT_BUILDDIR - echo -n "Archiving $SRC_NAME $SRC_FULLVERSION for $TT_MICROARCH... " - package > package-$(date +%Y%m%d%H%M%S).log - cd $TT_INSTALLDIR - find | bsdcpio -Jo > "$TT_PKGDIR/$TT_MICROARCH/$SRC_NAME-$SRC_FULLVERSION-$TT_MICROARCH.cpio.xz" - rm -rf $TT_INSTALLDIR - cd $PUSHD + rm -rf $TT_BUILDDIR exit 0 } -# Purges the entire build directory for a source -source_purge() { +# Prints a variable defined by treetap +source_variable() { source_spec $1 - rm -rf $TT_BUILDDIR + [ -z "$2" ] && (echo "source_variable: Variable name not given"; exit 1) + eval "echo \${$2}" exit 0 } @@ -446,11 +457,10 @@ source_purge() { case "$1" in "build") source_build $2 ;; -"clean") source_purge $2 ;; +"clean") source_clean $2 ;; "fetch") source_fetch $2 ;; "install") package_install $2 $3 ;; -"package") source_package $2 ;; -"purge") source_purge $2 ;; "uninstall") package_uninstall $2 $3 ;; +"variable") source_variable $2 $3 ;; *) help_message ;; esac