@@ -234,9 +234,6 @@ echo This is not a real PHP binary. The download of the Windows PHP binary faile
234
234
}
235
235
236
236
function generateConfigureArgs ( config : BuildConfig , installPrefix : string ) : string [ ] {
237
- const homeDir = process . env . HOME || process . env . USERPROFILE
238
- const launchpadPath = `${ homeDir } /.local`
239
-
240
237
// Base configure arguments for all platforms
241
238
const baseArgs = [
242
239
`--prefix=${ installPrefix } ` ,
@@ -271,23 +268,23 @@ function generateConfigureArgs(config: BuildConfig, installPrefix: string): stri
271
268
'--without-gdbm'
272
269
]
273
270
274
- // Add Launchpad dependency paths
271
+ // Use Launchpad libraries without hardcoded paths - rely on PKG_CONFIG_PATH and environment
275
272
const dependencyArgs = [
276
- ` --with-curl= ${ launchpadPath } /curl.se/v8.15.0` ,
277
- ` --with-ffi= ${ launchpadPath } /sourceware.org/ libffi/v3.5.2` ,
278
- ` --with-gettext= ${ launchpadPath } /gnu.org/ gettext/v0.22.5` ,
279
- ` --with-gmp= ${ launchpadPath } /gnu.org/ gmp/v6.3.0` ,
280
- ` --with-openssl= ${ launchpadPath } /openssl.org/v1.1.1w` ,
281
- ` --with-sodium= ${ launchpadPath } /libsodium.org/v1.0.18` ,
282
- ` --with-xsl= ${ launchpadPath } /gnome.org/libxslt/v1.1.43` ,
283
- ` --with-zlib= ${ launchpadPath } /zlib.net/v1.3.1` ,
284
- ` --with-bz2= ${ launchpadPath } /sourceware.org/bzip2/v1.0.8`
273
+ ' --with-curl' , // Will use PKG_CONFIG_PATH to find curl
274
+ ' --with-ffi' , // Will use PKG_CONFIG_PATH to find libffi
275
+ ' --with-gettext' , // Will use PKG_CONFIG_PATH to find gettext
276
+ ' --with-gmp' , // Will use PKG_CONFIG_PATH to find gmp
277
+ ' --with-openssl' , // Will use PKG_CONFIG_PATH to find openssl
278
+ ' --with-sodium' , // Will use PKG_CONFIG_PATH to find sodium
279
+ ' --with-xsl' , // Will use PKG_CONFIG_PATH to find xsl
280
+ ' --with-zlib' , // Will use PKG_CONFIG_PATH to find zlib
281
+ ' --with-bz2' // Will use PKG_CONFIG_PATH to find bz2
285
282
]
286
283
287
284
// Platform-specific dependency paths
288
285
const platformDependencyArgs = [ ]
289
286
if ( config . platform === 'darwin' ) {
290
- platformDependencyArgs . push ( ` --with-iconv= ${ launchpadPath } /gnu.org/libiconv/v1.18.0` )
287
+ platformDependencyArgs . push ( ' --with-iconv' ) // Will use PKG_CONFIG_PATH to find iconv
291
288
}
292
289
293
290
// Platform-specific arguments
@@ -796,7 +793,10 @@ async function buildPhp(config: BuildConfig): Promise<string> {
796
793
797
794
// Set up build environment with selective Launchpad dependencies
798
795
let buildEnv = { ...process . env }
799
- const homeDir = process . env . HOME || process . env . USERPROFILE || '/Users/chrisbreuer'
796
+ const homeDir = process . env . HOME || process . env . USERPROFILE
797
+ if ( ! homeDir ) {
798
+ throw new Error ( 'HOME or USERPROFILE environment variable must be set' )
799
+ }
800
800
const launchpadRoot = `${ homeDir } /.local`
801
801
802
802
// Add essential Launchpad paths to PATH
@@ -825,7 +825,8 @@ async function buildPhp(config: BuildConfig): Promise<string> {
825
825
`${ launchpadRoot } /sourceware.org/libffi/v3.5.2/lib/pkgconfig` ,
826
826
`${ launchpadRoot } /gnome.org/libxslt/v1.1.43/lib/pkgconfig` ,
827
827
`${ launchpadRoot } /sqlite.org/v3.47.2/lib/pkgconfig` ,
828
- `${ launchpadRoot } /libzip.org/v1.11.4/lib/pkgconfig`
828
+ `${ launchpadRoot } /libzip.org/v1.11.4/lib/pkgconfig` ,
829
+ `${ launchpadRoot } /invisible-island.net/ncurses/v6.5.0/lib/pkgconfig`
829
830
]
830
831
831
832
// Completely exclude libstdcxx and gcc paths on Linux
@@ -854,7 +855,8 @@ async function buildPhp(config: BuildConfig): Promise<string> {
854
855
`${ launchpadRoot } /sourceware.org/libffi/v3.5.2/lib` ,
855
856
`${ launchpadRoot } /gnome.org/libxslt/v1.1.43/lib` ,
856
857
`${ launchpadRoot } /sqlite.org/v3.47.2/lib` ,
857
- `${ launchpadRoot } /libzip.org/v1.11.4/lib`
858
+ `${ launchpadRoot } /libzip.org/v1.11.4/lib` ,
859
+ `${ launchpadRoot } /invisible-island.net/ncurses/v6.5.0/lib`
858
860
]
859
861
860
862
// Completely exclude libstdcxx and gcc paths on Linux
@@ -880,7 +882,8 @@ async function buildPhp(config: BuildConfig): Promise<string> {
880
882
`${ launchpadRoot } /sourceware.org/libffi/v3.5.2/include` ,
881
883
`${ launchpadRoot } /gnome.org/libxslt/v1.1.43/include` ,
882
884
`${ launchpadRoot } /sqlite.org/v3.47.2/include` ,
883
- `${ launchpadRoot } /libzip.org/v1.11.4/include`
885
+ `${ launchpadRoot } /libzip.org/v1.11.4/include` ,
886
+ `${ launchpadRoot } /invisible-island.net/ncurses/v6.5.0/include`
884
887
]
885
888
886
889
// Add iconv paths for macOS only (Linux uses system iconv)
@@ -895,14 +898,16 @@ async function buildPhp(config: BuildConfig): Promise<string> {
895
898
buildEnv . LDFLAGS = libPaths . map ( path => `-L${ path } ` ) . join ( ' ' )
896
899
buildEnv . CPPFLAGS = includePaths . map ( path => `-I${ path } ` ) . join ( ' ' )
897
900
898
- // Add macOS -specific linker flags for DNS resolver functions
901
+ // Add platform -specific linker flags without hardcoded rpaths
899
902
if ( config . platform === 'darwin' ) {
900
- buildEnv . LDFLAGS += ` -lresolv -Wl,-rpath,${ launchpadRoot } ,-headerpad_max_install_names`
901
- // Set up runtime library path for macOS
903
+ // macOS: Use standard system paths only, rely on shim scripts for dynamic library loading
904
+ buildEnv . LDFLAGS += ` -lresolv -Wl,-rpath,/usr/local/lib,-rpath,/opt/homebrew/lib,-headerpad_max_install_names`
905
+ // Set up runtime library path for macOS (build-time only)
902
906
buildEnv . DYLD_LIBRARY_PATH = libPaths . join ( ':' )
903
907
buildEnv . LD = '/usr/bin/ld'
904
908
} else {
905
- buildEnv . LDFLAGS += ` -Wl,-rpath,${ launchpadRoot } `
909
+ // Linux: Use standard system paths only, rely on shim scripts for dynamic library loading
910
+ buildEnv . LDFLAGS += ` -Wl,-rpath,/usr/local/lib,-rpath,/usr/lib`
906
911
}
907
912
908
913
log ( '✅ Configured targeted Launchpad dependencies' )
0 commit comments