upgrade php4 to 4.4.7 - fixes compile errors with updated curl versions, php4-sqlite...
[packages.git] / lang / php4 / Makefile
1
2 # Copyright (C) 2006,2007 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=php4
12 PKG_VERSION:=4.4.7
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=php-$(PKG_VERSION).tar.bz2
16 PKG_SOURCE_URL:=http://fr.php.net/distributions/
17 PKG_MD5SUM:=3f21b44d37a57ca3876d3aea713c700d
18 PKG_BUILD_DIR:=$(BUILD_DIR)/php-$(PKG_VERSION)
19
20 include $(INCLUDE_DIR)/package.mk
21
22 define Package/php4/Default
23   SUBMENU:=PHP
24   SECTION:=lang
25   CATEGORY:=Languages
26   TITLE:=PHP4 Hypertext preprocessor
27   URL:=http://www.php.net/
28 endef
29
30 define Package/php4/Default/description
31  PHP is a widely-used general-purpose scripting language that is especially 
32  suited for Web development and can be embedded into HTML.
33 endef
34
35 define Package/php4
36   $(call Package/php4/Default)
37   DEPENDS:=+libopenssl +zlib
38 endef
39
40 define Package/php4/description
41 $(call Package/php4/Default/description)
42  This package contains only the PHP config file. You must actually choose 
43  your PHP flavour (cli, cgi or fastcgi).
44 endef
45
46 define Package/php4-cli
47   $(call Package/php4/Default)
48   DEPENDS:=php4
49   TITLE+= (CLI)
50 endef
51
52 define Package/php4-cli/description
53 $(call Package/php4/Default/description)
54  This package contains the CLI version of the PHP4 interpreter.
55 endef
56
57 define Package/php4-cgi
58   $(call Package/php4/Default)
59   DEPENDS:=php4
60   TITLE+= (CGI)
61 endef
62
63 define Package/php4-cgi/description
64 $(call Package/php4/Default/description)
65  This package contains the CGI version of the PHP4 interpreter.
66 endef
67
68 define Package/php4-fastcgi
69   $(call Package/php4/Default)
70   DEPENDS:=php4
71   TITLE+= (FastCGI)
72 endef
73
74 define Package/php4-fastcgi/description
75 $(call Package/php4/Default/description)
76  This package contains the FastCGI version of the PHP4 interpreter.
77 endef
78
79 define Package/php4-mod-curl
80   $(call Package/php4/Default)
81   DEPENDS:=php4 +libcurl
82   TITLE:=cURL module
83 endef
84
85 define Package/php4-mod-ftp
86   $(call Package/php4/Default)
87   DEPENDS:=php4
88   TITLE:=FTP module
89 endef
90
91 define Package/php4-mod-gd
92   $(call Package/php4/Default)
93   DEPENDS:=php4 +libgd
94   TITLE:=GD graphics module
95 endef
96
97 define Package/php4-mod-gmp
98   $(call Package/php4/Default)
99   DEPENDS:=php4 +libgmp
100   TITLE:=GMP module
101 endef
102
103 define Package/php4-mod-ldap
104   $(call Package/php4/Default)
105   DEPENDS:=php4 +libopenldap
106   TITLE:=LDAP module
107 endef
108
109 define Package/php4-mod-mysql
110   $(call Package/php4/Default)
111   DEPENDS:=php4 +libmysqlclient
112   TITLE:=MySQL module
113 endef
114
115 define Package/php4-mod-openssl
116   $(call Package/php4/Default)
117   DEPENDS:=php4 +libopenssl
118   TITLE:=OpenSSL module
119 endef
120
121 define Package/php4-mod-pcre
122   $(call Package/php4/Default)
123   DEPENDS:=php4 +libpcre
124   TITLE:=PCRE module
125 endef
126
127 define Package/php4-mod-pgsql
128   $(call Package/php4/Default)
129   DEPENDS:=php4 +libpq
130   TITLE:=PostgreSQL module
131 endef
132
133 define Package/php4-mod-session
134   $(call Package/php4/Default)
135   DEPENDS:=php4
136   TITLE:=Session module
137 endef
138
139 define Package/php4-mod-sockets
140   $(call Package/php4/Default)
141   DEPENDS:=php4
142   TITLE:=Sockets module
143 endef
144
145 define Package/php4-mod-xml
146   $(call Package/php4/Default)
147   DEPENDS:=php4 +libexpat
148   TITLE:=XML module
149 endef
150
151 PKG_CONFIGURE_LIBS:= -lcrypto -lssl
152 PKG_CONFIGURE_OPTS:= \
153         --enable-shared \
154         --disable-static \
155         --disable-rpath \
156         --disable-debug \
157         --without-pear \
158         \
159         --with-config-file-path=/etc \
160         --disable-ipv6 \
161         --enable-magic-quotes \
162         --enable-memory-limit \
163         --disable-overload \
164         --disable-short-tags \
165         \
166         --disable-ctype \
167         --disable-dom \
168         --enable-ftp=shared \
169         --without-gettext \
170         --without-iconv \
171         --disable-mbstring \
172         --disable-mbregex \
173         --with-openssl=shared,"$(STAGING_DIR)/usr" \
174           --with-kerberos=no \
175           --with-openssl-dir="$(STAGING_DIR)/usr" \
176         --enable-session=shared \
177         --enable-sockets=shared \
178         --disable-tokenizer \
179         --with-zlib="$(STAGING_DIR)/usr" \
180           --with-zlib-dir="$(STAGING_DIR)/usr" \
181
182 ifneq ($(SDK),)
183   PKG_BUILD_DEPENDS:=libopenssl zlib libcurl libgd libgmp libopenldap libmysqlclient libpq libexpat
184 # force PKG_CONFIGURE_{LIBS,OPTS} below when built in the SDK
185   CONFIG_PACKAGE_php4-cli:=m
186   CONFIG_PACKAGE_php4-cgi:=m
187   CONFIG_PACKAGE_php4-fastcgi:=m
188   CONFIG_PACKAGE_php4-mod-curl:=m
189   CONFIG_PACKAGE_php4-mod-gd:=m
190   CONFIG_PACKAGE_php4-mod-gmp:=m
191   CONFIG_PACKAGE_php4-mod-ldap:=m
192   CONFIG_PACKAGE_php4-mod-mysql:=m
193   CONFIG_PACKAGE_php4-mod-pcre:=m
194   CONFIG_PACKAGE_php4-mod-pgsql:=m
195   CONFIG_PACKAGE_php4-mod-xml:=m
196 endif
197
198 ifneq ($(CONFIG_PACKAGE_php4-mod-curl),)
199   PKG_CONFIGURE_OPTS+= --with-curl=shared,"$(STAGING_DIR)/usr"
200 else
201   PKG_CONFIGURE_OPTS+= --without-curl
202 endif
203 ifneq ($(CONFIG_PACKAGE_php4-mod-gd),)
204   PKG_CONFIGURE_OPTS+= --with-gd=shared,"$(STAGING_DIR)/usr" \
205         --without-freetype-dir \
206         --with-jpeg-dir="$(STAGING_DIR)/usr" \
207         --with-png-dir="$(STAGING_DIR)/usr" \
208         --without-xpm-dir \
209         --without-ttf \
210         --without-t1lib \
211         --enable-gd-native-ttf \
212         --disable-gd-jis-conv
213 else
214   PKG_CONFIGURE_OPTS+= --without-gd
215 endif
216 ifneq ($(CONFIG_PACKAGE_php4-mod-gmp),)
217   PKG_CONFIGURE_OPTS+= --with-gmp=shared,"$(STAGING_DIR)/usr"
218 else
219   PKG_CONFIGURE_OPTS+= --without-gmp
220 endif
221 ifneq ($(CONFIG_PACKAGE_php4-mod-ldap),)
222   PKG_CONFIGURE_OPTS+= --with-ldap=shared,"$(STAGING_DIR)/usr"
223         --with-ldap-sasl="$(STAGING_DIR)/usr"
224 else
225   PKG_CONFIGURE_OPTS+= --without-ldap
226 endif
227 ifneq ($(CONFIG_PACKAGE_php4-mod-mysql),)
228   PKG_CONFIGURE_OPTS+= --with-mysql=shared,"$(STAGING_DIR)/usr"
229 else
230   PKG_CONFIGURE_OPTS+= --without-mysql
231 endif
232 ifneq ($(CONFIG_PACKAGE_php4-mod-pcre),)
233   PKG_CONFIGURE_OPTS+= --with-pcre-regex=shared,"$(STAGING_DIR)/usr"
234 else
235   PKG_CONFIGURE_OPTS+= --without-pcre-regex
236 endif
237 ifneq ($(CONFIG_PACKAGE_php4-mod-pgsql),)
238   PKG_CONFIGURE_OPTS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
239 else
240   PKG_CONFIGURE_OPTS+= --without-pgsql
241 endif
242 ifneq ($(CONFIG_PACKAGE_php4-mod-xml),)
243   PKG_CONFIGURE_OPTS+= --enable-xml=shared \
244         --with-expat-dir="$(STAGING_DIR)/usr"
245 else
246   PKG_CONFIGURE_OPTS+= --disable-xml
247 endif
248
249 define Build/Configure
250 endef
251
252 ifneq ($(CONFIG_PACKAGE_php4-cli),)
253   define Build/Compile/php4-cli
254         -$(MAKE) -C $(PKG_BUILD_DIR) clean
255         $(call Build/Configure/Default, \
256                 $(PKG_CONFIGURE_OPTS) \
257                 --enable-cli \
258                 --disable-cgi \
259                 --disable-fastcgi \
260                 --enable-force-cgi-redirect \
261                 --enable-discard-path \
262                 , \
263                 LIBS="$(PKG_CONFIGURE_LIBS)" \
264                 php_cv_cc_rpath="no" \
265         )
266         $(MAKE) -C $(PKG_BUILD_DIR)
267         mv $(PKG_BUILD_DIR)/sapi/cli/php $(PKG_BUILD_DIR)/php-cli
268   endef
269 endif
270
271 ifneq ($(CONFIG_PACKAGE_php4-cgi),)
272   define Build/Compile/php4-cgi
273         -$(MAKE) -C $(PKG_BUILD_DIR) clean
274         $(call Build/Configure/Default, \
275                 $(PKG_CONFIGURE_OPTS) \
276                 --disable-cli \
277                 --enable-cgi \
278                 --disable-fastcgi \
279                 --enable-force-cgi-redirect \
280                 --enable-discard-path \
281                 , \
282                 LIBS="$(PKG_CONFIGURE_LIBS)" \
283                 php_cv_cc_rpath="no" \
284         )
285         $(MAKE) -C $(PKG_BUILD_DIR)
286         mv $(PKG_BUILD_DIR)/sapi/cgi/php $(PKG_BUILD_DIR)/php-cgi
287   endef
288 endif
289
290 ifneq ($(CONFIG_PACKAGE_php4-fastcgi),)
291   define Build/Compile/php4-fastcgi
292         -$(MAKE) -C $(PKG_BUILD_DIR) clean
293         $(call Build/Configure/Default, \
294                 $(PKG_CONFIGURE_OPTS) \
295                 --disable-cli \
296                 --enable-cgi \
297                 --enable-fastcgi \
298                 --enable-force-cgi-redirect \
299                 --enable-discard-path \
300                 , \
301                 LIBS="$(PKG_CONFIGURE_LIBS)" \
302                 php_cv_cc_rpath="no" \
303         )
304         $(MAKE) -C $(PKG_BUILD_DIR)
305         mv $(PKG_BUILD_DIR)/sapi/cgi/php $(PKG_BUILD_DIR)/php-fastcgi
306   endef
307 endif
308
309 define Build/Compile
310         $(call Build/Compile/php4-cli)
311         $(call Build/Compile/php4-cgi)
312         $(call Build/Compile/php4-fastcgi)
313 endef
314
315 define Package/php4/conffiles
316 /etc/php.ini
317 endef
318
319 define Package/php4/install
320         $(INSTALL_DIR) $(1)/etc
321         $(INSTALL_DATA) ./files/php.ini $(1)/etc/
322 endef
323
324 define Package/php4-cli/install
325         $(INSTALL_DIR) $(1)/usr/bin
326         $(CP) $(PKG_BUILD_DIR)/php-cli $(1)/usr/bin/php
327 endef
328
329 define Package/php4-cgi/install
330         $(INSTALL_DIR) $(1)/usr/bin
331         $(CP) $(PKG_BUILD_DIR)/php-cgi $(1)/usr/bin/php
332 endef
333
334 define Package/php4-fastcgi/install
335         $(INSTALL_DIR) $(1)/usr/sbin
336         $(CP) $(PKG_BUILD_DIR)/php-fastcgi $(1)/usr/sbin/php
337         $(INSTALL_DIR) $(1)/etc/init.d
338         $(INSTALL_BIN) ./files/php.init $(1)/etc/init.d/php
339 endef
340
341 define BuildPlugin
342   define Package/$(1)/install
343         [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib/php
344         for m in $(2); do \
345                 $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$$$$$$$${m}.so $$(1)/usr/lib/php/ ; \
346         done
347   endef
348
349   $$(eval $$(call BuildPackage,$(1)))
350 endef
351
352 $(eval $(call BuildPackage,php4))
353 $(eval $(call BuildPackage,php4-cli))
354 $(eval $(call BuildPackage,php4-cgi))
355 $(eval $(call BuildPackage,php4-fastcgi))
356 $(eval $(call BuildPlugin,php4-mod-curl,curl))
357 $(eval $(call BuildPlugin,php4-mod-ftp,ftp))
358 $(eval $(call BuildPlugin,php4-mod-gd,gd))
359 $(eval $(call BuildPlugin,php4-mod-gmp,gmp))
360 $(eval $(call BuildPlugin,php4-mod-ldap,ldap))
361 $(eval $(call BuildPlugin,php4-mod-mysql,mysql))
362 $(eval $(call BuildPlugin,php4-mod-openssl,openssl))
363 $(eval $(call BuildPlugin,php4-mod-pcre,pcre))
364 $(eval $(call BuildPlugin,php4-mod-pgsql,pgsql))
365 $(eval $(call BuildPlugin,php4-mod-session,session))
366 $(eval $(call BuildPlugin,php4-mod-sockets,sockets))
367 $(eval $(call BuildPlugin,php4-mod-xml,xml))
368