Remove setup.sh.

This has turned out to not do very much, and adds an annoying initial
stage before building. Just move this logic into the main script
instead, and get rid of it.
This commit is contained in:
Simon Howard 2016-02-22 05:06:22 +00:00
parent 3ad8b4a563
commit ea6d80c4bf
2 changed files with 30 additions and 28 deletions

View file

@ -2,16 +2,42 @@
set -eu
# set_chocpkg_root sets the CHOCPKG_ROOT environment variable based on the
# path where the script is located.
set_chocpkg_root() {
# Assume that the package root is one directory up from the script.
local script_path=$(realpath "$0")
local script_dir=$(dirname "$script_path")
CHOCPKG_ROOT=$(dirname "$script_dir")
# Build directory must not contain a space, or bad things happen:
case "$CHOCPKG_ROOT" in
*\ *)
cat <<END
The build scripts are in a path containing a space:
$CHOCPKG_ROOT
Builds will probably fail - try moving the build scripts to a
different directory not containing a space.
END
exit 1
esac
}
# basic_setup is invoked on script startup to set various environment variables
# and create basic directories used throughout the rest of the script.
basic_setup() {
if [ "${CHOCPKG_ROOT:-}" = "" ]; then
echo "CHOCPKG_ROOT not configured - please source setup.sh." \
>> /dev/stderr
exit -1
if [ -z "${CHOCPKG_ROOT:-}" ]; then
set_chocpkg_root
PATH="$CHOCPKG_ROOT/chocpkg:$CHOCPKG_ROOT/install.native/bin:$PATH"
fi
INSTALL_DIR="$CHOCPKG_ROOT/install"
NATIVE_INSTALL_DIR="$CHOCPKG_ROOT/install.native"
PACKAGES_DIR="$CHOCPKG_ROOT/packages"
BUILD_DIR="$CHOCPKG_ROOT/build"
mkdir -p "$INSTALL_DIR" "$NATIVE_INSTALL_DIR" "$PACKAGES_DIR" "$BUILD_DIR"
}

View file

@ -1,24 +0,0 @@
CHOCPKG_ROOT=$HOME/chocolate-doom-build
export CHOCPKG_ROOT
# Build directory must not contain a space, or bad things happen:
case "$CHOCPKG_ROOT" in
*\ *)
cat <<END
The path to your home directory contains a space:
HOME=$HOME
This script will probably fail to build - reset HOME to point
somewhere else. For example, type:
mkdir /home/user
HOME=/home/user
END
exit -1
esac
# Set up various environment variables:
PATH="$CHOCPKG_ROOT/chocpkg:$CHOCPKG_ROOT/install.native/bin:$PATH"