Skip to content

Commit e4e9238

Browse files
committed
chore: wip
1 parent 20cd273 commit e4e9238

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

scripts/build-php.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,11 +284,18 @@ function generateConfigureArgs(config: BuildConfig, installPrefix: string): stri
284284
`--with-bz2=${launchpadPath}/sourceware.org/bzip2/v1.0.8`
285285
]
286286

287+
// Platform-specific dependency paths
288+
const platformDependencyArgs = []
289+
if (config.platform === 'darwin') {
290+
platformDependencyArgs.push(`--with-iconv=${launchpadPath}/gnu.org/libiconv/v1.18.0`)
291+
}
292+
287293
// Platform-specific arguments
288294
if (config.platform === 'darwin') {
289295
return [
290296
...baseArgs,
291297
...dependencyArgs,
298+
...platformDependencyArgs,
292299
'--enable-opcache=shared',
293300
'--with-libedit',
294301
'--with-zip',
@@ -299,10 +306,11 @@ function generateConfigureArgs(config: BuildConfig, installPrefix: string): stri
299306
return [
300307
...baseArgs,
301308
...dependencyArgs,
309+
...platformDependencyArgs,
302310
'--enable-opcache=shared',
303311
'--with-readline',
304312
'--without-zip',
305-
'--with-iconv',
313+
'--without-iconv',
306314
'--without-ldap-sasl'
307315
]
308316
}
@@ -852,6 +860,14 @@ async function buildPhp(config: BuildConfig): Promise<string> {
852860
`${launchpadRoot}/libzip.org/v1.11.4/include`
853861
]
854862

863+
// Add iconv paths for macOS only (Linux uses system iconv)
864+
if (config.platform === 'darwin') {
865+
libPaths.push(`${launchpadRoot}/gnu.org/libiconv/v1.18.0/lib`)
866+
includePaths.push(`${launchpadRoot}/gnu.org/libiconv/v1.18.0/include`)
867+
pkgConfigPaths.push(`${launchpadRoot}/gnu.org/libiconv/v1.18.0/lib/pkgconfig`)
868+
buildEnv.PKG_CONFIG_PATH = pkgConfigPaths.join(':')
869+
}
870+
855871
buildEnv.LDFLAGS = libPaths.map(path => `-L${path}`).join(' ')
856872
buildEnv.CPPFLAGS = includePaths.map(path => `-I${path}`).join(' ')
857873

@@ -884,9 +900,7 @@ async function buildPhp(config: BuildConfig): Promise<string> {
884900
buildEnv.LDFLAGS = buildEnv.LDFLAGS.replace(/-L[^\s]*libstdcxx[^\s]*/g, '')
885901
// Set preprocessor to avoid traditional-cpp issues
886902
buildEnv.CPP = 'gcc -E'
887-
// Force use of system iconv to avoid Launchpad libiconv linking issues
888-
buildEnv.ICONV_CFLAGS = ''
889-
buildEnv.ICONV_LIBS = '-liconv'
903+
// Disable iconv completely on Linux due to glibc errno check failure
890904
}
891905

892906
log('Running buildconf...')

0 commit comments

Comments
 (0)