= 80100 ? file_get_contents(ROOT_DIR . '/src/globals/extra/gd_config_81.w32') : file_get_contents(ROOT_DIR . '/src/globals/extra/gd_config_80.w32'); file_put_contents(SOURCE_PATH . '/php-src/ext/gd/config.w32.bak', file_get_contents(SOURCE_PATH . '/php-src/ext/gd/config.w32')); file_put_contents(SOURCE_PATH . '/php-src/ext/gd/config.w32', $origin); } } #[AfterSourceExtract('php-src')] #[PatchDescription('Patch FFI extension on CentOS 7 with -O3 optimization (strncmp issue)')] public function patchFfiCentos7FixO3strncmp(): void { spc_skip_if(!($ver = SystemTarget::getLibcVersion()) || version_compare($ver, '2.17', '>')); spc_skip_if(!file_exists(SOURCE_PATH . '/php-src/main/php_version.h')); $file = file_get_contents(SOURCE_PATH . '/php-src/main/php_version.h'); spc_skip_if(preg_match('/PHP_VERSION_ID (\d+)/', $file, $match) !== 0 && intval($match[1]) < 80316); SourcePatcher::patchFile('ffi_centos7_fix_O3_strncmp.patch', SOURCE_PATH . '/php-src'); } #[AfterSourceExtract('php-src')] #[PatchDescription('Add LICENSE file to IMAP extension if missing')] public function patchImapLicense(): void { if (!file_exists(SOURCE_PATH . '/php-src/ext/imap/LICENSE') && is_dir(SOURCE_PATH . '/php-src/ext/imap')) { file_put_contents(SOURCE_PATH . '/php-src/ext/imap/LICENSE', file_get_contents(ROOT_DIR . '/src/globals/extra/Apache_LICENSE')); } } }