-fPIC for postgresql CFLAGS, but it's still erroring out

This commit is contained in:
henderkes
2025-05-18 12:46:55 +07:00
parent 2ff300970a
commit 1fbd2c1adc

View File

@@ -42,7 +42,7 @@ trait postgresql
if (!empty($output[1][0])) { if (!empty($output[1][0])) {
$cppflags = $output[1][0]; $cppflags = $output[1][0];
$macos_15_bug_cflags = PHP_OS_FAMILY === 'Darwin' ? ' -Wno-unguarded-availability-new' : ''; $macos_15_bug_cflags = PHP_OS_FAMILY === 'Darwin' ? ' -Wno-unguarded-availability-new' : '';
$envs .= " CPPFLAGS=\"{$cppflags} -fPIC -fPIE -fno-ident{$macos_15_bug_cflags}\""; $envs .= " CPPFLAGS=\"{$cppflags} -DPIC -fpic -fPIC -fPIE -fno-ident{$macos_15_bug_cflags}\"";
} }
$output = shell()->execWithResult("pkg-config --libs-only-L --static {$packages}"); $output = shell()->execWithResult("pkg-config --libs-only-L --static {$packages}");
$error_exec_cnt += $output[0] === 0 ? 0 : 1; $error_exec_cnt += $output[0] === 0 ? 0 : 1;
@@ -78,9 +78,15 @@ trait postgresql
throw new RuntimeException('Unsupported version for postgresql: ' . $version . ' !'); throw new RuntimeException('Unsupported version for postgresql: ' . $version . ' !');
} }
$env = [
'CFLAGS' => $this->getLibExtraCFlags() . ' -DPIC -fpic',
'LDFLAGS' => $this->getLibExtraLdFlags(),
'LIBS' => $this->getLibExtraLibs(),
];
// configure // configure
shell()->cd($this->source_dir . '/build') shell()->cd($this->source_dir . '/build')
->exec( ->setEnv($env)
->execWithEnv(
"{$envs} ../configure " . "{$envs} ../configure " .
"--prefix={$builddir} " . "--prefix={$builddir} " .
'--disable-thread-safety ' . '--disable-thread-safety ' .
@@ -89,6 +95,7 @@ trait postgresql
'--with-readline ' . '--with-readline ' .
'--with-libxml ' . '--with-libxml ' .
($this->builder->getLib('icu') ? '--with-icu ' : '--without-icu ') . ($this->builder->getLib('icu') ? '--with-icu ' : '--without-icu ') .
// ($this->builder->getLib('ldap') ? '--with-ldap ' : '--without-ldap ') .
'--without-ldap ' . '--without-ldap ' .
($this->builder->getLib('libxslt') ? '--with-libxslt ' : '--without-libxslt ') . ($this->builder->getLib('libxslt') ? '--with-libxslt ' : '--without-libxslt ') .
($this->builder->getLib('zstd') ? '--with-zstd ' : '--without-zstd ') . ($this->builder->getLib('zstd') ? '--with-zstd ' : '--without-zstd ') .
@@ -98,16 +105,12 @@ trait postgresql
'--without-pam ' . '--without-pam ' .
'--without-bonjour ' . '--without-bonjour ' .
'--without-tcl ' '--without-tcl '
); )
// ($this->builder->getLib('ldap') ? '--with-ldap ' : '--without-ldap ') . ->execWithEnv($envs . ' make -C src/bin/pg_config install')
->execWithEnv($envs . ' make -C src/include install')
// build ->execWithEnv($envs . ' make -C src/common install')
shell()->cd($this->source_dir . '/build') ->execWithEnv($envs . ' make -C src/port install')
->exec($envs . ' make -C src/bin/pg_config install') ->execWithEnv($envs . ' make -C src/interfaces/libpq install');
->exec($envs . ' make -C src/include install')
->exec($envs . ' make -C src/common install')
->exec($envs . ' make -C src/port install')
->exec($envs . ' make -C src/interfaces/libpq install');
// remove dynamic libs // remove dynamic libs
shell()->cd($this->source_dir . '/build') shell()->cd($this->source_dir . '/build')