2024-07-09 14:58:07 +02:00
|
|
|
# This script setup the Redox build system
|
|
|
|
# It install Rustup, the recipe dependencies for cross-compilation
|
|
|
|
# and download the build system configuration files
|
|
|
|
|
2020-05-02 19:54:37 +02:00
|
|
|
#!/usr/bin/env bash
|
2016-11-03 22:19:44 +01:00
|
|
|
|
2023-12-13 21:51:55 +01:00
|
|
|
set -e
|
|
|
|
|
2016-11-03 22:19:44 +01:00
|
|
|
##########################################################
|
|
|
|
# This function is simply a banner to introduce the script
|
|
|
|
##########################################################
|
|
|
|
banner()
|
2017-01-02 22:46:23 +01:00
|
|
|
{
|
2016-11-03 22:19:44 +01:00
|
|
|
echo "|------------------------------------------|"
|
2022-09-29 12:48:31 +02:00
|
|
|
echo "|----- Welcome to the Redox bootstrap -----|"
|
2016-11-03 22:19:44 +01:00
|
|
|
echo "|------------------------------------------|"
|
|
|
|
}
|
|
|
|
|
2016-11-09 01:48:10 +01:00
|
|
|
###################################################################################
|
|
|
|
# This function takes care of installing a dependency via package manager of choice
|
2022-09-29 12:48:31 +02:00
|
|
|
# for building Redox on BSDs (macOS, FreeBSD, etc.).
|
2016-11-09 01:48:10 +01:00
|
|
|
# @params: $1 package manager
|
2022-09-29 12:48:31 +02:00
|
|
|
# $2 package name
|
|
|
|
# $3 binary name (optional)
|
2016-11-09 01:48:10 +01:00
|
|
|
###################################################################################
|
2020-05-03 02:13:21 +02:00
|
|
|
install_bsd_pkg()
|
2016-11-09 01:48:10 +01:00
|
|
|
{
|
|
|
|
PKG_MANAGER=$1
|
|
|
|
PKG_NAME=$2
|
|
|
|
BIN_NAME=$3
|
|
|
|
if [ -z "$BIN_NAME" ]; then
|
|
|
|
BIN_NAME=$PKG_NAME
|
|
|
|
fi
|
|
|
|
|
2017-02-24 19:25:39 +01:00
|
|
|
BIN_LOCATION=$(which $BIN_NAME || true)
|
2016-11-09 01:48:10 +01:00
|
|
|
if [ -z "$BIN_LOCATION" ]; then
|
|
|
|
echo "$PKG_MANAGER install $PKG_NAME"
|
|
|
|
$PKG_MANAGER install "$PKG_NAME"
|
|
|
|
else
|
|
|
|
echo "$BIN_NAME already exists at $BIN_LOCATION, no need to install $PKG_NAME..."
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
install_macports_pkg()
|
|
|
|
{
|
2020-05-03 02:13:21 +02:00
|
|
|
install_bsd_pkg "sudo port" "$1" "$2"
|
2016-11-09 01:48:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
install_brew_pkg()
|
|
|
|
{
|
2020-05-03 02:13:21 +02:00
|
|
|
install_bsd_pkg "brew" $@
|
2016-11-09 01:48:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
install_brew_cask_pkg()
|
|
|
|
{
|
2020-05-03 02:13:21 +02:00
|
|
|
install_bsd_pkg "brew cask" $@
|
|
|
|
}
|
|
|
|
|
|
|
|
install_freebsd_pkg()
|
|
|
|
{
|
|
|
|
install_bsd_pkg "sudo pkg" $@
|
2016-11-09 01:48:10 +01:00
|
|
|
}
|
|
|
|
|
2016-11-03 22:19:44 +01:00
|
|
|
###############################################################################
|
2016-11-09 01:48:10 +01:00
|
|
|
# This function checks which of the supported package managers
|
2022-09-29 12:48:31 +02:00
|
|
|
# is available on the macOS host.
|
2017-01-03 13:14:37 +01:00
|
|
|
# If a supported package manager is found, it delegates the installing work to
|
2016-11-09 01:48:10 +01:00
|
|
|
# the relevant function.
|
|
|
|
# Otherwise this function will exit this script with an error.
|
2016-11-03 22:19:44 +01:00
|
|
|
###############################################################################
|
|
|
|
osx()
|
|
|
|
{
|
2022-09-29 12:48:31 +02:00
|
|
|
echo "Detected macOS!"
|
2016-11-09 01:48:10 +01:00
|
|
|
|
|
|
|
if [ ! -z "$(which brew)" ]; then
|
|
|
|
osx_homebrew $@
|
|
|
|
elif [ ! -z "$(which port)" ]; then
|
|
|
|
osx_macports $@
|
|
|
|
else
|
2017-01-03 13:14:37 +01:00
|
|
|
echo "Please install either Homebrew or MacPorts, if you wish to use this script"
|
2016-11-09 01:48:10 +01:00
|
|
|
echo "Re-run this script once you installed one of those package managers"
|
|
|
|
echo "Will not install, now exiting..."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# This function takes care of installing all dependencies using MacPorts
|
2022-09-29 12:48:31 +02:00
|
|
|
# for building Redox on macOS
|
|
|
|
# @params: $1 the emulator to install, "virtualbox" or "qemu"
|
2016-11-09 01:48:10 +01:00
|
|
|
###############################################################################
|
|
|
|
osx_macports()
|
|
|
|
{
|
2022-09-29 12:48:31 +02:00
|
|
|
echo "MacPorts detected! Now updating..."
|
2016-11-09 01:48:10 +01:00
|
|
|
sudo port -v selfupdate
|
|
|
|
|
|
|
|
echo "Installing missing packages..."
|
|
|
|
|
|
|
|
install_macports_pkg "git"
|
|
|
|
|
2023-12-13 21:51:55 +01:00
|
|
|
|
|
|
|
if [ "$1" == "qemu" ]; then
|
2016-11-09 01:48:10 +01:00
|
|
|
install_macports_pkg "qemu" "qemu-system-x86_64"
|
2023-12-13 21:51:55 +01:00
|
|
|
elif [ "$1" == "virtualbox" ]; then
|
2016-11-09 01:48:10 +01:00
|
|
|
install_macports_pkg "virtualbox"
|
2023-12-13 21:51:55 +01:00
|
|
|
else
|
|
|
|
echo "Unknown emulator: $1"
|
|
|
|
exit 1
|
|
|
|
fi
|
2016-11-09 01:48:10 +01:00
|
|
|
|
2017-07-13 22:00:55 +02:00
|
|
|
install_macports_pkg "coreutils"
|
|
|
|
install_macports_pkg "findutils"
|
2024-07-18 19:51:05 +02:00
|
|
|
install_macports_pkg "gcc14"
|
2016-11-09 01:48:10 +01:00
|
|
|
install_macports_pkg "nasm"
|
2016-11-25 15:07:24 +01:00
|
|
|
install_macports_pkg "pkgconfig"
|
2016-11-09 01:48:10 +01:00
|
|
|
install_macports_pkg "osxfuse"
|
|
|
|
install_macports_pkg "x86_64-elf-gcc"
|
2017-12-10 17:00:44 +01:00
|
|
|
install_macports_pkg "cmake"
|
2023-04-02 12:29:15 +02:00
|
|
|
install_macports_pkg "ninja"
|
|
|
|
install_macports_pkg "po4a"
|
2023-04-04 21:03:37 +02:00
|
|
|
install_macports_pkg "findutils"
|
2023-04-15 19:41:42 +02:00
|
|
|
install_macports_pkg "texinfo"
|
2023-06-06 01:07:40 +02:00
|
|
|
install_macports_pkg "autoconf"
|
|
|
|
install_macports_pkg "openssl3"
|
|
|
|
install_macports_pkg "openssl11"
|
|
|
|
install_macports_pkg "bison"
|
|
|
|
install_macports_pkg "curl"
|
|
|
|
install_macports_pkg "wget"
|
|
|
|
install_macports_pkg "file"
|
|
|
|
install_macports_pkg "flex"
|
|
|
|
install_macports_pkg "gperf"
|
|
|
|
install_macports_pkg "expat"
|
|
|
|
install_macports_pkg "gmp"
|
|
|
|
install_macports_pkg "libpng"
|
|
|
|
install_macports_pkg "jpeg"
|
|
|
|
install_macports_pkg "libsdl12"
|
|
|
|
install_macports_pkg "libsdl2_ttf"
|
|
|
|
install_macports_pkg "libtool"
|
|
|
|
install_macports_pkg "m4"
|
|
|
|
install_macports_pkg "ninja"
|
|
|
|
install_macports_pkg "meson"
|
|
|
|
install_macports_pkg "python311"
|
|
|
|
install_macports_pkg "py37-mako"
|
|
|
|
install_macports_pkg "xdg-utils"
|
|
|
|
install_macports_pkg "zip"
|
|
|
|
install_macports_pkg "unzip"
|
2024-07-18 19:51:05 +02:00
|
|
|
install_macports_pkg "llvm-18"
|
|
|
|
install_macports_pkg "clang-18"
|
2023-06-06 01:07:40 +02:00
|
|
|
install_macports_pkg "perl5.24"
|
|
|
|
install_macports_pkg "p5-html-parser"
|
|
|
|
install_macports_pkg "doxygen"
|
|
|
|
install_macports_pkg "gpatch"
|
|
|
|
install_macports_pkg "automake"
|
|
|
|
install_macports_pkg "scons"
|
|
|
|
install_macports_pkg "gmake"
|
2023-07-26 00:25:28 +02:00
|
|
|
install_macports_pkg "lua"
|
2023-08-25 15:42:14 +02:00
|
|
|
install_macports_pkg "protobuf-c"
|
2016-11-09 01:48:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
###############################################################################
|
2017-01-03 13:14:37 +01:00
|
|
|
# This function takes care of installing all dependencies using Homebrew
|
2022-09-29 12:48:31 +02:00
|
|
|
# for building Redox on macOS
|
|
|
|
# @params: $1 the emulator to install, "virtualbox" or "qemu"
|
2016-11-09 01:48:10 +01:00
|
|
|
###############################################################################
|
|
|
|
osx_homebrew()
|
|
|
|
{
|
|
|
|
echo "Homebrew detected! Now updating..."
|
|
|
|
brew update
|
|
|
|
|
|
|
|
echo "Installing missing packages..."
|
|
|
|
|
|
|
|
install_brew_pkg "git"
|
|
|
|
|
2023-12-13 21:51:55 +01:00
|
|
|
|
|
|
|
if [ "$1" == "qemu" ]; then
|
2016-11-09 01:48:10 +01:00
|
|
|
install_brew_pkg "qemu" "qemu-system-x86_64"
|
2023-12-13 21:51:55 +01:00
|
|
|
elif [ "$1" == "virtualbox" ]; then
|
2016-11-09 01:48:10 +01:00
|
|
|
install_brew_pkg "virtualbox"
|
2023-12-13 21:51:55 +01:00
|
|
|
else
|
|
|
|
echo "Unknown emulator: $1"
|
|
|
|
exit 1
|
|
|
|
fi
|
2016-11-09 01:48:10 +01:00
|
|
|
|
2020-03-07 11:10:02 +01:00
|
|
|
install_brew_pkg "automake"
|
|
|
|
install_brew_pkg "bison"
|
|
|
|
install_brew_pkg "gettext"
|
|
|
|
install_brew_pkg "libtool"
|
|
|
|
install_brew_pkg "make"
|
2016-11-09 01:48:10 +01:00
|
|
|
install_brew_pkg "nasm"
|
2024-07-18 19:51:05 +02:00
|
|
|
install_brew_pkg "gcc@14"
|
2016-11-09 01:48:10 +01:00
|
|
|
install_brew_pkg "pkg-config"
|
2020-05-30 07:12:43 +02:00
|
|
|
install_brew_pkg "cmake"
|
2023-04-02 12:29:15 +02:00
|
|
|
install_brew_pkg "ninja"
|
|
|
|
install_brew_pkg "po4a"
|
2023-04-12 22:57:22 +02:00
|
|
|
install_brew_pkg "macfuse"
|
2023-04-04 21:03:37 +02:00
|
|
|
install_brew_pkg "findutils"
|
2023-04-15 19:41:42 +02:00
|
|
|
install_brew_pkg "texinfo"
|
2023-06-06 01:07:40 +02:00
|
|
|
install_brew_pkg "openssl@1.1"
|
|
|
|
install_brew_pkg "openssl@3.0"
|
|
|
|
install_brew_pkg "autoconf"
|
|
|
|
install_brew_pkg "curl"
|
|
|
|
install_brew_pkg "wget"
|
|
|
|
install_brew_pkg "flex"
|
|
|
|
install_brew_pkg "gperf"
|
|
|
|
install_brew_pkg "expat"
|
|
|
|
install_brew_pkg "gmp"
|
|
|
|
install_brew_pkg "libpng"
|
|
|
|
install_brew_pkg "jpeg"
|
|
|
|
install_brew_pkg "sdl12-compat"
|
|
|
|
install_brew_pkg "sdl2_ttf"
|
|
|
|
install_brew_pkg "perl"
|
|
|
|
install_brew_pkg "libtool"
|
|
|
|
install_brew_pkg "m4"
|
|
|
|
install_brew_pkg "ninja"
|
|
|
|
install_brew_pkg "meson"
|
|
|
|
install_brew_pkg "python@3.11"
|
|
|
|
install_brew_pkg "zip"
|
|
|
|
install_brew_pkg "unzip"
|
|
|
|
install_brew_pkg "llvm"
|
|
|
|
install_brew_pkg "doxygen"
|
|
|
|
install_brew_pkg "gpatch"
|
|
|
|
install_brew_pkg "automake"
|
|
|
|
install_brew_pkg "scons"
|
2023-07-26 00:25:28 +02:00
|
|
|
install_brew_pkg "lua"
|
2023-08-11 12:42:40 +02:00
|
|
|
install_brew_pkg "ant"
|
2023-08-25 15:42:14 +02:00
|
|
|
install_brew_pkg "protobuf"
|
2016-11-09 01:48:10 +01:00
|
|
|
|
2020-03-07 11:10:02 +01:00
|
|
|
install_brew_pkg "redox-os/gcc_cross_compilers/x86_64-elf-gcc" "x86_64-elf-gcc"
|
2016-11-03 22:19:44 +01:00
|
|
|
}
|
|
|
|
|
2020-05-03 02:13:21 +02:00
|
|
|
###############################################################################
|
|
|
|
# This function takes care of installing all dependencies using pkg
|
2022-09-29 12:48:31 +02:00
|
|
|
# for building Redox on FreeBSD
|
|
|
|
# @params: $1 the emulator to install, "virtualbox" or "qemu"
|
2020-05-03 02:13:21 +02:00
|
|
|
###############################################################################
|
|
|
|
freebsd()
|
|
|
|
{
|
2023-12-13 21:51:55 +01:00
|
|
|
set -x
|
2020-05-03 02:13:21 +02:00
|
|
|
echo "FreeBSD detected!"
|
|
|
|
echo "Installing missing packages..."
|
|
|
|
|
|
|
|
install_freebsd_pkg "git"
|
|
|
|
|
2023-12-13 21:51:55 +01:00
|
|
|
|
|
|
|
if [ "$1" == "qemu" ]; then
|
2020-05-03 02:13:21 +02:00
|
|
|
install_freebsd_pkg "qemu" "qemu-system-x86_64"
|
2023-12-13 21:51:55 +01:00
|
|
|
elif [ "$1" == "virtualbox" ]; then
|
2020-05-03 02:13:21 +02:00
|
|
|
install_freebsd_pkg "virtualbox"
|
2023-12-13 21:51:55 +01:00
|
|
|
else
|
|
|
|
echo "Unknown emulator: $1"
|
|
|
|
exit 1
|
|
|
|
fi
|
2020-05-03 02:13:21 +02:00
|
|
|
install_freebsd_pkg "coreutils"
|
|
|
|
install_freebsd_pkg "findutils"
|
|
|
|
install_freebsd_pkg "gcc"
|
|
|
|
install_freebsd_pkg "nasm"
|
|
|
|
install_freebsd_pkg "pkgconf"
|
2023-06-06 01:07:40 +02:00
|
|
|
install_freebsd_pkg "fusefs-libs3"
|
2020-05-03 02:13:21 +02:00
|
|
|
install_freebsd_pkg "cmake"
|
|
|
|
install_freebsd_pkg "gmake"
|
|
|
|
install_freebsd_pkg "wget"
|
2023-06-06 01:07:40 +02:00
|
|
|
install_freebsd_pkg "openssl"
|
2020-05-03 02:51:21 +02:00
|
|
|
install_freebsd_pkg "texinfo"
|
2020-05-03 03:06:57 +02:00
|
|
|
install_freebsd_pkg "python"
|
2020-05-04 00:57:52 +02:00
|
|
|
install_freebsd_pkg "automake"
|
|
|
|
install_freebsd_pkg "gettext"
|
|
|
|
install_freebsd_pkg "bison"
|
|
|
|
install_freebsd_pkg "gperf"
|
2023-06-06 01:07:40 +02:00
|
|
|
install_freebsd_pkg "autoconf"
|
|
|
|
install_freebsd_pkg "curl"
|
|
|
|
install_freebsd_pkg "file"
|
|
|
|
install_freebsd_pkg "flex"
|
|
|
|
install_freebsd_pkg "expat2"
|
|
|
|
install_freebsd_pkg "gmp"
|
|
|
|
install_freebsd_pkg "png"
|
|
|
|
install_freebsd_pkg "libjpeg-turbo"
|
|
|
|
install_freebsd_pkg "sdl12"
|
|
|
|
install_freebsd_pkg "sdl2_ttf"
|
|
|
|
install_freebsd_pkg "perl5.36"
|
|
|
|
install_freebsd_pkg "p5-HTML-Parser"
|
|
|
|
install_freebsd_pkg "libtool"
|
|
|
|
install_freebsd_pkg "m4"
|
|
|
|
install_freebsd_pkg "po4a"
|
|
|
|
install_freebsd_pkg "syslinux"
|
|
|
|
install_freebsd_pkg "ninja"
|
|
|
|
install_freebsd_pkg "meson"
|
|
|
|
install_freebsd_pkg "xdg-utils"
|
|
|
|
install_freebsd_pkg "zip"
|
|
|
|
install_freebsd_pkg "unzip"
|
|
|
|
install_freebsd_pkg "llvm"
|
|
|
|
install_freebsd_pkg "doxygen"
|
|
|
|
install_freebsd_pkg "patch"
|
|
|
|
install_freebsd_pkg "automake"
|
|
|
|
install_freebsd_pkg "scons"
|
2023-07-26 00:25:28 +02:00
|
|
|
install_freebsd_pkg "lua54"
|
2023-08-25 15:42:14 +02:00
|
|
|
install_freebsd_pkg "py-protobuf-compiler"
|
2023-12-13 21:51:55 +01:00
|
|
|
set +x
|
2020-05-03 02:13:21 +02:00
|
|
|
}
|
|
|
|
|
2016-11-03 22:19:44 +01:00
|
|
|
###############################################################################
|
2022-09-29 12:48:31 +02:00
|
|
|
# This function takes care of installing all dependencies for building Redox on
|
|
|
|
# Arch Linux
|
|
|
|
# @params: $1 the emulator to install, "virtualbox" or "qemu"
|
2024-02-10 10:59:39 +01:00
|
|
|
# $2 install non-interactively, boolean
|
2016-11-03 22:19:44 +01:00
|
|
|
###############################################################################
|
|
|
|
archLinux()
|
|
|
|
{
|
2024-02-10 10:59:39 +01:00
|
|
|
noninteractive=$2
|
|
|
|
|
|
|
|
pacman_install="pacman -S --needed"
|
|
|
|
if [ "$noninteractive" = true ]; then
|
|
|
|
pacman_install+=" --noconfirm"
|
|
|
|
fi
|
|
|
|
|
2016-11-03 22:19:44 +01:00
|
|
|
echo "Detected Arch Linux"
|
2023-07-26 00:25:28 +02:00
|
|
|
packages="cmake \
|
|
|
|
fuse \
|
|
|
|
git \
|
|
|
|
gperf \
|
|
|
|
perl-html-parser \
|
|
|
|
nasm \
|
|
|
|
wget \
|
|
|
|
texinfo \
|
|
|
|
bison \
|
|
|
|
flex \
|
|
|
|
po4a \
|
|
|
|
autoconf \
|
|
|
|
curl \
|
|
|
|
file \
|
|
|
|
patch \
|
|
|
|
automake \
|
|
|
|
scons \
|
|
|
|
waf \
|
|
|
|
expat \
|
|
|
|
gmp \
|
|
|
|
libtool \
|
|
|
|
libpng \
|
|
|
|
libjpeg-turbo \
|
|
|
|
sdl12-compat \
|
|
|
|
m4 \
|
|
|
|
pkgconf \
|
|
|
|
po4a \
|
|
|
|
syslinux \
|
|
|
|
meson \
|
|
|
|
python \
|
|
|
|
python-mako \
|
|
|
|
make \
|
|
|
|
xdg-utils \
|
|
|
|
zip \
|
|
|
|
unzip \
|
|
|
|
llvm \
|
|
|
|
clang \
|
|
|
|
perl \
|
|
|
|
doxygen \
|
2023-08-11 12:42:40 +02:00
|
|
|
lua \
|
2023-08-25 15:42:14 +02:00
|
|
|
ant \
|
2024-05-08 12:52:07 +02:00
|
|
|
protobuf \
|
|
|
|
rsync"
|
2023-12-13 21:51:55 +01:00
|
|
|
|
2016-11-03 22:19:44 +01:00
|
|
|
if [ "$1" == "qemu" ]; then
|
2018-10-30 07:15:59 +01:00
|
|
|
packages="$packages qemu"
|
|
|
|
elif [ "$1" == "virtualbox" ]; then
|
|
|
|
packages="$packages virtualbox"
|
2023-12-13 21:51:55 +01:00
|
|
|
else
|
|
|
|
echo "Unknown emulator: $1"
|
|
|
|
exit 1
|
2016-11-03 22:19:44 +01:00
|
|
|
fi
|
2019-10-27 19:59:52 +01:00
|
|
|
# Scripts should not cause a system update in order to just install a couple
|
|
|
|
# of packages. If pacman -S --needed is going to fail, let it fail and the
|
|
|
|
# user will figure out the issues (without updating if required) and rerun
|
|
|
|
# the script.
|
|
|
|
#echo "Updating system..."
|
|
|
|
#sudo pacman -Syu
|
2018-10-30 07:15:59 +01:00
|
|
|
|
|
|
|
echo "Installing packages $packages..."
|
2024-02-10 10:59:39 +01:00
|
|
|
sudo $pacman_install $packages
|
2016-11-03 22:19:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
###############################################################################
|
2022-09-29 12:48:31 +02:00
|
|
|
# This function takes care of installing all dependencies for building Redox on
|
|
|
|
# Debian-based Linux
|
|
|
|
# @params: $1 the emulator to install, "virtualbox" or "qemu"
|
2024-02-10 10:59:39 +01:00
|
|
|
# $2 install non-interactively, boolean
|
|
|
|
# $3 the package manager to use
|
2016-11-03 22:19:44 +01:00
|
|
|
###############################################################################
|
|
|
|
ubuntu()
|
|
|
|
{
|
2024-02-10 10:59:39 +01:00
|
|
|
noninteractive=$2
|
|
|
|
package_manager=$3
|
2016-11-03 22:19:44 +01:00
|
|
|
echo "Detected Ubuntu/Debian"
|
|
|
|
echo "Updating system..."
|
2024-02-10 10:59:39 +01:00
|
|
|
sudo $package_manager update
|
|
|
|
|
|
|
|
if [ $package_manager == "apt-get" ]; then
|
|
|
|
if [ "$noninteractive" = true ]; then
|
|
|
|
install_command+="DEBIAN_FRONTEND=noninteractive apt-get install --assume-yes --quiet"
|
|
|
|
else
|
|
|
|
install_command="apt-get install"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
install_command="$package_manager install"
|
|
|
|
fi
|
|
|
|
|
2016-11-03 22:19:44 +01:00
|
|
|
echo "Installing required packages..."
|
2023-09-08 23:22:46 +02:00
|
|
|
pkgs="\
|
|
|
|
ant \
|
2023-09-11 17:28:25 +02:00
|
|
|
autoconf \
|
2023-09-08 23:22:46 +02:00
|
|
|
automake \
|
2019-10-21 03:32:50 +02:00
|
|
|
autopoint \
|
|
|
|
bison \
|
|
|
|
build-essential \
|
2023-09-08 23:22:46 +02:00
|
|
|
clang \
|
2019-10-21 03:32:50 +02:00
|
|
|
cmake \
|
|
|
|
curl \
|
2023-09-11 17:28:25 +02:00
|
|
|
dos2unix \
|
2023-09-08 23:22:46 +02:00
|
|
|
doxygen \
|
2019-10-21 03:32:50 +02:00
|
|
|
file \
|
|
|
|
flex \
|
2024-02-10 14:19:27 +01:00
|
|
|
fuse3 \
|
2023-09-08 23:22:46 +02:00
|
|
|
g++ \
|
2019-10-21 03:32:50 +02:00
|
|
|
genisoimage \
|
|
|
|
git \
|
|
|
|
gperf \
|
2023-12-11 17:32:24 +01:00
|
|
|
intltool \
|
2021-07-16 18:57:24 +02:00
|
|
|
libexpat-dev \
|
2019-10-21 03:32:50 +02:00
|
|
|
libfuse-dev \
|
2021-07-16 18:57:24 +02:00
|
|
|
libgmp-dev \
|
2023-09-08 23:22:46 +02:00
|
|
|
libhtml-parser-perl \
|
2023-05-26 12:09:21 +02:00
|
|
|
libjpeg-dev \
|
2023-09-11 17:28:25 +02:00
|
|
|
libmpfr-dev \
|
2023-09-08 23:22:46 +02:00
|
|
|
libpng-dev \
|
2023-05-26 12:09:21 +02:00
|
|
|
libsdl1.2-dev \
|
|
|
|
libsdl2-ttf-dev \
|
2019-10-21 03:32:50 +02:00
|
|
|
libtool \
|
2023-09-08 23:22:46 +02:00
|
|
|
llvm \
|
|
|
|
lua5.4 \
|
2024-06-05 19:44:52 +02:00
|
|
|
lzip \
|
2019-10-21 03:32:50 +02:00
|
|
|
m4 \
|
2023-09-08 23:22:46 +02:00
|
|
|
make \
|
|
|
|
meson \
|
2019-10-21 03:32:50 +02:00
|
|
|
nasm \
|
2023-09-08 23:22:46 +02:00
|
|
|
ninja-build \
|
2023-06-06 01:07:40 +02:00
|
|
|
patch \
|
2023-09-08 23:22:46 +02:00
|
|
|
perl \
|
2019-10-21 03:32:50 +02:00
|
|
|
pkg-config \
|
2020-11-23 05:10:27 +01:00
|
|
|
po4a \
|
2023-09-08 23:22:46 +02:00
|
|
|
protobuf-compiler \
|
2023-05-11 19:07:57 +02:00
|
|
|
python3 \
|
2023-09-08 23:22:46 +02:00
|
|
|
python3-mako \
|
2023-12-11 17:32:24 +01:00
|
|
|
rsync \
|
2023-09-08 23:22:46 +02:00
|
|
|
scons \
|
|
|
|
texinfo \
|
|
|
|
unzip \
|
|
|
|
wget \
|
2023-05-11 19:07:57 +02:00
|
|
|
xdg-utils \
|
2023-09-11 17:28:25 +02:00
|
|
|
xxd \
|
2023-05-11 19:07:57 +02:00
|
|
|
zip \
|
2024-02-10 22:42:42 +01:00
|
|
|
zstd \
|
2023-09-11 17:28:25 +02:00
|
|
|
"
|
2023-06-05 19:09:04 +02:00
|
|
|
# Not availible for at least ARM hosts
|
|
|
|
case "$host_arch" in
|
|
|
|
x86*|i?86) pkgs="$pkgs libc6-dev-i386 syslinux-utils";;
|
|
|
|
esac
|
2024-02-10 10:59:39 +01:00
|
|
|
sudo $install_command $pkgs
|
2016-11-03 22:19:44 +01:00
|
|
|
if [ "$1" == "qemu" ]; then
|
2017-01-16 18:23:52 +01:00
|
|
|
if [ -z "$(which qemu-system-x86_64)" ]; then
|
2016-11-03 22:19:44 +01:00
|
|
|
echo "Installing QEMU..."
|
2024-02-10 10:59:39 +01:00
|
|
|
sudo $install_command qemu-system-x86 qemu-kvm
|
|
|
|
sudo $install_command qemu-efi-arm qemu-system-arm
|
2016-11-03 22:19:44 +01:00
|
|
|
else
|
|
|
|
echo "QEMU already installed!"
|
|
|
|
fi
|
2023-12-13 21:51:55 +01:00
|
|
|
elif [ "$1" == "virtualbox" ]; then
|
2016-11-03 22:19:44 +01:00
|
|
|
if [ -z "$(which virtualbox)" ]; then
|
2023-12-13 21:51:55 +01:00
|
|
|
|
|
|
|
if grep '^ID=debian$' /etc/os-release > /dev/null; then
|
|
|
|
echo "Virtualbox is not in the official debian packages"
|
|
|
|
echo "To install virtualbox on debian, see https://wiki.debian.org/VirtualBox"
|
|
|
|
echo "Please install VirtualBox and re-run this script,"
|
|
|
|
echo "or run with -e qemu"
|
2024-02-10 10:59:39 +01:00
|
|
|
exit 1
|
2023-12-13 21:51:55 +01:00
|
|
|
else
|
|
|
|
echo "Installing VirtualBox..."
|
2024-02-10 10:59:39 +01:00
|
|
|
sudo $install_command virtualbox
|
2023-12-13 21:51:55 +01:00
|
|
|
fi
|
2016-11-03 22:19:44 +01:00
|
|
|
else
|
2022-09-29 12:48:31 +02:00
|
|
|
echo "VirtualBox already installed!"
|
2016-11-03 22:19:44 +01:00
|
|
|
fi
|
2023-12-13 21:51:55 +01:00
|
|
|
else
|
|
|
|
echo "Unknown emulator: $1"
|
|
|
|
exit 1
|
2016-11-03 22:19:44 +01:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
###############################################################################
|
2022-09-29 12:48:31 +02:00
|
|
|
# This function takes care of installing all dependencies for building Redox on
|
|
|
|
# Fedora Linux
|
|
|
|
# @params: $1 the emulator to install, "virtualbox" or "qemu"
|
2024-02-10 10:59:39 +01:00
|
|
|
# $2 install non-interactively, boolean
|
2016-11-03 22:19:44 +01:00
|
|
|
###############################################################################
|
|
|
|
fedora()
|
|
|
|
{
|
2024-02-10 10:59:39 +01:00
|
|
|
noninteractive=$2
|
|
|
|
|
|
|
|
dnf_install="dnf install"
|
|
|
|
if [ "$noninteractive" = true ]; then
|
|
|
|
dnf_install+=" --assumeyes --quiet"
|
|
|
|
fi
|
|
|
|
|
2016-11-03 22:19:44 +01:00
|
|
|
echo "Detected Fedora"
|
|
|
|
if [ -z "$(which git)" ]; then
|
|
|
|
echo "Installing git..."
|
2024-02-10 10:59:39 +01:00
|
|
|
sudo $dnf_install git-all
|
2016-11-03 22:19:44 +01:00
|
|
|
fi
|
2023-12-13 21:51:55 +01:00
|
|
|
|
2016-11-03 22:19:44 +01:00
|
|
|
if [ "$1" == "qemu" ]; then
|
2017-01-16 18:23:52 +01:00
|
|
|
if [ -z "$(which qemu-system-x86_64)" ]; then
|
2016-11-03 22:19:44 +01:00
|
|
|
echo "Installing QEMU..."
|
2024-02-10 10:59:39 +01:00
|
|
|
sudo $dnf_install qemu-system-x86 qemu-kvm
|
2016-11-03 22:19:44 +01:00
|
|
|
else
|
|
|
|
echo "QEMU already installed!"
|
|
|
|
fi
|
2023-12-13 21:51:55 +01:00
|
|
|
elif [ "$1" == "virtualbox" ]; then
|
2016-11-03 22:19:44 +01:00
|
|
|
if [ -z "$(which virtualbox)" ]; then
|
2023-12-13 21:51:55 +01:00
|
|
|
echo "Please install VirtualBox and re-run this script,"
|
|
|
|
echo "or run with -e qemu"
|
|
|
|
exit 1
|
2016-11-03 22:19:44 +01:00
|
|
|
else
|
2022-09-29 12:48:31 +02:00
|
|
|
echo "VirtualBox already installed!"
|
2016-11-03 22:19:44 +01:00
|
|
|
fi
|
2023-12-13 21:51:55 +01:00
|
|
|
else
|
|
|
|
echo "Unknown emulator: $1"
|
|
|
|
exit 1
|
2016-11-03 22:19:44 +01:00
|
|
|
fi
|
2024-05-08 12:52:07 +02:00
|
|
|
|
2016-12-20 18:33:12 +01:00
|
|
|
# Use rpm -q <package> to check if it's already installed
|
2024-06-14 23:18:16 +02:00
|
|
|
PKGS=$(for pkg in @development-tools \
|
|
|
|
file \
|
2023-07-26 00:25:28 +02:00
|
|
|
autoconf \
|
|
|
|
vim \
|
|
|
|
bison \
|
|
|
|
flex \
|
|
|
|
genisoimage \
|
|
|
|
gperf \
|
|
|
|
glibc-devel.i686 \
|
|
|
|
expat \
|
|
|
|
expat-devel \
|
|
|
|
fuse-devel \
|
|
|
|
fuse3-devel \
|
|
|
|
gmp-devel \
|
|
|
|
libpng-devel \
|
|
|
|
perl \
|
|
|
|
perl-HTML-Parser \
|
|
|
|
libtool \
|
|
|
|
libjpeg-turbo-devel \
|
|
|
|
SDL2_ttf-devel \
|
|
|
|
sdl12-compat-devel \
|
|
|
|
m4 \
|
|
|
|
nasm \
|
|
|
|
po4a \
|
|
|
|
syslinux \
|
|
|
|
texinfo \
|
|
|
|
ninja-build \
|
|
|
|
meson \
|
|
|
|
waf \
|
|
|
|
python3-mako \
|
|
|
|
make \
|
|
|
|
gcc \
|
|
|
|
gcc-c++ \
|
|
|
|
openssl \
|
|
|
|
patch \
|
|
|
|
automake \
|
|
|
|
perl-Pod-Html \
|
|
|
|
perl-FindBin \
|
|
|
|
gperf \
|
|
|
|
curl \
|
|
|
|
gettext-devel \
|
|
|
|
perl-Pod-Xhtml \
|
|
|
|
pkgconf-pkg-config \
|
|
|
|
cmake \
|
|
|
|
llvm \
|
|
|
|
zip \
|
|
|
|
unzip \
|
|
|
|
lua \
|
|
|
|
luajit \
|
|
|
|
make \
|
|
|
|
clang \
|
2023-08-11 12:42:40 +02:00
|
|
|
doxygen \
|
2023-08-25 15:42:14 +02:00
|
|
|
ant \
|
2024-02-10 22:42:42 +01:00
|
|
|
protobuf-compiler \
|
2024-06-14 23:18:16 +02:00
|
|
|
zstd \
|
|
|
|
lzip ; do rpm -q $pkg > /dev/null || echo $pkg; done)
|
2016-12-20 18:33:12 +01:00
|
|
|
# If the list of packages is not empty, install missing
|
|
|
|
COUNT=$(echo $PKGS | wc -w)
|
|
|
|
if [ $COUNT -ne 0 ]; then
|
|
|
|
echo "Installing necessary build tools..."
|
2024-02-10 10:59:39 +01:00
|
|
|
sudo $dnf_install $PKGS
|
2016-12-20 18:33:12 +01:00
|
|
|
fi
|
2016-11-03 22:19:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
###############################################################################
|
2022-09-29 12:48:31 +02:00
|
|
|
# This function takes care of installing all dependencies for building Redox on
|
|
|
|
# *SUSE Linux
|
2016-11-03 22:19:44 +01:00
|
|
|
###############################################################################
|
|
|
|
suse()
|
|
|
|
{
|
2017-01-03 13:14:37 +01:00
|
|
|
echo "Detected SUSE Linux"
|
2023-12-13 21:51:55 +01:00
|
|
|
|
|
|
|
packages=(
|
|
|
|
"gcc"
|
|
|
|
"gcc-c++"
|
|
|
|
"glibc-devel-32bit"
|
|
|
|
"nasm"
|
|
|
|
"make"
|
|
|
|
"fuse-devel"
|
|
|
|
"cmake"
|
|
|
|
"openssl"
|
|
|
|
"automake"
|
|
|
|
"gettext-tools"
|
|
|
|
"libtool"
|
|
|
|
"po4a"
|
|
|
|
"patch"
|
|
|
|
"flex"
|
|
|
|
"gperf"
|
|
|
|
"autoconf"
|
|
|
|
"bison"
|
|
|
|
"curl"
|
|
|
|
"wget"
|
|
|
|
"file"
|
|
|
|
"libexpat-devel"
|
|
|
|
"gmp-devel"
|
|
|
|
"libpng16-devel"
|
|
|
|
"libjpeg8-devel"
|
|
|
|
"perl"
|
|
|
|
"perl-HTML-Parser"
|
|
|
|
"m4"
|
|
|
|
"patch"
|
|
|
|
"scons"
|
|
|
|
"pkgconf"
|
|
|
|
"syslinux-utils"
|
|
|
|
"ninja"
|
|
|
|
"meson"
|
|
|
|
"python-Mako"
|
|
|
|
"xdg-utils"
|
|
|
|
"zip"
|
|
|
|
"unzip"
|
|
|
|
"llvm"
|
|
|
|
"clang"
|
|
|
|
"doxygen"
|
|
|
|
"lua54"
|
|
|
|
"ant"
|
|
|
|
"protobuf"
|
|
|
|
)
|
|
|
|
|
2016-11-03 22:19:44 +01:00
|
|
|
if [ -z "$(which git)" ]; then
|
2023-12-13 21:51:55 +01:00
|
|
|
echo "Will install git ..."
|
|
|
|
packages+=(git)
|
2016-11-03 22:19:44 +01:00
|
|
|
fi
|
2023-12-13 21:51:55 +01:00
|
|
|
|
2016-11-03 22:19:44 +01:00
|
|
|
if [ "$1" == "qemu" ]; then
|
2017-01-16 18:23:52 +01:00
|
|
|
if [ -z "$(which qemu-system-x86_64)" ]; then
|
2023-12-13 21:51:55 +01:00
|
|
|
echo "Will install QEMU..."
|
|
|
|
packages+=(qemu-x86 qemu-kvm)
|
2016-11-03 22:19:44 +01:00
|
|
|
else
|
|
|
|
echo "QEMU already installed!"
|
|
|
|
fi
|
2023-12-13 21:51:55 +01:00
|
|
|
elif [ "$1" == "virtualbox" ]; then
|
2016-11-03 22:19:44 +01:00
|
|
|
if [ -z "$(which virtualbox)" ]; then
|
2022-09-29 12:48:31 +02:00
|
|
|
echo "Please install VirtualBox and re-run this script,"
|
2016-11-03 22:19:44 +01:00
|
|
|
echo "or run with -e qemu"
|
2023-12-13 21:51:55 +01:00
|
|
|
exit 1
|
2016-11-03 22:19:44 +01:00
|
|
|
else
|
2022-09-29 12:48:31 +02:00
|
|
|
echo "VirtualBox already installed!"
|
2016-11-03 22:19:44 +01:00
|
|
|
fi
|
2023-12-13 21:51:55 +01:00
|
|
|
else
|
|
|
|
echo "Unknown emulator: $1"
|
|
|
|
exit 1
|
2016-11-03 22:19:44 +01:00
|
|
|
fi
|
2024-05-08 12:52:07 +02:00
|
|
|
|
2016-11-03 22:19:44 +01:00
|
|
|
echo "Installing necessary build tools..."
|
2023-12-13 21:51:55 +01:00
|
|
|
|
|
|
|
# We could install all the packages in a single zypper command with:
|
|
|
|
#
|
|
|
|
# zypper install package1 package2 package3
|
2024-05-08 12:52:07 +02:00
|
|
|
#
|
2023-12-13 21:51:55 +01:00
|
|
|
# But there is an issue with this: zypper returns a success code if at
|
|
|
|
# least one of the packages was correctly installed, but we need it to fail
|
|
|
|
# if any of the packages is missing.
|
|
|
|
#
|
|
|
|
# To confirm that the packages are available, we try to install them one by
|
|
|
|
# one with --dry-run.
|
|
|
|
# We still install all the packages in a single zypper command so that the
|
|
|
|
# user has to confirm only once.
|
|
|
|
for p in ${packages[@]}; do
|
|
|
|
if rpm -q "${p}" > /dev/null ; then
|
|
|
|
echo "${p} is already installed"
|
|
|
|
else
|
2024-05-08 12:52:07 +02:00
|
|
|
# Zypper shows a confirmation prompt and the "y" answer even with
|
2023-12-13 21:51:55 +01:00
|
|
|
# --non-interactive and --no-confirm:
|
|
|
|
#
|
|
|
|
# 1 new package to install.
|
|
|
|
# Overall download size: 281.7 KiB. Already cached: 0 B. After the operation, additional 394.6 KiB will be used.
|
|
|
|
# Continue? [y/n/v/...? shows all options] (y): y
|
|
|
|
#
|
2024-05-08 12:52:07 +02:00
|
|
|
# That could make the user think that the package was installed,
|
2023-12-13 21:51:55 +01:00
|
|
|
# when it was only a dry run.
|
|
|
|
# To avoid the confusion, we hide the output unless there was an
|
|
|
|
# error.
|
|
|
|
if out="$(zypper --non-interactive install --no-confirm --dry-run --force-resolution ${p} 2>&1)" ; then
|
|
|
|
echo "${p} can be installed"
|
|
|
|
else
|
|
|
|
echo "no"
|
|
|
|
echo ""
|
|
|
|
echo "Zypper output:"
|
|
|
|
echo ""
|
|
|
|
echo "${out}"
|
|
|
|
echo ""
|
|
|
|
echo "Could not find how to install '${p}', try running:"
|
|
|
|
echo ""
|
|
|
|
echo " zypper install ${p}"
|
|
|
|
echo ""
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
zypper install ${packages[@]}
|
|
|
|
|
2016-11-03 22:19:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
##############################################################################
|
2022-09-29 12:48:31 +02:00
|
|
|
# This function takes care of installing all dependencies for building Redox on
|
|
|
|
# Gentoo Linux
|
|
|
|
# @params: $1 the emulator to install, "virtualbox" or "qemu"
|
2016-11-03 22:19:44 +01:00
|
|
|
##############################################################################
|
|
|
|
gentoo()
|
|
|
|
{
|
|
|
|
echo "Detected Gentoo Linux"
|
|
|
|
if [ -z "$(which nasm)" ]; then
|
|
|
|
echo "Installing nasm..."
|
|
|
|
sudo emerge dev-lang/nasm
|
|
|
|
fi
|
|
|
|
if [ -z "$(which git)" ]; then
|
|
|
|
echo "Installing git..."
|
|
|
|
sudo emerge dev-vcs/git
|
|
|
|
fi
|
2023-03-21 04:00:19 +01:00
|
|
|
if [ -z "$(which fusermount 2>/dev/null)" ] && [ -z "$(which fusermount3 2>/dev/null)" ]; then
|
2017-07-27 02:14:18 +02:00
|
|
|
echo "Installing fuse..."
|
|
|
|
sudo emerge sys-fs/fuse
|
|
|
|
fi
|
2023-12-13 21:51:55 +01:00
|
|
|
|
|
|
|
if [ "$1" == "qemu" ]; then
|
2017-01-16 18:23:52 +01:00
|
|
|
if [ -z "$(which qemu-system-x86_64)" ]; then
|
2016-11-03 22:19:44 +01:00
|
|
|
echo "Please install QEMU and re-run this script"
|
2017-07-27 03:53:23 +02:00
|
|
|
echo "Step1. Add QEMU_SOFTMMU_TARGETS=\"x86_64\" to /etc/portage/make.conf"
|
2016-11-03 22:19:44 +01:00
|
|
|
echo "Step2. Execute \"sudo emerge app-emulation/qemu\""
|
2023-12-13 21:51:55 +01:00
|
|
|
exit 1
|
2016-11-03 22:19:44 +01:00
|
|
|
else
|
|
|
|
echo "QEMU already installed!"
|
|
|
|
fi
|
2023-12-13 21:51:55 +01:00
|
|
|
elif [ "$1" == "virtualbox" ]; then
|
|
|
|
if [ -z "$(which virtualbox)" ]; then
|
|
|
|
echo "Please install VirtualBox and re-run this script,"
|
|
|
|
echo "or run with -e qemu"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "VirtualBox already installed!"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Unknown emulator: $1"
|
|
|
|
exit 1
|
2016-11-03 22:19:44 +01:00
|
|
|
fi
|
2023-12-13 21:51:55 +01:00
|
|
|
|
2017-12-10 17:00:44 +01:00
|
|
|
if [ -z "$(which cmake)" ]; then
|
|
|
|
echo "Installing cmake..."
|
|
|
|
sudo emerge dev-util/cmake
|
|
|
|
fi
|
2023-03-23 20:02:07 +01:00
|
|
|
if [ -z "$(ldconfig -p | grep fontconfig)" ]; then
|
|
|
|
sudo emerge media-libs/fontconfig
|
|
|
|
fi
|
2016-11-03 22:19:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
##############################################################################
|
2022-09-29 12:48:31 +02:00
|
|
|
# This function takes care of installing all dependencies for building Redox on
|
|
|
|
# Solus
|
|
|
|
# @params: $1 the emulator to install, "virtualbox" or "qemu"
|
2016-11-03 22:19:44 +01:00
|
|
|
##############################################################################
|
|
|
|
solus()
|
|
|
|
{
|
2022-09-29 12:48:31 +02:00
|
|
|
echo "Detected Solus"
|
2017-07-13 22:00:55 +02:00
|
|
|
|
2016-11-03 22:19:44 +01:00
|
|
|
if [ "$1" == "qemu" ]; then
|
2017-01-16 18:23:52 +01:00
|
|
|
if [ -z "$(which qemu-system-x86_64)" ]; then
|
2016-11-03 22:19:44 +01:00
|
|
|
sudo eopkg it qemu
|
|
|
|
else
|
|
|
|
echo "QEMU already installed!"
|
|
|
|
fi
|
2023-12-13 21:51:55 +01:00
|
|
|
elif [ "$1" == "virtualbox" ]; then
|
2016-11-03 22:19:44 +01:00
|
|
|
if [ -z "$(which virtualbox)" ]; then
|
2022-09-29 12:48:31 +02:00
|
|
|
echo "Please install VirtualBox and re-run this script,"
|
2016-11-03 22:19:44 +01:00
|
|
|
echo "or run with -e qemu"
|
2023-12-13 21:51:55 +01:00
|
|
|
exit 1
|
2016-11-03 22:19:44 +01:00
|
|
|
else
|
2022-09-29 12:48:31 +02:00
|
|
|
echo "VirtualBox already installed!"
|
2016-11-03 22:19:44 +01:00
|
|
|
fi
|
2023-12-13 21:51:55 +01:00
|
|
|
else
|
|
|
|
echo "Unknown emulator: $1"
|
|
|
|
exit 1
|
2016-11-03 22:19:44 +01:00
|
|
|
fi
|
2017-07-13 22:00:55 +02:00
|
|
|
|
2017-05-24 23:09:32 +02:00
|
|
|
echo "Installing necessary build tools..."
|
|
|
|
#if guards are not necessary with eopkg since it does nothing if latest version is already installed
|
2023-07-26 00:25:28 +02:00
|
|
|
sudo eopkg it fuse-devel \
|
|
|
|
git \
|
|
|
|
gcc \
|
|
|
|
g++ \
|
|
|
|
libgcc-32bit \
|
|
|
|
libstdc++-32bit \
|
|
|
|
nasm \
|
|
|
|
make \
|
|
|
|
cmake \
|
|
|
|
binutils-gold \
|
|
|
|
glibc-devel \
|
|
|
|
pkg-config \
|
|
|
|
fuse2-devel \
|
|
|
|
linux-headers \
|
|
|
|
rsync \
|
|
|
|
automake \
|
|
|
|
autoconf \
|
|
|
|
m4 \
|
|
|
|
libtool-devel \
|
|
|
|
po4a \
|
|
|
|
patch \
|
|
|
|
bison \
|
|
|
|
flex \
|
|
|
|
gperf \
|
|
|
|
libpng-devel \
|
|
|
|
perl-html-parser
|
2016-11-03 22:19:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# This function outlines the different options available for bootstrap
|
|
|
|
######################################################################
|
|
|
|
usage()
|
|
|
|
{
|
|
|
|
echo "------------------------"
|
|
|
|
echo "|Redox bootstrap script|"
|
|
|
|
echo "------------------------"
|
|
|
|
echo "Usage: ./bootstrap.sh"
|
|
|
|
echo "OPTIONS:"
|
|
|
|
echo
|
|
|
|
echo " -h,--help Show this prompt"
|
|
|
|
echo " -u [branch] Update git repo and update rust"
|
|
|
|
echo " If blank defaults to master"
|
|
|
|
echo " -s Check the status of the current travis build"
|
|
|
|
echo " -e [emulator] Install specific emulator, virtualbox or qemu"
|
|
|
|
echo " -p [package Choose an Ubuntu package manager, apt-fast or"
|
|
|
|
echo " manager] aptitude"
|
2017-01-02 22:46:23 +01:00
|
|
|
echo " -d Only install the dependencies, skip boot step"
|
2024-02-10 10:59:39 +01:00
|
|
|
echo " -y Install non-interactively. Answer \"yes\" or"
|
|
|
|
echo " select the default option for rustup and package"
|
|
|
|
echo " managers. Only the apt, dnf and pacman"
|
|
|
|
echo " package managers are supported."
|
2016-11-03 22:19:44 +01:00
|
|
|
echo "EXAMPLES:"
|
|
|
|
echo
|
2017-03-04 05:38:34 +01:00
|
|
|
echo "./bootstrap.sh -e qemu"
|
2016-11-03 22:19:44 +01:00
|
|
|
exit
|
|
|
|
}
|
|
|
|
|
2020-02-15 14:30:47 +01:00
|
|
|
|
|
|
|
#############################################################
|
|
|
|
# Looks for and installs a cargo-managed binary or subcommand
|
|
|
|
#############################################################
|
|
|
|
cargoInstall() {
|
2024-05-06 19:23:43 +02:00
|
|
|
if [[ "`cargo +stable install --list`" != *"$1 v$2"* ]]; then
|
|
|
|
cargo +stable install --force --version "$2" "$1"
|
2020-02-15 14:30:47 +01:00
|
|
|
else
|
2020-12-24 19:20:32 +01:00
|
|
|
echo "You have $1 version $2 installed already!"
|
2020-02-15 14:30:47 +01:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2016-11-03 22:19:44 +01:00
|
|
|
####################################################################################
|
|
|
|
# This function takes care of everything associated to rust, and the version manager
|
2017-01-02 22:46:23 +01:00
|
|
|
# That controls it, it can install rustup and uninstall multirust as well as making
|
2016-11-03 22:19:44 +01:00
|
|
|
# sure that the correct version of rustc is selected by rustup
|
2024-02-10 10:59:39 +01:00
|
|
|
# @params: $1 install non-interactively, boolean
|
2016-11-03 22:19:44 +01:00
|
|
|
####################################################################################
|
|
|
|
rustInstall() {
|
2024-02-10 10:59:39 +01:00
|
|
|
noninteractive=$1
|
2016-11-03 22:19:44 +01:00
|
|
|
# Check to see if multirust is installed, we don't want it messing with rustup
|
2016-11-04 19:47:06 +01:00
|
|
|
# In the future we can probably remove this but I believe it's good to have for now
|
2016-11-03 22:19:44 +01:00
|
|
|
if [ -e /usr/local/lib/rustlib/uninstall.sh ] ; then
|
|
|
|
echo "It appears that multirust is installed on your system."
|
|
|
|
echo "This tool has been deprecated by the maintainer, and will cause issues."
|
|
|
|
echo "This script can remove multirust from your system if you wish."
|
|
|
|
printf "Uninstall multirust (y/N):"
|
|
|
|
read multirust
|
|
|
|
if echo "$multirust" | grep -iq "^y" ;then
|
2017-01-02 22:46:23 +01:00
|
|
|
sudo /usr/local/lib/rustlib/uninstall.sh
|
2016-11-03 22:19:44 +01:00
|
|
|
else
|
|
|
|
echo "Please manually uninstall multirust and any other versions of rust, then re-run bootstrap."
|
2023-12-13 21:51:55 +01:00
|
|
|
exit 1
|
2016-11-03 22:19:44 +01:00
|
|
|
fi
|
|
|
|
fi
|
2017-01-02 22:46:23 +01:00
|
|
|
# If rustup is not installed we should offer to install it for them
|
2016-11-03 22:19:44 +01:00
|
|
|
if [ -z "$(which rustup)" ]; then
|
2024-05-11 03:58:56 +02:00
|
|
|
rustup_options="--default-toolchain stable"
|
2016-11-03 22:19:44 +01:00
|
|
|
echo "You do not have rustup installed."
|
2024-02-10 10:59:39 +01:00
|
|
|
if [ "$noninteractive" = true ]; then
|
|
|
|
rustup="y"
|
|
|
|
rustup_options+=" -y"
|
|
|
|
else
|
|
|
|
echo "We HIGHLY recommend using rustup."
|
|
|
|
echo "Would you like to install it now?"
|
|
|
|
echo "*WARNING* this involves a 'curl | sh' style command"
|
|
|
|
printf "(y/N): "
|
|
|
|
read rustup
|
|
|
|
fi
|
2016-11-03 22:19:44 +01:00
|
|
|
if echo "$rustup" | grep -iq "^y" ;then
|
|
|
|
#install rustup
|
2024-02-10 10:59:39 +01:00
|
|
|
curl https://sh.rustup.rs -sSf | sh -s -- $rustup_options
|
2017-01-02 22:46:23 +01:00
|
|
|
# You have to add the rustup variables to the $PATH
|
2016-11-03 22:19:44 +01:00
|
|
|
echo "export PATH=\"\$HOME/.cargo/bin:\$PATH\"" >> ~/.bashrc
|
|
|
|
# source the variables so that we can execute rustup commands in the current shell
|
2017-01-02 22:46:23 +01:00
|
|
|
source ~/.cargo/env
|
2016-11-03 22:19:44 +01:00
|
|
|
else
|
|
|
|
echo "Rustup will not be installed!"
|
|
|
|
fi
|
2017-01-02 22:46:23 +01:00
|
|
|
fi
|
|
|
|
#
|
2016-11-03 22:19:44 +01:00
|
|
|
if [ -z "$(which rustc)" ]; then
|
|
|
|
echo "Rust is not installed"
|
|
|
|
echo "Please either run the script again, accepting rustup install"
|
2024-05-11 03:58:56 +02:00
|
|
|
echo "or install rustc stable manually (not recommended) via:"
|
|
|
|
echo "\#curl -sSf https://static.rust-lang.org/rustup.sh | sh -s -- --channel=stable"
|
2023-12-13 21:51:55 +01:00
|
|
|
exit 1
|
2016-11-03 22:19:44 +01:00
|
|
|
else
|
2022-09-29 12:48:31 +02:00
|
|
|
echo "Your Rust install looks good!"
|
2016-11-03 22:19:44 +01:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
####################################################################
|
2017-01-02 22:46:23 +01:00
|
|
|
# This function gets the current build status from travis and prints
|
2016-11-03 22:19:44 +01:00
|
|
|
# a message to the user
|
|
|
|
####################################################################
|
|
|
|
statusCheck() {
|
|
|
|
for i in $(echo "$(curl -sf https://api.travis-ci.org/repositories/redox-os/redox.json)" | tr "," "\n")
|
|
|
|
do
|
|
|
|
if echo "$i" | grep -iq "last_build_status" ;then
|
|
|
|
if echo "$i" | grep -iq "0" ;then
|
|
|
|
echo
|
|
|
|
echo "********************************************"
|
2017-01-03 13:14:37 +01:00
|
|
|
echo "Travis reports that the last build succeeded!"
|
2016-11-03 22:19:44 +01:00
|
|
|
echo "Looks like you are good to go!"
|
|
|
|
echo "********************************************"
|
|
|
|
elif echo "$i" | grep -iq "null" ;then
|
|
|
|
echo
|
2017-01-02 22:46:23 +01:00
|
|
|
echo "******************************************************************"
|
2016-11-03 22:19:44 +01:00
|
|
|
echo "The Travis build did not finish, this is an error with its config."
|
2017-01-03 13:14:37 +01:00
|
|
|
echo "I cannot reliably determine whether the build is succeeding or not."
|
2018-08-26 18:10:54 +02:00
|
|
|
echo "Consider checking for and maybe opening an issue on gitlab"
|
2016-11-03 22:19:44 +01:00
|
|
|
echo "******************************************************************"
|
|
|
|
else
|
|
|
|
echo
|
|
|
|
echo "**************************************************"
|
|
|
|
echo "Travis reports that the last build *FAILED* :("
|
|
|
|
echo "Might want to check out the issues before building"
|
|
|
|
echo "**************************************************"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
###########################################################################
|
|
|
|
# This function is the main logic for the bootstrap; it clones the git repo
|
|
|
|
# then it installs the rust version manager and the latest version of rustc
|
|
|
|
###########################################################################
|
|
|
|
boot()
|
|
|
|
{
|
2018-08-26 18:10:54 +02:00
|
|
|
echo "Cloning gitlab repo..."
|
2018-06-14 21:32:41 +02:00
|
|
|
git clone https://gitlab.redox-os.org/redox-os/redox.git --origin upstream --recursive
|
2016-11-03 22:19:44 +01:00
|
|
|
echo "Cleaning up..."
|
|
|
|
rm bootstrap.sh
|
|
|
|
echo
|
|
|
|
echo "---------------------------------------"
|
|
|
|
echo "Well it looks like you are ready to go!"
|
|
|
|
echo "---------------------------------------"
|
|
|
|
statusCheck
|
2024-08-18 01:59:37 +02:00
|
|
|
echo
|
|
|
|
echo "** Be sure to update your path to include Rust - run the following command: **"
|
|
|
|
echo 'source $HOME/.cargo/env'
|
|
|
|
echo
|
2022-09-29 12:48:31 +02:00
|
|
|
echo "Run the following commands to build Redox:"
|
2016-11-03 22:19:44 +01:00
|
|
|
echo "cd redox"
|
2020-05-03 20:33:22 +02:00
|
|
|
MAKE="make"
|
2020-05-11 17:57:56 +02:00
|
|
|
if [[ "$(uname)" == "FreeBSD" ]]; then
|
2020-05-03 20:33:22 +02:00
|
|
|
MAKE="gmake"
|
2022-09-29 12:48:31 +02:00
|
|
|
echo "kldload fuse.ko # This loads the kernel module for FUSE"
|
2020-05-03 20:33:22 +02:00
|
|
|
fi
|
|
|
|
echo "$MAKE all"
|
|
|
|
echo "$MAKE virtualbox or qemu"
|
2016-11-03 22:19:44 +01:00
|
|
|
echo
|
|
|
|
echo " Good luck!"
|
|
|
|
|
|
|
|
exit
|
|
|
|
}
|
|
|
|
|
2017-09-11 07:54:27 +02:00
|
|
|
if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
|
2016-11-03 22:19:44 +01:00
|
|
|
usage
|
|
|
|
elif [ "$1" == "-u" ]; then
|
2016-11-04 19:46:38 +01:00
|
|
|
git pull upstream master
|
2016-11-03 22:19:44 +01:00
|
|
|
git submodule update --recursive --init
|
|
|
|
exit
|
|
|
|
elif [ "$1" == "-s" ]; then
|
|
|
|
statusCheck
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2023-06-05 19:09:04 +02:00
|
|
|
host_arch=$(uname -m)
|
2016-11-03 22:19:44 +01:00
|
|
|
emulator="qemu"
|
|
|
|
defpackman="apt-get"
|
2016-11-09 01:48:10 +01:00
|
|
|
dependenciesonly=false
|
2019-10-27 19:59:52 +01:00
|
|
|
update=false
|
2024-02-10 10:59:39 +01:00
|
|
|
noninteractive=false
|
|
|
|
|
|
|
|
while getopts ":e:p:udhys" opt
|
2016-11-03 22:19:44 +01:00
|
|
|
do
|
|
|
|
case "$opt" in
|
|
|
|
e) emulator="$OPTARG";;
|
|
|
|
p) defpackman="$OPTARG";;
|
2016-11-09 01:48:10 +01:00
|
|
|
d) dependenciesonly=true;;
|
2019-10-27 19:59:52 +01:00
|
|
|
u) update=true;;
|
|
|
|
h) usage;;
|
2024-02-10 10:59:39 +01:00
|
|
|
y) noninteractive=true;;
|
2019-10-27 19:59:52 +01:00
|
|
|
s) statusCheck && exit;;
|
2023-12-13 21:51:55 +01:00
|
|
|
\?) echo "I don't know what to do with that option, try -h for help"; exit 1;;
|
2016-11-03 22:19:44 +01:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2020-12-24 19:33:16 +01:00
|
|
|
banner
|
|
|
|
|
2024-02-10 10:59:39 +01:00
|
|
|
rustInstall "$noninteractive"
|
2020-12-24 19:33:16 +01:00
|
|
|
|
2019-10-27 19:59:52 +01:00
|
|
|
if [ "$update" == "true" ]; then
|
|
|
|
git pull upstream master
|
|
|
|
git submodule update --recursive --init
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2016-11-03 22:19:44 +01:00
|
|
|
if [ "Darwin" == "$(uname -s)" ]; then
|
|
|
|
osx "$emulator"
|
|
|
|
else
|
2017-09-07 01:09:10 +02:00
|
|
|
# Here we will use package managers to determine which operating system the user is using.
|
2018-10-30 07:15:59 +01:00
|
|
|
|
2022-09-29 12:48:31 +02:00
|
|
|
# SUSE and derivatives
|
2018-11-17 20:02:51 +01:00
|
|
|
if hash 2>/dev/null zypper; then
|
2016-11-03 22:19:44 +01:00
|
|
|
suse "$emulator"
|
2017-09-07 01:09:10 +02:00
|
|
|
# Debian or any derivative of it
|
|
|
|
elif hash 2>/dev/null apt-get; then
|
2024-02-10 10:59:39 +01:00
|
|
|
ubuntu "$emulator" "$noninteractive" "$defpackman"
|
2017-09-07 01:09:10 +02:00
|
|
|
# Fedora
|
|
|
|
elif hash 2>/dev/null dnf; then
|
2024-02-10 10:59:39 +01:00
|
|
|
fedora "$emulator" "$noninteractive"
|
2017-09-07 01:09:10 +02:00
|
|
|
# Gentoo
|
|
|
|
elif hash 2>/dev/null emerge; then
|
|
|
|
gentoo "$emulator"
|
2022-09-29 12:48:31 +02:00
|
|
|
# Solus
|
2017-09-07 01:09:10 +02:00
|
|
|
elif hash 2>/dev/null eopkg; then
|
|
|
|
solus "$emulator"
|
2022-09-29 12:48:31 +02:00
|
|
|
# Arch Linux
|
2018-11-17 20:02:51 +01:00
|
|
|
elif hash 2>/dev/null pacman; then
|
2024-02-10 10:59:39 +01:00
|
|
|
archLinux "$emulator" "$noninteractive"
|
2020-05-03 02:13:21 +02:00
|
|
|
# FreeBSD
|
|
|
|
elif hash 2>/dev/null pkg; then
|
|
|
|
freebsd "$emulator"
|
|
|
|
# Unsupported platform
|
|
|
|
else
|
2022-09-29 12:50:01 +02:00
|
|
|
printf "\e[31;1mFatal error: \e[0;31mUnsupported platform, please open an issue\e[0m\n"
|
2018-10-30 07:15:59 +01:00
|
|
|
fi
|
2016-11-03 22:19:44 +01:00
|
|
|
fi
|
2016-11-09 01:48:10 +01:00
|
|
|
|
2022-09-28 09:59:32 +02:00
|
|
|
cargoInstall cargo-config 0.1.1
|
2023-11-22 13:21:47 +01:00
|
|
|
cargoInstall just 1.16.0
|
2023-12-14 15:32:54 +01:00
|
|
|
cargoInstall cbindgen 0.26.0
|
2022-09-28 09:59:32 +02:00
|
|
|
|
2016-11-09 01:48:10 +01:00
|
|
|
if [ "$dependenciesonly" = false ]; then
|
|
|
|
boot
|
|
|
|
fi
|
2020-12-24 19:33:16 +01:00
|
|
|
|
2023-12-14 15:32:54 +01:00
|
|
|
echo "Redox bootstrap complete!"
|