2019-09-20 09:41:20 +07:00
|
|
|
import * as utils from './utils';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Install and enable extensions for darwin
|
|
|
|
*
|
|
|
|
* @param extension_csv
|
2019-09-26 04:03:39 +07:00
|
|
|
* @param version
|
2019-09-20 09:41:20 +07:00
|
|
|
*/
|
|
|
|
export async function addExtensionDarwin(
|
2019-09-26 04:03:39 +07:00
|
|
|
extension_csv: string,
|
2020-11-08 14:36:21 +07:00
|
|
|
version: string
|
2019-09-20 09:41:20 +07:00
|
|
|
): Promise<string> {
|
2019-11-24 03:34:12 +07:00
|
|
|
const extensions: Array<string> = await utils.extensionArray(extension_csv);
|
2020-05-07 04:57:00 +07:00
|
|
|
let add_script = '\n';
|
2020-05-22 01:01:12 +07:00
|
|
|
let remove_script = '';
|
2020-05-08 07:11:00 +07:00
|
|
|
await utils.asyncForEach(extensions, async function (extension: string) {
|
2019-12-26 20:01:18 +07:00
|
|
|
const version_extension: string = version + extension;
|
2020-02-16 01:55:50 +07:00
|
|
|
const [ext_name, ext_version]: string[] = extension.split('-');
|
2020-03-12 06:17:52 +07:00
|
|
|
const ext_prefix = await utils.getExtensionPrefix(ext_name);
|
2021-01-21 17:37:11 +07:00
|
|
|
|
2019-12-24 00:49:38 +07:00
|
|
|
switch (true) {
|
2020-05-07 04:57:00 +07:00
|
|
|
// match :extension
|
|
|
|
case /^:/.test(ext_name):
|
2021-08-25 21:06:40 +07:00
|
|
|
remove_script += '\ndisable_extension' + ext_name.replace(/:/g, ' ');
|
2020-05-07 04:57:00 +07:00
|
|
|
return;
|
2021-08-26 22:59:38 +07:00
|
|
|
// Match none
|
|
|
|
case /^none$/.test(ext_name):
|
|
|
|
add_script += '\ndisable_all_shared';
|
|
|
|
return;
|
2021-04-03 06:43:18 +07:00
|
|
|
// match extensions for compiling from source
|
2021-03-11 08:59:43 +07:00
|
|
|
case /.+-.+\/.+@.+/.test(extension):
|
2021-03-17 06:18:19 +07:00
|
|
|
add_script += await utils.parseExtensionSource(extension, ext_prefix);
|
2021-03-11 08:59:43 +07:00
|
|
|
return;
|
2023-03-31 02:53:49 +07:00
|
|
|
// match 7.4relay...8.3relay
|
2023-11-23 18:42:56 +07:00
|
|
|
// match 5.3blackfire...8.3blackfire
|
|
|
|
// match 5.3blackfire-(semver)...8.3blackfire-(semver)
|
2022-07-05 17:52:07 +07:00
|
|
|
// match couchbase, event, geos, pdo_oci, oci8, http, pecl_http
|
2021-04-03 06:43:18 +07:00
|
|
|
// match 5.3ioncube...7.4ioncube
|
2024-01-07 02:42:10 +07:00
|
|
|
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.3phalcon5
|
2023-01-22 03:34:12 +07:00
|
|
|
// match 7.0zephir_parser...8.2zephir_parser
|
2023-03-31 02:53:49 +07:00
|
|
|
case /^(7\.4|8\.[0-3])relay(-v?\d+\.\d+\.\d+)?$/.test(version_extension):
|
2023-11-23 18:42:56 +07:00
|
|
|
case /^(5\.[3-6]|7\.[0-4]|8\.[0-3])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
2020-02-27 18:55:54 +07:00
|
|
|
version_extension
|
|
|
|
):
|
2022-11-14 16:47:12 +07:00
|
|
|
case /^couchbase|^event|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
|
2021-02-22 20:10:19 +07:00
|
|
|
extension
|
|
|
|
):
|
2021-04-03 06:43:18 +07:00
|
|
|
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
2024-01-07 02:42:10 +07:00
|
|
|
case /(5\.6|7\.[0-3])phalcon3|7\.[2-4]phalcon4|(7\.4|8\.[0-3])phalcon5?/.test(
|
2022-07-16 02:16:28 +07:00
|
|
|
version_extension
|
|
|
|
):
|
2022-01-31 19:07:26 +07:00
|
|
|
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
|
2023-01-22 03:34:12 +07:00
|
|
|
case /^(7\.[0-4]|8\.[0-2])zephir_parser(-v?\d+\.\d+\.\d+)?$/.test(
|
|
|
|
version_extension
|
|
|
|
):
|
2020-08-06 17:03:58 +07:00
|
|
|
add_script += await utils.customPackage(
|
|
|
|
ext_name,
|
2022-01-02 18:51:14 +07:00
|
|
|
'extensions',
|
2020-08-06 17:03:58 +07:00
|
|
|
extension,
|
|
|
|
'darwin'
|
2020-07-26 17:18:19 +07:00
|
|
|
);
|
|
|
|
return;
|
2020-03-12 06:17:52 +07:00
|
|
|
// match pre-release versions. For example - xdebug-beta
|
2021-02-09 01:36:18 +07:00
|
|
|
case /.+-(stable|beta|alpha|devel|snapshot|rc|preview)/.test(extension):
|
2020-07-24 11:58:48 +07:00
|
|
|
add_script += await utils.joins(
|
|
|
|
'\nadd_unstable_extension',
|
|
|
|
ext_name,
|
|
|
|
ext_version,
|
|
|
|
ext_prefix
|
|
|
|
);
|
2020-01-30 13:33:30 +07:00
|
|
|
return;
|
2020-03-12 06:17:52 +07:00
|
|
|
// match semver
|
2023-05-24 17:26:18 +07:00
|
|
|
case /.+-\d+(\.\d+\.\d+.*)?/.test(extension):
|
2020-07-24 11:58:48 +07:00
|
|
|
add_script += await utils.joins(
|
|
|
|
'\nadd_pecl_extension',
|
|
|
|
ext_name,
|
|
|
|
ext_version,
|
|
|
|
ext_prefix
|
|
|
|
);
|
2020-02-23 20:30:40 +07:00
|
|
|
return;
|
2020-07-23 08:17:57 +07:00
|
|
|
// match 5.3pcov to 7.0pcov
|
|
|
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
2020-07-24 11:58:48 +07:00
|
|
|
add_script += await utils.getUnsupportedLog('pcov', version, 'darwin');
|
2020-07-23 08:17:57 +07:00
|
|
|
return;
|
2022-11-14 16:47:12 +07:00
|
|
|
// match brew extensions
|
2024-03-26 18:59:27 +07:00
|
|
|
case /(?<!5\.[3-5])(amqp|apcu|expect|gnupg|grpc|igbinary|imagick|imap|mailparse|mcrypt|memcache|memcached|mongodb|msgpack|protobuf|psr|raphf|rdkafka|redis|snmp|ssh2|swoole|uuid|vld|xdebug|xdebug2|yaml|zmq)/.test(
|
2020-10-17 23:26:06 +07:00
|
|
|
version_extension
|
|
|
|
):
|
2022-11-14 16:47:12 +07:00
|
|
|
case /(?<!5\.[3-6])(ds|v8js)/.test(version_extension):
|
|
|
|
case /(5\.6|7\.[0-4])(propro|lua)/.test(version_extension):
|
2021-04-03 06:43:18 +07:00
|
|
|
case /(?<!5\.[3-6]|7\.0)pcov/.test(version_extension):
|
2022-08-10 14:49:47 +07:00
|
|
|
case /(?<!5\.[3-6])(ast|vips|xlswriter)/.test(version_extension):
|
2020-11-08 14:36:21 +07:00
|
|
|
add_script += await utils.joins(
|
|
|
|
'\nadd_brew_extension',
|
|
|
|
ext_name,
|
|
|
|
ext_prefix
|
|
|
|
);
|
|
|
|
return;
|
2020-03-12 06:17:52 +07:00
|
|
|
// match sqlite
|
2020-03-16 08:23:58 +07:00
|
|
|
case /^sqlite$/.test(extension):
|
2020-03-12 06:17:52 +07:00
|
|
|
extension = 'sqlite3';
|
|
|
|
break;
|
2019-09-26 04:03:39 +07:00
|
|
|
default:
|
|
|
|
break;
|
2019-09-20 09:41:20 +07:00
|
|
|
}
|
2020-11-08 14:36:21 +07:00
|
|
|
add_script += await utils.joins('\nadd_extension', extension, ext_prefix);
|
2019-09-20 09:41:20 +07:00
|
|
|
});
|
2020-05-07 04:57:00 +07:00
|
|
|
return add_script + remove_script;
|
2019-09-20 09:41:20 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Install and enable extensions for windows
|
|
|
|
*
|
|
|
|
* @param extension_csv
|
|
|
|
* @param version
|
|
|
|
*/
|
|
|
|
export async function addExtensionWindows(
|
|
|
|
extension_csv: string,
|
2020-03-12 09:27:40 +07:00
|
|
|
version: string
|
2019-09-20 09:41:20 +07:00
|
|
|
): Promise<string> {
|
2019-11-24 03:34:12 +07:00
|
|
|
const extensions: Array<string> = await utils.extensionArray(extension_csv);
|
2020-05-07 04:57:00 +07:00
|
|
|
let add_script = '\n';
|
2020-05-22 01:01:12 +07:00
|
|
|
let remove_script = '';
|
2020-05-08 07:11:00 +07:00
|
|
|
await utils.asyncForEach(extensions, async function (extension: string) {
|
2020-02-16 01:55:50 +07:00
|
|
|
const [ext_name, ext_version]: string[] = extension.split('-');
|
2019-12-26 20:01:18 +07:00
|
|
|
const version_extension: string = version + extension;
|
2020-02-16 01:55:50 +07:00
|
|
|
let matches: RegExpExecArray;
|
2019-12-24 00:49:38 +07:00
|
|
|
switch (true) {
|
2020-05-07 04:57:00 +07:00
|
|
|
// Match :extension
|
|
|
|
case /^:/.test(ext_name):
|
2021-08-25 21:06:40 +07:00
|
|
|
remove_script += '\nDisable-Extension' + ext_name.replace(/:/g, ' ');
|
2020-07-26 17:18:19 +07:00
|
|
|
break;
|
2021-08-26 22:59:38 +07:00
|
|
|
// Match none
|
|
|
|
case /^none$/.test(ext_name):
|
|
|
|
add_script += '\nDisable-AllShared';
|
|
|
|
break;
|
2023-11-23 18:42:56 +07:00
|
|
|
// match 5.3blackfire...8.3blackfire
|
|
|
|
// match 5.3blackfire-(semver)...8.3blackfire-(semver)
|
2020-08-06 17:03:58 +07:00
|
|
|
// match pdo_oci and oci8
|
2020-12-14 15:44:49 +07:00
|
|
|
// match 5.3ioncube...7.4ioncube
|
2024-01-07 02:42:10 +07:00
|
|
|
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.3phalcon5
|
2022-03-15 13:43:17 +07:00
|
|
|
// match 7.1pecl_http...8.1pecl_http and 7.1http...8.1http
|
2023-01-22 03:34:12 +07:00
|
|
|
// match 7.0zephir_parser...8.2zephir_parser
|
2023-11-23 18:42:56 +07:00
|
|
|
case /^(5\.[3-6]|7\.[0-4]|8\.[0-3])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
2020-02-27 18:55:54 +07:00
|
|
|
version_extension
|
|
|
|
):
|
2021-02-22 20:10:19 +07:00
|
|
|
case /^pdo_oci$|^oci8$|^pdo_firebird$/.test(extension):
|
2021-04-03 06:43:18 +07:00
|
|
|
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
2024-01-07 02:42:10 +07:00
|
|
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-3])phalcon5?$/.test(
|
2022-07-19 15:56:08 +07:00
|
|
|
version_extension
|
|
|
|
):
|
2022-03-15 13:43:17 +07:00
|
|
|
case /^(7\.[1-4]|8\.1)(pecl_)?http/.test(version_extension):
|
2023-09-09 14:22:06 +07:00
|
|
|
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
|
2023-01-22 03:34:12 +07:00
|
|
|
case /^(7\.[0-4]|8\.[0-2])zephir_parser(-v?\d+\.\d+\.\d+)?$/.test(
|
|
|
|
version_extension
|
|
|
|
):
|
2020-08-06 17:03:58 +07:00
|
|
|
add_script += await utils.customPackage(
|
|
|
|
ext_name,
|
2022-01-02 18:51:14 +07:00
|
|
|
'extensions',
|
2020-08-06 17:03:58 +07:00
|
|
|
extension,
|
|
|
|
'win32'
|
2020-07-26 17:18:19 +07:00
|
|
|
);
|
2020-08-06 17:03:58 +07:00
|
|
|
return;
|
2020-03-12 06:17:52 +07:00
|
|
|
// match pre-release versions. For example - xdebug-beta
|
2021-02-09 01:36:18 +07:00
|
|
|
case /.+-(stable|beta|alpha|devel|snapshot)/.test(extension):
|
2020-07-24 11:58:48 +07:00
|
|
|
add_script += await utils.joins(
|
|
|
|
'\nAdd-Extension',
|
|
|
|
ext_name,
|
2020-11-27 16:25:30 +07:00
|
|
|
ext_version.replace('stable', '')
|
2020-07-24 11:58:48 +07:00
|
|
|
);
|
2020-01-26 02:34:09 +07:00
|
|
|
break;
|
2021-04-03 06:43:18 +07:00
|
|
|
// match extensions for compiling from source
|
2021-02-09 01:36:18 +07:00
|
|
|
case /.+-.+\/.+@.+/.test(extension):
|
2021-01-21 17:37:11 +07:00
|
|
|
add_script += await utils.getUnsupportedLog(
|
|
|
|
extension,
|
|
|
|
version,
|
|
|
|
'win32'
|
|
|
|
);
|
|
|
|
break;
|
2020-03-12 06:17:52 +07:00
|
|
|
// match semver with state
|
2021-02-09 01:36:18 +07:00
|
|
|
case /.+-\d+\.\d+\.\d+[a-zA-Z]+\d*/.test(extension):
|
|
|
|
matches = /.+-(\d+\.\d+\.\d+)([a-zA-Z]+)\d*/.exec(
|
2020-02-16 01:55:50 +07:00
|
|
|
version_extension
|
|
|
|
) as RegExpExecArray;
|
2020-07-24 11:58:48 +07:00
|
|
|
add_script += await utils.joins(
|
|
|
|
'\nAdd-Extension',
|
|
|
|
ext_name,
|
2020-10-31 20:34:20 +07:00
|
|
|
matches[2].replace('preview', 'devel'),
|
2020-07-24 11:58:48 +07:00
|
|
|
matches[1]
|
|
|
|
);
|
2020-07-26 17:18:19 +07:00
|
|
|
break;
|
2023-05-24 17:26:18 +07:00
|
|
|
// match semver without state
|
|
|
|
case /.+-\d+(\.\d+\.\d+.*)?/.test(extension):
|
|
|
|
add_script += await utils.joins(
|
|
|
|
'\nAdd-Extension',
|
|
|
|
ext_name,
|
|
|
|
'stable',
|
|
|
|
ext_version
|
|
|
|
);
|
|
|
|
break;
|
2020-12-24 19:50:42 +07:00
|
|
|
// match 7.2xdebug2 to 7.4xdebug2
|
|
|
|
case /7\.[2-4]xdebug2/.test(version_extension):
|
2020-11-27 00:41:52 +07:00
|
|
|
add_script += '\nAdd-Extension xdebug stable 2.9.8';
|
|
|
|
break;
|
2020-12-24 19:50:42 +07:00
|
|
|
// match 5.3pcov to 7.0pcov
|
2020-07-23 08:17:57 +07:00
|
|
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
2020-07-24 11:58:48 +07:00
|
|
|
add_script += await utils.getUnsupportedLog('pcov', version, 'win32');
|
2020-07-23 08:17:57 +07:00
|
|
|
break;
|
2021-04-03 06:43:18 +07:00
|
|
|
// match 5.3 to 5.6 - mysql, mysqli, mysqlnd
|
2021-04-27 16:47:29 +07:00
|
|
|
case /^5\.[3-6](?<!pdo_)(mysql|mysqli|mysqlnd)$/.test(version_extension):
|
2020-05-07 04:57:00 +07:00
|
|
|
add_script +=
|
2020-03-16 08:23:58 +07:00
|
|
|
'\nAdd-Extension mysql\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
|
|
|
|
break;
|
2021-04-03 06:43:18 +07:00
|
|
|
// match 7.0 and newer mysql, mysqli and mysqlnd
|
2021-04-27 16:47:29 +07:00
|
|
|
case /(?<!5\.[3-6])(?<!pdo_)(mysql|mysqli|mysqlnd)$/.test(
|
|
|
|
version_extension
|
|
|
|
):
|
2020-05-07 04:57:00 +07:00
|
|
|
add_script += '\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
|
2020-03-16 08:23:58 +07:00
|
|
|
break;
|
2020-03-12 06:17:52 +07:00
|
|
|
// match sqlite
|
2020-03-16 08:23:58 +07:00
|
|
|
case /^sqlite$/.test(extension):
|
2020-03-12 06:17:52 +07:00
|
|
|
extension = 'sqlite3';
|
2020-07-24 11:58:48 +07:00
|
|
|
add_script += await utils.joins('\nAdd-Extension', extension);
|
2020-03-12 06:17:52 +07:00
|
|
|
break;
|
2019-12-02 22:13:45 +07:00
|
|
|
default:
|
2020-05-17 12:49:52 +07:00
|
|
|
add_script += '\nAdd-Extension ' + extension;
|
2019-12-02 22:13:45 +07:00
|
|
|
break;
|
|
|
|
}
|
2019-09-20 09:41:20 +07:00
|
|
|
});
|
2020-05-07 04:57:00 +07:00
|
|
|
return add_script + remove_script;
|
2019-09-20 09:41:20 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Install and enable extensions for linux
|
|
|
|
*
|
|
|
|
* @param extension_csv
|
|
|
|
* @param version
|
|
|
|
*/
|
|
|
|
export async function addExtensionLinux(
|
|
|
|
extension_csv: string,
|
2020-11-08 14:36:21 +07:00
|
|
|
version: string
|
2019-09-20 09:41:20 +07:00
|
|
|
): Promise<string> {
|
2019-11-24 03:34:12 +07:00
|
|
|
const extensions: Array<string> = await utils.extensionArray(extension_csv);
|
2020-05-07 04:57:00 +07:00
|
|
|
let add_script = '\n';
|
2020-05-22 01:01:12 +07:00
|
|
|
let remove_script = '';
|
2020-05-08 07:11:00 +07:00
|
|
|
await utils.asyncForEach(extensions, async function (extension: string) {
|
2019-12-26 20:01:18 +07:00
|
|
|
const version_extension: string = version + extension;
|
2021-12-08 06:26:29 +07:00
|
|
|
const [ext_name, ext_version]: string[] = extension
|
|
|
|
.split(/-(.+)/)
|
|
|
|
.filter(Boolean);
|
2020-03-12 06:17:52 +07:00
|
|
|
const ext_prefix = await utils.getExtensionPrefix(ext_name);
|
2021-01-21 17:37:11 +07:00
|
|
|
|
2019-12-24 00:49:38 +07:00
|
|
|
switch (true) {
|
2020-05-07 04:57:00 +07:00
|
|
|
// Match :extension
|
|
|
|
case /^:/.test(ext_name):
|
2021-08-25 21:06:40 +07:00
|
|
|
remove_script += '\ndisable_extension' + ext_name.replace(/:/g, ' ');
|
2020-05-07 04:57:00 +07:00
|
|
|
return;
|
2021-08-26 22:59:38 +07:00
|
|
|
// Match none
|
|
|
|
case /^none$/.test(ext_name):
|
|
|
|
add_script += '\ndisable_all_shared';
|
|
|
|
return;
|
2021-04-03 06:43:18 +07:00
|
|
|
// match extensions for compiling from source
|
2021-03-11 08:59:43 +07:00
|
|
|
case /.+-.+\/.+@.+/.test(extension):
|
2021-03-17 06:18:19 +07:00
|
|
|
add_script += await utils.parseExtensionSource(extension, ext_prefix);
|
2021-03-11 08:59:43 +07:00
|
|
|
return;
|
2023-03-31 02:53:49 +07:00
|
|
|
// match 7.4relay...8.3relay
|
2023-11-23 18:42:56 +07:00
|
|
|
// match 5.3blackfire...8.3blackfire
|
|
|
|
// match 5.3blackfire-(semver)...8.3blackfire-(semver)
|
2020-08-08 20:32:17 +07:00
|
|
|
// match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
|
2021-04-03 06:43:18 +07:00
|
|
|
// match couchbase, geos, pdo_oci, oci8, http, pecl_http
|
|
|
|
// match 5.3ioncube...7.4ioncube
|
2024-01-07 02:42:10 +07:00
|
|
|
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, 7.4phalcon5...8.3phalcon5
|
2023-01-22 03:34:12 +07:00
|
|
|
// match 7.0zephir_parser...8.2zephir_parser
|
2023-03-31 02:53:49 +07:00
|
|
|
case /^(7\.4|8\.[0-3])relay(-v?\d+\.\d+\.\d+)?$/.test(version_extension):
|
2023-11-23 18:42:56 +07:00
|
|
|
case /^(5\.[3-6]|7\.[0-4]|8\.[0-3])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
2020-02-27 18:55:54 +07:00
|
|
|
version_extension
|
|
|
|
):
|
2020-08-08 20:32:17 +07:00
|
|
|
case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(
|
|
|
|
version_extension
|
|
|
|
):
|
2022-07-05 17:52:07 +07:00
|
|
|
case /^couchbase|^event|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
|
2021-02-22 20:10:19 +07:00
|
|
|
extension
|
|
|
|
):
|
2022-11-14 16:47:12 +07:00
|
|
|
case /(?<!5\.[3-5])intl-\d+\.\d+$/.test(version_extension):
|
2021-04-03 06:43:18 +07:00
|
|
|
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
2024-01-07 02:42:10 +07:00
|
|
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-3])phalcon5?$/.test(
|
2022-07-16 02:16:28 +07:00
|
|
|
version_extension
|
|
|
|
):
|
2022-01-31 19:07:26 +07:00
|
|
|
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
|
2023-01-22 03:34:12 +07:00
|
|
|
case /^(7\.[0-4]|8\.[0-2])zephir_parser(-v?\d+\.\d+\.\d+)?$/.test(
|
|
|
|
version_extension
|
|
|
|
):
|
2020-08-06 17:03:58 +07:00
|
|
|
add_script += await utils.customPackage(
|
|
|
|
ext_name,
|
2022-01-02 18:51:14 +07:00
|
|
|
'extensions',
|
2020-08-06 17:03:58 +07:00
|
|
|
extension,
|
|
|
|
'linux'
|
|
|
|
);
|
2020-07-26 17:18:19 +07:00
|
|
|
return;
|
2020-03-12 06:17:52 +07:00
|
|
|
// match pre-release versions. For example - xdebug-beta
|
2021-02-09 01:36:18 +07:00
|
|
|
case /.+-(stable|beta|alpha|devel|snapshot|rc|preview)/.test(extension):
|
2020-07-24 11:58:48 +07:00
|
|
|
add_script += await utils.joins(
|
|
|
|
'\nadd_unstable_extension',
|
|
|
|
ext_name,
|
|
|
|
ext_version,
|
|
|
|
ext_prefix
|
|
|
|
);
|
2020-01-30 13:33:30 +07:00
|
|
|
return;
|
2020-03-12 06:17:52 +07:00
|
|
|
// match semver versions
|
2023-05-24 17:26:18 +07:00
|
|
|
case /.+-\d+(\.\d+\.\d+.*)?/.test(extension):
|
2020-07-24 11:58:48 +07:00
|
|
|
add_script += await utils.joins(
|
|
|
|
'\nadd_pecl_extension',
|
|
|
|
ext_name,
|
|
|
|
ext_version,
|
|
|
|
ext_prefix
|
|
|
|
);
|
2020-02-14 00:09:00 +07:00
|
|
|
return;
|
2020-07-23 08:17:57 +07:00
|
|
|
// match 5.3pcov to 7.0pcov
|
|
|
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
2020-07-24 11:58:48 +07:00
|
|
|
add_script += await utils.getUnsupportedLog('pcov', version, 'linux');
|
2020-07-23 08:17:57 +07:00
|
|
|
return;
|
2020-12-24 19:50:42 +07:00
|
|
|
// match 7.2xdebug2...7.4xdebug2
|
|
|
|
case /^7\.[2-4]xdebug2$/.test(version_extension):
|
2020-11-27 00:41:52 +07:00
|
|
|
add_script += await utils.joins(
|
|
|
|
'\nadd_pecl_extension',
|
2020-12-24 19:50:42 +07:00
|
|
|
'xdebug',
|
2020-11-27 00:41:52 +07:00
|
|
|
'2.9.8',
|
|
|
|
ext_prefix
|
|
|
|
);
|
2020-12-24 19:50:42 +07:00
|
|
|
return;
|
2020-03-05 07:28:24 +07:00
|
|
|
// match pdo extensions
|
2021-02-09 01:36:18 +07:00
|
|
|
case /^pdo[_-].+/.test(extension):
|
2020-07-26 17:18:19 +07:00
|
|
|
extension = extension.replace(/pdo[_-]|3/, '');
|
2020-05-07 04:57:00 +07:00
|
|
|
add_script += '\nadd_pdo_extension ' + extension;
|
2020-03-05 07:28:24 +07:00
|
|
|
return;
|
2020-03-12 06:17:52 +07:00
|
|
|
// match sqlite
|
2020-03-16 08:23:58 +07:00
|
|
|
case /^sqlite$/.test(extension):
|
2020-03-12 06:17:52 +07:00
|
|
|
extension = 'sqlite3';
|
|
|
|
break;
|
2019-09-28 21:39:05 +07:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2020-11-08 14:36:21 +07:00
|
|
|
add_script += await utils.joins('\nadd_extension', extension, ext_prefix);
|
2019-09-20 09:41:20 +07:00
|
|
|
});
|
2020-05-07 04:57:00 +07:00
|
|
|
return add_script + remove_script;
|
2019-09-20 09:41:20 +07:00
|
|
|
}
|
2019-11-24 03:34:12 +07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Install and enable extensions
|
|
|
|
*
|
|
|
|
* @param extension_csv
|
|
|
|
* @param version
|
2022-01-29 06:59:58 +07:00
|
|
|
* @param os
|
2020-03-12 06:17:52 +07:00
|
|
|
* @param no_step
|
2019-11-24 03:34:12 +07:00
|
|
|
*/
|
|
|
|
export async function addExtension(
|
|
|
|
extension_csv: string,
|
|
|
|
version: string,
|
2022-01-29 06:59:58 +07:00
|
|
|
os: string,
|
2019-11-24 03:34:12 +07:00
|
|
|
no_step = false
|
|
|
|
): Promise<string> {
|
2022-01-29 06:59:58 +07:00
|
|
|
const log: string = await utils.stepLog('Setup Extensions', os);
|
2019-11-24 03:34:12 +07:00
|
|
|
let script = '\n';
|
|
|
|
switch (no_step) {
|
|
|
|
case true:
|
2022-01-29 06:59:58 +07:00
|
|
|
script += log + (await utils.suppressOutput(os));
|
2019-11-24 03:34:12 +07:00
|
|
|
break;
|
|
|
|
case false:
|
|
|
|
default:
|
2020-11-08 14:36:21 +07:00
|
|
|
script += log;
|
2019-11-24 03:34:12 +07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2022-01-29 06:59:58 +07:00
|
|
|
switch (os) {
|
2019-11-24 03:34:12 +07:00
|
|
|
case 'win32':
|
2020-03-12 09:27:40 +07:00
|
|
|
return script + (await addExtensionWindows(extension_csv, version));
|
2019-11-24 03:34:12 +07:00
|
|
|
case 'darwin':
|
2020-11-08 14:36:21 +07:00
|
|
|
return script + (await addExtensionDarwin(extension_csv, version));
|
2019-11-24 03:34:12 +07:00
|
|
|
case 'linux':
|
2020-11-08 14:36:21 +07:00
|
|
|
return script + (await addExtensionLinux(extension_csv, version));
|
2019-11-24 03:34:12 +07:00
|
|
|
default:
|
|
|
|
return await utils.log(
|
2022-01-29 06:59:58 +07:00
|
|
|
'Platform ' + os + ' is not supported',
|
|
|
|
os,
|
2019-11-24 03:34:12 +07:00
|
|
|
'error'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|