Chinaunix首页 | 论坛 | 博客
  • 博客访问: 379834
  • 博文数量: 120
  • 博客积分: 5051
  • 博客等级: 大校
  • 技术积分: 1255
  • 用 户 组: 普通用户
  • 注册时间: 2007-07-03 01:25
文章分类

全部博文(120)

文章存档

2011年(2)

2010年(11)

2009年(28)

2008年(26)

2007年(53)

我的朋友

分类: LINUX

2007-10-17 17:58:19

原文链接

http://blog.madtech.cx/2006/12/08/debian-etch-libapache2-mod-php5-with-bundled-libgd-gdlib/

Debian Etch libapache2-mod-php5 with bundled libgd (GDLib)

A customer of the company I work for desperately wanted the libgd that comes bundled with PHP. This has been an ongoing debate in the Debian bugtracking system and on some mailinglists. The problem is that by linking an external libgd (made by the people of Boutell.Com; the original authors of GDLib) causes PHP to miss certain functions like imagerotate(). The PHP team defends this behaviour by pleading that their own, hacked up version of the GDLib is better. Well, I don’t know either way, what I do know is that Debian only offers the php5-gd, which is the Boutell.Com version. So I needed to recompile the PHP5 package to get it to work with the bundled libgd.

It seems easy enough, apt-get source the libapache2-mod-php5 code, change the configure line so it doesn’t go look for an external libgd (and in so doing force it to use the bundled version), compile, install and done. I wish it was that easy ;)

The PHP5 package is a multi-binary-package source package. This means that all PHP5 binary packages are made from the same source package. The binary packages being libapache-mod-php5, libapache2-mod-php5, php5-cli, etc. Here it gets messy, to build this beast we will have to install a _lot_ of development packages.

Here is what I did:

apt-get source libapache2-mod-php5

doesn’t matter which of the binary packages you choose, it gets the complete source package

this creates:

web01:/usr/src# ls -l
total 8504
drwxr-xr-x 15 root root 4096 2006-12-08 05:14 php5-5.2.0
-rw-r–r– 1 root src 93346 2006-11-24 16:02 php5_5.2.0-7.diff.gz
-rw-r–r– 1 root src 1963 2006-11-24 16:02 php5_5.2.0-7.dsc
-rw-r–r– 1 root src 8583491 2006-11-07 13:34 php5_5.2.0.orig.tar.gz

apt-get build-dep libapache2-mod-php5

this install all packages the build process for php5 depends on. Which are _a lot_.

You will notice apt-get whining about libapr1-dev not being of the right version; this is because the Debian PHP guys used the unstable version of this lib to compile their packages. Add a line for sid or unstable in your /etc/apt/sources.list (copy an etch/testing line and edit),

apt-get update && apt-get install libapr1-dev=1.2.7-8

strictly speaking you don’t have to add the version number, since this will be the newest version it can install, but I just like to be sure.
Edit your sources.list again and apt-get update, to remove any trace of unstable. Try the build-dep step again.

cd php5-5.2.0/
vi debian/rules # search for –with-gd and remove the “=share,/usr” part
debian/rules binary # actually go through the configure and make process. Drink coffee (or tea, a nice cup of redbush, yes, that’ll do nicely)

After it is finished it will have created a whole stack of debs in /usr/src:

web01:/usr/src# ls *.deb

libapache2-mod-php5_5.2.0-7_amd64.deb libapache-mod-php5_5.2.0-7_amd64.deb php5_5.2.0-7_all.deb php5-cgi_5.2.0-7_amd64.deb php5-cli_5.2.0-7_amd64.deb php5-common_5.2.0-7_amd64.deb php5-curl_5.2.0-7_amd64.deb php5-dev_5.2.0-7_amd64.deb php5-gd_5.2.0-7_amd64.deb php5-imap_5.2.0-7_amd64.deb php5-interbase_5.2.0-7_amd64.deb php5-ldap_5.2.0-7_amd64.deb php5-mcrypt_5.2.0-7_amd64.deb php5-mhash_5.2.0-7_amd64.deb php5-mysql_5.2.0-7_amd64.deb php5-odbc_5.2.0-7_amd64.deb php5-pgsql_5.2.0-7_amd64.deb php5-pspell_5.2.0-7_amd64.deb php5-recode_5.2.0-7_amd64.deb php5-snmp_5.2.0-7_amd64.deb php5-sqlite_5.2.0-7_amd64.deb php5-sybase_5.2.0-7_amd64.deb php5-tidy_5.2.0-7_amd64.deb php5-xmlrpc_5.2.0-7_amd64.deb php5-xsl_5.2.0-7_amd64.deb php-pear_5.2.0-7_all.deb

in my case I just do:

dpkg -i libapache2-mod-php5_5.2.0-7_amd64.deb

and I’m done. So much work for so little result (as far as I can see the customers use of imagerotate() still doesn’t work). If the package is updated in the Debian repositories; rince and repeat. Of course you actually want to pin this package in your apt.conf file, but I’ve already typed more than enough as it is :)

Of course you can use the same process here if you want to make small changes in other packages, apt-get source, apt-get build-dep, update what needs to be updated, debian/rules binary, dpkg -i. Or you can even put the packages in your own local repository, etc. More about that in a later post.

This entry was posted on Friday, December 8th, 2006 at 5:54 and is filed under debian
阅读(784) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~