From c7736a605a2de3eaa0b1609998f9eedbe2b62329 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Thu, 11 Mar 2021 06:50:01 +0530 Subject: [PATCH] Add support for adding libraries when building extensions from source --- src/scripts/common.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/scripts/common.sh b/src/scripts/common.sh index f0171237..4aef3bdd 100644 --- a/src/scripts/common.sh +++ b/src/scripts/common.sh @@ -291,6 +291,16 @@ php_src_tag() { echo "$php_src_tag" } +# Function to add required libraries +add_libs() { + libs=("$@") + if [ "$(uname -s)" = "Linux" ]; then + install_packages "${libs[@]}" + else + brew install "${libs[@]}" + fi +} + # Function to install extension from a GitHub repository add_extension_from_github() { extension=$1 @@ -298,6 +308,8 @@ add_extension_from_github() { repo=$3 release=$4 prefix=$5 + libs_var="${extension}_LIBS" + IFS=' ' read -r -a libs <<< "${!libs_var}" ( add_devtools phpize delete_extension "$extension" @@ -305,6 +317,7 @@ add_extension_from_github() { cd /tmp/"$repo-$release" || exit 1 git checkout "$release" || exit 1 git submodule update --init --recursive || exit 1 + add_libs "${libs[@]}" phpize && ./configure && make -j"$(nproc)" && sudo make install enable_extension "$extension" "$prefix" ) >/dev/null 2>&1