diff options
author | Peter Elliott <pelliott@ualberta.ca> | 2022-10-21 20:53:50 -0600 |
---|---|---|
committer | Jelle Raaijmakers <jelle@gmta.nl> | 2023-01-19 12:22:24 +0100 |
commit | d844829de47c0ad1bb898512c12759d044b416e1 (patch) | |
tree | a2c00a4fa60e5a1bdb11a5851851252628d387fe | |
parent | 18d72ed3fde60c5593c425a7dc5b92beea4f2d9d (diff) | |
download | serenity-d844829de47c0ad1bb898512c12759d044b416e1.zip |
Ports: Fix compatiblity issues with running package.sh on Serenity
-rwxr-xr-x | Ports/.port_include.sh | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/Ports/.port_include.sh b/Ports/.port_include.sh index e7984fc435..c24c0c1f16 100755 --- a/Ports/.port_include.sh +++ b/Ports/.port_include.sh @@ -30,14 +30,16 @@ buildstep_intro() { echo -e "\x1b[1;32m=> $@\x1b[0m" } -maybe_source() { - if [ -f "$1" ]; then - . "$1" - fi -} - target_env() { - maybe_source "${SCRIPT}/.hosted_defs.sh" + if [ -f "${SCRIPT}/.hosted_defs.sh" ]; then + . "${SCRIPT}/.hosted_defs.sh" + elif [ "$(uname -s)" = "SerenityOS" ]; then + export SERENITY_ARCH="$(uname -m)" + export SERENITY_INSTALL_ROOT="" + else + >&2 echo "Error: .hosted_defs.sh is missing and we are not running on Serenity." + exit 1 + fi } target_env @@ -107,7 +109,12 @@ shift : "${workdir:=$port-$version}" PORT_META_DIR="$(pwd)" -PORT_BUILD_DIR="${SERENITY_BUILD_DIR}/Ports/${port}" +if [[ -z ${SERENITY_BUILD_DIR:-} ]]; then + PORT_BUILD_DIR="${PORT_META_DIR}" +else + PORT_BUILD_DIR="${SERENITY_BUILD_DIR}/Ports/${port}" +fi + mkdir -p "${PORT_BUILD_DIR}" cd "${PORT_BUILD_DIR}" @@ -455,7 +462,11 @@ func_defined pre_configure || pre_configure() { } func_defined configure || configure() { chmod +x "${workdir}"/"$configscript" - run ./"$configscript" --host="${SERENITY_ARCH}-pc-serenity" "${configopts[@]}" + if [[ -n "${SERENITY_SOURCE_DIR:-}" ]]; then + run ./"$configscript" --host="${SERENITY_ARCH}-pc-serenity" "${configopts[@]}" + else + run ./"$configscript" --build="${SERENITY_ARCH}-pc-serenity" "${configopts[@]}" + fi } func_defined post_configure || post_configure() { : |