mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:47: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:
parent
452334ab6e
commit
2130a83640
2 changed files with 28 additions and 26 deletions
|
@ -1,5 +1,23 @@
|
||||||
#!/usr/bin/env bash
|
#!/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}/../")"
|
export SERENITY_SOURCE_DIR="$(realpath "${SCRIPT}/../")"
|
||||||
|
|
||||||
if [ "$SERENITY_TOOLCHAIN" = "Clang" ]; then
|
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_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"
|
export PKG_CONFIG_LIBDIR="${PKG_CONFIG_SYSROOT_DIR}/usr/lib/pkgconfig/:${PKG_CONFIG_SYSROOT_DIR}/usr/local/lib/pkgconfig"
|
||||||
|
|
||||||
enable_ccache
|
export SERENITY_INSTALL_ROOT="${SERENITY_BUILD_DIR}/Root"
|
||||||
|
|
||||||
DESTDIR="${SERENITY_BUILD_DIR}/Root"
|
|
||||||
export SERENITY_INSTALL_ROOT="$DESTDIR"
|
|
||||||
|
|
|
@ -2,23 +2,6 @@
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
SCRIPT="$(dirname "${0}")"
|
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() {
|
maybe_source() {
|
||||||
if [ -f "$1" ]; then
|
if [ -f "$1" ]; then
|
||||||
|
@ -26,6 +9,14 @@ maybe_source() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
target_env() {
|
||||||
|
maybe_source "${SCRIPT}/.hosted_defs.sh"
|
||||||
|
}
|
||||||
|
|
||||||
|
target_env
|
||||||
|
|
||||||
|
DESTDIR="${SERENITY_INSTALL_ROOT}"
|
||||||
|
|
||||||
enable_ccache() {
|
enable_ccache() {
|
||||||
if command -v ccache &>/dev/null; then
|
if command -v ccache &>/dev/null; then
|
||||||
ccache_tooldir="${SERENITY_BUILD_DIR}/ccache"
|
ccache_tooldir="${SERENITY_BUILD_DIR}/ccache"
|
||||||
|
@ -37,11 +28,7 @@ enable_ccache() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
target_env() {
|
enable_ccache
|
||||||
maybe_source "${SCRIPT}/.hosted_defs.sh"
|
|
||||||
}
|
|
||||||
|
|
||||||
target_env
|
|
||||||
|
|
||||||
host_env() {
|
host_env() {
|
||||||
export CC="${HOST_CC}"
|
export CC="${HOST_CC}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue