diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 1ffc6dc3..f4207dc6 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -235,7 +235,7 @@ class Extension $ret = ''; foreach ($order as $ext) { if ($ext instanceof Extension && $ext->isBuildShared()) { - if (Config::getExt($ext->getName(), 'zend_extension', false) === true) { + if (Config::getExt($ext->getName(), 'zend-extension', false) === true) { $ret .= " -d \"zend_extension={$ext->getName()}\""; } else { $ret .= " -d \"extension={$ext->getName()}\""; @@ -371,6 +371,7 @@ class Extension } $env = [ 'CFLAGS' => $config['cflags'], + 'CXXFLAGS' => $config['cflags'], 'LDFLAGS' => $config['ldflags'], 'LIBS' => '-Wl,-Bstatic ' . $staticLibs . ' -Wl,-Bdynamic ' . $sharedLibs, 'LD_LIBRARY_PATH' => BUILD_LIB_PATH, @@ -485,6 +486,11 @@ class Extension } } + if (array_key_exists(0, $deps)) { + $zero = [0 => $deps[0]]; + unset($deps[0]); + return $zero + $deps; + } return $deps; } } diff --git a/src/SPC/builder/extension/curl.php b/src/SPC/builder/extension/curl.php index 4779e67c..0c5de6a5 100644 --- a/src/SPC/builder/extension/curl.php +++ b/src/SPC/builder/extension/curl.php @@ -22,7 +22,7 @@ class curl extends Extension { logger()->info('patching before-configure for curl checks'); $file1 = "AC_DEFUN([PHP_CHECK_LIBRARY], [\n $3\n])"; - $files = FileSystem::readFile(SOURCE_PATH . '/php-src/ext/curl/config.m4'); + $files = FileSystem::readFile($this->source_dir . '/config.m4'); $file2 = 'AC_DEFUN([PHP_CHECK_LIBRARY], [ save_old_LDFLAGS=$LDFLAGS ac_stuff="$5" @@ -41,7 +41,7 @@ class curl extends Extension $4 ])dnl ])'; - file_put_contents(SOURCE_PATH . '/php-src/ext/curl/config.m4', $file1 . "\n" . $files . "\n" . $file2); + file_put_contents($this->source_dir . '/config.m4', $file1 . "\n" . $files . "\n" . $file2); return true; } @@ -59,7 +59,7 @@ class curl extends Extension public function patchBeforeSharedConfigure(): bool { - $file = SOURCE_PATH . '/php-src/ext/curl/config.m4'; + $file = $this->source_dir . '/config.m4'; $content = FileSystem::readFile($file); // Inject patch before it diff --git a/src/SPC/builder/extension/dom.php b/src/SPC/builder/extension/dom.php index fb1a4e15..85437f62 100644 --- a/src/SPC/builder/extension/dom.php +++ b/src/SPC/builder/extension/dom.php @@ -30,6 +30,6 @@ class dom extends Extension public function getWindowsConfigureArg($shared = false): string { - return '--with-dom --with-libxml'; + return '--with-dom'; } } diff --git a/src/SPC/builder/extension/pdo_sqlsrv.php b/src/SPC/builder/extension/pdo_sqlsrv.php deleted file mode 100644 index ed501bb2..00000000 --- a/src/SPC/builder/extension/pdo_sqlsrv.php +++ /dev/null @@ -1,33 +0,0 @@ -builder))->config([$this->getName()]); - $env = [ - 'CFLAGS' => $config['cflags'], - 'CXXFLAGS' => $config['cflags'], - 'LDFLAGS' => $config['ldflags'], - 'LIBS' => $config['libs'], - 'LD_LIBRARY_PATH' => BUILD_LIB_PATH, - ]; - // prepare configure args - shell()->cd($this->source_dir) - ->setEnv($env) - ->execWithEnv(BUILD_BIN_PATH . '/phpize') - ->execWithEnv('./configure ' . $this->getUnixConfigureArg(true) . ' --with-php-config=' . BUILD_BIN_PATH . '/php-config --enable-shared --disable-static --with-pic') - ->execWithEnv('make clean') - ->execWithEnv('make -j' . $this->builder->concurrency) - ->execWithEnv('make install'); - } -} diff --git a/src/SPC/builder/extension/pgsql.php b/src/SPC/builder/extension/pgsql.php index df852f4b..a70c1fb7 100644 --- a/src/SPC/builder/extension/pgsql.php +++ b/src/SPC/builder/extension/pgsql.php @@ -39,12 +39,9 @@ class pgsql extends Extension $libfiles = $this->getLibFilesString(); $libfiles = str_replace(BUILD_LIB_PATH . '/lib', '-l', $libfiles); $libfiles = str_replace('.a', '', $libfiles); - $libfiles = str_replace(' -lpq', '', $libfiles); - $libfiles = str_replace(' -lpgport', '', $libfiles); - $libfiles = str_replace(' -lpgcommon', '', $libfiles); return '--with-pgsql' . ($shared ? '=shared' : '') . ' PGSQL_CFLAGS=-I' . BUILD_INCLUDE_PATH . - ' PGSQL_LIBS="-L' . BUILD_LIB_PATH . ' -lpq -lpgport -lpgcommon ' . $libfiles . '"'; + ' PGSQL_LIBS="-L' . BUILD_LIB_PATH . ' ' . $libfiles . '"'; } return '--with-pgsql=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH; } diff --git a/src/SPC/builder/linux/LinuxBuilder.php b/src/SPC/builder/linux/LinuxBuilder.php index c40f8871..61a436eb 100644 --- a/src/SPC/builder/linux/LinuxBuilder.php +++ b/src/SPC/builder/linux/LinuxBuilder.php @@ -109,18 +109,6 @@ class LinuxBuilder extends UnixBuilderBase */ public function buildPHP(int $build_target = BUILD_TARGET_NONE): void { - if ($build_target === BUILD_TARGET_EMBED && - file_exists(BUILD_BIN_PATH . '/php-config') && - file_exists(BUILD_BIN_PATH . '/phpize') - ) { - $embed_type = getenv('SPC_CMD_VAR_PHP_EMBED_TYPE') ?: 'static'; - if ($embed_type === 'shared' && file_exists(BUILD_LIB_PATH . '/libphp.so')) { - return; - } - if (file_exists(BUILD_LIB_PATH . '/libphp.a')) { - return; - } - } // ---------- Update extra-libs ---------- $extra_libs = getenv('SPC_EXTRA_LIBS') ?: ''; // bloat means force-load all static libraries, even if they are not used diff --git a/src/SPC/command/BuildPHPCommand.php b/src/SPC/command/BuildPHPCommand.php index 61781d2c..24900d6d 100644 --- a/src/SPC/command/BuildPHPCommand.php +++ b/src/SPC/command/BuildPHPCommand.php @@ -208,7 +208,7 @@ class BuildPHPCommand extends BuildCommand SourcePatcher::patchSPCVersionToPHP($this->getApplication()->getVersion()); // start to build - $builder->buildPHP($rule); + // $builder->buildPHP($rule); SourcePatcher::patchBeforeSharedBuild($builder); diff --git a/src/SPC/store/SourcePatcher.php b/src/SPC/store/SourcePatcher.php index 6abcf52d..d61020b8 100644 --- a/src/SPC/store/SourcePatcher.php +++ b/src/SPC/store/SourcePatcher.php @@ -457,16 +457,11 @@ class SourcePatcher if (PHP_OS_FAMILY !== 'Linux' || SystemUtil::getLibcVersionIfExists() >= '2.17') { return false; } - $version = null; - if (file_exists(SOURCE_PATH . '/php-src/main/php_version.h')) { - $file = SOURCE_PATH . '/php-src/main/php_version.h'; - $cnt = preg_match('/PHP_VERSION "(\d+\.\d+\.\d+)"/', file_get_contents($file), $match); - if (!$cnt) { - return false; - } - $version = $match[1]; + if (!file_exists(SOURCE_PATH . '/php-src/main/php_version.h')) { + return false; } - if (version_compare($version, '8.3.16', '<')) { + $file = file_get_contents(SOURCE_PATH . '/php-src/main/php_version.h'); + if (preg_match('/PHP_VERSION_ID (\d+)/', $file, $match) !== 0 && intval($match[1]) < 80316) { return false; } SourcePatcher::patchFile('ffi_centos7_fix_O3_strncmp.patch', SOURCE_PATH . '/php-src');