Pre-ITP: apache/mod_php

Reini Urban rurban@x-ray.at
Fri Sep 24 16:45:00 GMT 2004


Brian Dessent schrieb:
> Reini Urban wrote:
> Not talking about building static.  The binary still links to the shared
> system libs for all the things for which there exist system libs.  The
> only thing that's duplicated between CLI and DSO are the PHP extensions
> that you don't build shared.  

ah, ok. this reduces size.

>># ldd /usr/local/bin/php
>>         libcrypt.so.1 => /lib/libcrypt.so.1 (0x4001b000)
>>         libexpat.so.0 => /usr/local/lib/libexpat.so.0 (0x40048000)
>>         libmm.so.13 => /usr/local/lib/libmm.so.13 (0x4006c000)
>>         libpq.so.3 => /usr/local/pgsql/lib/libpq.so.3 (0x40071000)
>>         libmhash.so.2 => /usr/lib/libmhash.so.2 (0x40139000)
>>         libmcrypt.so.4 => /usr/local/lib/libmcrypt.so.4 (0x4015c000)
>>         libdl.so.2 => /lib/libdl.so.2 (0x40163000)
>>         libltdl.so.3 => /usr/lib/libltdl.so.3 (0x40167000)
>>         libpng.so.2 => /usr/lib/libpng.so.2 (0x4016e000)
>>         libz.so.1 => /lib/libz.so.1 (0x401a0000)
>>         libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x401af000)
>>         libdb-4.2.so => /usr/local/BerkeleyDB.4.2/lib/libdb-4.2.so
>>(0x401ce000)
>>         libgdbm.so.2 => /usr/lib/libgdbm.so.2 (0x40278000)
>>         libresolv.so.2 => /lib/libresolv.so.2 (0x4027f000)
>>         libm.so.6 => /lib/libm.so.6 (0x40292000)
>>         libnsl.so.1 => /lib/libnsl.so.1 (0x402b4000)
>>         libcurl.so.3 => /usr/local/lib/libcurl.so.3 (0x402ca000)
>>         libxml2.so.2 => /usr/local/lib/libxml2.so.2 (0x403a7000)
>>         libpthread.so.0 => /lib/libpthread.so.0 (0x404b5000)
>>         libc.so.6 => /lib/libc.so.6 (0x404cb000)
>>         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

> That's quite a mouthful.  Here is Debian's:
> 
> $ ldd /usr/bin/php4 
>         libcrypt.so.1 => /lib/libcrypt.so.1 (0x4001f000)
>         libnsl.so.1 => /lib/libnsl.so.1 (0x4004c000)
>         libexpat.so.1 => /usr/lib/libexpat.so.1 (0x40061000)
>         libpcre.so.3 => /usr/lib/libpcre.so.3 (0x40081000)
>         libdb-4.2.so => /usr/lib/libdb-4.2.so (0x40092000)
>         libbz2.so.1.0 => /usr/lib/libbz2.so.1.0 (0x40168000)
>         libz.so.1 => /usr/lib/libz.so.1 (0x40178000)
>         libssl.so.0.9.7 => /usr/lib/i586/libssl.so.0.9.7 (0x40189000)
>         libresolv.so.2 => /lib/libresolv.so.2 (0x401b6000)
>         libm.so.6 => /lib/libm.so.6 (0x401c8000)
>         libdl.so.2 => /lib/libdl.so.2 (0x401eb000)
>         libc.so.6 => /lib/libc.so.6 (0x401ee000)
>         libcrypto.so.0.9.7 => /usr/lib/i586/libcrypto.so.0.9.7
> (0x40321000)
>         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
> 
> Everything else is shared - there are a ton of php4-foo packages.


>>for apache2 and lighttpd we must make our own php libs then, with the
>>same configure quirks. that's what I wanted to avoid with the general
>>cygphp4.dll
> 
> 
> It would be nice, I agree.  But it would take some serious hacking to
> the buildscripts.  And as I said the more I get to know them the less I
> want to.  :-)

no serious hacking, just simply avoiding the libtool section their 
buildscripts. because I wanted to add some static libs which are not in 
the cygwin distro: pdflib, fastcgi, libzzip

# apply brians patch
#patch -p1 < ../php-all.patch

# apply reini's dba patch
#patch -p0 < ../php-dba.patch

# re-autoconf, tatata...

# pdflib-lite (static):
#   cd /usr/src; wget -q 
http://www.pdflib.com/products/pdflib/download/600p1src/PDFlib-Lite-6.0.0p1.tar.gz
#   tar xfz PDFlib-Lite-6.0.0p1.tar.gz; cd PDFlib-Lite-6.0.0p1
#   ./configure --disable-shared; make; make install
# fastcgi (static for CGI php.exe only):
#   cd /usr/src; wget -q http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz
#   tar xfz fcgi-2.4.0.tar.gz; cd fcgi-2.4.0;
#   ./configure; make; make install
# libzzip (static for --with-zip, http://zziplib.sourceforge.net/)
#   cd /usr/src; wget -q 
http://puzzle.dl.sourceforge.net/sourceforge/zziplib/zziplib-0.10.82.tar.bz2
#   tar xfj zziplib-0.10.82.tar.bz2; cd zziplib-0.10.82
#   ./configure --prefix=/usr/local --libdir=/usr/local/lib 
includedir=/usr/local/include --disable-shared; make; make install

./configure --mandir=/usr/share/man --with-mysql=/usr/local/mysql 
--with-apxs=/usr/sbin/apxs --enable-track-vars --prefix=/usr 
--enable-safe-mode --enable-cli --enable-cgi --enable-fastcgi 
--with-openssl=shared --enable-bcmath --with-bzip2=shared 
--enable-calendar --with-curl=shared --enable-dba --with-gdbm --with-db4 
--with-cdb --with-inifile --with-flatfile --with-dom=shared 
--with-dom-xslt=shared --with-dom-exslt=shared --with-gd 
--enable-gd-native-ttf --with-jpeg-dir=/usr/lib --with-gettext=shared 
--with-gmp=shared --with-ldap --enable-mbstring --with-libmbfl 
--with-mcrypt=shared --with-mhash=shared --with-iconv=shared 
--with-ncurses=shared --enable-pcntl --with-pdflib --with-pgsql=shared 
--enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-xmlrpc 
--with-domxml --with-zip --with-zlib --with-zlib-dir=/usr/lib 
--enable-memory-limit --enable-zend-multibyte 2>&1 | tee .build/log.config

# hmm, sablotron missing...

# this will fail after building the lo's. this is ok
# I just didn't grok how to create the lo's more easily
make 2>&1 | tee .build/log.make

# now create libphp4.dll.a
# all .lo's but the sapi stuff. link the sapi's then seperately.
# avoid the php build system because the tend to duplicate
# all libs and garble the correct order
libtool --mode=link gcc -shared -O2 -o libphp4.la -module -avoid-version 
-L/usr/local/mysql/lib/mysql -L/usr/local/lib -o libphp4.la `find . \( 
-name x_dummymain -o -name sapi \) -prune -o -name \*.lo | grep .lo` 
-lcrypt -lz -liconv -lexpat -lzzip -lpdf -lpng -ljpeg -lmysqlclient 
-lldap -llber -ldb-4.2 -lgdbm -lresolv -lssl 2>&1 | tee .build/log.link

# just the final steps are missing: libphp4.dll.a => cygphp4.dll
# and link the sapi stuff seperately against it.
# have to read more about libtool...

> It's not that bad - cygphp4.dll is 1.3M stripped, and that's with the
> "kitchen sink" config.  Linking to external mysqlclient and pcre and/or
> getting the remaining bundled libs shared would shrink that further. 
> There's another 1.2M of loadable extensions but those should be shared
> between the CLI / DSO versions.

ah, that's also good.
-- 
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/



More information about the Cygwin-apps mailing list