Improve support to install extensions from source. #418
-
After work done by @alcaeus in #399, extensions on GitHub can be installed from source. - name: Setup PHP and remove shared extension
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: mongodb-mongodb/mongo-php-driver@v1.9 I would like to propose the following improvements. Support any git repositoryThis should also work - name: Setup PHP and remove shared extension
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: mongodb-https://github.com/mongodb/mongo-php-driver@v1.9
Add support for extensions in subdirectory- name: Setup PHP and remove shared extension
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: protobuf-protocolbuffers/protobuf@v3.15.2
env:
PROTOBUF_PATH: php/ext/google/protobuf <EXTENSION>__PATH can be used to specify subdirectory. Regex to check extension can be (https://regex101.com/r/vgIAmG/1) Add a check to ensure that the repo contains a PHP extension
add_extension_from_source() {
...
if ! [[ -e ./config.m4 && grep 'PHP_NEW_EXTENSION' ./config.m4 ]]; then
add_log "$cross" "$extension" "Provided repository does not contain a PHP extension"
fi
...
} Add support to specify configure arguments
So, support for these 3 arguments can be added.
- name: Setup PHP and remove shared extension
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
extensions: http-m6w6/ext-http@v4.0.0
env:
HTTP_CONFIGURE_PREFIX_OPTS: "CFLAGS=-Wno-implicit-function-declaration"
HTTP_CONFIGURE_OPTS: "--with-http" # or HTTP_CONFIGURE_SUFFIX_OPTS: "--with-http" add_extension_from_source() {
...
prefix_opts_var="${extension}_CONFIGURE_PREFIX_OPTS"
suffix_opts_var="${extension}_CONFIGURE_SUFFIX_OPTS"
opts_var="${extension}_CONFIGURE_OPTS"
IFS=' ' read -r -a prefix_opts <<< "${!prefix_opts_var}"
IFS=' ' read -r -a suffix_opts <<< "${!suffix_opts_var}"
IFS=' ' read -r -a opts <<< "${!opts_var}"
phpize
"${prefix_opts[@]}" ./configure "${suffix_opts[@]}" "${opts[@]}"
...
} Add support for libraries required by extensionadd_libs() {
libs=("$@")
if [ $(uname -s) = "Linux" ]; then
install_packages "${libs[@]}"
else
brew install "${libs[@]}"
fi
}
add_extension_from_source() {
...
libs_var="${extension}_LIBS"
IFS=' ' read -r -a libs <<< "${!libs_var}"
add_libs "${libs[@]}"
...
} |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
//cc @alcaeus |
Beta Was this translation helpful? Give feedback.
-
Related feature request for configuring extensions: #419 |
Beta Was this translation helpful? Give feedback.
-
Released |
Beta Was this translation helpful? Give feedback.
Released
2.11.0
with these changes