mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Add support for geos on unix
This commit is contained in:
parent
9af1e7006f
commit
fd9aae59b0
@ -170,7 +170,10 @@ The action supports both `GitHub-hosted` runners and `self-hosted` runners on th
|
||||
extensions: intl-67.1
|
||||
```
|
||||
|
||||
- These extensions have custom support - `cubrid`, `pdo_cubrid` and `gearman` on `Ubuntu`, and `blackfire`, `couchbase`, `ioncube`, `oci8`, `pdo_oci`, `phalcon3` and `phalcon4` on all supported OS.
|
||||
- These extensions have custom support:
|
||||
- `cubrid`, `pdo_cubrid` and `gearman` on `Ubuntu`.
|
||||
- `geos` on `Ubuntu` and `macOS`.
|
||||
- `blackfire`, `couchbase`, `ioncube`, `oci8`, `pdo_oci`, `phalcon3` and `phalcon4` on all supported OS.
|
||||
|
||||
- By default, extensions which cannot be added or removed gracefully leave an error message in the logs, the action is not interrupted. To change this behaviour you can set `fail-fast` flag to `true`.
|
||||
|
||||
|
@ -112,6 +112,9 @@ describe('Extension tests', () => {
|
||||
linux = await extensions.addExtension('ioncube', '7.3', 'linux');
|
||||
expect(linux).toContain('add_ioncube');
|
||||
|
||||
linux = await extensions.addExtension('geos', '7.3', 'linux');
|
||||
expect(linux).toContain('add_geos');
|
||||
|
||||
linux = await extensions.addExtension('oci8, pdo_oci', '7.3', 'linux');
|
||||
expect(linux).toContain('add_oci oci8');
|
||||
expect(linux).toContain('add_oci pdo_oci');
|
||||
@ -164,6 +167,9 @@ describe('Extension tests', () => {
|
||||
darwin = await extensions.addExtension('ioncube', '7.3', 'darwin');
|
||||
expect(darwin).toContain('add_ioncube');
|
||||
|
||||
darwin = await extensions.addExtension('geos', '7.3', 'darwin');
|
||||
expect(darwin).toContain('add_geos');
|
||||
|
||||
darwin = await extensions.addExtension('oci8, pdo_oci', '7.3', 'darwin');
|
||||
expect(darwin).toContain('add_oci oci8');
|
||||
expect(darwin).toContain('add_oci pdo_oci');
|
||||
|
6
dist/index.js
vendored
6
dist/index.js
vendored
@ -2875,11 +2875,12 @@ async function addExtensionDarwin(extension_csv, version) {
|
||||
// match 5.3blackfire-(semver)...5.6blackfire-(semver), 7.0blackfire-(semver)...7.4blackfire-(semver)
|
||||
// match pdo_oci and oci8
|
||||
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
||||
// match 5.3geos...7.4geos, 7.0geos...7.4geos
|
||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||
// match 5.6couchbase...7.4couchbase
|
||||
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
||||
case /^pdo_oci$|^oci8$/.test(extension):
|
||||
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
||||
case /^(5\.[3-6]|7\.[0-4])(ioncube|geos)$/.test(version_extension):
|
||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||
case /^5\.6couchbase$|^7\.[0-4]couchbase$/.test(version_extension):
|
||||
add_script += await utils.customPackage(ext_name, 'ext', extension, 'darwin');
|
||||
@ -3020,13 +3021,14 @@ async function addExtensionLinux(extension_csv, version) {
|
||||
// match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
|
||||
// match pdo_oci and oci8
|
||||
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
||||
// match 5.3geos...7.4geos, 7.0geos...7.4geos
|
||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||
// match 5.6gearman...7.4gearman, 5.6couchbase...7.4couchbase
|
||||
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
||||
case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(version_extension):
|
||||
case /^pdo_oci$|^oci8$/.test(extension):
|
||||
case /^5\.6intl-[\d]+\.[\d]+$|^7\.[0-4]intl-[\d]+\.[\d]+$/.test(version_extension):
|
||||
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
||||
case /^(5\.[3-6]|7\.[0-4])(ioncube|geos)$/.test(version_extension):
|
||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||
case /^((5\.6)|(7\.[0-4]))(gearman|couchbase)$/.test(version_extension):
|
||||
add_script += await utils.customPackage(ext_name, 'ext', extension, 'linux');
|
||||
|
@ -26,13 +26,14 @@ export async function addExtensionDarwin(
|
||||
// match 5.3blackfire-(semver)...5.6blackfire-(semver), 7.0blackfire-(semver)...7.4blackfire-(semver)
|
||||
// match pdo_oci and oci8
|
||||
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
||||
// match 5.3geos...7.4geos, 7.0geos...7.4geos
|
||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||
// match 5.6couchbase...7.4couchbase
|
||||
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||
version_extension
|
||||
):
|
||||
case /^pdo_oci$|^oci8$/.test(extension):
|
||||
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
||||
case /^(5\.[3-6]|7\.[0-4])(ioncube|geos)$/.test(version_extension):
|
||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||
case /^5\.6couchbase$|^7\.[0-4]couchbase$/.test(version_extension):
|
||||
add_script += await utils.customPackage(
|
||||
@ -227,6 +228,7 @@ export async function addExtensionLinux(
|
||||
// match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
|
||||
// match pdo_oci and oci8
|
||||
// match 5.3ioncube...7.4ioncube, 7.0ioncube...7.4ioncube
|
||||
// match 5.3geos...7.4geos, 7.0geos...7.4geos
|
||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||
// match 5.6gearman...7.4gearman, 5.6couchbase...7.4couchbase
|
||||
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||
@ -239,7 +241,7 @@ export async function addExtensionLinux(
|
||||
case /^5\.6intl-[\d]+\.[\d]+$|^7\.[0-4]intl-[\d]+\.[\d]+$/.test(
|
||||
version_extension
|
||||
):
|
||||
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
||||
case /^(5\.[3-6]|7\.[0-4])(ioncube|geos)$/.test(version_extension):
|
||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||
case /^((5\.6)|(7\.[0-4]))(gearman|couchbase)$/.test(version_extension):
|
||||
add_script += await utils.customPackage(
|
||||
|
51
src/scripts/ext/geos.sh
Normal file
51
src/scripts/ext/geos.sh
Normal file
@ -0,0 +1,51 @@
|
||||
# Helper function install geos library and headers
|
||||
add_geos_libs() {
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
brew install geos
|
||||
else
|
||||
sudo apt-get install libgeos-dev
|
||||
if [ "${runner:?}" = "self-hosted" ]; then
|
||||
${apt_install:?} --no-upgrade --no-install-recommends autoconf automake gcc g++
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Patch geos for PHP 7
|
||||
patch_geos() {
|
||||
if [ "$(php -r "echo PHP_VERSION_ID;")" -ge 70000 ]; then
|
||||
sed -i~ -e "s/, ce->name/, ZSTR_VAL(ce->name)/; s/ulong /zend_ulong /" /tmp/php-geos-"$geos_tag"/geos.c
|
||||
fi
|
||||
}
|
||||
|
||||
# Get geos source
|
||||
get_geos() {
|
||||
curl -o /tmp/geos.tar.gz -sL https://github.com/libgeos/php-geos/archive/"$geos_tag".tar.gz
|
||||
tar -xzf /tmp/geos.tar.gz -C /tmp
|
||||
patch_geos
|
||||
}
|
||||
|
||||
# Helper function to compile and install geos
|
||||
add_geos_helper() {
|
||||
get_geos
|
||||
(
|
||||
cd /tmp/php-geos-"$geos_tag" || exit
|
||||
phpize
|
||||
./configure --enable-geos --with-geos-config="$(command -v geos-config)"
|
||||
sudo make -j"$(nproc)"
|
||||
sudo make install
|
||||
enable_extension geos extension
|
||||
)
|
||||
}
|
||||
|
||||
# Function to add geos
|
||||
add_geos() {
|
||||
geos_tag='1.0.0'
|
||||
add_geos_libs >/dev/null 2>&1
|
||||
enable_extension "geos" "extension"
|
||||
if check_extension "geos"; then
|
||||
add_log "${tick:?}" "geos" "Enabled"
|
||||
else
|
||||
add_geos_helper >/dev/null 2>&1
|
||||
add_extension_log "geos" "Installed and enabled"
|
||||
fi
|
||||
}
|
Loading…
Reference in New Issue
Block a user