import * as utils from './utils'; /** * Install and enable extensions for darwin * * @param extension_csv * @param version */ export async function addExtensionDarwin( extension_csv: string, version: string ): Promise { const extensions: Array = await utils.extensionArray(extension_csv); let add_script = '\n'; let remove_script = ''; await utils.asyncForEach(extensions, async function (extension: string) { const version_extension: string = version + extension; const [ext_name, ext_version]: string[] = extension.split('-'); const ext_prefix = await utils.getExtensionPrefix(ext_name); switch (true) { // match :extension case /^:/.test(ext_name): remove_script += '\ndisable_extension' + ext_name.replace(/:/g, ' '); return; // Match none case /^none$/.test(ext_name): add_script += '\ndisable_all_shared'; return; // match extensions for compiling from source case /.+-.+\/.+@.+/.test(extension): add_script += await utils.parseExtensionSource(extension, ext_prefix); return; // match 7.4relay...8.3relay // match 5.3blackfire...8.2blackfire // match 5.3blackfire-(semver)...8.1blackfire-(semver) // match couchbase, event, geos, pdo_oci, oci8, http, pecl_http // match 5.3ioncube...7.4ioncube // match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.2phalcon5 // match 7.0zephir_parser...8.2zephir_parser case /^(7\.4|8\.[0-3])relay(-v?\d+\.\d+\.\d+)?$/.test(version_extension): case /^(5\.[3-6]|7\.[0-4]|8\.[0-2])blackfire(-\d+\.\d+\.\d+)?$/.test( version_extension ): case /^couchbase|^event|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test( extension ): case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension): case /(5\.6|7\.[0-3])phalcon3|7\.[2-4]phalcon4|(7\.4|8\.[0-2])phalcon5/.test( version_extension ): case /(? { const extensions: Array = await utils.extensionArray(extension_csv); let add_script = '\n'; let remove_script = ''; await utils.asyncForEach(extensions, async function (extension: string) { const [ext_name, ext_version]: string[] = extension.split('-'); const version_extension: string = version + extension; let matches: RegExpExecArray; switch (true) { // Match :extension case /^:/.test(ext_name): remove_script += '\nDisable-Extension' + ext_name.replace(/:/g, ' '); break; // Match none case /^none$/.test(ext_name): add_script += '\nDisable-AllShared'; break; // match 5.3blackfire...8.2blackfire // match 5.3blackfire-(semver)...8.1blackfire-(semver) // match pdo_oci and oci8 // match 5.3ioncube...7.4ioncube // match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.2phalcon5 // match 7.1pecl_http...8.1pecl_http and 7.1http...8.1http // match 7.0zephir_parser...8.2zephir_parser case /^(5\.[3-6]|7\.[0-4]|8\.[0-2])blackfire(-\d+\.\d+\.\d+)?$/.test( version_extension ): case /^pdo_oci$|^oci8$|^pdo_firebird$/.test(extension): case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension): case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-2])phalcon5$/.test( version_extension ): case /^(7\.[1-4]|8\.1)(pecl_)?http/.test(version_extension): case /^(7\.[0-4]|8\.[0-2])zephir_parser(-v?\d+\.\d+\.\d+)?$/.test( version_extension ): add_script += await utils.customPackage( ext_name, 'extensions', extension, 'win32' ); return; // match pre-release versions. For example - xdebug-beta case /.+-(stable|beta|alpha|devel|snapshot)/.test(extension): add_script += await utils.joins( '\nAdd-Extension', ext_name, ext_version.replace('stable', '') ); break; // match extensions for compiling from source case /.+-.+\/.+@.+/.test(extension): add_script += await utils.getUnsupportedLog( extension, version, 'win32' ); break; // match semver with state case /.+-\d+\.\d+\.\d+[a-zA-Z]+\d*/.test(extension): matches = /.+-(\d+\.\d+\.\d+)([a-zA-Z]+)\d*/.exec( version_extension ) as RegExpExecArray; add_script += await utils.joins( '\nAdd-Extension', ext_name, matches[2].replace('preview', 'devel'), matches[1] ); break; // match semver without state case /.+-\d+(\.\d+\.\d+.*)?/.test(extension): add_script += await utils.joins( '\nAdd-Extension', ext_name, 'stable', ext_version ); break; // match 7.2xdebug2 to 7.4xdebug2 case /7\.[2-4]xdebug2/.test(version_extension): add_script += '\nAdd-Extension xdebug stable 2.9.8'; break; // match 5.3pcov to 7.0pcov case /(5\.[3-6]|7\.0)pcov/.test(version_extension): add_script += await utils.getUnsupportedLog('pcov', version, 'win32'); break; // match 5.3 to 5.6 - mysql, mysqli, mysqlnd case /^5\.[3-6](? { const extensions: Array = await utils.extensionArray(extension_csv); let add_script = '\n'; let remove_script = ''; await utils.asyncForEach(extensions, async function (extension: string) { const version_extension: string = version + extension; const [ext_name, ext_version]: string[] = extension .split(/-(.+)/) .filter(Boolean); const ext_prefix = await utils.getExtensionPrefix(ext_name); switch (true) { // Match :extension case /^:/.test(ext_name): remove_script += '\ndisable_extension' + ext_name.replace(/:/g, ' '); return; // Match none case /^none$/.test(ext_name): add_script += '\ndisable_all_shared'; return; // match extensions for compiling from source case /.+-.+\/.+@.+/.test(extension): add_script += await utils.parseExtensionSource(extension, ext_prefix); return; // match 7.4relay...8.3relay // match 5.3blackfire...8.2blackfire // match 5.3blackfire-(semver)...8.1blackfire-(semver) // match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid // match couchbase, geos, pdo_oci, oci8, http, pecl_http // match 5.3ioncube...7.4ioncube // match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, 7.4phalcon5...8.2phalcon5 // match 7.0zephir_parser...8.2zephir_parser case /^(7\.4|8\.[0-3])relay(-v?\d+\.\d+\.\d+)?$/.test(version_extension): case /^(5\.[3-6]|7\.[0-4]|8\.[0-2])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 /^couchbase|^event|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test( extension ): case /(? { const log: string = await utils.stepLog('Setup Extensions', os); let script = '\n'; switch (no_step) { case true: script += log + (await utils.suppressOutput(os)); break; case false: default: script += log; break; } switch (os) { case 'win32': return script + (await addExtensionWindows(extension_csv, version)); case 'darwin': return script + (await addExtensionDarwin(extension_csv, version)); case 'linux': return script + (await addExtensionLinux(extension_csv, version)); default: return await utils.log( 'Platform ' + os + ' is not supported', os, 'error' ); } }