1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-30 13:17:45 +00:00

Ports: Make .hosted_defs.sh usable outside of .port_include.sh

This commit moves some stuff around in order to isolate .hosted_defs.sh
from .port_include.sh
This commit is contained in:
circl 2022-04-21 18:58:02 +02:00 committed by Linus Groh
parent 452334ab6e
commit 2130a83640
2 changed files with 28 additions and 26 deletions

View file

@ -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}"