Skip to content

Commit

Permalink
fix: dynamic libphp linking on Mac
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Dec 16, 2024
1 parent fa64a1d commit 34cb1f6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ PHP NEWS
- Curl:
. Fix various memory leaks in curl mime handling. (nielsdos)

- Embed:
. Fixed GH-8533 (Unable to link dynamic libphp on Mac). (Kévin Dunglas)

- FPM:
. Fixed GH-16432 (PHP-FPM 8.2 SIGSEGV in fpm_get_status). (Jakub Zelenka)

Expand Down
4 changes: 4 additions & 0 deletions build/Makefile.global
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ libphp.la: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
$(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 $@
-@$(LIBTOOL) --silent --tag=CC --mode=install cp $@ $(phptempdir)/$@ >/dev/null 2>&1

libphp.dylib: libphp.la
$(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 $@
-@$(LIBTOOL) --silent --tag=CC --mode=install cp $@ $(phptempdir)/$@ >/dev/null 2>&1

libs/libphp.bundle: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
$(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

Expand Down
4 changes: 4 additions & 0 deletions sapi/embed/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ if test "$PHP_EMBED" != "no"; then
yes|shared)
LIBPHP_CFLAGS="-shared"
PHP_EMBED_TYPE=shared
AS_CASE(["$host_alias"], [*darwin*], [SAPI_SHARED="libs/libphp.dylib"], [])
INSTALL_IT="\$(mkinstalldirs) \$(INSTALL_ROOT)\$(prefix)/lib; \$(INSTALL) -m 0755 $SAPI_SHARED \$(INSTALL_ROOT)\$(prefix)/lib"
;;
static)
Expand All @@ -26,6 +27,9 @@ if test "$PHP_EMBED" != "no"; then
if test "$PHP_EMBED_TYPE" != "no"; then
PHP_SUBST(LIBPHP_CFLAGS)
PHP_SELECT_SAPI(embed, $PHP_EMBED_TYPE, php_embed.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
if test "$SAPI_SHARED" = "libs/libphp.dylib"; then
OVERALL_TARGET=libphp.dylib
fi
PHP_INSTALL_HEADERS([sapi/embed/php_embed.h])
fi
AC_MSG_RESULT([$PHP_EMBED_TYPE])
Expand Down

0 comments on commit 34cb1f6

Please sign in to comment.