summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Ports/.hosted_defs.sh23
-rwxr-xr-xPorts/.port_include.sh31
2 files changed, 28 insertions, 26 deletions
diff --git a/Ports/.hosted_defs.sh b/Ports/.hosted_defs.sh
index 72a09d0fba..7f7e9fbaf4 100644
--- a/Ports/.hosted_defs.sh
+++ b/Ports/.hosted_defs.sh
@@ -1,5 +1,23 @@
#!/usr/bin/env bash
+SCRIPT="$(dirname "${0}")"
+
+export SERENITY_ARCH="${SERENITY_ARCH:-i686}"
+export SERENITY_TOOLCHAIN="${SERENITY_TOOLCHAIN:-GCC}"
+
+if [ -z "${HOST_CC:=}" ]; then
+ export HOST_CC="${CC:=cc}"
+ export HOST_CXX="${CXX:=c++}"
+ export HOST_AR="${AR:=ar}"
+ export HOST_RANLIB="${RANLIB:=ranlib}"
+ export HOST_PATH="${PATH:=}"
+ export HOST_READELF="${READELF:=readelf}"
+ export HOST_OBJCOPY="${OBJCOPY:=objcopy}"
+ export HOST_PKG_CONFIG_DIR="${PKG_CONFIG_DIR:=}"
+ export HOST_PKG_CONFIG_SYSROOT_DIR="${PKG_CONFIG_SYSROOT_DIR:=}"
+ export HOST_PKG_CONFIG_LIBDIR="${PKG_CONFIG_LIBDIR:=}"
+fi
+
export SERENITY_SOURCE_DIR="$(realpath "${SCRIPT}/../")"
if [ "$SERENITY_TOOLCHAIN" = "Clang" ]; then
@@ -26,7 +44,4 @@ export PKG_CONFIG_DIR=""
export PKG_CONFIG_SYSROOT_DIR="${SERENITY_BUILD_DIR}/Root"
export PKG_CONFIG_LIBDIR="${PKG_CONFIG_SYSROOT_DIR}/usr/lib/pkgconfig/:${PKG_CONFIG_SYSROOT_DIR}/usr/local/lib/pkgconfig"
-enable_ccache
-
-DESTDIR="${SERENITY_BUILD_DIR}/Root"
-export SERENITY_INSTALL_ROOT="$DESTDIR"
+export SERENITY_INSTALL_ROOT="${SERENITY_BUILD_DIR}/Root"
diff --git a/Ports/.port_include.sh b/Ports/.port_include.sh
index 7341cad119..75793938c0 100755
--- a/Ports/.port_include.sh
+++ b/Ports/.port_include.sh
@@ -2,23 +2,6 @@
set -eu
SCRIPT="$(dirname "${0}")"
-export SERENITY_ARCH="${SERENITY_ARCH:-i686}"
-export SERENITY_TOOLCHAIN="${SERENITY_TOOLCHAIN:-GCC}"
-
-if [ -z "${HOST_CC:=}" ]; then
- export HOST_CC="${CC:=cc}"
- export HOST_CXX="${CXX:=c++}"
- export HOST_AR="${AR:=ar}"
- export HOST_RANLIB="${RANLIB:=ranlib}"
- export HOST_PATH="${PATH:=}"
- export HOST_READELF="${READELF:=readelf}"
- export HOST_OBJCOPY="${OBJCOPY:=objcopy}"
- export HOST_PKG_CONFIG_DIR="${PKG_CONFIG_DIR:=}"
- export HOST_PKG_CONFIG_SYSROOT_DIR="${PKG_CONFIG_SYSROOT_DIR:=}"
- export HOST_PKG_CONFIG_LIBDIR="${PKG_CONFIG_LIBDIR:=}"
-fi
-
-DESTDIR="/"
maybe_source() {
if [ -f "$1" ]; then
@@ -26,6 +9,14 @@ maybe_source() {
fi
}
+target_env() {
+ maybe_source "${SCRIPT}/.hosted_defs.sh"
+}
+
+target_env
+
+DESTDIR="${SERENITY_INSTALL_ROOT}"
+
enable_ccache() {
if command -v ccache &>/dev/null; then
ccache_tooldir="${SERENITY_BUILD_DIR}/ccache"
@@ -37,11 +28,7 @@ enable_ccache() {
fi
}
-target_env() {
- maybe_source "${SCRIPT}/.hosted_defs.sh"
-}
-
-target_env
+enable_ccache
host_env() {
export CC="${HOST_CC}"