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
Notes: sideshowbarker 2024-07-17 11:31:12 +09:00
2 changed files with 28 additions and 26 deletions

View File

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

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