Skip to content

Commit e7ae3d6

Browse files
committed
chore: wip
1 parent d372ac6 commit e7ae3d6

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

scripts/build-php.ts

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -805,8 +805,8 @@ async function buildPhp(config: BuildConfig): Promise<string> {
805805

806806
buildEnv.PATH = `${launchpadBinPaths.join(':')}:${buildEnv.PATH}`
807807

808-
// Set up targeted PKG_CONFIG_PATH for essential libraries
809-
const pkgConfigPaths = [
808+
// Set up targeted PKG_CONFIG_PATH for essential libraries (exclude libstdcxx on Linux)
809+
let pkgConfigPaths = [
810810
`${launchpadRoot}/sourceware.org/bzip2/v1.0.8/lib/pkgconfig`,
811811
`${launchpadRoot}/zlib.net/v1.3.1/lib/pkgconfig`,
812812
`${launchpadRoot}/curl.se/v8.15.0/lib/pkgconfig`,
@@ -822,16 +822,20 @@ async function buildPhp(config: BuildConfig): Promise<string> {
822822
`${launchpadRoot}/sqlite.org/v3.47.2/lib/pkgconfig`,
823823
`${launchpadRoot}/libzip.org/v1.11.4/lib/pkgconfig`
824824
]
825-
826-
// Filter out libstdcxx paths from PKG_CONFIG_PATH on Linux
827-
const filteredPkgConfigPaths = config.platform === 'linux'
828-
? pkgConfigPaths.filter(path => !path.includes('libstdcxx'))
829-
: pkgConfigPaths
830825

831-
buildEnv.PKG_CONFIG_PATH = filteredPkgConfigPaths.join(':')
826+
// Completely exclude libstdcxx and gcc paths on Linux
827+
if (config.platform === 'linux') {
828+
pkgConfigPaths = pkgConfigPaths.filter(path =>
829+
!path.includes('libstdcxx') &&
830+
!path.includes('gcc') &&
831+
!path.includes('gnu.org/gcc')
832+
)
833+
}
834+
835+
buildEnv.PKG_CONFIG_PATH = pkgConfigPaths.join(':')
832836

833-
// Set up targeted library and include paths
834-
const libPaths = [
837+
// Set up targeted library and include paths (exclude libstdcxx on Linux)
838+
let libPaths = [
835839
`${launchpadRoot}/sourceware.org/bzip2/v1.0.8/lib`,
836840
`${launchpadRoot}/zlib.net/v1.3.1/lib`,
837841
`${launchpadRoot}/curl.se/v8.15.0/lib`,
@@ -847,6 +851,15 @@ async function buildPhp(config: BuildConfig): Promise<string> {
847851
`${launchpadRoot}/sqlite.org/v3.47.2/lib`,
848852
`${launchpadRoot}/libzip.org/v1.11.4/lib`
849853
]
854+
855+
// Completely exclude libstdcxx and gcc paths on Linux
856+
if (config.platform === 'linux') {
857+
libPaths = libPaths.filter(path =>
858+
!path.includes('libstdcxx') &&
859+
!path.includes('gcc') &&
860+
!path.includes('gnu.org/gcc')
861+
)
862+
}
850863

851864
const includePaths = [
852865
`${launchpadRoot}/sourceware.org/bzip2/v1.0.8/include`,
@@ -874,12 +887,7 @@ async function buildPhp(config: BuildConfig): Promise<string> {
874887
buildEnv.PKG_CONFIG_PATH = pkgConfigPaths.join(':')
875888
}
876889

877-
// Filter out libstdcxx paths on Linux to avoid linking issues
878-
const filteredLibPaths = config.platform === 'linux'
879-
? libPaths.filter(path => !path.includes('libstdcxx'))
880-
: libPaths
881-
882-
buildEnv.LDFLAGS = filteredLibPaths.map(path => `-L${path}`).join(' ')
890+
buildEnv.LDFLAGS = libPaths.map(path => `-L${path}`).join(' ')
883891
buildEnv.CPPFLAGS = includePaths.map(path => `-I${path}`).join(' ')
884892

885893
// Add macOS-specific linker flags for DNS resolver functions

0 commit comments

Comments
 (0)