From ea6d80c4bf058fb38ec9c97916145c137b9cd4f2 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 22 Feb 2016 05:06:22 +0000 Subject: [PATCH] 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. --- chocpkg/chocpkg | 34 ++++++++++++++++++++++++++++++---- setup.sh | 24 ------------------------ 2 files changed, 30 insertions(+), 28 deletions(-) delete mode 100644 setup.sh diff --git a/chocpkg/chocpkg b/chocpkg/chocpkg index ce3979d..cb541c0 100755 --- a/chocpkg/chocpkg +++ b/chocpkg/chocpkg @@ -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 <> /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" } diff --git a/setup.sh b/setup.sh deleted file mode 100644 index c5518df..0000000 --- a/setup.sh +++ /dev/null @@ -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 <