Skip to content

Commit 7655c71

Browse files
committed
chore(osx): clean up PHP installation PATH handling
- Append LLVM to PATH instead of prepending to preserve PHP access - Add brew bin directory to PATH for better PHP discovery - Remove hide_dynamic_libs/restore_dynamic_libs mechanism as unneeded - Add PHP verification step for ext-php-rs build
1 parent 825110d commit 7655c71

2 files changed

Lines changed: 8 additions & 32 deletions

File tree

build-bash-base.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,11 @@ if [ "$(uname)" == "Darwin" ]; then
9090
LIBCLANG_PATH="$LLVM_PREFIX/lib"
9191
LLVM_CONFIG_PATH="$LLVM_PREFIX/bin/llvm-config"
9292
LLVM_PATH="$LLVM_PREFIX/bin"
93-
export LIBCLANG_PATH="$LIBCLANG_PATH" LLVM_CONFIG_PATH="$LLVM_CONFIG_PATH" PATH="$LLVM_PATH:$PATH"
93+
# Ensure PHP is still accessible by appending LLVM to PATH instead of prepending
94+
export LIBCLANG_PATH="$LIBCLANG_PATH" LLVM_CONFIG_PATH="$LLVM_CONFIG_PATH" PATH="$PATH:$LLVM_PATH"
95+
# Verify PHP is accessible
96+
echo "Verifying PHP is accessible for ext-php-rs build..."
97+
which php && php --version || echo "WARNING: php not found in PATH!"
9498
fi
9599
cd ../..
96100

build-osx

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ install_deps() {
1414
brew install shivammathur/php/php@8.4 bash curl autoconf automake bison re2c zstd git openssl zlib cmake libzip librdkafka libiconv llvm@17
1515
brew link --overwrite --force shivammathur/php/php@8.4
1616

17-
# Add PHP to PATH
17+
# Add PHP to PATH - include both versioned path and brew bin directory
1818
PHP_PREFIX="$(brew --prefix shivammathur/php/php@8.4)"
19-
export PATH="${PHP_PREFIX}/bin:${PATH}"
19+
BREW_PREFIX="$(brew --prefix)"
20+
export PATH="${PHP_PREFIX}/bin:${BREW_PREFIX}/bin:${PATH}"
2021

2122
OPENSSL_PREFIX="$(brew --prefix openssl)"
2223
LIBRDKAFKA_PREFIX="$(brew --prefix librdkafka)"
@@ -40,33 +41,6 @@ install_dev_deps() {
4041
export -f install_deps install_dev_deps install_rust
4142
. ./build-bash-base.sh "$@"
4243

43-
hide_dynamic_libs() {
44-
! which brew && return
45-
for lib in "$@"; do
46-
LIB_PATH=$(brew --prefix "$lib")
47-
if ls "$LIB_PATH"/lib/*.dylib; then
48-
for f in "$LIB_PATH"/lib/*.dylib; do
49-
mv "$f" "$f.bak"
50-
done
51-
fi
52-
done
53-
}
54-
55-
restore_dynamic_libs() {
56-
! which brew && return
57-
for lib in "$@"; do
58-
LIB_PATH=$(brew --prefix "$lib")
59-
if ls "$LIB_PATH"/lib/*.dylib.bak; then
60-
for f in "$LIB_PATH"/lib/*.dylib.bak; do
61-
mv "$f" "${f%*.bak}"
62-
done
63-
fi
64-
done
65-
}
66-
67-
# Leave only static libs on
68-
hide_dynamic_libs zstd zlib
69-
7044
MAKE_LDFLAGS=
7145
ENABLE_SHARED=yes
7246
ENABLE_STATIC=no
@@ -120,5 +94,3 @@ make LDFLAGS=$MAKE_LDFLAGS -j8
12094
make install-cli
12195
strip dist/bin/php
12296

123-
# Return skipped dynamic libs
124-
restore_dynamic_libs zstd zlib

0 commit comments

Comments
 (0)