mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
Meta: Add install-ports CMake target
install-ports copys the necessary files from Ports/ to /usr/Ports. Also refactor the compiler and destiation variables from .port_include.sh into .hosted_defs.sh. .hosted_defs.sh does not exists when ports are built in serenity
This commit is contained in:
parent
9c3948ef3e
commit
938924f36d
Notes:
sideshowbarker
2024-07-18 20:29:22 +09:00
Author: https://github.com/petelliott Commit: https://github.com/SerenityOS/serenity/commit/938924f36de Pull-request: https://github.com/SerenityOS/serenity/pull/6227 Reviewed-by: https://github.com/alimpfard Reviewed-by: https://github.com/bcoles
5 changed files with 40 additions and 12 deletions
|
@ -67,6 +67,11 @@ add_custom_target(check-style
|
|||
USES_TERMINAL
|
||||
)
|
||||
|
||||
add_custom_target(install-ports
|
||||
COMMAND ${CMAKE_COMMAND} -E env "SERENITY_ROOT=${CMAKE_SOURCE_DIR}" "SERENITY_ARCH=${SERENITY_ARCH}" ${CMAKE_SOURCE_DIR}/Meta/install-ports-tree.sh
|
||||
USES_TERMINAL
|
||||
)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
|
10
Meta/install-ports-tree.sh
Executable file
10
Meta/install-ports-tree.sh
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
SERENITY_PORTS_DIR="${SERENITY_ROOT}/Build/${SERENITY_ARCH}/Root/usr/Ports"
|
||||
|
||||
for file in $(git ls-files "${SERENITY_ROOT}/Ports"); do
|
||||
if [ "$(basename "$file")" != ".hosted_defs.sh" ]; then
|
||||
target=${SERENITY_PORTS_DIR}/$(realpath --relative-to="${SERENITY_ROOT}/Ports" "$file")
|
||||
mkdir -p "$(dirname "$target")" && cp "$file" "$target"
|
||||
fi
|
||||
done
|
|
@ -14,7 +14,8 @@ IGNORE_FILES = {
|
|||
PORT_TABLE_FILE,
|
||||
'build_all.sh',
|
||||
'build_installed.sh',
|
||||
'README.md'
|
||||
'README.md',
|
||||
'.hosted_defs.sh'
|
||||
}
|
||||
|
||||
|
||||
|
|
10
Ports/.hosted_defs.sh
Normal file
10
Ports/.hosted_defs.sh
Normal file
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
export SERENITY_ROOT="$(realpath "${SCRIPT}/../")"
|
||||
export SERENITY_BUILD_DIR="${SERENITY_ROOT}/Build/${SERENITY_ARCH}"
|
||||
export CC="${SERENITY_ARCH}-pc-serenity-gcc"
|
||||
export CXX="${SERENITY_ARCH}-pc-serenity-g++"
|
||||
export AR="${SERENITY_ARCH}-pc-serenity-ar"
|
||||
export RANLIB="${SERENITY_ARCH}-pc-serenity-ranlib"
|
||||
export PATH="${SERENITY_ROOT}/Toolchain/Local/${SERENITY_ARCH}/bin:${PATH}"
|
||||
export DESTDIR="${SERENITY_BUILD_DIR}/Root"
|
|
@ -2,16 +2,17 @@
|
|||
set -eu
|
||||
|
||||
SCRIPT="$(dirname "${0}")"
|
||||
export SERENITY_ROOT="$(realpath "${SCRIPT}/../")"
|
||||
export SERENITY_ARCH="${SERENITY_ARCH:-i686}"
|
||||
export SERENITY_BUILD_DIR="${SERENITY_ROOT}/Build/${SERENITY_ARCH}"
|
||||
export CC="${SERENITY_ARCH}-pc-serenity-gcc"
|
||||
export CXX="${SERENITY_ARCH}-pc-serenity-g++"
|
||||
export AR="${SERENITY_ARCH}-pc-serenity-ar"
|
||||
export RANLIB="${SERENITY_ARCH}-pc-serenity-ranlib"
|
||||
export PATH="${SERENITY_ROOT}/Toolchain/Local/${SERENITY_ARCH}/bin:${PATH}"
|
||||
|
||||
packagesdb="${SERENITY_BUILD_DIR}/packages.db"
|
||||
maybe_source() {
|
||||
if [ -f "$1" ]; then
|
||||
. "$1"
|
||||
fi
|
||||
}
|
||||
DESTDIR="/"
|
||||
maybe_source "${SCRIPT}/.hosted_defs.sh"
|
||||
|
||||
packagesdb="${DESTDIR}/usr/Ports/packages.db"
|
||||
|
||||
MD5SUM=md5sum
|
||||
|
||||
|
@ -164,7 +165,7 @@ func_defined build || build() {
|
|||
run make $makeopts
|
||||
}
|
||||
func_defined install || install() {
|
||||
run make DESTDIR="${SERENITY_BUILD_DIR}/Root" $installopts install
|
||||
run make DESTDIR=$DESTDIR $installopts install
|
||||
}
|
||||
func_defined post_install || post_install() {
|
||||
echo
|
||||
|
@ -194,6 +195,7 @@ func_defined clean_all || clean_all() {
|
|||
addtodb() {
|
||||
if [ ! -f "$packagesdb" ]; then
|
||||
echo "Note: $packagesdb does not exist. Creating."
|
||||
mkdir -p "${DESTDIR}/usr/Ports/"
|
||||
touch "$packagesdb"
|
||||
fi
|
||||
if ! grep -E "^(auto|manual) $port $version" "$packagesdb" > /dev/null; then
|
||||
|
@ -226,10 +228,10 @@ uninstall() {
|
|||
for f in `cat plist`; do
|
||||
case $f in
|
||||
*/)
|
||||
run rmdir "${SERENITY_BUILD_DIR}/Root/$f" || true
|
||||
run rmdir "${DESTDIR}/$f" || true
|
||||
;;
|
||||
*)
|
||||
run rm -rf "${SERENITY_BUILD_DIR}/Root/$f"
|
||||
run rm -rf "${DESTDIR}/$f"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue