Skip to content

Commit 5e2a4fc

Browse files
committed
use spc-config
1 parent 6bc4516 commit 5e2a4fc

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

build-static.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ fi
1010

1111
arch="$(uname -m)"
1212
os="$(uname -s | tr '[:upper:]' '[:lower:]')"
13+
# FIXME: re-enable PHP errors when SPC will be compatible with PHP 8.4
14+
spcCommand="php -ddisplay_errors=Off ./bin/spc"
1315
md5binary="md5sum"
1416
if [ "${os}" = "darwin" ]; then
1517
os="mac"
@@ -114,10 +116,10 @@ else
114116
extraOpts="${extraOpts} --no-strip"
115117
fi
116118

117-
./bin/spc doctor --auto-fix
118-
./bin/spc download --with-php="${PHP_VERSION}" --for-extensions="${PHP_EXTENSIONS}" --for-libs="${PHP_EXTENSION_LIBS}" --ignore-cache-sources=php-src --prefer-pre-built
119+
${spcCommand} doctor --auto-fix
120+
${spcCommand} download --with-php="${PHP_VERSION}" --for-extensions="${PHP_EXTENSIONS}" --for-libs="${PHP_EXTENSION_LIBS}" --ignore-cache-sources=php-src --prefer-pre-built
119121
# shellcheck disable=SC2086
120-
./bin/spc build --debug --enable-zts --build-embed ${extraOpts} "${PHP_EXTENSIONS}" --with-libs="${PHP_EXTENSION_LIBS}"
122+
${spcCommand} build --debug --enable-zts --build-embed ${extraOpts} "${PHP_EXTENSIONS}" --with-libs="${PHP_EXTENSION_LIBS}"
121123
fi
122124

123125
curlGitHubHeaders=(--header "X-GitHub-Api-Version: 2022-11-28")
@@ -144,7 +146,7 @@ cp -R include/wtr/watcher-c.h ../../buildroot/include/wtr/watcher-c.h
144146
cd ../../
145147

146148
# See https://github.com/docker-library/php/blob/master/8.3/alpine3.20/zts/Dockerfile#L53-L55
147-
CGO_CFLAGS="-DFRANKENPHP_VERSION=${FRANKENPHP_VERSION} -I${PWD}/buildroot/include/ $(./buildroot/bin/php-config --includes | sed s#-I/#-I"${PWD}"/buildroot/#g)"
149+
CGO_CFLAGS="-DFRANKENPHP_VERSION=${FRANKENPHP_VERSION} -I${PWD}/buildroot/include/ $(${spcCommand} spc-config "${PHP_EXTENSIONS}" --with-libs="${PHP_EXTENSION_LIBS}" --includes)"
148150
if [ -n "${DEBUG_SYMBOLS}" ]; then
149151
CGO_CFLAGS="-g ${CGO_CFLAGS}"
150152
else
@@ -159,7 +161,7 @@ elif [ "${os}" = "linux" ] && [ -z "${DEBUG_SYMBOLS}" ]; then
159161
CGO_LDFLAGS="-Wl,-O1 -pie"
160162
fi
161163

162-
CGO_LDFLAGS="${CGO_LDFLAGS} ${PWD}/buildroot/lib/libbrotlicommon.a ${PWD}/buildroot/lib/libbrotlienc.a ${PWD}/buildroot/lib/libbrotlidec.a ${PWD}/buildroot/lib/libwatcher-c.a $(./buildroot/bin/php-config --ldflags || true) $(./buildroot/bin/php-config --libs | sed -e 's/-lgcc_s//g' || true)"
164+
CGO_LDFLAGS="${CGO_LDFLAGS} ${PWD}/buildroot/lib/libbrotlicommon.a ${PWD}/buildroot/lib/libbrotlienc.a ${PWD}/buildroot/lib/libbrotlidec.a ${PWD}/buildroot/lib/libwatcher-c.a $(${spcCommand} spc-config "${PHP_EXTENSIONS}" --with-libs="${PHP_EXTENSION_LIBS}" --libs)"
163165
if [ "${os}" = "linux" ]; then
164166
if echo "${PHP_EXTENSIONS}" | grep -qE "\b(intl|imagick|grpc|v8js|protobuf|mongodb|tbb)\b"; then
165167
CGO_LDFLAGS="${CGO_LDFLAGS} -lstdc++"

0 commit comments

Comments
 (0)