From 9b7e217dda0c45f0733f89a48e2cf483a6ba0a5e Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Thu, 5 Jan 2023 18:51:32 +0100 Subject: [PATCH] Ports: Support multiple port directories This allows Ports unfit for the main repository to be put elsewhere. --- Ports/.hosted_defs.sh | 1 + Ports/.port_include.sh | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Ports/.hosted_defs.sh b/Ports/.hosted_defs.sh index a1ce692d7ad..a83f85da7fd 100644 --- a/Ports/.hosted_defs.sh +++ b/Ports/.hosted_defs.sh @@ -56,3 +56,4 @@ export PKG_CONFIG_SYSROOT_DIR="${SERENITY_BUILD_DIR}/Root" export PKG_CONFIG_LIBDIR="${PKG_CONFIG_SYSROOT_DIR}/usr/local/lib/pkgconfig" export SERENITY_INSTALL_ROOT="${SERENITY_BUILD_DIR}/Root" +export SERENITY_PORT_DIRS="${SERENITY_PORT_DIRS:+${SERENITY_PORT_DIRS}:}${SERENITY_SOURCE_DIR}/Ports" diff --git a/Ports/.port_include.sh b/Ports/.port_include.sh index c24c0c1f162..f5d5e7633d3 100755 --- a/Ports/.port_include.sh +++ b/Ports/.port_include.sh @@ -528,7 +528,17 @@ package_install_state() { installdepends() { for depend in "${depends[@]}"; do if [ -z "$(package_install_state $depend)" ]; then - (cd "${PORT_META_DIR}/../$depend" && ./package.sh --auto) + # Split colon seperated string into a list + IFS=':' read -ra port_directories <<< "$SERENITY_PORT_DIRS" + for port_dir in "${port_directories[@]}"; do + if [ -d "${port_dir}/$depend" ]; then + (cd "${port_dir}/$depend" && ./package.sh --auto) + return + fi + done + + >&2 echo "Error: Dependency $depend could not be found." + exit 1 fi done }