Skip to content

Commit 7de1f76

Browse files
committed
chore: wip
1 parent 5c924e4 commit 7de1f76

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

scripts/build-php.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,7 +1209,15 @@ function buildPhpWithSystemLibraries(config: BuildConfig, installPrefix: string)
12091209
// Install required system packages for extensions
12101210
log('Installing required system packages...')
12111211
try {
1212-
execSync('apt-get update && apt-get install -y libbz2-dev libzip-dev gettext libgettextpo-dev', { stdio: 'inherit' })
1212+
execSync('apt-get update && apt-get install -y libbz2-dev libzip-dev gettext libgettextpo-dev pkg-config', { stdio: 'inherit' })
1213+
1214+
// Verify libzip installation
1215+
try {
1216+
const libzipVersion = execSync('pkg-config --modversion libzip', { encoding: 'utf8' }).trim()
1217+
log(`✅ libzip ${libzipVersion} detected`)
1218+
} catch (e) {
1219+
log('⚠️ libzip pkg-config not found, zip extension may fail')
1220+
}
12131221
} catch (e) {
12141222
log('Warning: Could not install system packages, continuing with available libraries')
12151223
}
@@ -1222,8 +1230,8 @@ function buildPhpWithSystemLibraries(config: BuildConfig, installPrefix: string)
12221230
CPP: 'gcc -E',
12231231
CFLAGS: '-O2 -fPIC',
12241232
CXXFLAGS: '-O2 -fPIC',
1225-
// Clear any paths that might contain libstdc++
1226-
PKG_CONFIG_PATH: '',
1233+
// Set system pkg-config path for extension detection, but exclude Launchpad paths
1234+
PKG_CONFIG_PATH: '/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig',
12271235
LDFLAGS: '',
12281236
CPPFLAGS: '',
12291237
LD_LIBRARY_PATH: '',
@@ -1287,7 +1295,7 @@ function buildPhpWithSystemLibraries(config: BuildConfig, installPrefix: string)
12871295
// Try to configure with all critical extensions first
12881296
const fullConfigureArgs = [
12891297
...baseConfigureArgs,
1290-
'--enable-zip',
1298+
'--with-zip',
12911299
'--with-iconv',
12921300
'--with-bz2',
12931301
'--with-gettext'
@@ -1308,9 +1316,9 @@ function buildPhpWithSystemLibraries(config: BuildConfig, installPrefix: string)
13081316
// Try with individual extensions to see which ones work
13091317
const workingArgs = [...baseConfigureArgs]
13101318

1311-
// Test each extension individually
1319+
// Test each extension individually with proper configuration
13121320
const extensionsToTest = [
1313-
{ flag: '--enable-zip', name: 'zip' },
1321+
{ flag: '--with-zip', name: 'zip' }, // Use --with-zip instead of --enable-zip
13141322
{ flag: '--with-iconv', name: 'iconv' },
13151323
{ flag: '--with-bz2', name: 'bz2' },
13161324
{ flag: '--with-gettext', name: 'gettext' }

0 commit comments

Comments
 (0)