summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--LICENSE15
-rwxr-xr-xbuild-bootstrap.sh372
-rwxr-xr-xbuild-chroot.sh416
-rwxr-xr-xbuild-image.sh20
-rwxr-xr-xmaple-chroot.sh22
-rw-r--r--sources.list43
-rwxr-xr-xsources.sh18
8 files changed, 909 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..d9c42d9
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+/build
+/maple
+/sources \ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..b2a6784
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,15 @@
+ISC License
+
+Copyright (c) Alexander Hill, Nicholas McDaniel, and Maple Linux Contributors
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
diff --git a/build-bootstrap.sh b/build-bootstrap.sh
new file mode 100755
index 0000000..1d78ad3
--- /dev/null
+++ b/build-bootstrap.sh
@@ -0,0 +1,372 @@
+#!/bin/sh -e
+export CC=clang
+export CXX=clang++
+export LD=ld.lld
+export MAPLE=$(pwd)/maple
+export THREADS=$(nproc)
+export HOST=x86_64-unknown-linux-musl
+
+# A simplified FHS variant with symlinks for backwards compatibility ~ahill
+# TODO: Where does /usr/com fit into all of this (shared state directory)? ~ahill
+mkdir -p $MAPLE/bin
+mkdir -p $MAPLE/boot
+mkdir -p $MAPLE/dev
+mkdir -p $MAPLE/etc
+mkdir -p $MAPLE/home/root
+mkdir -p $MAPLE/lib
+# TODO: Does it make sense to have this long-term? Anything that depends on
+# libc++ fails to link without it, but this should be fixed via a
+# configuration change in LLVM. ~ahill
+ln -s . $MAPLE/lib/$HOST
+mkdir -p $MAPLE/maple/sources
+mkdir -p $MAPLE/mnt
+mkdir -p $MAPLE/proc
+ln -s home/root $MAPLE/root
+ln -s var/run $MAPLE/run
+mkdir -p $MAPLE/sbin
+mkdir -p $MAPLE/sys
+mkdir -p $MAPLE/tmp
+mkdir -p $MAPLE/usr
+ln -s ../bin $MAPLE/usr/bin
+mkdir -p $MAPLE/usr/include
+ln -s ../lib $MAPLE/usr/lib
+ln -s ../lib $MAPLE/usr/libexec
+ln -s ../sbin $MAPLE/usr/sbin
+mkdir -p $MAPLE/usr/share
+mkdir -p $MAPLE/var
+mkdir -p $MAPLE/var/cache
+mkdir -p $MAPLE/var/lib
+mkdir -p $MAPLE/var/lock
+mkdir -p $MAPLE/var/log
+mkdir -p $MAPLE/var/run
+mkdir -p $MAPLE/var/spool
+mkdir -p $MAPLE/var/tmp
+
+mkdir -p build
+cd build
+
+# LLVM Build
+tar xf ../sources/llvm-project-*.tar*
+cd llvm-project-*/
+cmake -B stage1 -G Ninja -S llvm \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_INSTALL_PREFIX=$MAPLE/maple/tools \
+ -DCLANG_DEFAULT_CXX_STDLIB=libc++ \
+ -DCLANG_DEFAULT_RTLIB=compiler-rt \
+ -DCLANG_DEFAULT_UNWINDLIB=libunwind \
+ -DCOMPILER_RT_USE_BUILTINS_LIBRARY=ON \
+ -DLIBCXX_CXX_ABI=libcxxabi \
+ -DLIBCXX_HAS_MUSL_LIBC=ON \
+ -DLIBCXX_USE_COMPILER_RT=ON \
+ -DLIBCXXABI_USE_COMPILER_RT=ON \
+ -DLIBCXXABI_USE_LLVM_UNWINDER=ON \
+ -DLIBUNWIND_ENABLE_ASSERTIONS=OFF \
+ -DLIBUNWIND_USE_COMPILER_RT=ON \
+ -DLLVM_BUILD_LLVM_DYLIB=ON \
+ -DLLVM_ENABLE_LIBCXX=ON \
+ -DLLVM_ENABLE_PROJECTS="clang;lld;llvm" \
+ -DLLVM_ENABLE_RUNTIMES="compiler-rt;libunwind;libcxxabi;libcxx" \
+ -DLLVM_HOST_TRIPLE=$HOST \
+ -DLLVM_INSTALL_BINUTILS_SYMLINKS=ON \
+ -DLLVM_INSTALL_UTILS=ON \
+ -DLLVM_LINK_LLVM_DYLIB=ON \
+ -DLLVM_TARGETS_TO_BUILD=X86 \
+ -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON
+cmake --build stage1
+cmake --install stage1
+cd ..
+
+export CC="$MAPLE/maple/tools/bin/clang"
+export CXX="$MAPLE/maple/tools/bin/clang++"
+export CFLAGS="--sysroot=$MAPLE"
+export CXXFLAGS="$CFLAGS"
+export LD=$MAPLE/maple/tools/bin/ld.lld
+export PATH="$MAPLE/maple/tools/bin:$PATH"
+
+# Linux Headers
+tar xf ../sources/linux-*.tar*
+cd linux-*/
+LLVM=1 make -j $THREADS mrproper
+LLVM=1 make -j $THREADS headers_install INSTALL_HDR_PATH=$MAPLE/usr
+cd ..
+
+# musl Build
+tar xf ../sources/musl-*.tar*
+cd musl-*/
+./configure --disable-static --includedir=/usr/include --prefix=""
+make -j $THREADS
+make -j $THREADS install DESTDIR=$MAPLE
+# NOTE: musl provides static libraries for POSIX libraries such as libm, but
+# fails to provide shared versions which will breaks builds later on.
+# Granted, they are useless since libc.so contains all the functionality
+# we need, but it is needed for compatibility. As of April 5th, 2025, zsh
+# is known to be misconfigured as a result of missing libraries. ~ahill
+for lib in $(grep "EMPTY_LIB_NAMES =" Makefile | sed "s/EMPTY_LIB_NAMES = //"); do
+ ln -s libc.so $MAPLE/lib/lib$lib.so
+done
+# NOTE: musl has some witchcraft associated with it that allows it to function
+# as an implementation of ldd. Honestly, the idea of a library with as an
+# entry point is something I have never thought of before, but I'm
+# interested in exploring the possibilities. ~ahill
+ln -s /lib/ld-musl-x86_64.so.1 $MAPLE/bin/ldd
+cd ..
+
+# dash Build
+tar xf ../sources/dash-*.tar*
+cd dash-*/
+./configure \
+ --datarootdir=/usr/share \
+ --exec-prefix="" \
+ --includedir=/usr/include \
+ --libexecdir=/lib \
+ --prefix="" \
+ --sharedstatedir=/usr/com
+make -j $THREADS
+make -j $THREADS install DESTDIR=$MAPLE
+ln -s dash $MAPLE/bin/sh
+cd ..
+
+# m4 Build
+tar xf ../sources/m4-*.tar*
+cd m4-*/
+./configure \
+ --datarootdir=/usr/share \
+ --disable-nls \
+ --enable-c++ \
+ --includedir=/usr/include \
+ --libexecdir=/lib \
+ --prefix="" \
+ --sharedstatedir=/usr/com
+make -j $THREADS
+make -j $THREADS install DESTDIR=$MAPLE
+cd ..
+
+# Coreutils Build
+tar xf ../sources/coreutils-*.tar*
+cd coreutils-*/
+./configure \
+ --datarootdir=/usr/share \
+ --disable-nls \
+ --includedir=/usr/include \
+ --libexecdir=/lib \
+ --prefix="" \
+ --sharedstatedir=/usr/com
+make -j $THREADS
+make -j $THREADS install DESTDIR=$MAPLE
+cd ..
+
+# Diffutils Build
+tar xf ../sources/diffutils-*.tar*
+cd diffutils-*/
+./configure \
+ --disable-nls \
+ --exec-prefix="" \
+ --libexecdir=/lib \
+ --localstatedir=/var \
+ --prefix=/usr \
+ --sysconfdir=/etc
+make -j $THREADS
+make -j $THREADS install DESTDIR=$MAPLE
+cd ..
+
+# Findutils Build
+tar xf ../sources/findutils-*.tar*
+cd findutils-*/
+./configure \
+ --datarootdir=/usr/share \
+ --disable-nls \
+ --exec-prefix="" \
+ --libexecdir=/lib \
+ --localstatedir=/var \
+ --prefix=/usr \
+ --sysconfdir=/etc
+make -j $THREADS
+make -j $THREADS install DESTDIR=$MAPLE
+cd ..
+
+# Grep Build
+tar xf ../sources/grep-*.tar*
+cd grep-*/
+./configure \
+ --datarootdir=/usr/share \
+ --disable-nls \
+ --exec-prefix="" \
+ --libexecdir=/lib \
+ --localstatedir=/var \
+ --prefix=/usr \
+ --sysconfdir=/etc
+make -j $THREADS
+make -j $THREADS install DESTDIR=$MAPLE
+cd ..
+
+# Gzip Build
+tar xf ../sources/gzip-*.tar*
+cd gzip-*/
+./configure \
+ --datarootdir=/usr/share \
+ --exec-prefix="" \
+ --libexecdir=/lib \
+ --localstatedir=/var \
+ --prefix=/usr \
+ --sysconfdir=/etc
+make -j $THREAD
+make -j $THREAD install DESTDIR=$MAPLE
+cd ..
+
+# Make Build
+tar xf ../sources/make-*.tar*
+cd make-*/
+./configure \
+ --datarootdir=/usr/share \
+ --disable-nls \
+ --enable-year2038 \
+ --exec-prefix="" \
+ --libexecdir=/lib \
+ --localstatedir=/var \
+ --prefix=/usr \
+ --sysconfdir=/etc
+make -j $THREAD
+make -j $THREAD install DESTDIR=$MAPLE
+cd ..
+
+# Sed Build
+tar xf ../sources/sed-*.tar*
+cd sed-*/
+./configure \
+ --datarootdir=/usr/share \
+ --disable-i18n \
+ --disable-nls \
+ --exec-prefix="" \
+ --libexecdir=/lib \
+ --localstatedir=/var \
+ --prefix=/usr \
+ --sysconfdir=/etc
+make -j $THREAD
+make -j $THREAD install DESTDIR=$MAPLE
+cd ..
+
+# Tar Build
+tar xf ../sources/tar-*.tar*
+cd tar-*/
+./configure \
+ --datarootdir=/usr/share \
+ --disable-nls \
+ --exec-prefix="" \
+ --libexecdir=/lib \
+ --localstatedir=/var \
+ --prefix=/usr \
+ --sysconfdir=/etc
+make -j $THREAD
+make -j $THREAD install DESTDIR=$MAPLE
+cd ..
+
+# Xz Build
+tar xf ../sources/xz-*.tar*
+cd xz-*/
+./configure \
+ --datarootdir=/usr/share \
+ --disable-doc \
+ --disable-nls \
+ --disable-static \
+ --enable-year2038 \
+ --exec-prefix="" \
+ --libexecdir=/lib \
+ --localstatedir=/var \
+ --prefix=/usr \
+ --sysconfdir=/etc
+make -j $THREAD
+make -j $THREAD install DESTDIR=$MAPLE
+cd ..
+
+# Clear compiler flags to avoid potentially issues with the LLVM build
+export CFLAGS=""
+export CXXFLAGS=""
+
+# LLVM Build (Stage 2)
+tar xf ../sources/llvm-project-*.tar*
+cd llvm-project-*/
+TOOLCHAIN_FILE=$HOST-maple-clang.cmake
+# NOTE: First time doing this. Did I do it right? ~ahill
+echo "set(CMAKE_SYSTEM_NAME Linux)" > $TOOLCHAIN_FILE
+echo "set(CMAKE_SYSROOT $MAPLE)" >> $TOOLCHAIN_FILE
+echo "set(CMAKE_C_COMPILER_TARGET $HOST)" >> $TOOLCHAIN_FILE
+echo "set(CMAKE_CXX_COMPILER_TARGET $HOST)" >> $TOOLCHAIN_FILE
+echo "set(CMAKE_C_FLAGS_INIT \"$CFLAGS\")" >> $TOOLCHAIN_FILE
+echo "set(CMAKE_CXX_FLAGS_INIT \"$CXXFLAGS\")" >> $TOOLCHAIN_FILE
+echo "set(CMAKE_LINKER_TYPE LLD)" >> $TOOLCHAIN_FILE
+echo "set(CMAKE_C_COMPILER \"$CC\")" >> $TOOLCHAIN_FILE
+echo "set(CMAKE_CXX_COMPILER \"$CXX\")" >> $TOOLCHAIN_FILE
+echo "set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)" >> $TOOLCHAIN_FILE
+echo "set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)" >> $TOOLCHAIN_FILE
+echo "set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)" >> $TOOLCHAIN_FILE
+echo "set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)" >> $TOOLCHAIN_FILE
+# TODO: Is it possible to prevent CMake from building static libraries? ~ahill
+# NOTE: compiler-rt fails to build on musl because execinfo.h is missing.
+# Disabling COMPILER_RT_BUILD_GWP_ASAN works. ~ahill
+# See also: https://github.com/llvm/llvm-project/issues/60687
+cmake -B stage2 -G Ninja -S llvm \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_INSTALL_PREFIX=$MAPLE/usr \
+ -DCMAKE_TOOLCHAIN_FILE=$(pwd)/$TOOLCHAIN_FILE \
+ -DCLANG_DEFAULT_CXX_STDLIB=libc++ \
+ -DCLANG_DEFAULT_RTLIB=compiler-rt \
+ -DCLANG_DEFAULT_UNWINDLIB=libunwind \
+ -DCOMPILER_RT_BUILD_GWP_ASAN=OFF \
+ -DCOMPILER_RT_USE_BUILTINS_LIBRARY=ON \
+ -DLIBCXX_CXX_ABI=libcxxabi \
+ -DLIBCXX_HAS_MUSL_LIBC=ON \
+ -DLIBCXX_USE_COMPILER_RT=ON \
+ -DLIBCXXABI_USE_COMPILER_RT=ON \
+ -DLIBCXXABI_USE_LLVM_UNWINDER=ON \
+ -DLIBUNWIND_ENABLE_ASSERTIONS=OFF \
+ -DLIBUNWIND_USE_COMPILER_RT=ON \
+ -DLLVM_BUILD_LLVM_DYLIB=ON \
+ -DLLVM_ENABLE_LIBCXX=ON \
+ -DLLVM_ENABLE_LLD=ON \
+ -DLLVM_ENABLE_PROJECTS="clang;lld;llvm" \
+ -DLLVM_ENABLE_RUNTIMES="compiler-rt;libunwind;libcxxabi;libcxx" \
+ -DLLVM_ENABLE_ZSTD=OFF \
+ -DLLVM_HOST_TRIPLE=$HOST \
+ -DLLVM_INSTALL_BINUTILS_SYMLINKS=ON \
+ -DLLVM_INSTALL_UTILS=ON \
+ -DLLVM_LINK_LLVM_DYLIB=ON \
+ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
+ -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON
+cmake --build stage2
+cmake --install stage2
+ln -s clang $MAPLE/bin/cc
+ln -s clang++ $MAPLE/bin/c++
+ln -s ld.lld $MAPLE/bin/ld
+cd ..
+
+# CMake Build
+tar xf ../sources/cmake-*.tar*
+cd cmake-*/
+# NOTE: Tests are disabled because they attempt to run on the system responsible
+# for the build, not the system being built. ~ahill
+cmake -B build -G Ninja \
+ -DBUILD_TESTING=OFF \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_C_COMPILER=$CC \
+ -DCMAKE_CXX_COMPILER=$CXX \
+ -DCMAKE_INSTALL_PREFIX=$MAPLE/usr \
+ -DCMAKE_SYSROOT=$MAPLE \
+ -DCMAKE_USE_OPENSSL=OFF
+cmake --build build
+cmake --install build
+cd ..
+
+# Gawk Build
+tar xf ../sources/gawk-*.tar*
+cd gawk-*/
+./configure \
+ --disable-mpfr \
+ --disable-nls \
+ --exec-prefix="" \
+ --libexecdir=/lib \
+ --localstatedir=/var \
+ --prefix=/usr \
+ --sysconfdir=/etc
+make -j $THREADS
+make -j $THREADS install DESTDIR=$MAPLE
+cd ..
diff --git a/build-chroot.sh b/build-chroot.sh
new file mode 100755
index 0000000..7d76a08
--- /dev/null
+++ b/build-chroot.sh
@@ -0,0 +1,416 @@
+#!/bin/sh -e
+THREADS=$(nproc)
+
+mkdir -p build
+cd build
+
+# Zlib Build
+tar xf ../sources/zlib-*.tar*
+cd zlib-*/
+# The configure script refuses to build a shared library because the linker
+# script attempts to modify symbols that do not exist. Passing CFLAGS fixes the
+# issue. ~ahill
+CFLAGS="-Wl,--undefined-version" ./configure --prefix=/usr --shared
+make -j $THREADS
+make -j $THREADS install
+cd ..
+
+# LibreSSL Build
+tar xf ../sources/libressl-*.tar*
+cd libressl-*/
+./configure \
+ --disable-static \
+ --exec-prefix="" \
+ --libexecdir=/lib \
+ --localstatedir=/var \
+ --prefix=/usr \
+ --sysconfdir=/etc
+make -j $THREADS
+make -j $THREADS install
+cd ..
+
+# bzip2 Build
+tar xf ../sources/bzip2-*.tar*
+cd bzip2-*/
+make CC=clang
+make install CC=clang PREFIX=/usr
+cd ..
+
+# libarchive Build
+tar xf ../sources/libarchive-*.tar*
+cd libarchive-*/
+./configure \
+ --disable-static \
+ --exec-prefix="" \
+ --libexecdir=/lib \
+ --localstatedir=/var \
+ --prefix=/usr \
+ --sysconfdir=/etc
+make -j $THREADS
+make -j $THREADS install
+cd ..
+
+# libexpat Build
+tar xf ../sources/expat-*.tar*
+cd expat-*/
+./configure \
+ --disable-static \
+ --exec-prefix="" \
+ --libexecdir=/lib \
+ --localstatedir=/var \
+ --prefix=/usr \
+ --sysconfdir=/etc
+make -j $THREADS
+make -j $THREADS install
+cd ..
+
+# pkgconf Build
+tar xf ../sources/pkgconf-*.tar*
+cd pkgconf-*/
+./configure \
+ --disable-static \
+ --enable-year2038 \
+ --exec-prefix="" \
+ --libexecdir=/lib \
+ --localstatedir=/var \
+ --prefix=/usr \
+ --sysconfdir=/etc
+make -j $THREADS
+make -j $THREADS install
+cd ..
+
+# Perl Build
+tar xf ../sources/perl-*.tar*
+cd perl-*/
+# NOTE: d_eaccess is manually undefined because of undeclared function use in
+# pp_sys.c ~ahill
+./Configure -des \
+ -Dprefix=/usr \
+ -Dvendorprefix=/usr \
+ -Duseshrplib \
+ -Dusethreads \
+ -Ud_eaccess
+make -j $THREADS
+make -j $THREADS install
+cd ..
+
+# cURL Build
+tar xf ../sources/curl-*.tar*
+cd curl-*/
+./configure \
+ --disable-ntlm \
+ --disable-static \
+ --enable-ipv6 \
+ --enable-optimize \
+ --enable-unix-sockets \
+ --exec-prefix="" \
+ --libexecdir=/lib \
+ --localstatedir=/var \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --with-ca-bundle=/etc/ssl/cert.pem \
+ --with-ca-path=/etc/ssl/certs \
+ --with-openssl \
+ --with-zlib \
+ --with-zsh-functions-dir \
+ --without-libpsl
+make -j $THREADS
+make -j $THREADS install
+cd ..
+
+# Samurai Build
+tar xf ../sources/samurai-*.tar*
+cd samurai-*/
+# NOTE: Unfortunately, there is no way to change the prefix without modifying
+# the Makefile. ~ahill
+sed -i "s/^PREFIX=.*/PREFIX=\/usr/" Makefile
+# NOTE: CC is manually defined due to the use of the c99 command. ~ahill
+make -j $THREADS CC=clang
+make -j $THREADS install
+cd ..
+
+# git Build
+tar xf ../sources/git-*.tar*
+cd git-*/
+# NOTE: musl doesn't support REG_STARTEND, which git requires. Therefore, we
+# pass NO_REGEX=NeedsStartEnd so git will use its own implementation
+# instead. ~ahill
+# NOTE: Passing NO_TCLTK disables the GUI and passing NO_GETTEXT disables locale
+# generation... unless it attempts to build the GUI, where it will attempt
+# to generate the locales anyways. ~ahill
+make -j $THREADS all prefix=/usr NO_GETTEXT=YesUnfortunately NO_REGEX=NeedsStartEnd NO_TCLTK=YesPlease
+make -j $THREADS install prefix=/usr NO_GETTEXT=YesUnfortunately NO_REGEX=NeedsStartEnd NO_TCLTK=YesPlease
+cd ..
+
+# muon Build
+tar xf ../sources/muon-*.tar*
+cd muon-*/
+# NOTE: Muon's bootstrap script requires the "c99" command, which doesn't exist
+# on Maple Linux. Using sed to rewrite the command to clang -std=c99
+# instead. ~ahill
+sed -i "s/c99/clang -std=c99/" bootstrap.sh
+CFLAGS="-DBOOTSTRAP_NO_SAMU" ./bootstrap.sh build
+./build/muon-bootstrap setup -Dprefix=/usr build
+samu -C build
+./build/muon-bootstrap -C build install
+cd ..
+
+# ncurses Build
+tar xf ../sources/ncurses-*.tar*
+cd ncurses-*/
+./configure \
+ --enable-ext-colors \
+ --enable-widec \
+ --exec-prefix="" \
+ --libexecdir=/lib \
+ --prefix=/usr \
+ --with-shared \
+ --with-cxx-binding \
+ --with-cxx-shared \
+ --without-ada \
+ --without-manpages \
+ --without-normal
+make -j $THREADS
+make -j $THREADS install
+cd ..
+
+# zsh Build
+tar xf ../sources/zsh-*.tar*
+cd zsh-*/
+# NOTE: The target triple is explicitly passed to the configure script since it
+# believes the host system is based on glibc rather than musl. ~ahill
+# NOTE: Most of Autoconf's tests do not specify a type for the main function,
+# causing clang to get angry. Passing -Wno-implicit-int fixes this. ~ahill
+CFLAGS="-Wno-implicit-int" ./configure \
+ --build=$(clang -dumpmachine) \
+ --disable-locale \
+ --enable-libc-musl \
+ --enable-multibyte \
+ --exec-prefix="" \
+ --libexecdir=/lib \
+ --prefix=/usr
+make -j $THREADS
+make -j $THREADS install
+# NOTE: While zsh isn't 100% compatible with bash, it can still be used as a
+# reliable replacement in this case. ~ahill
+ln -s zsh /bin/bash
+cd ..
+
+# libcap Build
+tar xf ../sources/libcap-*.tar*
+cd libcap-*/
+# NOTE: Review additional prefix settings for correctness
+make CC=clang prefix=/usr lib=lib -j $THREADS
+make prefix=/usr lib=lib -j $THREADS install
+cd ..
+
+# Linux PAM Build
+tar xf ../sources/Linux-PAM-*.tar*
+cd Linux-PAM-*/
+# FIXME: Muon has an issue with system dependencies that lack a pkgconfig file.
+# We change the method we use for resolving dependencies as a workaround.
+# ~ahill
+sed -i "s/^libdl = dependency('dl')/libdl = dependency('dl', method : 'system')/" meson.build
+# NOTE: The version script associated with PAM attempts to modify symbols that
+# don't exist, so it fails to compile on LLVM. Passing
+# -Wl,--undefined-version fixes the problem. ~ahill
+LDFLAGS="-Wl,--undefined-version" muon setup build
+# NOTE: We are using Samurai directly because we don't have the ability to reach
+# the Internet to download meson's tests in our current state. ~ahill
+samu -C build
+muon -C build install
+cd ..
+
+# OpenRC Build
+tar xf ../sources/openrc-*.tar*
+cd openrc-*/
+muon setup build
+samu -C build
+# NOTE: build/src/shared/version is never generated, which causes an error with
+# the install process. Deleting the last line as a workaround. ~ahill
+sed -i "/^install.*\/src\/shared\/version\".*/d" ./tools/meson_final.sh
+# NOTE: One of the shell scripts OpenRC uses to install requires a DESTDIR, so
+# we simply say the root is / in this case. ~ahill
+DESTDIR=/ muon -C build install
+cd ..
+
+# nasm Build
+tar xf ../sources/nasm-*.tar*
+cd nasm-*/
+./configure \
+ --exec-prefix="" \
+ --libexecdir=/lib \
+ --localstatedir=/var \
+ --prefix=/usr \
+ --sysconfdir=/etc
+make -j $THREADS
+make -j $THREADS install
+cd ..
+
+# Limine Build
+tar xf ../sources/limine-*.tar*
+cd limine-*/
+./configure \
+ --enable-uefi-x86-64 \
+ --exec-prefix="" \
+ --libexecdir=/lib \
+ --localstatedir=/var \
+ --prefix=/usr \
+ --sysconfdir=/etc
+make -j $THREADS
+make -j $THREADS install
+cd ..
+
+# dosfstools Build
+tar xf ../sources/dosfstools-*.tar*
+cd dosfstools-*/
+./configure \
+ --exec-prefix="" \
+ --libexecdir=/usr/lib \
+ --localstatedir=/var \
+ --prefix=/usr \
+ --sysconfdir=/etc
+make -j $THREADS
+make -j $THREADS install
+cd ..
+
+# bison Build
+tar xf ../sources/bison-*.tar*
+cd bison-*/
+./configure \
+ --disable-nls \
+ --exec-prefix="" \
+ --libexecdir=/usr/lib \
+ --localstatedir=/var \
+ --prefix=/usr \
+ --sysconfdir=/etc
+make -j $THREADS
+make -j $THREADS install
+cd ..
+
+# flex Build
+tar xf ../sources/flex-*.tar*
+cd flex-*/
+./configure \
+ --disable-nls \
+ --disable-static \
+ --exec-prefix="" \
+ --libexecdir=/usr/lib \
+ --localstatedir=/var \
+ --prefix=/usr \
+ --sysconfdir=/etc
+make -j $THREADS
+make -j $THREADS install
+cd ..
+
+# util-linux Build
+tar xf ../sources/util-linux-*.tar*
+cd util-linux-*
+# lastlog2 depends on sqlite, which we don't have
+# groups and chown are disabled as we don't have either at this point
+# TODO: Do we care about bash completion when we're using zsh? ~ahill
+./configure \
+ --disable-liblastlog2 \
+ --disable-makeinstall-chown \
+ --disable-nls \
+ --disable-pam-lastlog2 \
+ --disable-static \
+ --disable-use-tty-group \
+ --exec-prefix="" \
+ --libexecdir=/usr/lib \
+ --localstatedir=/var \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --without-python \
+ --without-systemd
+make -j $THREADS
+make -j $THREADS install
+cd ..
+
+# libinih Build
+tar xf ../sources/libinih-*.tar*
+cd inih-*/
+muon setup \
+ -Ddefault_library=shared \
+ -Dprefix=/usr \
+ build
+muon samu -C build
+muon -C build install
+cd ..
+
+# liburcu Build
+tar xf ../sources/userspace-rcu-*.tar*
+cd userspace-rcu-*/
+./configure \
+ --disable-static \
+ --exec-prefix="" \
+ --libexecdir=/usr/lib \
+ --localstatedir=/var \
+ --prefix=/usr \
+ --sysconfdir=/etc
+make -j $THREADS
+make -j $THREADS install
+cd ..
+
+# xfsprogs Build
+tar xf ../sources/xfsprogs-*.tar*
+cd xfsprogs-*/
+# Overriding system statx fixes an issue with musl compatability.
+# Gentoo bugzilla for reference: https://bugs.gentoo.org/948468
+CFLAGS=-DOVERRIDE_SYSTEM_STATX ./configure \
+ --disable-static \
+ --enable-gettext=no \
+ --exec-prefix="" \
+ --libexecdir=/usr/lib \
+ --localstatedir=/var \
+ --prefix=/usr \
+ --sysconfdir=/etc
+make -j $THREADS
+make -j $THREADS install
+cd ..
+
+# bc Build
+tar xf ../sources/bc-*.tar*
+cd bc-*/
+./configure \
+ --exec-prefix="" \
+ --libexecdir=/usr/lib \
+ --localstatedir=/var \
+ --prefix=/usr \
+ --sysconfdir=/etc
+# NOTE: Documentation is not properly built here,
+# MAKEINFO=true replaces the makeinfo executable (which we don't have)
+# with `/usr/bin/true`. This is fine for the bootstrap, but should
+# not be done when properly packaged. ~nmcdaniel
+make MAKEINFO=true -j $THREADS
+make MAKEINFO=true -j $THREADS install
+cd ..
+
+# libelf Build
+tar xf ../sources/libelf-*.tar*
+cd libelf-*/
+# NOTE: This distribution of libelf has been extracted from elfutils and lacks a
+# proper configuration script. The best we can do is modify src/config.h
+# to do what we need. Zstd does *not* belong in binaries. ~ahill
+sed -i "/#define USE_ZSTD.*/d" src/config.h
+# NOTE: Similarly, we need to modify the Makefile to prevent it from linking
+# with zstd. At the very least, we can use the proper target to only build
+# the shared library. ~ahill
+sed -i "s/-lzstd//" Makefile
+make -j $THREADS libelf.so
+make -j $THREADS install-headers
+make -j $THREADS install-shared
+cd ..
+
+# Linux Build
+tar xf ../sources/linux-*.tar*
+cd linux-*/
+# NOTE: LLVM=1 is required for the Linux kernel Makefile. Otherwise, things will
+# not build properly. ~ahill
+LLVM=1 make -j $THREADS mrproper
+LLVM=1 make -j $THREADS defconfig
+LLVM=1 make -j $THREADS
+LLVM=1 make -j $THREADS install
+cd ..
+
+cd ..
diff --git a/build-image.sh b/build-image.sh
new file mode 100755
index 0000000..75c23ed
--- /dev/null
+++ b/build-image.sh
@@ -0,0 +1,20 @@
+#!/bin/sh -e
+dd if=/dev/zero of=maple.img bs=1G count=4
+# TODO: Replace parted with sfdisk to reduce the number of dependencies required
+# to build Maple Linux. ~ahill
+parted --script maple.img \
+ mklabel gpt \
+ mkpart fat32 0% 512M \
+ mkpart xfs 512M 100% \
+ set 1 esp on
+# FIXME: If we adjust the partition table above, these numbers are no longer
+# accurate. Is there a way to automate this process in a rootless
+# fashion? ~ahill
+dd if=/dev/zero of=maple.img1 count=997375
+mkfs.fat -F32 maple.img1
+dd if=maple.img1 of=maple.img seek=2048 conv=notrunc
+rm maple.img1
+dd if=/dev/zero of=maple.img2 count=7387135
+mkfs.xfs maple.img2
+dd if=maple.img2 of=maple.img seek=999424 conv=notrunc
+rm maple.img2 \ No newline at end of file
diff --git a/maple-chroot.sh b/maple-chroot.sh
new file mode 100755
index 0000000..8afe8d0
--- /dev/null
+++ b/maple-chroot.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+MAPLE=$(pwd)/maple
+
+if mount --rbind /dev $MAPLE/dev && mount --make-rslave $MAPLE/dev; then
+ if mount -t proc /proc $MAPLE/proc; then
+ if mount --rbind /sys $MAPLE/sys && mount --make-rslave $MAPLE/sys; then
+ if mount --rbind /tmp $MAPLE/tmp; then
+ if mount --bind /run $MAPLE/run; then
+ if mount --bind ./sources $MAPLE/maple/sources; then
+ chroot $MAPLE /bin/sh
+ umount $MAPLE/maple/sources
+ fi
+ umount $MAPLE/run
+ fi
+ umount $MAPLE/tmp
+ fi
+ umount -R $MAPLE/sys
+ fi
+ umount $MAPLE/proc
+ fi
+ umount -R $MAPLE/dev
+fi \ No newline at end of file
diff --git a/sources.list b/sources.list
new file mode 100644
index 0000000..4f808da
--- /dev/null
+++ b/sources.list
@@ -0,0 +1,43 @@
+515430115b3334c636317503460a0950dff79940aa3259ce2c1aa67c2881d023,https://ftp.gnu.org/gnu/bc/bc-1.08.1.tar.xz,
+9bba0214ccf7f1079c5d59210045227bcf619519840ebfa80cd3849cff5a5bf2,https://ftp.gnu.org/gnu/bison/bison-3.8.2.tar.xz,
+ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269,https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz
+ddc54ad63b87e153cf50be450a6580f1b17b4881de8941da963ff56991a4083b,https://github.com/Kitware/CMake/releases/download/v4.0.0/cmake-4.0.0.tar.gz,
+e8bb26ad0293f9b5a1fc43fb42ba970e312c66ce92c1b0b16713d7500db251bf,https://ftp.gnu.org/gnu/coreutils/coreutils-9.7.tar.xz,
+c261a4db579b289a7501565497658bbd52d3138fdbaccf1490fa918129ab45bc,https://curl.se/download/curl-8.13.0.tar.gz,
+a0d845af4bfc1e11ff67986cf9684ac9d158b75c04b20433f1f213d2053680be,https://salsa.debian.org/debian/dash/-/archive/debian/0.5.12-11/dash-debian-0.5.12-11.tar.gz,
+7c8b7f9fc8609141fdea9cece85249d308624391ff61dedaf528fcb337727dfd,https://ftp.gnu.org/gnu/diffutils/diffutils-3.12.tar.xz,
+64926eebf90092dca21b14259a5301b7b98e7b1943e8a201c7d726084809b527,https://github.com/dosfstools/dosfstools/releases/download/v4.2/dosfstools-4.2.tar.gz,
+354552544b8f99012e5062f7d570ec77f14b412a3ff5c7d8d0dae62c0d217c30,https://github.com/libexpat/libexpat/releases/download/R_2_7_1/expat-2.7.1.tar.xz,
+1387e0b67ff247d2abde998f90dfbf70c1491391a59ddfecb8ae698789f0a4f5,https://ftp.gnu.org/gnu/findutils/findutils-4.10.0.tar.xz,
+e87aae032bf07c26f85ac0ed3250998c37621d95f8bd748b31f15b33c45ee995,https://github.com/westes/flex/releases/download/v2.6.4/flex-2.6.4.tar.gz,
+f8c3486509de705192138b00ef2c00bbbdd0e84c30d5c07d23fc73a9dc4cc9cc,https://ftp.gnu.org/gnu/gawk/gawk-5.3.2.tar.xz,
+1bfeeafc78036e78c7b422219473987a6fa79bfdc1da673fcf20e4901399e09f,https://git.kernel.org/pub/scm/git/git.git/snapshot/git-2.49.0.tar.gz,
+1db2aedde89d0dea42b16d9528f894c8d15dae4e190b59aecc78f5a951276eab,https://ftp.gnu.org/gnu/grep/grep-3.11.tar.xz,
+7454eb6935db17c6655576c2e1b0fabefd38b4d0936e0f87f48cd062ce91a057,https://ftp.gnu.org/gnu/gzip/gzip-1.13.tar.xz,
+ed8b5732e4cd6e30fae909fb945cad8ff9cb7be5c6cdaa3944ec96e4a200c04c,https://libarchive.org/downloads/libarchive-3.7.9.tar.xz,
+de4e7e064c9ba451d5234dd46e897d7c71c96a9ebf9a0c445bc04f4742d83632,https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.75.tar.xz,
+a359755a54200e0d9fab4bf169d5af7d2177d12b324874c6c32eaac5cce79295,https://github.com/arachsys/libelf/archive/refs/tags/v0.192.1.tar.gz,libelf-0.192.1.tar.gz
+706aa05c888b53bd170e5d8aa8f8a9d9ccf5449dfed262d5103d1f292af26774,https://github.com/benhoyt/inih/archive/refs/tags/r60.tar.gz,libinih-r60.tar.gz
+4d841955f0acc3dfc71d0e3dd35f283af461222350e26843fea9731c0246a1e4,https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-4.0.0.tar.gz,
+47460e776a45bd4f54f14b7a6f6c1302d06b2df668b4a13033fdb0b2c8e4a9e0,https://github.com/limine-bootloader/limine/releases/download/v9.2.2/limine-9.2.2.tar.xz,
+5bf122d1879fd64fadf0cecfcd477957ebce1bc5931c14835ee0eda88463e407,https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.14.1.tar.xz,
+57dcd7a6b966ecd5bbd95e1d11173734691e16b68692fa59661cdae9b13b1697,https://github.com/linux-pam/linux-pam/releases/download/v1.7.0/Linux-PAM-1.7.0.tar.xz,
+f0a4a240aabc9b056142d14d5478bb6d962aeac549cbd75b809f5499240a8b38,https://github.com/llvm/llvm-project/releases/download/llvmorg-20.1.2/llvm-project-20.1.2.src.tar.xz,
+63aede5c6d33b6d9b13511cd0be2cac046f2e70fd0a07aa9573a04a82783af96,https://ftp.gnu.org/gnu/m4/m4-1.4.19.tar.xz,
+dd16fb1d67bfab79a72f5e8390735c49e3e8e70b4945a15ab1f81ddb78658fb3,https://ftp.gnu.org/gnu/make/make-4.4.1.tar.gz,
+c2ce8302e886b2d3534ec38896a824dc83f43698d085d57bb19a751611d94e86,https://git.sr.ht/~lattis/muon/archive/0.4.0.tar.gz,muon-0.4.0.tar.gz
+a9a118bbe84d8764da0ea0d28b3ab3fae8477fc7e4085d90102b8596fc7c75e4,https://musl.libc.org/releases/musl-1.2.5.tar.gz,
+1412a1c760bbd05db026b6c0d1657affd6631cd0a63cddb6f73cc6d4aa616148,https://www.nasm.us/pub/nasm/releasebuilds/2.16.03/nasm-2.16.03.tar.xz,
+97fc51ac2b085d4cde31ef4d2c3122c21abc217e9090a43a30fc5ec21684e059,https://invisible-island.net/datafiles/release/ncurses.tar.gz,ncurses-6.3.tar.gz
+a56bfc25c86620c6d04ee3037fbeb7f3cc508f6d0040ca006dea34b8ad2696e9,https://github.com/OpenRC/openrc/archive/refs/tags/0.61.tar.gz,openrc-0.61.tar.gz
+02f8c45bb379ed0c3de7514fad48c714fd46be8f0b536bfd5320050165a1ee26,https://www.cpan.org/src/5.0/perl-5.40.1.tar.gz,
+51203d99ed573fa7344bf07ca626f10c7cc094e0846ac4aa0023bd0c83c25a41,https://distfiles.ariadne.space/pkgconf/pkgconf-2.4.3.tar.xz,
+3b8cf51548dfc49b7efe035e191ff5e1963ebc4fe8f6064a5eefc5343eaf78a5,https://github.com/michaelforney/samurai/releases/download/1.2/samurai-1.2.tar.gz,
+6e226b732e1cd739464ad6862bd1a1aba42d7982922da7a53519631d24975181,https://ftp.gnu.org/gnu/sed/sed-4.9.tar.xz,
+4d62ff37342ec7aed748535323930c7cf94acf71c3591882b26a7ea50f3edc16,https://ftp.gnu.org/gnu/tar/tar-1.35.tar.xz,
+0b54f79df85912504de0b14aec7971e3f964491af1812d83447005807513cd9e,https://github.com/tukaani-project/xz/releases/download/v5.8.1/xz-5.8.1.tar.xz,
+98d66cc12f2c5881879b976f0c55d10d311401513be254e3bd28cf3811fb50c8,https://lttng.org/files/urcu/userspace-rcu-latest-0.15.tar.bz2,userspace-rcu-0.15.tar.bz2
+c014b5861695b603d0be2ad1e6f10d5838b9d7859e1dd72d01504556817d8a87,https://www.kernel.org/pub/linux/utils/util-linux/v2.41/util-linux-2.41.tar.gz,
+0459933f93d94c82bc2789e7bd63742273d9d74207cdae67dc3032038da08337,https://www.kernel.org/pub/linux/utils/fs/xfs/xfsprogs/xfsprogs-6.13.0.tar.xz,
+9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23,https://www.zlib.net/zlib-1.3.1.tar.gz,
+9b8d1ecedd5b5e81fbf1918e876752a7dd948e05c1a0dba10ab863842d45acd5,https://www.zsh.org/pub/zsh-5.9.tar.xz,
diff --git a/sources.sh b/sources.sh
new file mode 100755
index 0000000..6d700ea
--- /dev/null
+++ b/sources.sh
@@ -0,0 +1,18 @@
+#!/bin/sh -e
+mkdir -p sources
+cd sources
+cat ../sources.list | while read line; do
+ HASH=$(echo $line | cut -d"," -f1)
+ URL=$(echo $line | cut -d"," -f2)
+ CANONICAL=$(echo $line | cut -d"," -f3)
+ if [ -z "$CANONICAL" ]; then
+ OUTPUT=$(basename $URL)
+ else
+ OUTPUT=$CANONICAL
+ fi
+ if [ ! -f "$OUTPUT" ]; then
+ echo $OUTPUT
+ curl -L $URL -o $OUTPUT
+ fi
+ echo "$HASH $OUTPUT" | sha256sum -c -
+done