mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Refactor and improve extension support
Add support for APCu on macOS from shivammathur/homebrew-extensions Improve support for geos to compile on PHP 8.0 and 8.1 Fix pecl setup to avoid unnecessary callbacks Use GitHub releases for all couchbase versions Use add_extension_from_source for all custom supported extensions Remove bintray and use shivammathur/intl-icu releases Add patch for protobuf for installing from source Move patches from custom extension scripts to patches directory Add support to build extension from GitHub and pecl tar archives (Internal API) Refactor regex in extension.ts Move add_pecl_extension to common.sh Refactor remove_extension in darwin.sh Fix shellcheck warning in darwin.sh Improve switch_version in linux.sh to accept parameters
This commit is contained in:
parent
7c13389546
commit
ada1ce86b7
@ -160,11 +160,12 @@ describe('Extension tests', () => {
|
|||||||
|
|
||||||
it('checking addExtensionOnDarwin', async () => {
|
it('checking addExtensionOnDarwin', async () => {
|
||||||
let darwin: string = await extensions.addExtension(
|
let darwin: string = await extensions.addExtension(
|
||||||
'amqp, Xdebug, pcov, grpc, igbinary, imagick, imap, msgpack, protobuf, redis, swoole, sqlite, oci8, pdo_oci, :intl, ast-beta, grpc-1.2.3',
|
'amqp, apcu, Xdebug, pcov, grpc, igbinary, imagick, imap, msgpack, protobuf, redis, swoole, sqlite, oci8, pdo_oci, :intl, ast-beta, grpc-1.2.3',
|
||||||
'7.2',
|
'7.2',
|
||||||
'darwin'
|
'darwin'
|
||||||
);
|
);
|
||||||
expect(darwin).toContain('add_brew_extension amqp extension');
|
expect(darwin).toContain('add_brew_extension amqp extension');
|
||||||
|
expect(darwin).toContain('add_brew_extension apcu extension');
|
||||||
expect(darwin).toContain('add_brew_extension xdebug zend_extension');
|
expect(darwin).toContain('add_brew_extension xdebug zend_extension');
|
||||||
expect(darwin).toContain('add_brew_extension pcov extension');
|
expect(darwin).toContain('add_brew_extension pcov extension');
|
||||||
expect(darwin).toContain('add_brew_extension grpc extension');
|
expect(darwin).toContain('add_brew_extension grpc extension');
|
||||||
|
51
dist/index.js
vendored
51
dist/index.js
vendored
@ -1810,18 +1810,18 @@ async function addExtensionDarwin(extension_csv, version) {
|
|||||||
case /^:/.test(ext_name):
|
case /^:/.test(ext_name):
|
||||||
remove_script += '\nremove_extension ' + ext_name.slice(1);
|
remove_script += '\nremove_extension ' + ext_name.slice(1);
|
||||||
return;
|
return;
|
||||||
// match extensions for compiling from source.
|
// match extensions for compiling from source
|
||||||
case /.+-.+\/.+@.+/.test(extension):
|
case /.+-.+\/.+@.+/.test(extension):
|
||||||
add_script += await utils.parseExtensionSource(extension, ext_prefix);
|
add_script += await utils.parseExtensionSource(extension, ext_prefix);
|
||||||
return;
|
return;
|
||||||
// match 5.3blackfire...8.0blackfire
|
// match 5.3blackfire...8.0blackfire
|
||||||
// match 5.3blackfire-(semver)...8.0blackfire-(semver)
|
// match 5.3blackfire-(semver)...8.0blackfire-(semver)
|
||||||
// match couchbase, pdo_oci, oci8, http, pecl_http
|
// match couchbase, geos, pdo_oci, oci8, http, pecl_http
|
||||||
// match 5.3ioncube...7.4ioncube, 5.3geos...7.4geos
|
// match 5.3ioncube...7.4ioncube
|
||||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.0)blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4]|8\.0)blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
||||||
case /^couchbase$|^pdo_oci$|^oci8$|^http|^pecl_http|^pdo_firebird$/.test(extension):
|
case /^couchbase$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(extension):
|
||||||
case /^(5\.[3-6]|7\.[0-4])(ioncube|geos)$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
add_script += await utils.customPackage(ext_name, 'ext', extension, 'darwin');
|
add_script += await utils.customPackage(ext_name, 'ext', extension, 'darwin');
|
||||||
return;
|
return;
|
||||||
@ -1837,12 +1837,12 @@ async function addExtensionDarwin(extension_csv, version) {
|
|||||||
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
add_script += await utils.getUnsupportedLog('pcov', version, 'darwin');
|
add_script += await utils.getUnsupportedLog('pcov', version, 'darwin');
|
||||||
return;
|
return;
|
||||||
// match 5.6 to 8.9 for amqp, grpc, igbinary, imagick, imap, msgpack, protobuf, raphf, redis, swoole, xdebug, xdebug2, zmq
|
// match 5.6 and newer - amqp, apcu, grpc, igbinary, imagick, imap, msgpack, protobuf, raphf, redis, swoole, xdebug, xdebug2, zmq
|
||||||
// match 7.1 to 8.9 for pcov
|
// match 7.1 and newer - pcov
|
||||||
// match 5.6 to 7.4 for propro
|
// match 5.6 to 7.4 - propro
|
||||||
case /(5\.6|7\.[0-4]|8\.[0-9])(amqp|grpc|igbinary|imagick|imap|msgpack|protobuf|raphf|redis|swoole|xdebug|xdebug2|zmq)/.test(version_extension):
|
case /(?<!5\.[3-5])(amqp|apcu|grpc|igbinary|imagick|imap|msgpack|protobuf|raphf|redis|swoole|xdebug|xdebug2|zmq)/.test(version_extension):
|
||||||
case /(5\.6|7\.[0-4])propro/.test(version_extension):
|
case /(5\.6|7\.[0-4])propro/.test(version_extension):
|
||||||
case /(7\.[1-4]|8\.[0-9])pcov/.test(version_extension):
|
case /(?<!5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
add_script += await utils.joins('\nadd_brew_extension', ext_name, ext_prefix);
|
add_script += await utils.joins('\nadd_brew_extension', ext_name, ext_prefix);
|
||||||
return;
|
return;
|
||||||
// match sqlite
|
// match sqlite
|
||||||
@ -1884,17 +1884,16 @@ async function addExtensionWindows(extension_csv, version) {
|
|||||||
// match 7.1pecl_http...8.0pecl_http and 7.1http...8.0http
|
// match 7.1pecl_http...8.0pecl_http and 7.1http...8.0http
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.0)blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4]|8\.0)blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
||||||
case /^pdo_oci$|^oci8$|^pdo_firebird$/.test(extension):
|
case /^pdo_oci$|^oci8$|^pdo_firebird$/.test(extension):
|
||||||
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
case /^(7\.[1-4]|8\.0)(http|pecl_http)$/.test(version_extension):
|
case /^(7\.[1-4]|8\.0)(pecl_)?http/.test(version_extension):
|
||||||
add_script += await utils.customPackage(ext_name, 'ext', extension, 'win32');
|
add_script += await utils.customPackage(ext_name, 'ext', extension, 'win32');
|
||||||
return;
|
return;
|
||||||
// match pre-release versions. For example - xdebug-beta
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.+-(stable|beta|alpha|devel|snapshot)/.test(extension):
|
case /.+-(stable|beta|alpha|devel|snapshot)/.test(extension):
|
||||||
add_script += await utils.joins('\nAdd-Extension', ext_name, ext_version.replace('stable', ''));
|
add_script += await utils.joins('\nAdd-Extension', ext_name, ext_version.replace('stable', ''));
|
||||||
break;
|
break;
|
||||||
// match extensions from GitHub. Do this before checking for semver as
|
// match extensions for compiling from source
|
||||||
// the version may match that as well
|
|
||||||
case /.+-.+\/.+@.+/.test(extension):
|
case /.+-.+\/.+@.+/.test(extension):
|
||||||
add_script += await utils.getUnsupportedLog(extension, version, 'win32');
|
add_script += await utils.getUnsupportedLog(extension, version, 'win32');
|
||||||
break;
|
break;
|
||||||
@ -1915,17 +1914,13 @@ async function addExtensionWindows(extension_csv, version) {
|
|||||||
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
add_script += await utils.getUnsupportedLog('pcov', version, 'win32');
|
add_script += await utils.getUnsupportedLog('pcov', version, 'win32');
|
||||||
break;
|
break;
|
||||||
// match 5.3mysql..5.6mysql
|
// match 5.3 to 5.6 - mysql, mysqli, mysqlnd
|
||||||
// match 5.3mysqli..5.6mysqli
|
case /^5\.[3-6](mysql|mysqli|mysqlnd)$/.test(version_extension):
|
||||||
// match 5.3mysqlnd..5.6mysqlnd
|
|
||||||
case /^5\.\d(mysql|mysqli|mysqlnd)$/.test(version_extension):
|
|
||||||
add_script +=
|
add_script +=
|
||||||
'\nAdd-Extension mysql\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
|
'\nAdd-Extension mysql\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
|
||||||
break;
|
break;
|
||||||
// match 7.0mysql..8.9mysql
|
// match 7.0 and newer mysql, mysqli and mysqlnd
|
||||||
// match 7.0mysqli..8.9mysqli
|
case /(?<!5\.[3-6])(mysql|mysqli|mysqlnd)$/.test(version_extension):
|
||||||
// match 7.0mysqlnd..8.9mysqlnd
|
|
||||||
case /[7-8]\.\d+(mysql|mysqli|mysqlnd)$/.test(version_extension):
|
|
||||||
add_script += '\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
|
add_script += '\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
|
||||||
break;
|
break;
|
||||||
// match sqlite
|
// match sqlite
|
||||||
@ -1960,24 +1955,22 @@ async function addExtensionLinux(extension_csv, version) {
|
|||||||
case /^:/.test(ext_name):
|
case /^:/.test(ext_name):
|
||||||
remove_script += '\nremove_extension ' + ext_name.slice(1);
|
remove_script += '\nremove_extension ' + ext_name.slice(1);
|
||||||
return;
|
return;
|
||||||
// match extensions for compiling from source.
|
// match extensions for compiling from source
|
||||||
case /.+-.+\/.+@.+/.test(extension):
|
case /.+-.+\/.+@.+/.test(extension):
|
||||||
add_script += await utils.parseExtensionSource(extension, ext_prefix);
|
add_script += await utils.parseExtensionSource(extension, ext_prefix);
|
||||||
return;
|
return;
|
||||||
// match 5.3blackfire...8.0blackfire
|
// match 5.3blackfire...8.0blackfire
|
||||||
// match 5.3blackfire-(semver)...8.0blackfire-(semver)
|
// match 5.3blackfire-(semver)...8.0blackfire-(semver)
|
||||||
// match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
|
// match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
|
||||||
// match couchbase, pdo_oci, oci8, http, pecl_http
|
// match couchbase, geos, pdo_oci, oci8, http, pecl_http
|
||||||
// match 5.3ioncube...7.4ioncube, 5.3geos...7.4geos
|
// match 5.3ioncube...7.4ioncube
|
||||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
// match 5.6gearman...8.1gearman
|
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.0)blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4]|8\.0)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 /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(version_extension):
|
||||||
case /^couchbase$|^pdo_oci$|^oci8$|^http|^pecl_http|^pdo_firebird$/.test(extension):
|
case /^couchbase$|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(extension):
|
||||||
case /(?<!5\.[3-5])intl-[\d]+\.[\d]+$/.test(version_extension):
|
case /(?<!5\.[3-5])intl-[\d]+\.[\d]+$/.test(version_extension):
|
||||||
case /^(5\.[3-6]|7\.[0-4])(ioncube|geos)$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.[0-9])gearman$/.test(version_extension):
|
|
||||||
add_script += await utils.customPackage(ext_name, 'ext', extension, 'linux');
|
add_script += await utils.customPackage(ext_name, 'ext', extension, 'linux');
|
||||||
return;
|
return;
|
||||||
// match pre-release versions. For example - xdebug-beta
|
// match pre-release versions. For example - xdebug-beta
|
||||||
|
@ -23,22 +23,22 @@ export async function addExtensionDarwin(
|
|||||||
case /^:/.test(ext_name):
|
case /^:/.test(ext_name):
|
||||||
remove_script += '\nremove_extension ' + ext_name.slice(1);
|
remove_script += '\nremove_extension ' + ext_name.slice(1);
|
||||||
return;
|
return;
|
||||||
// match extensions for compiling from source.
|
// match extensions for compiling from source
|
||||||
case /.+-.+\/.+@.+/.test(extension):
|
case /.+-.+\/.+@.+/.test(extension):
|
||||||
add_script += await utils.parseExtensionSource(extension, ext_prefix);
|
add_script += await utils.parseExtensionSource(extension, ext_prefix);
|
||||||
return;
|
return;
|
||||||
// match 5.3blackfire...8.0blackfire
|
// match 5.3blackfire...8.0blackfire
|
||||||
// match 5.3blackfire-(semver)...8.0blackfire-(semver)
|
// match 5.3blackfire-(semver)...8.0blackfire-(semver)
|
||||||
// match couchbase, pdo_oci, oci8, http, pecl_http
|
// match couchbase, geos, pdo_oci, oci8, http, pecl_http
|
||||||
// match 5.3ioncube...7.4ioncube, 5.3geos...7.4geos
|
// match 5.3ioncube...7.4ioncube
|
||||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.0)blackfire(-\d+\.\d+\.\d+)?$/.test(
|
case /^(5\.[3-6]|7\.[0-4]|8\.0)blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
case /^couchbase$|^pdo_oci$|^oci8$|^http|^pecl_http|^pdo_firebird$/.test(
|
case /^couchbase$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
|
||||||
extension
|
extension
|
||||||
):
|
):
|
||||||
case /^(5\.[3-6]|7\.[0-4])(ioncube|geos)$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
add_script += await utils.customPackage(
|
add_script += await utils.customPackage(
|
||||||
ext_name,
|
ext_name,
|
||||||
@ -69,14 +69,14 @@ export async function addExtensionDarwin(
|
|||||||
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
add_script += await utils.getUnsupportedLog('pcov', version, 'darwin');
|
add_script += await utils.getUnsupportedLog('pcov', version, 'darwin');
|
||||||
return;
|
return;
|
||||||
// match 5.6 to 8.9 for amqp, grpc, igbinary, imagick, imap, msgpack, protobuf, raphf, redis, swoole, xdebug, xdebug2, zmq
|
// match 5.6 and newer - amqp, apcu, grpc, igbinary, imagick, imap, msgpack, protobuf, raphf, redis, swoole, xdebug, xdebug2, zmq
|
||||||
// match 7.1 to 8.9 for pcov
|
// match 7.1 and newer - pcov
|
||||||
// match 5.6 to 7.4 for propro
|
// match 5.6 to 7.4 - propro
|
||||||
case /(5\.6|7\.[0-4]|8\.[0-9])(amqp|grpc|igbinary|imagick|imap|msgpack|protobuf|raphf|redis|swoole|xdebug|xdebug2|zmq)/.test(
|
case /(?<!5\.[3-5])(amqp|apcu|grpc|igbinary|imagick|imap|msgpack|protobuf|raphf|redis|swoole|xdebug|xdebug2|zmq)/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
case /(5\.6|7\.[0-4])propro/.test(version_extension):
|
case /(5\.6|7\.[0-4])propro/.test(version_extension):
|
||||||
case /(7\.[1-4]|8\.[0-9])pcov/.test(version_extension):
|
case /(?<!5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
add_script += await utils.joins(
|
add_script += await utils.joins(
|
||||||
'\nadd_brew_extension',
|
'\nadd_brew_extension',
|
||||||
ext_name,
|
ext_name,
|
||||||
@ -127,9 +127,9 @@ export async function addExtensionWindows(
|
|||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
case /^pdo_oci$|^oci8$|^pdo_firebird$/.test(extension):
|
case /^pdo_oci$|^oci8$|^pdo_firebird$/.test(extension):
|
||||||
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
case /^(7\.[1-4]|8\.0)(http|pecl_http)$/.test(version_extension):
|
case /^(7\.[1-4]|8\.0)(pecl_)?http/.test(version_extension):
|
||||||
add_script += await utils.customPackage(
|
add_script += await utils.customPackage(
|
||||||
ext_name,
|
ext_name,
|
||||||
'ext',
|
'ext',
|
||||||
@ -145,8 +145,7 @@ export async function addExtensionWindows(
|
|||||||
ext_version.replace('stable', '')
|
ext_version.replace('stable', '')
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
// match extensions from GitHub. Do this before checking for semver as
|
// match extensions for compiling from source
|
||||||
// the version may match that as well
|
|
||||||
case /.+-.+\/.+@.+/.test(extension):
|
case /.+-.+\/.+@.+/.test(extension):
|
||||||
add_script += await utils.getUnsupportedLog(
|
add_script += await utils.getUnsupportedLog(
|
||||||
extension,
|
extension,
|
||||||
@ -183,17 +182,13 @@ export async function addExtensionWindows(
|
|||||||
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
add_script += await utils.getUnsupportedLog('pcov', version, 'win32');
|
add_script += await utils.getUnsupportedLog('pcov', version, 'win32');
|
||||||
break;
|
break;
|
||||||
// match 5.3mysql..5.6mysql
|
// match 5.3 to 5.6 - mysql, mysqli, mysqlnd
|
||||||
// match 5.3mysqli..5.6mysqli
|
case /^5\.[3-6](mysql|mysqli|mysqlnd)$/.test(version_extension):
|
||||||
// match 5.3mysqlnd..5.6mysqlnd
|
|
||||||
case /^5\.\d(mysql|mysqli|mysqlnd)$/.test(version_extension):
|
|
||||||
add_script +=
|
add_script +=
|
||||||
'\nAdd-Extension mysql\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
|
'\nAdd-Extension mysql\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
|
||||||
break;
|
break;
|
||||||
// match 7.0mysql..8.9mysql
|
// match 7.0 and newer mysql, mysqli and mysqlnd
|
||||||
// match 7.0mysqli..8.9mysqli
|
case /(?<!5\.[3-6])(mysql|mysqli|mysqlnd)$/.test(version_extension):
|
||||||
// match 7.0mysqlnd..8.9mysqlnd
|
|
||||||
case /[7-8]\.\d+(mysql|mysqli|mysqlnd)$/.test(version_extension):
|
|
||||||
add_script += '\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
|
add_script += '\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
|
||||||
break;
|
break;
|
||||||
// match sqlite
|
// match sqlite
|
||||||
@ -232,30 +227,28 @@ export async function addExtensionLinux(
|
|||||||
case /^:/.test(ext_name):
|
case /^:/.test(ext_name):
|
||||||
remove_script += '\nremove_extension ' + ext_name.slice(1);
|
remove_script += '\nremove_extension ' + ext_name.slice(1);
|
||||||
return;
|
return;
|
||||||
// match extensions for compiling from source.
|
// match extensions for compiling from source
|
||||||
case /.+-.+\/.+@.+/.test(extension):
|
case /.+-.+\/.+@.+/.test(extension):
|
||||||
add_script += await utils.parseExtensionSource(extension, ext_prefix);
|
add_script += await utils.parseExtensionSource(extension, ext_prefix);
|
||||||
return;
|
return;
|
||||||
// match 5.3blackfire...8.0blackfire
|
// match 5.3blackfire...8.0blackfire
|
||||||
// match 5.3blackfire-(semver)...8.0blackfire-(semver)
|
// match 5.3blackfire-(semver)...8.0blackfire-(semver)
|
||||||
// match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
|
// match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
|
||||||
// match couchbase, pdo_oci, oci8, http, pecl_http
|
// match couchbase, geos, pdo_oci, oci8, http, pecl_http
|
||||||
// match 5.3ioncube...7.4ioncube, 5.3geos...7.4geos
|
// match 5.3ioncube...7.4ioncube
|
||||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
// match 5.6gearman...8.1gearman
|
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.0)blackfire(-\d+\.\d+\.\d+)?$/.test(
|
case /^(5\.[3-6]|7\.[0-4]|8\.0)blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(
|
case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
case /^couchbase$|^pdo_oci$|^oci8$|^http|^pecl_http|^pdo_firebird$/.test(
|
case /^couchbase$|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
|
||||||
extension
|
extension
|
||||||
):
|
):
|
||||||
case /(?<!5\.[3-5])intl-[\d]+\.[\d]+$/.test(version_extension):
|
case /(?<!5\.[3-5])intl-[\d]+\.[\d]+$/.test(version_extension):
|
||||||
case /^(5\.[3-6]|7\.[0-4])(ioncube|geos)$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.[0-9])gearman$/.test(version_extension):
|
|
||||||
add_script += await utils.customPackage(
|
add_script += await utils.customPackage(
|
||||||
ext_name,
|
ext_name,
|
||||||
'ext',
|
'ext',
|
||||||
|
@ -145,9 +145,6 @@ configure_php() {
|
|||||||
# Function to configure PECL.
|
# Function to configure PECL.
|
||||||
configure_pecl() {
|
configure_pecl() {
|
||||||
if ! [ -e /tmp/pecl_config ]; then
|
if ! [ -e /tmp/pecl_config ]; then
|
||||||
if ! command -v pecl >/dev/null || ! command -v pear >/dev/null; then
|
|
||||||
add_pecl >/dev/null 2>&1
|
|
||||||
fi
|
|
||||||
for script in pear pecl; do
|
for script in pear pecl; do
|
||||||
sudo "$script" config-set php_ini "${pecl_file:-${ini_file[@]}}"
|
sudo "$script" config-set php_ini "${pecl_file:-${ini_file[@]}}"
|
||||||
sudo "$script" channel-update "$script".php.net
|
sudo "$script" channel-update "$script".php.net
|
||||||
@ -172,10 +169,30 @@ get_pecl_version() {
|
|||||||
# Function to install PECL extensions and accept default options
|
# Function to install PECL extensions and accept default options
|
||||||
pecl_install() {
|
pecl_install() {
|
||||||
local extension=$1
|
local extension=$1
|
||||||
configure_pecl >/dev/null 2>&1
|
add_pecl >/dev/null 2>&1
|
||||||
yes '' 2>/dev/null | sudo pecl install -f "$extension" >/dev/null 2>&1
|
yes '' 2>/dev/null | sudo pecl install -f "$extension" >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to install a specific version of PECL extension.
|
||||||
|
add_pecl_extension() {
|
||||||
|
extension=$1
|
||||||
|
pecl_version=$2
|
||||||
|
prefix=$3
|
||||||
|
enable_extension "$extension" "$prefix"
|
||||||
|
if [[ $pecl_version =~ .*(alpha|beta|rc|snapshot|preview).* ]]; then
|
||||||
|
pecl_version=$(get_pecl_version "$extension" "$pecl_version")
|
||||||
|
fi
|
||||||
|
ext_version=$(php -r "echo phpversion('$extension');")
|
||||||
|
if [ "$ext_version" = "$pecl_version" ]; then
|
||||||
|
add_log "${tick:?}" "$extension" "Enabled"
|
||||||
|
else
|
||||||
|
disable_extension "$extension" >/dev/null 2>&1
|
||||||
|
delete_extension "$extension" >/dev/null 2>&1
|
||||||
|
pecl_install "$extension-$pecl_version"
|
||||||
|
add_extension_log "$extension-$pecl_version" "Installed and enabled"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Function to setup pre-release extensions using PECL.
|
# Function to setup pre-release extensions using PECL.
|
||||||
add_unstable_extension() {
|
add_unstable_extension() {
|
||||||
extension=$1
|
extension=$1
|
||||||
|
@ -7,12 +7,24 @@ self_hosted_helper() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to delete extension
|
||||||
|
delete_extension() {
|
||||||
|
extension=$1
|
||||||
|
sudo rm -rf "${scan_dir:?}"/*"$extension"* "${ext_dir:?}"/"$extension".so >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to disable extension
|
||||||
|
disable_extension() {
|
||||||
|
extension=$1
|
||||||
|
sudo sed -Ei '' "/=(.*\/)?\"?$extension(.so)?$/d" "${ini_file:?}"
|
||||||
|
}
|
||||||
|
|
||||||
# Function to remove extensions.
|
# Function to remove extensions.
|
||||||
remove_extension() {
|
remove_extension() {
|
||||||
extension=$1
|
extension=$1
|
||||||
if check_extension "$extension"; then
|
if check_extension "$extension"; then
|
||||||
sudo sed -Ei '' "/=(.*\/)?\"?$extension(.so)?$/d" "${ini_file:?}"
|
disable_extension "$extension"
|
||||||
sudo rm -rf "${scan_dir:?}"/*"$extension"* "${ext_dir:?}"/"$extension".so >/dev/null 2>&1
|
delete_extension "$extension"
|
||||||
(! check_extension "$extension" && add_log "${tick:?}" ":$extension" "Removed") ||
|
(! check_extension "$extension" && add_log "${tick:?}" ":$extension" "Removed") ||
|
||||||
add_log "${cross:?}" ":$extension" "Could not remove $extension on PHP ${semver:?}"
|
add_log "${cross:?}" ":$extension" "Could not remove $extension on PHP ${semver:?}"
|
||||||
else
|
else
|
||||||
@ -20,25 +32,6 @@ remove_extension() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to install a specific version of PECL extension.
|
|
||||||
add_pecl_extension() {
|
|
||||||
extension=$1
|
|
||||||
pecl_version=$2
|
|
||||||
prefix=$3
|
|
||||||
enable_extension "$extension" "$prefix"
|
|
||||||
if [[ $pecl_version =~ .*(alpha|beta|rc|snapshot|preview).* ]]; then
|
|
||||||
pecl_version=$(get_pecl_version "$extension" "$pecl_version")
|
|
||||||
fi
|
|
||||||
ext_version=$(php -r "echo phpversion('$extension');")
|
|
||||||
if [ "$ext_version" = "$pecl_version" ]; then
|
|
||||||
add_log "${tick:?}" "$extension" "Enabled"
|
|
||||||
else
|
|
||||||
remove_extension "$extension" >/dev/null 2>&1
|
|
||||||
pecl_install "$extension-$pecl_version"
|
|
||||||
add_extension_log "$extension-$pecl_version" "Installed and enabled"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to fetch a brew tap
|
# Function to fetch a brew tap
|
||||||
fetch_brew_tap() {
|
fetch_brew_tap() {
|
||||||
tap=$1
|
tap=$1
|
||||||
@ -107,6 +100,7 @@ add_devtools() {
|
|||||||
|
|
||||||
# Function to handle request to add PECL.
|
# Function to handle request to add PECL.
|
||||||
add_pecl() {
|
add_pecl() {
|
||||||
|
configure_pecl >/dev/null 2>&1
|
||||||
pecl_version=$(get_tool_version "pecl" "version")
|
pecl_version=$(get_tool_version "pecl" "version")
|
||||||
add_log "${tick:?}" "PECL" "Found PECL $pecl_version"
|
add_log "${tick:?}" "PECL" "Found PECL $pecl_version"
|
||||||
}
|
}
|
||||||
@ -119,7 +113,7 @@ link_libraries() {
|
|||||||
for lib in "$formula_prefix"/lib/*.dylib; do
|
for lib in "$formula_prefix"/lib/*.dylib; do
|
||||||
lib_name=$(basename "$lib")
|
lib_name=$(basename "$lib")
|
||||||
sudo cp -a "$lib" "$brew_prefix/lib/old_$lib_name" 2>/dev/null || true
|
sudo cp -a "$lib" "$brew_prefix/lib/old_$lib_name" 2>/dev/null || true
|
||||||
sudo ln -sf "$brew_prefix"/lib/old_$lib_name "$brew_prefix/lib/$lib_name"
|
sudo ln -sf "$brew_prefix"/lib/old_"$lib_name" "$brew_prefix/lib/$lib_name"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,22 +1,17 @@
|
|||||||
# Function to install libraries required by couchbase
|
# Function to install libraries required by couchbase
|
||||||
add_couchbase_libs() {
|
add_couchbase_libs() {
|
||||||
if [ "$(uname -s)" = "Linux" ]; then
|
if [ "$(uname -s)" = "Linux" ]; then
|
||||||
|
trunk="https://github.com/couchbase/libcouchbase/releases"
|
||||||
if [[ ${version:?} =~ 5.[3-6]|7.[0-1] ]]; then
|
if [[ ${version:?} =~ 5.[3-6]|7.[0-1] ]]; then
|
||||||
release="2.10.9"
|
release="2.10.9"
|
||||||
trunk="https://github.com/couchbase/libcouchbase/releases/download"
|
|
||||||
package="libcouchbase-${release}_ubuntu${DISTRIB_RELEASE/./}_${DISTRIB_CODENAME}_amd64.tar"
|
|
||||||
get -q -n /tmp/libcouchbase.tar "$trunk/$release/$package"
|
|
||||||
sudo tar -xf /tmp/libcouchbase.tar -C /tmp
|
|
||||||
install_packages libev4
|
|
||||||
sudo dpkg -i /tmp/libcouchbase-*/*.deb
|
|
||||||
else
|
else
|
||||||
trunk="http://packages.couchbase.com/clients/c/repos/deb"
|
release="$(curl -sL $trunk/latest | grep -Eo "libcouchbase-[0-9]+\.[0-9]+\.[0-9]+" | head -n 1 | cut -d'-' -f 2)"
|
||||||
list="deb $trunk/ubuntu${DISTRIB_RELEASE/./} ${DISTRIB_CODENAME:?} ${DISTRIB_CODENAME:?}/main"
|
|
||||||
get -s -n "" "$trunk/couchbase.key" | sudo apt-key add
|
|
||||||
echo "$list" | sudo tee /etc/apt/sources.list.d/couchbase.list
|
|
||||||
sudo apt-get update
|
|
||||||
fi
|
fi
|
||||||
${apt_install:?} libcouchbase-dev
|
deb_url="$trunk/download/$release/libcouchbase-${release}_ubuntu${DISTRIB_RELEASE/./}_${DISTRIB_CODENAME}_amd64.tar"
|
||||||
|
get -q -n /tmp/libcouchbase.tar "$deb_url"
|
||||||
|
sudo tar -xf /tmp/libcouchbase.tar -C /tmp
|
||||||
|
install_packages libev4 libevent-dev
|
||||||
|
sudo dpkg -i /tmp/libcouchbase-*/*.deb
|
||||||
else
|
else
|
||||||
if [[ ${version:?} =~ 5.[3-6]|7.[0-1] ]]; then
|
if [[ ${version:?} =~ 5.[3-6]|7.[0-1] ]]; then
|
||||||
brew install libcouchbase@2
|
brew install libcouchbase@2
|
||||||
|
@ -40,16 +40,11 @@ add_cubrid_helper() {
|
|||||||
set_cubrid_repo
|
set_cubrid_repo
|
||||||
set_cubrid_branch
|
set_cubrid_branch
|
||||||
[ "$DISTRIB_RELEASE" = "16.04" ] && setup_compiler
|
[ "$DISTRIB_RELEASE" = "16.04" ] && setup_compiler
|
||||||
(
|
patch_phpize
|
||||||
git clone -b "$cubrid_branch" --recursive "https://github.com/CUBRID/$cubrid_repo" "/tmp/$cubrid_repo"
|
read -r "${ext}_PREFIX_CONFIGURE_OPTS" <<< "CFLAGS=-Wno-implicit-function-declaration"
|
||||||
cd "/tmp/$cubrid_repo" || exit
|
read -r "${ext}_CONFIGURE_OPTS" <<< "--with-php-config=$(command -v php-config)"
|
||||||
! [[ "$version" =~ ${old_versions:?} ]] && add_devtools
|
add_extension_from_source "$ext" https://github.com CUBRID "$cubrid_repo" . "$cubrid_branch" extension
|
||||||
phpize
|
restore_phpize
|
||||||
sudo ./configure --with-php-config="$(command -v php-config)" --with-"${ext/_/-}"=shared
|
|
||||||
make -j"$(nproc)"
|
|
||||||
sudo make install
|
|
||||||
)
|
|
||||||
echo "extension=$ext.so" | sudo tee "${scan_dir:?}/$ext.ini"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,3 +56,6 @@ add_cubrid() {
|
|||||||
add_extension_log "$ext" "$status"
|
add_extension_log "$ext" "$status"
|
||||||
check_extension "$ext" && add_license_log
|
check_extension "$ext" && add_license_log
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# shellcheck source=.
|
||||||
|
. "${scripts:?}"/ext/patches/phpize.sh
|
||||||
|
@ -10,18 +10,9 @@ add_firebird_client_darwin() {
|
|||||||
add_firebird_helper() {
|
add_firebird_helper() {
|
||||||
firebird_dir=$1
|
firebird_dir=$1
|
||||||
tag="$(php_src_tag)"
|
tag="$(php_src_tag)"
|
||||||
get -s -n "" https://github.com/php/php-src/archive/"$tag".tar.gz | tar -xzf - -C /tmp
|
export PDO_FIREBIRD_CONFIGURE_OPTS="--with-pdo-firebird=$firebird_dir"
|
||||||
(
|
export PDO_FIREBIRD_LINUX_LIBS="firebird-dev"
|
||||||
cd /tmp/php-src-"$tag"/ext/pdo_firebird || exit
|
add_extension_from_source pdo_firebird https://github.com php php-src ext/pdo_firebird "$tag" extension get
|
||||||
if [[ "${version:?}" =~ ${old_versions:?} ]]; then
|
|
||||||
sudo sed -i '' '/PHP_CHECK_PDO_INCLUDES/d' config.m4 2>/dev/null || sudo sed -i '/PHP_CHECK_PDO_INCLUDES/d' config.m4
|
|
||||||
fi
|
|
||||||
sudo phpize
|
|
||||||
sudo ./configure --with-pdo-firebird="$firebird_dir"
|
|
||||||
sudo make -j"$(nproc 2>/dev/null || sysctl -n hw.ncpu)"
|
|
||||||
sudo make install
|
|
||||||
enable_extension pdo_firebird extension
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
add_firebird() {
|
add_firebird() {
|
||||||
@ -29,10 +20,6 @@ add_firebird() {
|
|||||||
if ! check_extension pdo_firebird; then
|
if ! check_extension pdo_firebird; then
|
||||||
if [ "$(uname -s)" = "Linux" ]; then
|
if [ "$(uname -s)" = "Linux" ]; then
|
||||||
if [[ "${version:?}" =~ 5.3|${nightly_versions:?} ]]; then
|
if [[ "${version:?}" =~ 5.3|${nightly_versions:?} ]]; then
|
||||||
lib_arch=$(gcc -dumpmachine)
|
|
||||||
install_packages firebird-dev >/dev/null 2>&1
|
|
||||||
sudo ln -sf /usr/lib/"$lib_arch"/libfbclient.so.2 /usr/lib/libfbclient.so >/dev/null 2>&1
|
|
||||||
sudo ln -sf /usr/lib/"$lib_arch"/libib_util.so /usr/lib/ >/dev/null 2>&1
|
|
||||||
add_firebird_helper /usr >/dev/null 2>&1
|
add_firebird_helper /usr >/dev/null 2>&1
|
||||||
else
|
else
|
||||||
add_pdo_extension firebird >/dev/null 2>&1
|
add_pdo_extension firebird >/dev/null 2>&1
|
||||||
|
@ -1,46 +1,12 @@
|
|||||||
# 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
|
# Helper function to compile and install geos
|
||||||
add_geos_helper() {
|
add_geos_helper() {
|
||||||
get_geos
|
export GEOS_LINUX_LIBS='libgeos-dev'
|
||||||
(
|
export GEOS_DARWIN_LIBS='geos'
|
||||||
cd /tmp/php-geos-"$geos_tag" || exit
|
add_extension_from_source geos https://github.com libgeos php-geos . 1.0.0 extension get
|
||||||
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
|
# Function to add geos
|
||||||
add_geos() {
|
add_geos() {
|
||||||
geos_tag='1.0.0'
|
|
||||||
add_geos_libs >/dev/null 2>&1
|
|
||||||
enable_extension "geos" "extension"
|
enable_extension "geos" "extension"
|
||||||
if check_extension "geos"; then
|
if check_extension "geos"; then
|
||||||
add_log "${tick:?}" "geos" "Enabled"
|
add_log "${tick:?}" "geos" "Enabled"
|
||||||
|
@ -19,48 +19,30 @@ enable_http() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to install linux dependencies.
|
# Function to install extensions.
|
||||||
add_http_dependencies_linux() {
|
add_extension_helper() {
|
||||||
! [[ ${version:?} =~ ${nightly_versions:?} ]] && add_devtools phpize
|
if [ "$os" = "Linux" ]; then
|
||||||
install_packages zlib1g libbrotli-dev libcurl4-openssl-dev libevent-dev libicu-dev libidn2-dev
|
add_extension "$1" extension
|
||||||
|
else
|
||||||
|
add_brew_extension "$1" extension
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install http dependencies.
|
||||||
|
add_http_dependencies() {
|
||||||
if [[ ${version:?} =~ ${old_versions:?} ]]; then
|
if [[ ${version:?} =~ ${old_versions:?} ]]; then
|
||||||
add_pecl_extension raphf 1.1.2 extension
|
add_pecl_extension raphf 1.1.2 extension
|
||||||
add_pecl_extension propro 1.0.2 extension
|
add_pecl_extension propro 1.0.2 extension
|
||||||
elif [[ ${version:?} =~ 5.6|7.[0-4] ]]; then
|
elif [[ ${version:?} =~ 5.6|7.[0-4] ]]; then
|
||||||
add_extension propro extension
|
add_extension_helper propro
|
||||||
add_extension raphf extension
|
add_extension_helper raphf
|
||||||
else
|
else
|
||||||
add_extension raphf extension
|
add_extension_helper raphf
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to install darwin dependencies.
|
|
||||||
add_http_dependencies_darwin() {
|
|
||||||
brew install brotli curl icu4c libevent libidn2
|
|
||||||
if ! [[ ${version:?} =~ ${old_versions:?} ]]; then
|
|
||||||
if [[ ${version:?} =~ 5.6|7.[0-4] ]]; then
|
|
||||||
add_brew_extension propro extension
|
|
||||||
fi
|
|
||||||
add_brew_extension raphf extension
|
|
||||||
else
|
|
||||||
add_pecl_extension raphf 1.1.2 extension
|
|
||||||
add_pecl_extension propro 1.0.2 extension
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to install the dependencies.
|
|
||||||
add_http_dependencies() {
|
|
||||||
os=$1
|
|
||||||
if [ "$os" = 'Linux' ]; then
|
|
||||||
add_http_dependencies_linux
|
|
||||||
else
|
|
||||||
add_http_dependencies_darwin
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to get configure options for http.
|
# Function to get configure options for http.
|
||||||
get_http_configure_opts() {
|
get_http_configure_opts() {
|
||||||
os=$1
|
|
||||||
if [ "$os" = 'Linux' ]; then
|
if [ "$os" = 'Linux' ]; then
|
||||||
for lib in zlib libbrotli libcurl libevent libicu libidn2 libidn libidnkit2 libidnkit; do
|
for lib in zlib libbrotli libcurl libevent libicu libidn2 libidn libidnkit2 libidnkit; do
|
||||||
http_opts+=( "--with-http-$lib-dir=/usr" )
|
http_opts+=( "--with-http-$lib-dir=/usr" )
|
||||||
@ -75,59 +57,31 @@ get_http_configure_opts() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
patch_http_source() {
|
|
||||||
ext=$1
|
|
||||||
os=$2
|
|
||||||
if [ "$os" = 'Darwin' ] && ! [[ ${version:?} =~ ${old_versions:?} ]]; then
|
|
||||||
if [[ ${version:?} =~ 5.6|7.[0-4] ]]; then
|
|
||||||
sed -i '' -e "s|ext/propro|$(brew --prefix propro@"${version:?}")/include/php/ext/propro@${version:?}|" "/tmp/pecl_http-${ext##*-}/src/php_http_api.h"
|
|
||||||
fi
|
|
||||||
sed -i '' -e "s|ext/raphf|$(brew --prefix raphf@"${version:?}")/include/php/ext/raphf@${version:?}|" "/tmp/pecl_http-${ext##*-}/src/php_http_api.h"
|
|
||||||
if [ "${version:?}" = "5.6" ]; then
|
|
||||||
sed -i '' -e "s|\$abs_srcdir|\$abs_srcdir ${brew_prefix:?}/include|" -e "s|/ext/propro|/php/ext/propro@5.6|" -e "s|/ext/raphf|/php/ext/raphf@5.6|" "/tmp/pecl_http-${ext##*-}/config9.m4"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Helper function to compile and install http.
|
|
||||||
build_http() {
|
|
||||||
ext=$1
|
|
||||||
os=$2
|
|
||||||
(
|
|
||||||
http_opts=() && get_http_configure_opts "$os"
|
|
||||||
c_opts="CFLAGS=-Wno-implicit-function-declaration"
|
|
||||||
cd /tmp/pecl_http-"${ext##*-}" || exit
|
|
||||||
sudo phpize
|
|
||||||
sudo "$c_opts" ./configure --with-http --with-php-config="$(command -v php-config)" "${http_opts[@]}"
|
|
||||||
sudo make -j"$(nproc 2>/dev/null || sysctl -n hw.ncpu)"
|
|
||||||
sudo make install
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
# Compile and install http explicitly.
|
# Compile and install http explicitly.
|
||||||
# This is done as pecl compiles raphf and propro as well.
|
# This is done as pecl compiles raphf and propro as well.
|
||||||
add_http_helper() {
|
add_http_helper() {
|
||||||
ext=$1
|
ext=$1
|
||||||
os=$2
|
http_opts=() && get_http_configure_opts
|
||||||
add_http_dependencies "$os"
|
export HTTP_PREFIX_CONFIGURE_OPTS="CFLAGS=-Wno-implicit-function-declaration"
|
||||||
get -q -n /tmp/http.tgz https://pecl.php.net/get/pecl_http-"${ext##*-}".tgz
|
http_configure_opts="--with-http --with-php-config=$(command -v php-config) ${http_opts[*]}"
|
||||||
tar -xzf /tmp/http.tgz -C /tmp
|
export HTTP_CONFIGURE_OPTS="$http_configure_opts"
|
||||||
patch_http_source "$ext" "$os"
|
export HTTP_LINUX_LIBS="zlib1g libbrotli-dev libcurl4-openssl-dev libevent-dev libicu-dev libidn2-dev"
|
||||||
build_http "$ext" "$os"
|
export HTTP_DARWIN_LIBS="brotli curl icu4c libevent libidn2"
|
||||||
enable_extension http extension
|
if [[ "${version:?}" =~ ${nightly_versions:?} ]]; then
|
||||||
|
add_extension_from_source http https://github.com m6w6 ext-http . master extension
|
||||||
|
else
|
||||||
|
add_extension_from_source pecl_http https://pecl.php.net http http . "${ext##*-}" extension pecl
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to setup latest http extension.
|
# Function to setup latest http extension.
|
||||||
add_http_latest() {
|
add_http_latest() {
|
||||||
os=$1
|
|
||||||
enable_http
|
enable_http
|
||||||
if ! check_extension http; then
|
if ! check_extension http; then
|
||||||
|
add_http_dependencies
|
||||||
if [ "$os" = "Linux" ]; then
|
if [ "$os" = "Linux" ]; then
|
||||||
if ! [[ "${version:?}" =~ ${old_versions:?}|${nightly_versions:?} ]]; then
|
if ! [[ "${version:?}" =~ ${old_versions:?}|${nightly_versions:?} ]]; then
|
||||||
if [[ ${version:?} =~ 5.6|7.[0-4] ]]; then
|
install_packages "php$version-http"
|
||||||
install_packages "php$version-propro"
|
|
||||||
fi
|
|
||||||
install_packages "php$version-raphf" "php$version-http"
|
|
||||||
else
|
else
|
||||||
add_http_helper "$(get_http_version)" "$os"
|
add_http_helper "$(get_http_version)" "$os"
|
||||||
fi
|
fi
|
||||||
@ -143,7 +97,6 @@ add_http_latest() {
|
|||||||
# Function to setup http extension given a version.
|
# Function to setup http extension given a version.
|
||||||
add_http_version() {
|
add_http_version() {
|
||||||
ext=$1
|
ext=$1
|
||||||
os=$2
|
|
||||||
enable_http
|
enable_http
|
||||||
if [ "x$(php -r "echo phpversion('http');")" != "x${ext##*-}" ]; then
|
if [ "x$(php -r "echo phpversion('http');")" != "x${ext##*-}" ]; then
|
||||||
remove_extension http >/dev/null
|
remove_extension http >/dev/null
|
||||||
@ -155,12 +108,13 @@ add_http_version() {
|
|||||||
# Function to setup http extension
|
# Function to setup http extension
|
||||||
add_http() {
|
add_http() {
|
||||||
ext=$1
|
ext=$1
|
||||||
os="$(uname -s)"
|
|
||||||
status="Enabled"
|
status="Enabled"
|
||||||
if [[ "$ext" =~ ^(pecl_http|http)$ ]]; then
|
if [[ "$ext" =~ ^(pecl_http|http)$ ]]; then
|
||||||
add_http_latest "$os" >/dev/null 2>&1
|
add_http_latest >/dev/null 2>&1
|
||||||
else
|
else
|
||||||
add_http_version "$ext" "$os" >/dev/null 2>&1
|
add_http_version "$ext" >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
add_extension_log "http" "$status"
|
add_extension_log "http" "$status"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
os="$(uname -s)"
|
||||||
|
@ -31,71 +31,16 @@ add_client() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to get PHP source.
|
|
||||||
get_php() {
|
|
||||||
[ ! -d "/opt/oracle/php-src-$tag" ] && get -s -n "" "https://github.com/php/php-src/archive/$tag.tar.gz" | tar xzf - -C "$oracle_home/"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to get phpize location on darwin.
|
|
||||||
get_phpize() {
|
|
||||||
if [[ "${version:?}" =~ 5.[3-5] ]]; then
|
|
||||||
echo '/opt/local/bin/phpize'
|
|
||||||
else
|
|
||||||
echo "/usr/local/bin/$(readlink /usr/local/bin/phpize)"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to patch phpize to link to php headers on darwin.
|
|
||||||
patch_phpize() {
|
|
||||||
if [ "$os" = "Darwin" ]; then
|
|
||||||
sudo cp "$phpize_orig" "$phpize_orig.bck"
|
|
||||||
sudo sed -i '' 's~includedir=.*~includedir="$(xcrun --show-sdk-path)/usr/include/php"~g' "$phpize_orig"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to restore phpize.
|
|
||||||
restore_phpize() {
|
|
||||||
if [ "$os" = "Darwin" ]; then
|
|
||||||
sudo mv "$phpize_orig.bck" "$phpize_orig" || true
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to patch pdo_oci.
|
|
||||||
patch_pdo_oci_config() {
|
|
||||||
get -q -n config.m4 https://raw.githubusercontent.com/php/php-src/PHP-8.0/ext/pdo_oci/config.m4
|
|
||||||
if [[ ${version:?} =~ 5.[3-6] ]]; then
|
|
||||||
sudo sed -i '' "/PHP_CHECK_PDO_INCLUDES/d" config.m4 2>/dev/null || sudo sed -i "/PHP_CHECK_PDO_INCLUDES/d" config.m4
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to install the dependencies.
|
|
||||||
add_dependencies() {
|
|
||||||
if [ "$os" = 'Linux' ]; then
|
|
||||||
if [ "${runner:?}" = "self-hosted" ]; then
|
|
||||||
${apt_install:?} --no-upgrade --no-install-recommends libaio-dev
|
|
||||||
fi
|
|
||||||
! [[ ${version:?} =~ $nightly_versions ]] && add_devtools phpize
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to install oci8 and pdo_oci.
|
# Function to install oci8 and pdo_oci.
|
||||||
add_oci_helper() {
|
add_oci_helper() {
|
||||||
if ! [ -e "${ext_dir:?}/$ext.so" ]; then
|
if ! [ -e "${ext_dir:?}/$ext.so" ]; then
|
||||||
status='Installed and enabled'
|
status='Installed and enabled'
|
||||||
phpize_orig=$(get_phpize)
|
read -r "${ext}_LINUX_LIBS" <<< "libaio-dev"
|
||||||
tag=$(php_src_tag)
|
read -r "${ext}_CONFIGURE_OPTS" <<< "--with-php-config=$(command -v php-config) --with-${ext/_/-}=instantclient,$oracle_client"
|
||||||
get_php
|
|
||||||
patch_phpize
|
patch_phpize
|
||||||
(
|
add_extension_from_source "$ext" https://github.com php php-src ext/"$ext" "$(php_src_tag)" extension get
|
||||||
cd "/opt/oracle/php-src-$tag/ext/$ext" || exit 1
|
|
||||||
[ "$ext" = "pdo_oci" ] && patch_pdo_oci_config
|
|
||||||
sudo phpize && ./configure --with-php-config="$(command -v php-config)" --with-"${ext/_/-}"=instantclient,"$oracle_client"
|
|
||||||
sudo make -j"$(nproc 2>/dev/null || sysctl -n hw.ncpu)"
|
|
||||||
sudo cp ./modules/* "$ext_dir/"
|
|
||||||
)
|
|
||||||
restore_phpize
|
restore_phpize
|
||||||
fi
|
fi
|
||||||
echo "extension=$ext.so" | sudo tee "${scan_dir:?}/99-$ext.ini"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to add oci extension oci8 and pdo_oci.
|
# Function to add oci extension oci8 and pdo_oci.
|
||||||
@ -106,8 +51,10 @@ add_oci() {
|
|||||||
oracle_client=$oracle_home/instantclient
|
oracle_client=$oracle_home/instantclient
|
||||||
os=$(uname -s)
|
os=$(uname -s)
|
||||||
add_client >/dev/null 2>&1
|
add_client >/dev/null 2>&1
|
||||||
add_dependencies >/dev/null 2>&1
|
|
||||||
add_oci_helper >/dev/null 2>&1
|
add_oci_helper >/dev/null 2>&1
|
||||||
add_extension_log "$ext" "$status"
|
add_extension_log "$ext" "$status"
|
||||||
check_extension "$ext" && add_license_log
|
check_extension "$ext" && add_license_log
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# shellcheck source=.
|
||||||
|
. "${scripts:?}"/ext/patches/phpize.sh
|
||||||
|
11
src/scripts/ext/patches/firebird.sh
Normal file
11
src/scripts/ext/patches/firebird.sh
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
patch_firebird() {
|
||||||
|
if [[ "${version:?}" =~ ${old_versions:?} ]]; then
|
||||||
|
sudo sed -i '' '/PHP_CHECK_PDO_INCLUDES/d' config.m4 2>/dev/null || sudo sed -i '/PHP_CHECK_PDO_INCLUDES/d' config.m4
|
||||||
|
fi
|
||||||
|
lib_arch=$(gcc -dumpmachine)
|
||||||
|
lib_dir=/usr/lib/"$lib_arch"
|
||||||
|
if [ -d "$lib_dir" ]; then
|
||||||
|
sudo ln -sf "$lib_dir"/libfbclient.so.2 /usr/lib/libfbclient.so
|
||||||
|
sudo ln -sf "$lib_dir"/libib_util.so /usr/lib/
|
||||||
|
fi
|
||||||
|
}
|
7
src/scripts/ext/patches/geos.sh
Normal file
7
src/scripts/ext/patches/geos.sh
Normal file
@ -0,0 +1,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 /" geos.c
|
||||||
|
fi
|
||||||
|
get -q -n /tmp/php8.patch https://git.remirepo.net/cgit/rpms/php/php-geos.git/plain/0003-add-all-arginfo-and-fix-build-with-PHP-8.patch
|
||||||
|
patch -p1 < /tmp/php8.patch 2>/dev/null || true
|
||||||
|
}
|
11
src/scripts/ext/patches/http.sh
Normal file
11
src/scripts/ext/patches/http.sh
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
patch_pecl_http() {
|
||||||
|
if [ "$(uname -s)" = 'Darwin' ] && ! [[ ${version:?} =~ ${old_versions:?} ]]; then
|
||||||
|
if [[ ${version:?} =~ 5.6|7.[0-4] ]]; then
|
||||||
|
sed -i '' -e "s|ext/propro|$(brew --prefix propro@"${version:?}")/include/php/ext/propro@${version:?}|" "./src/php_http_api.h"
|
||||||
|
fi
|
||||||
|
sed -i '' -e "s|ext/raphf|$(brew --prefix raphf@"${version:?}")/include/php/ext/raphf@${version:?}|" "./src/php_http_api.h"
|
||||||
|
if [ "${version:?}" = "5.6" ]; then
|
||||||
|
sed -i '' -e "s|\$abs_srcdir|\$abs_srcdir ${brew_prefix:?}/include|" -e "s|/ext/propro|/php/ext/propro@5.6|" -e "s|/ext/raphf|/php/ext/raphf@5.6|" "./config9.m4"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
6
src/scripts/ext/patches/pdo_oci.sh
Normal file
6
src/scripts/ext/patches/pdo_oci.sh
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
patch_pdo_oci() {
|
||||||
|
get -q -n config.m4 https://raw.githubusercontent.com/php/php-src/PHP-8.0/ext/pdo_oci/config.m4
|
||||||
|
if [[ ${version:?} =~ 5.[3-6] ]]; then
|
||||||
|
sudo sed -i '' "/PHP_CHECK_PDO_INCLUDES/d" config.m4 2>/dev/null || sudo sed -i "/PHP_CHECK_PDO_INCLUDES/d" config.m4
|
||||||
|
fi
|
||||||
|
}
|
26
src/scripts/ext/patches/phpize.sh
Normal file
26
src/scripts/ext/patches/phpize.sh
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# Function to get phpize location on darwin.
|
||||||
|
get_phpize() {
|
||||||
|
if [[ "${version:?}" =~ 5.[3-5] ]]; then
|
||||||
|
echo '/opt/local/bin/phpize'
|
||||||
|
else
|
||||||
|
echo "/usr/local/bin/$(readlink /usr/local/bin/phpize)"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to patch phpize to link to php headers on darwin.
|
||||||
|
patch_phpize() {
|
||||||
|
if [ "$(uname -s)" = "Darwin" ]; then
|
||||||
|
sudo cp "$phpize_orig" "$phpize_orig.bck"
|
||||||
|
sudo sed -i '' 's~includedir=.*~includedir="$(xcrun --show-sdk-path)/usr/include/php"~g' "$phpize_orig"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to restore phpize.
|
||||||
|
restore_phpize() {
|
||||||
|
if [ "$os" = "Darwin" ]; then
|
||||||
|
sudo mv "$phpize_orig.bck" "$phpize_orig" || true
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
os="$(uname -s)"
|
||||||
|
phpize_orig="$(get_phpize)"
|
4
src/scripts/ext/patches/protobuf.sh
Normal file
4
src/scripts/ext/patches/protobuf.sh
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
patch_protobuf() {
|
||||||
|
mkdir -p third_party/wyhash
|
||||||
|
cp ../../../../third_party/wyhash/* third_party/wyhash
|
||||||
|
}
|
@ -1,11 +1,12 @@
|
|||||||
# Function to parse extension environment variables
|
# Function to parse extension environment variables
|
||||||
parse_args() {
|
parse_args() {
|
||||||
extension=$1
|
extension=$1
|
||||||
suffix=$2
|
suffix=$(echo "$2" | tr '[:lower:]' '[:upper:]')
|
||||||
up_extension=$(echo "$extension" | tr '[:lower:]' '[:upper:]')
|
up_ext_name=$(echo "$extension" | tr '[:lower:]' '[:upper:]')
|
||||||
var="${extension}_${suffix}"
|
var="${extension}_${suffix}"
|
||||||
up_var="${up_extension}_${suffix}"
|
up_var="${up_ext_name}_${suffix}"
|
||||||
output=$(echo "${!var} ${!up_var}" | sed "s/, */ /g")
|
! [[ "$suffix" =~ .*PREFIX|LIBS.* ]] && hyp='-'
|
||||||
|
output=$(echo "${!var} ${!up_var}" | sed "s/, *$hyp/ $hyp/g" | sed -E "s/^,|,$//g")
|
||||||
echo "$output" | xargs -n 1 | sort | uniq | xargs
|
echo "$output" | xargs -n 1 | sort | uniq | xargs
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20,16 +21,45 @@ add_lib_log() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to check if a library is installed
|
||||||
|
check_lib() {
|
||||||
|
lib=$1
|
||||||
|
if [ "$(uname -s)" = "Linux" ]; then
|
||||||
|
[ "x$(dpkg -s "$lib" 2>/dev/null | grep Status)" != "x" ]
|
||||||
|
else
|
||||||
|
[ "x$(find "${brew_prefix:?}"/Cellar -maxdepth 1 -name "$lib")" != "x" ]
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to add a library on linux
|
||||||
|
add_linux_libs() {
|
||||||
|
lib=$1
|
||||||
|
if ! check_lib "$lib"; then
|
||||||
|
install_packages "$lib" >/dev/null 2>&1 || true
|
||||||
|
fi
|
||||||
|
add_lib_log "$lib"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to add a library on macOS
|
||||||
|
add_darwin_libs() {
|
||||||
|
lib=$1
|
||||||
|
if ! check_lib "$lib"; then
|
||||||
|
brew install "$lib" >/dev/null 2>&1 || true
|
||||||
|
if [[ "$lib" = *@* ]]; then
|
||||||
|
brew link --overwrite --force "$lib" >/dev/null 2>&1 || true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
add_lib_log "$lib"
|
||||||
|
}
|
||||||
|
|
||||||
# Function to add required libraries
|
# Function to add required libraries
|
||||||
add_libs() {
|
add_libs() {
|
||||||
libs=("$@")
|
all_libs=("$@")
|
||||||
for lib in "${libs[@]}"; do
|
for lib in "${all_libs[@]}"; do
|
||||||
if [ "$(uname -s)" = "Linux" ]; then
|
if [ "$(uname -s)" = "Linux" ]; then
|
||||||
install_packages "$lib" >/dev/null 2>&1
|
add_linux_libs "$lib"
|
||||||
add_lib_log "$lib" "$(dpkg -s "$lib" 2>/dev/null | grep Status)"
|
|
||||||
else
|
else
|
||||||
brew install "$lib" >/dev/null 2>&1
|
add_darwin_libs "$lib"
|
||||||
add_lib_log "$lib" "$(find "${brew_cellar:?}" -maxdepth 1 -name "$lib")"
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -45,36 +75,65 @@ run_group() {
|
|||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
patch_extension() {
|
||||||
|
extension=$1
|
||||||
|
if [ -e "${scripts:?}"/ext/patches/"$extension".sh ]; then
|
||||||
|
# shellcheck source=.
|
||||||
|
. "${scripts:?}"/ext/patches/"$extension".sh
|
||||||
|
patch_"${extension}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
fetch_extension() {
|
||||||
|
fetch=$1
|
||||||
|
if [ "$fetch" = "clone" ]; then
|
||||||
|
run_group "git clone -nv $url/$org/$repo /tmp/$repo-$release" "git clone"
|
||||||
|
cd /tmp/"$repo-$release" || exit 1
|
||||||
|
git checkout -q "$release"
|
||||||
|
cd "$sub_dir" || exit 1
|
||||||
|
if [ -e .gitmodules ]; then
|
||||||
|
jobs="$(grep -c "\[submodule" .gitmodules)"
|
||||||
|
run_group "git submodule update --jobs $jobs --init --recursive" "git submodule"
|
||||||
|
fi
|
||||||
|
elif [ "$fetch" = "get" ]; then
|
||||||
|
get -q -n /tmp/"$extension".tar.gz "$url/$org/$repo/archive/$release.tar.gz"
|
||||||
|
tar -xzf /tmp/"$extension".tar.gz -C /tmp
|
||||||
|
cd /tmp/"$repo"-"$release"/"$sub_dir" || exit
|
||||||
|
elif [ "$fetch" = "pecl" ]; then
|
||||||
|
source="pecl"
|
||||||
|
pecl_name=${extension/http/pecl_http}
|
||||||
|
get -q -n /tmp/"$pecl_name".tgz https://pecl.php.net/get/"$pecl_name"-"$release".tgz
|
||||||
|
tar -xzf /tmp/"$pecl_name".tgz -C /tmp
|
||||||
|
cd /tmp/"$pecl_name"-"$release" || exit
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Function to install extension from a git repository
|
# Function to install extension from a git repository
|
||||||
add_extension_from_source() {
|
add_extension_from_source() {
|
||||||
extension=$1
|
extension="${1/pecl_/}"
|
||||||
domain=$2
|
url=$2
|
||||||
org=$3
|
org=$3
|
||||||
repo=$4
|
repo=$4
|
||||||
sub_dir=$5
|
sub_dir=$5
|
||||||
release=$6
|
release=$6
|
||||||
prefix=$7
|
prefix=$7
|
||||||
|
fetch=${8:-clone}
|
||||||
slug="$extension-$release"
|
slug="$extension-$release"
|
||||||
libraries="$(parse_args "$extension" LIBS)"
|
source="$url/$org/$repo"
|
||||||
|
libraries="$(parse_args "$extension" LIBS) $(parse_args "$extension" "$(uname -s)"_LIBS)"
|
||||||
opts="$(parse_args "$extension" CONFIGURE_OPTS)"
|
opts="$(parse_args "$extension" CONFIGURE_OPTS)"
|
||||||
prefix_opts="$(parse_args "$extension" CONFIGURE_PREFIX_OPTS)"
|
prefix_opts="$(parse_args "$extension" CONFIGURE_PREFIX_OPTS)"
|
||||||
suffix_opts="$(parse_args "$extension" CONFIGURE_SUFFIX_OPTS)"
|
suffix_opts="$(parse_args "$extension" CONFIGURE_SUFFIX_OPTS)"
|
||||||
step_log "Setup $slug"
|
step_log "Setup $slug"
|
||||||
(
|
(
|
||||||
add_devtools phpize >/dev/null
|
add_devtools phpize >/dev/null 2>&1
|
||||||
delete_extension "$extension"
|
delete_extension "$extension"
|
||||||
run_group "git clone -nv $domain/$org/$repo /tmp/$repo-$release" "git clone"
|
fetch_extension "$fetch"
|
||||||
cd /tmp/"$repo-$release" || exit 1
|
|
||||||
git checkout -q "$release"
|
|
||||||
cd $sub_dir || exit 1
|
|
||||||
if ! [ "$(find . -maxdepth 1 -name '*.m4' -exec grep -H 'PHP_NEW_EXTENSION' {} \; | wc -l)" != "0" ]; then
|
if ! [ "$(find . -maxdepth 1 -name '*.m4' -exec grep -H 'PHP_NEW_EXTENSION' {} \; | wc -l)" != "0" ]; then
|
||||||
add_log "${cross:?}" "$domain/$org/$repo" "$domain/$org/$repo does not have a PHP extension"
|
add_log "${cross:?}" "$source" "$source does not have a PHP extension"
|
||||||
else
|
else
|
||||||
if [ -e .gitmodules ]; then
|
[[ -n "${libraries// }" ]] && run_group "add_libs $libraries" "add libraries"
|
||||||
jobs="$(grep -c "\[submodule" .gitmodules)"
|
patch_extension "$extension" >/dev/null 2>&1
|
||||||
run_group "git submodule update --jobs $jobs --init --recursive" "git submodule"
|
|
||||||
fi
|
|
||||||
[ "x$libraries" != "x" ] && run_group "add_libs $libraries" "add libraries"
|
|
||||||
run_group "phpize" "phpize"
|
run_group "phpize" "phpize"
|
||||||
run_group "sudo $prefix_opts ./configure $suffix_opts $opts" "configure"
|
run_group "sudo $prefix_opts ./configure $suffix_opts $opts" "configure"
|
||||||
run_group "sudo make -j$(nproc 2>/dev/null || sysctl -n hw.ncpu)" "make"
|
run_group "sudo make -j$(nproc 2>/dev/null || sysctl -n hw.ncpu)" "make"
|
||||||
@ -82,5 +141,5 @@ add_extension_from_source() {
|
|||||||
enable_extension "$extension" "$prefix"
|
enable_extension "$extension" "$prefix"
|
||||||
fi
|
fi
|
||||||
)
|
)
|
||||||
add_extension_log "$slug" "Installed from $domain/$org/$repo and enabled"
|
add_extension_log "$slug" "Installed from $source and enabled"
|
||||||
}
|
}
|
||||||
|
@ -89,8 +89,10 @@ add_pdo_extension() {
|
|||||||
else
|
else
|
||||||
ext=$1
|
ext=$1
|
||||||
ext_name=$1
|
ext_name=$1
|
||||||
|
if [ -e "$ext_dir"/pdo.so ]; then
|
||||||
disable_extension pdo
|
disable_extension pdo
|
||||||
echo "extension=pdo.so" | sudo tee "${ini_file[@]/php.ini/conf.d/10-pdo.ini}" >/dev/null 2>&1
|
echo "extension=pdo.so" | sudo tee "${ini_file[@]/php.ini/conf.d/10-pdo.ini}" >/dev/null 2>&1
|
||||||
|
fi
|
||||||
if [ "$ext" = "mysql" ]; then
|
if [ "$ext" = "mysql" ]; then
|
||||||
enable_extension "mysqlnd" "extension"
|
enable_extension "mysqlnd" "extension"
|
||||||
ext_name='mysqli'
|
ext_name='mysqli'
|
||||||
@ -128,34 +130,13 @@ add_extension() {
|
|||||||
sudo chmod 777 "${ini_file[@]}"
|
sudo chmod 777 "${ini_file[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to install a PECL version.
|
|
||||||
add_pecl_extension() {
|
|
||||||
extension=$1
|
|
||||||
pecl_version=$2
|
|
||||||
prefix=$3
|
|
||||||
if [[ $pecl_version =~ .*(alpha|beta|rc|snapshot|preview).* ]]; then
|
|
||||||
pecl_version=$(get_pecl_version "$extension" "$pecl_version")
|
|
||||||
fi
|
|
||||||
enable_extension "$extension" "$prefix"
|
|
||||||
ext_version=$(php -r "echo phpversion('$extension');")
|
|
||||||
if [ "$ext_version" = "$pecl_version" ]; then
|
|
||||||
add_log "${tick:?}" "$extension" "Enabled"
|
|
||||||
else
|
|
||||||
delete_extension "$extension"
|
|
||||||
pecl_install "$extension-$pecl_version"
|
|
||||||
add_extension_log "$extension-$pecl_version" "Installed and enabled"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to setup phpize and php-config.
|
# Function to setup phpize and php-config.
|
||||||
add_devtools() {
|
add_devtools() {
|
||||||
tool=$1
|
tool=$1
|
||||||
if ! command -v "$tool$version" >/dev/null; then
|
if ! command -v "$tool$version" >/dev/null; then
|
||||||
install_packages "php$version-dev" "php$version-xml"
|
install_packages "php$version-dev" "php$version-xml"
|
||||||
fi
|
fi
|
||||||
sudo update-alternatives --set php-config /usr/bin/php-config"$version" >/dev/null 2>&1
|
switch_version "phpize" "php-config"
|
||||||
sudo update-alternatives --set phpize /usr/bin/phpize"$version" >/dev/null 2>&1
|
|
||||||
configure_pecl >/dev/null 2>&1
|
|
||||||
add_log "${tick:?}" "$tool" "Added $tool $semver"
|
add_log "${tick:?}" "$tool" "Added $tool $semver"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,9 +164,11 @@ add_pecl() {
|
|||||||
|
|
||||||
# Function to switch versions of PHP binaries.
|
# Function to switch versions of PHP binaries.
|
||||||
switch_version() {
|
switch_version() {
|
||||||
for tool in pear pecl php phar phar.phar php-cgi php-config phpize phpdbg; do
|
tools=("$@") && ! (( ${#tools[@]} )) && tools+=(pear pecl php phar phar.phar php-cgi php-config phpize phpdbg)
|
||||||
|
to_wait=()
|
||||||
|
for tool in "${tools[@]}"; do
|
||||||
if [ -e "/usr/bin/$tool$version" ]; then
|
if [ -e "/usr/bin/$tool$version" ]; then
|
||||||
sudo update-alternatives --set $tool /usr/bin/"$tool$version" &
|
sudo update-alternatives --set "$tool" /usr/bin/"$tool$version" &
|
||||||
to_wait+=($!)
|
to_wait+=($!)
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user