Skip to content

Commit 041bf47

Browse files
committed
fix: dynamic libphp linking on Mac
1 parent fa64a1d commit 041bf47

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ PHP NEWS
2727
- Curl:
2828
. Fix various memory leaks in curl mime handling. (nielsdos)
2929

30+
- Embed:
31+
. Fixed GH-8533 (Unable to link dynamic libphp on Mac). (Kévin Dunglas)
32+
3033
- FPM:
3134
. Fixed GH-16432 (PHP-FPM 8.2 SIGSEGV in fpm_get_status). (Jakub Zelenka)
3235

build/Makefile.global

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ libphp.la: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
1919
$(LIBTOOL) --tag=CC --mode=link $(CC) $(LIBPHP_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -rpath $(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@
2020
-@$(LIBTOOL) --silent --tag=CC --mode=install cp $@ $(phptempdir)/$@ >/dev/null 2>&1
2121

22+
libphp.dylib: libphp.la
23+
$(LIBTOOL) --tag=CC --mode=link $(CC) -dynamiclib $(LIBPHP_CFLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) -rpath $(phptempdir) -install_name @rpath/$@ $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@
24+
-@$(LIBTOOL) --silent --tag=CC --mode=install cp $@ $(phptempdir)/$@ >/dev/null 2>&1
25+
2226
libs/libphp.bundle: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
2327
$(CC) $(MH_BUNDLE_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(PHP_GLOBAL_OBJS:.lo=.o) $(PHP_SAPI_OBJS:.lo=.o) $(PHP_FRAMEWORKS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@ && cp $@ libs/libphp.so
2428

sapi/embed/config.m4

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ PHP_ARG_ENABLE([embed],,
77

88
AC_MSG_CHECKING([for embedded SAPI library support])
99

10+
DYLIB="0"
1011
if test "$PHP_EMBED" != "no"; then
1112
case "$PHP_EMBED" in
1213
yes|shared)
13-
LIBPHP_CFLAGS="-shared"
1414
PHP_EMBED_TYPE=shared
15+
AS_CASE(["$host_alias"], [*darwin*], [SAPI_SHARED="libs/libphp.dylib"])
1516
INSTALL_IT="\$(mkinstalldirs) \$(INSTALL_ROOT)\$(prefix)/lib; \$(INSTALL) -m 0755 $SAPI_SHARED \$(INSTALL_ROOT)\$(prefix)/lib"
1617
;;
1718
static)
@@ -26,6 +27,9 @@ if test "$PHP_EMBED" != "no"; then
2627
if test "$PHP_EMBED_TYPE" != "no"; then
2728
PHP_SUBST(LIBPHP_CFLAGS)
2829
PHP_SELECT_SAPI(embed, $PHP_EMBED_TYPE, php_embed.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
30+
if test "$SAPI_SHARED" = "libs/libphp.dylib"; then
31+
OVERALL_TARGET=libphp.dylib
32+
fi
2933
PHP_INSTALL_HEADERS([sapi/embed/php_embed.h])
3034
fi
3135
AC_MSG_RESULT([$PHP_EMBED_TYPE])

0 commit comments

Comments
 (0)