[PATCH] Fix bundle compilation on Darwin for Apache 2.0
| From: | Justin Erenkrantz | Date: | Mon, 13 May 2002 05:10:43 +0000 |
| Subject: | [PATCH] Fix bundle compilation on Darwin for Apache 2.0 | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-83972@lists.php.net to get a copy of this message | ||
This patch adds support for Darwin bundles for the apache2filter
module. I brought up extending apxs to allow building self-contained
libraries on the dev@httpd lists to no answer. Since Darwin is a
special case that requires self-contained libraries (unless using
a flat namespace), I don't think it's necessary to add code to apxs
to always build self-contained libraries - we just need to handle
Darwin specially.
This patch does two things that should only be Darwin specific:
- Call apr-config and apu-config to determine the link information
for the requisite libraries so that they can be self-contained.
- Modifies the libphp4.bundle target to allow linking with libtool.
Since ap{ru}-config *may* print out information requiring libtool
to link (i.e. libexpat.la as a dependency), this makes more sense
to me.
While I was at WWDC last week, I talked to the linker developer
and we tossed around some ideas for handling this bundling problem.
I don't forsee any solution coming in the Jaguar timeframe, but
perhaps something later on. If you are interested in more details,
drop me a line as I don't think the entire PHP community cares
about Darwin. =)
Please let me know if you have any questions or comments. I have
tested this on my platform and it works. -- justin
Index: Makefile.global
===================================================================
RCS file: /repository/php4/Makefile.global,v
retrieving revision 1.11
diff -u -r1.11 Makefile.global
--- Makefile.global 28 Apr 2002 03:27:43 -0000 1.11
+++ Makefile.global 12 May 2002 23:01:21 -0000
@@ -15,7 +15,7 @@
$(LIBTOOL) --mode=link $(CC) $(COMMON_FLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -rpath $(phptempdir)
$(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS)
$(ZEND_EXTRA_LIBS) -o $@
libs/libphp4.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) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@ &&
cp $@ libs/libphp4.so
+ $(LIBTOOL) --mode=link $(CC) $(MH_BUNDLE_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS)
$(EXTRA_LDFLAGS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@
&& cp $@ libs/libphp4.so
php: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
$(LIBTOOL) --mode=link $(CC) -export-dynamic $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS)
$(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS)
$(ZEND_EXTRA_LIBS) -o $@
Index: sapi/apache2filter/config.m4
===================================================================
RCS file: /repository/php4/sapi/apache2filter/config.m4,v
retrieving revision 1.15
diff -u -r1.15 config.m4
--- sapi/apache2filter/config.m4 5 May 2002 09:52:39 -0000 1.15
+++ sapi/apache2filter/config.m4 12 May 2002 23:01:33 -0000
@@ -57,7 +57,18 @@
INSTALL_IT="$APXS -i -a -n php4 $SAPI_LIBTOOL"
;;
*darwin*)
- MH_BUNDLE_FLAGS="-bundle -bundle_loader $APXS_HTTPD"
+ dnl When using bundles on Darwin, we must resolve all symbols. However,
+ dnl the linker does not recursively look at the bundle loader and
+ dnl pull in its dependencies. Therefore, we must pull in the APR
+ dnl and APR-util libraries.
+ APXS_BINDIR=
$APXS -q BINDIR
+ if test -f $APXS_BINDIR/apr-config; then
+ MH_BUNDLE_FLAGS="$APXS_BINDIR/apr-config --ldflags --link-ld --libs"
+ fi
+ if test -f $APXS_BINDIR/apu-config; then
+ MH_BUNDLE_FLAGS="$APXS_BINDIR/apu-config --ldflags --link-ld --libs
$MH_BUNDLE_FLAGS"
+ fi
+ MH_BUNDLE_FLAGS="-bundle -bundle_loader $APXS_HTTPD $MH_BUNDLE_FLAGS"
PHP_SUBST(MH_BUNDLE_FLAGS)
PHP_SELECT_SAPI(apache2filter, bundle, sapi_apache2.c apache_config.c php_functions.c)
SAPI_SHARED=libs/libphp4.so