This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: New packge: lighttpd-1.3.0


"Gerrit P. Haase" wrote:
> 
> Hello Brian,
> 
> >> I have a flag here:
> >> --enable-embed=TYPE   EXPERIMENTAL: Enable building of embedded SAPI library
> >>                           TYPE is either 'shared' or 'static'. TYPE=shared
> >>
> >> is this new in php-5?  Lets see what happens when I define it.
> 
> > No, it's the same in php4, and I haven't had to touch it.
> 
> > Are you using one of --with-apxs or --with-apache?  The former requires
> > Apache to be installed and the apxs binary in the path or specified
> > location, and the latter requires an Apache source tree that's been
> > configured.  If neither is found or gives an error then it won't try to
> > build as an apache module, which looks like what's happening in your
> > case -- getting the CLI only.
> 
> No I don't use Apache here at home, I running lighttpd now;) I use the
> options --enable-fastcgi and two others to get the CGI SAPI.
> 
> Now I see "$(LIBTOOL) --mode=compile $(CC) ...." in the Makefile,
> which was previously just "$(CC) ...", however I'm not sure what
> option makes the difference, I already see now what the problem is, if
> you have a source tree with the static archives ready compiled you can
> try the following, remove all *.la files, add to the Makefile:
> LDFLAGS = -no-undefined
> and run make again and see if the modules are compiled shared then.
> 
> There should be lines like this in the Makefile:
> ext/bcmath/bcmath.la: $(shared_objects_bcmath) $(BCMATH_SHARED_DEPENDENCIES)
>         $(LIBTOOL) --mode=link $(CC) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -o $@ -export-dynamic -avoid-version -prefer-pic -module -rpath $(phplibdir) $(EXTRA_LDFLAGS) $(shared_objects_bcmath) $(BCMATH_SHARED_LIBADD)
> 
> Originally LDFLAGS is empty.  BUT, BCMATH_SHARED_LIBADD is empty too,
> so it needs to hold a reference to libphp5 else there will be most
> probably failures during linking because of unresolved references.
> 
> This will need some more changes in their build system, that is
> we need to update all config.m4 files to include the reference to
> libphp.la for all modules which are available.

I'll attach the patches that I finally arrived at.  Basically, I skip
the step of creating libtoolized *.a and *.la and then using that awful
mkdll.sh to compile that into a dll.  As you pointed out this will also
require the cygphp4.dll (-lphp4) symbols at link time, but the way the
build is structured it's actually quite easy to add cygphp4.dll to the
dependencies of all the other .dlls and then stick it at the end of the
link line.  The only hackish thing left is that I had to include
/usr/bin/libhttpd.dll on the link line directly to pick up the Apache
symbols.  I'm not sure how to use it but the Apache build also includes
/usr/lib/httpd.exp which is just a plain listing of the httpd exports -
that might have been cleaner to use but I didn't know how.

In any case after the attached patch, I just run:

autoreconf  --verbose --force && \
./configure --prefix=/usr --with-layout=GNU \
--libexecdir=/usr/lib/apache --sysconfdir=/etc/php4 \
--with-config-file-path=/etc/php4 --infodir=/usr/share/info \
--mandir=/usr/share/man --with-apxs=/usr/sbin/apxs \
--libdir=/usr/lib/php4 --disable-ipv6 --disable-debug \
--with-gnu-ld --without-pear --disable-cli --enable-sockets \
--with-zlib=shared --with-bz2=shared --enable-calendar \
--enable-bcmath --with-openssl=shared --with-pgsql=shared \
--with-mysql --with-curl=shared --enable-dba --with-gdbm=shared \
--with-inifile --with-flatfile --enable-dbase --enable-dbx \
--enable-dio --enable-exif --enable-filepro --enable-ftp \
--with-gd=shared,/usr --with-jpeg-dir=/usr --with-png-dir=/usr \
--with-freetype-dir=/usr --with-xpm-dir=/usr/X11R6 \
--with-imap=shared --with-imap-ssl=/usr --with-iconv=shared \
--with-gettext=shared --with-ldap=shared --without-mhash \
--with-mcrypt=shared --with-gmp=shared --with-mime-magic \
--with-dom=shared --with-dom-xslt=shared --with-expat-dir=/usr \
&& make

After all that (and stripping), the result is:

$ ls -l modules/ libs/
libs/:
total 1.4M
-rwxr-xr-x    1 brian    None         1.3M Sep 23 05:42 cygphp4.dll

modules/:
total 1.2M
-rwxr-xr-x    1 brian    None          12k Sep 23 05:42 php4_bz2.dll
-rwxr-xr-x    1 brian    None          30k Sep 23 05:42 php4_curl.dll
-rwxr-xr-x    1 brian    None          81k Sep 23 05:42 php4_domxml.dll
-rwxr-xr-x    1 brian    None          65k Sep 23 05:42 php4_gd.dll
-rwxr-xr-x    1 brian    None          11k Sep 23 05:42 php4_gettext.dll
-rwxr-xr-x    1 brian    None          26k Sep 23 05:42 php4_gmp.dll
-rwxr-xr-x    1 brian    None          10k Sep 23 05:42 php4_iconv.dll
-rwxr-xr-x    1 brian    None         737k Sep 23 05:42 php4_imap.dll
-rwxr-xr-x    1 brian    None          37k Sep 23 05:42 php4_ldap.dll
-rwxr-xr-x    1 brian    None          31k Sep 23 05:42 php4_mcrypt.dll
-rwxr-xr-x    1 brian    None          53k Sep 23 05:42 php4_openssl.dll
-rwxr-xr-x    1 brian    None          71k Sep 23 05:42 php4_pgsql.dll
-rwxr-xr-x    1 brian    None          23k Sep 23 05:42 php4_zlib.dll

I arbitrariliy picked php4_ as a prefix for the module dlls.

Brian
--- php-4.3.8-upstream/acinclude.m4	2004-01-19 17:11:40.000000000 -0800
+++ php-4.3.8/acinclude.m4	2004-09-23 03:29:47.281250000 -0700
@@ -278,7 +278,6 @@
 
 AC_DEFUN([PHP_SHLIB_SUFFIX_NAME],[
   PHP_SUBST(SHLIB_SUFFIX_NAME)
-  SHLIB_SUFFIX_NAME=so
   case $host_alias in
   *hpux*[)]
 	SHLIB_SUFFIX_NAME=sl
@@ -286,6 +285,12 @@
   *darwin*[)]
 	SHLIB_SUFFIX_NAME=dylib
 	;;
+  *cygwin*[)]
+	SHLIB_SUFFIX_NAME=dll
+	;;
+  *[)]
+	SHLIB_SUFFIX_NAME=so
+	;;
   esac
 ])
 
@@ -733,7 +738,15 @@
 dnl
 AC_DEFUN([PHP_BUILD_SHARED],[
   PHP_BUILD_PROGRAM
-  OVERALL_TARGET=libphp4.la
+  case $host_alias in  
+  *cygwin*[)]
+	OVERALL_TARGET=cygphp4.dll
+	;;
+  *[)]
+	OVERALL_TARGET=libphp4.la
+	;;
+  esac
+  
   php_build_target=shared
   
   php_c_pre=$shared_c_pre
@@ -750,7 +763,14 @@
 dnl
 AC_DEFUN([PHP_BUILD_STATIC],[
   PHP_BUILD_PROGRAM
-  OVERALL_TARGET=libphp4.la
+  case $host_alias in
+  *cygwin*[)]
+	OVERALL_TARGET=cygphp4.dll
+	;;
+  *[)]
+	OVERALL_TARGET=libphp4.la
+	;;
+  esac
   php_build_target=static
 ])
 
@@ -1160,9 +1180,23 @@
 dnl
 AC_DEFUN([PHP_SHARED_MODULE],[
   install_modules="install-modules"
-  PHP_MODULES="$PHP_MODULES \$(phplibdir)/$1.la"
-  PHP_SUBST($2)
-  cat >>Makefile.objects<<EOF
+  case $host_alias in
+  *cygwin*[)]
+	PHP_MODULES="$PHP_MODULES \$(phplibdir)/php4_$1.dll"
+	PHP_SUBST($2)
+	cat >>Makefile.objects<<EOF
+\$(phplibdir)/php4_$1.dll: $3/php4_$1.dll
+	\$(LIBTOOL) --mode=install cp $3/php4_$1.dll \$(phplibdir)
+
+$3/php4_$1.dll: \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_DEPENDENCIES) \$(phptempdir)/\$(OVERALL_TARGET)
+	ifelse($4,,[\$(CC)],[\$(CXX)]) -shared \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(LDFLAGS) -o \[$]@ \$(EXTRA_LDFLAGS) \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_LIBADD) -L\$(phptempdir) -lphp4 ; \\
+
+EOF
+	;;
+  *[)]
+	PHP_MODULES="$PHP_MODULES \$(phplibdir)/$1.la"
+	PHP_SUBST($2)
+	cat >>Makefile.objects<<EOF
 \$(phplibdir)/$1.la: $3/$1.la
 	\$(LIBTOOL) --mode=install cp $3/$1.la \$(phplibdir)
 
@@ -1170,6 +1204,8 @@
 	\$(LIBTOOL) --mode=link ifelse($4,,[\$(CC)],[\$(CXX)]) \$(COMMON_FLAGS) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(LDFLAGS) -o \[$]@ -export-dynamic -avoid-version -prefer-pic -module -rpath \$(phplibdir) \$(EXTRA_LDFLAGS) \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_LIBADD)
 
 EOF
+	;;
+  esac
 ])
 
 dnl
--- php-4.3.8-upstream/Makefile.global	2003-12-04 07:59:04.000000000 -0800
+++ php-4.3.8/Makefile.global	2004-09-23 02:58:00.546875000 -0700
@@ -14,9 +14,9 @@
 	
 build-modules: $(PHP_MODULES)
 
-libphp4.la: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
-	$(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -rpath $(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@
-	-@$(LIBTOOL) --silent --mode=install cp libphp4.la $(phptempdir)/libphp4.la >/dev/null 2>&1
+$(OVERALL_TARGET): $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
+	$(CC) -shared $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) /usr/bin/libhttpd.dll -o $@
+	-@$(LIBTOOL) --silent --mode=install cp $(OVERALL_TARGET) $(phptempdir)/$(OVERALL_TARGET) >/dev/null 2>&1
 
 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) $(PHP_FRAMEWORKS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@ && cp $@ libs/libphp4.so
@@ -39,8 +39,10 @@
 install-modules: build-modules
 	@test -d modules && \
 	$(mkinstalldirs) $(INSTALL_ROOT)$(EXTENSION_DIR)
+	@echo "Stripping DLLs..."
+	-@find $(phplibdir) -name \*.dll | xargs strip
+	-@find $(phptempdir) -name \*.dll | xargs strip
 	@echo "Installing shared extensions:     $(INSTALL_ROOT)$(EXTENSION_DIR)/"
-	@rm -f modules/*.la >/dev/null 2>&1
 	@$(INSTALL) modules/* $(INSTALL_ROOT)$(EXTENSION_DIR)
 
 install-tester:
@@ -67,7 +69,7 @@
 	find . -name \*.a | xargs rm -f
 	find . -name \*.so | xargs rm -f
 	find . -name .libs -a -type d|xargs rm -rf
-	rm -f libphp4.la $(SAPI_CLI_PATH) $(OVERALL_TARGET) modules/* libs/*
+	rm -f $(SAPI_CLI_PATH) $(OVERALL_TARGET) modules/* libs/*
 
 distclean: clean
 	rm -f config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h stamp-h php4.spec sapi/apache/libphp4.module buildmk.stamp
--- php-4.3.8-upstream/ext/domxml/config.m4	2002-10-30 09:42:36.000000000 -0800
+++ php-4.3.8/ext/domxml/config.m4	2004-09-22 19:40:42.000000000 -0700
@@ -50,7 +50,8 @@
 
   PHP_DOM_CHECK_VERSION
 
-  if test -f $DOMXML_DIR/lib/libxml2.a -o -f $DOMXML_DIR/lib/libxml2.$SHLIB_SUFFIX_NAME ; then
+  if test -f $DOMXML_DIR/lib/libxml2.a -o -f $DOMXML_DIR/lib/libxml2.$SHLIB_SUFFIX_NAME \
+      -o -f $DOMXML_DIR/lib/libxml2.dll.a ; then
     DOM_LIBNAME=xml2
   else
     DOM_LIBNAME=xml
@@ -145,16 +146,18 @@
     AC_MSG_ERROR(DOMXSLT requires DOMXML. Use --with-dom=<DIR>)
   fi
   
-  if test -f $DOMXML_DIR/lib/libxml2.a -o -f $DOMXML_DIR/lib/libxml2.$SHLIB_SUFFIX_NAME ; then
+  if test -f $DOMXML_DIR/lib/libxml2.a -o -f $DOMXML_DIR/lib/libxml2.$SHLIB_SUFFIX_NAME \
+        -o -f $DOMXML_DIR/lib/libxml2.dll.a ; then
     DOM_LIBNAME=xml2
   else
     DOM_LIBNAME=xml
   fi
-
+  
   PHP_ADD_LIBRARY_WITH_PATH($DOM_LIBNAME, $DOMXML_DIR/lib, DOMXML_SHARED_LIBADD)
   PHP_ADD_INCLUDE($DOMXML_DIR/include$DOMXML_DIR_ADD)
 
-  if test -f $DOMXML_DIR/lib/libxsltbreakpoint.a -o -f $DOMXML_DIR/lib/libxsltbreakpoint.$SHLIB_SUFFIX_NAME ; then
+  if test -f $DOMXML_DIR/lib/libxsltbreakpoint.a -o -f $DOMXML_DIR/lib/libxsltbreakpoint.$SHLIB_SUFFIX_NAME \
+        -o -f $DOMXML_DIR/lib/libxsltbreakpoint.dll.a ; then
     PHP_ADD_LIBRARY_WITH_PATH(xsltbreakpoint, $DOMXML_DIR/lib, DOMXML_SHARED_LIBADD)
   fi
 
--- php-4.3.8-upstream/ext/xml/config.m4	2003-10-02 22:25:42.000000000 -0700
+++ php-4.3.8/ext/xml/config.m4	2004-09-23 04:40:26.000000000 -0700
@@ -31,7 +31,7 @@
     PHP_NEW_EXTENSION(xml, xml.c, $ext_shared)
 
     for i in $PHP_XML $PHP_EXPAT_DIR; do
-      if test -f $i/lib/libexpat.a -o -f $i/lib/libexpat.$SHLIB_SUFFIX_NAME ; then
+      if test -f $i/lib/libexpat.dll.a -o -f $i/lib/libexpat.$SHLIB_SUFFIX_NAME ; then
         EXPAT_DIR=$i
       fi
     done
--- php-4.3.8-upstream/ext/gd/config.m4	2003-12-25 14:33:02.000000000 -0800
+++ php-4.3.8/ext/gd/config.m4	2004-09-22 20:58:25.000000000 -0700
@@ -51,7 +51,7 @@
   if test "$PHP_JPEG_DIR" != "no"; then
 
     for i in $PHP_JPEG_DIR /usr/local /usr; do
-      test -f $i/lib/libjpeg.$SHLIB_SUFFIX_NAME -o -f $i/lib/libjpeg.a && GD_JPEG_DIR=$i && break
+      test -f $i/lib/libjpeg.$SHLIB_SUFFIX_NAME -o -f $i/lib/libjpeg.dll.a && GD_JPEG_DIR=$i && break
     done
 
     if test -z "$GD_JPEG_DIR"; then
@@ -76,7 +76,7 @@
   if test "$PHP_PNG_DIR" != "no"; then
 
     for i in $PHP_PNG_DIR /usr/local /usr; do
-      test -f $i/lib/libpng.$SHLIB_SUFFIX_NAME -o -f $i/lib/libpng.a && GD_PNG_DIR=$i && break
+      test -f $i/lib/libpng.$SHLIB_SUFFIX_NAME -o -f $i/lib/libpng.dll.a && GD_PNG_DIR=$i && break
     done
 
     if test -z "$GD_PNG_DIR"; then
@@ -111,14 +111,14 @@
   if test "$PHP_XPM_DIR" != "no"; then
 
     for i in $PHP_XPM_DIR /usr/local /usr/X11R6 /usr; do
-      test -f $i/lib/libXpm.$SHLIB_SUFFIX_NAME -o -f $i/lib/libXpm.a && GD_XPM_DIR=$i && break
+      test -f $i/lib/libXpm.$SHLIB_SUFFIX_NAME -o -f $i/lib/libXpm.dll.a && GD_XPM_DIR=$i && break
     done
 
     if test -z "$GD_XPM_DIR"; then
       AC_MSG_ERROR([libXpm.(a|so) not found.])
     fi
 
-    for i in include include/X11; do
+    for i in include include/X11 ; do
       test -f $GD_XPM_DIR/$i/xpm.h && GD_XPM_INC=$GD_XPM_DIR/include
     done
 
@@ -360,7 +360,7 @@
 
 dnl Library path
   for i in lib/gd1.3 lib/gd lib gd1.3 gd ""; do
-    test -f "$PHP_GD/$i/libgd.$SHLIB_SUFFIX_NAME" -o -f "$PHP_GD/$i/libgd.a" && GD_LIB="$PHP_GD/$i"
+    test -f "$PHP_GD/$i/libgd.$SHLIB_SUFFIX_NAME" -o -f "$PHP_GD/$i/libgd.dll.a" && GD_LIB="$PHP_GD/$i"
   done
 
   if test -n "$GD_INCLUDE" && test -n "$GD_LIB"; then
--- php-4.3.8-upstream/sapi/apache/config.m4	2003-05-28 07:12:04.000000000 -0700
+++ php-4.3.8/sapi/apache/config.m4	2004-09-22 17:55:19.000000000 -0700
@@ -61,6 +61,10 @@
     SAPI_SHARED=libs/libphp4.so
     build_type=bundle
     ;;
+  *cygwin*)
+    SAPI_SHARED=libs/cygphp4.dll
+    build_type=shared
+    ;;
   *)
     build_type=shared
     ;;

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]