diff --git a/native_bootstrap.sh b/native_bootstrap.sh index bb868bd81..c832431a2 100755 --- a/native_bootstrap.sh +++ b/native_bootstrap.sh @@ -873,6 +873,84 @@ solus() perl-html-parser } +############################################################################### +# Helper function to detect if we're running on Redox OS +# This needs to be checked before FreeBSD since both use 'pkg' package manager +############################################################################### +is_os_redox() +{ + [ "$(uname -s)" = "Redox" ] +} + +############################################################################### +# This function takes care of installing all dependencies for building Redox on +# Redox OS itself (bootstrapping Redox on Redox) +# @params: $1 the emulator to install, "virtualbox" or "qemu" +############################################################################### +redox() +{ + echo "Detected Redox OS" + + # Check if git is installed + if [ -z "$(which git)" ]; then + echo "Installing git..." + sudo pkg install git + fi + + # Handle emulator selection + if [ "$1" == "qemu" ]; then + echo "QEMU is not available on Redox OS yet, but it is mandatory for running the built system." + echo "Please install QEMU manually on a compatible host or use another machine to run the emulator." + exit 1 + elif [ "$1" == "virtualbox" ]; then + echo "VirtualBox is not supported on Redox OS." + exit 1 + else + echo "Unknown emulator: $1" + exit 1 + fi + + echo "Installing necessary build tools..." + + # Core development packages that are likely available on Redox + # This list is conservative and only includes essentials + packages=""autoconf \ + automake \ + expat \ + gcc13 \ + gnu-make \ + libgmp \ + libjpeg \ + libpng \ + nasm \ + patch \ + pkg-config \ + rust \ + rustpython \ + sdl1 \ + sdl2-ttf \ + vim" + + + # Try to install packages, but don't fail if some are unavailable + # since Redox package ecosystem is still developing + for pkg in $PKGS; do + if ! pkg list | grep -q "^${pkg}"; then + echo "Attempting to install ${pkg}..." + if ! sudo pkg install ${pkg} 2>/dev/null; then + echo "Warning: ${pkg} could not be installed. It may not be available yet." + fi + else + echo "${pkg} is already installed." + fi + done + + echo "" + echo "Note: Building Redox on Redox itself is experimental." + echo "Some dependencies may not be available yet in the Redox package repository." + echo "For the best build experience, consider using podman_bootstrap.sh on another system." +} + ###################################################################### # This function outlines the different options available for bootstrap ###################################################################### @@ -1098,8 +1176,11 @@ if [ "Darwin" == "$(uname -s)" ]; then else # Here we will use package managers to determine which operating system the user is using. + # Redox OS + if is_os_redox; then + redox "$emulator" # SUSE and derivatives - if hash 2>/dev/null zypper; then + elif hash 2>/dev/null zypper; then suse "$emulator" # Debian or any derivative of it elif hash 2>/dev/null apt-get; then