fix duplicate PKG_NAME use
[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.3.11
13 PKG_RELEASE:=2
14
15 PKG_SOURCE:=php-$(PKG_VERSION).tar.bz2
16 PKG_SOURCE_URL:=http://fr.php.net/distributions/
17 PKG_MD5SUM:=fbc67d240812136a9842bc1f2a217b7a
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-sqlite
146   $(call Package/php4/Default)
147   DEPENDS:=php4 +libsqlite2
148   TITLE:=SQLite module
149 endef
150
151 define Package/php4-mod-xml
152   $(call Package/php4/Default)
153   DEPENDS:=php4 +libexpat
154   TITLE:=XML module
155 endef
156
157 PKG_CONFIGURE_LIBS:= -lcrypto -lssl
158 PKG_CONFIGURE_OPTS:= \
159         --enable-shared \
160         --disable-static \
161         --disable-rpath \
162         --disable-debug \
163         --without-pear \
164         \
165         --with-config-file-path=/etc \
166         --disable-ipv6 \
167         --enable-magic-quotes \
168         --enable-memory-limit \
169         --disable-overload \
170         --disable-short-tags \
171         \
172         --disable-ctype \
173         --disable-dom \
174         --enable-ftp=shared \
175         --without-gettext \
176         --without-iconv \
177         --disable-mbstring \
178         --disable-mbregex \
179         --with-openssl=shared,"$(STAGING_DIR)/usr" \
180           --with-kerberos=no \
181           --with-openssl-dir="$(STAGING_DIR)/usr" \
182         --enable-session=shared \
183         --enable-sockets=shared \
184         --disable-tokenizer \
185         --with-zlib="$(STAGING_DIR)/usr" \
186           --with-zlib-dir="$(STAGING_DIR)/usr" \
187
188 ifneq ($(SDK),)
189   PKG_BUILD_DEPENDS:=libopenssl zlib libcurl libgd libgmp libopenldap libmysqlclient libpq libsqlite2 libexpat
190 # force PKG_CONFIGURE_{LIBS,OPTS} below when built in the SDK
191   CONFIG_PACKAGE_php4-cli:=m
192   CONFIG_PACKAGE_php4-cgi:=m
193   CONFIG_PACKAGE_php4-fastcgi:=m
194   CONFIG_PACKAGE_php4-mod-curl:=m
195   CONFIG_PACKAGE_php4-mod-gd:=m
196   CONFIG_PACKAGE_php4-mod-gmp:=m
197   CONFIG_PACKAGE_php4-mod-ldap:=m
198   CONFIG_PACKAGE_php4-mod-mysql:=m
199   CONFIG_PACKAGE_php4-mod-pcre:=m
200   CONFIG_PACKAGE_php4-mod-pgsql:=m
201   CONFIG_PACKAGE_php4-mod-sqlite:=m
202   CONFIG_PACKAGE_php4-mod-xml:=m
203 endif
204
205 ifneq ($(CONFIG_PACKAGE_php4-mod-curl),)
206   PKG_CONFIGURE_OPTS+= --with-curl=shared,"$(STAGING_DIR)/usr"
207 else
208   PKG_CONFIGURE_OPTS+= --without-curl
209 endif
210 ifneq ($(CONFIG_PACKAGE_php4-mod-gd),)
211   PKG_CONFIGURE_OPTS+= --with-gd=shared,"$(STAGING_DIR)/usr" \
212         --without-freetype-dir \
213         --with-jpeg-dir="$(STAGING_DIR)/usr" \
214         --with-png-dir="$(STAGING_DIR)/usr" \
215         --without-xpm-dir \
216         --without-ttf \
217         --without-t1lib \
218         --enable-gd-native-ttf \
219         --disable-gd-jis-conv
220 else
221   PKG_CONFIGURE_OPTS+= --without-gd
222 endif
223 ifneq ($(CONFIG_PACKAGE_php4-mod-gmp),)
224   PKG_CONFIGURE_OPTS+= --with-gmp=shared,"$(STAGING_DIR)/usr"
225 else
226   PKG_CONFIGURE_OPTS+= --without-gmp
227 endif
228 ifneq ($(CONFIG_PACKAGE_php4-mod-ldap),)
229   PKG_CONFIGURE_OPTS+= --with-ldap=shared,"$(STAGING_DIR)/usr"
230         --with-ldap-sasl="$(STAGING_DIR)/usr"
231 else
232   PKG_CONFIGURE_OPTS+= --without-ldap
233 endif
234 ifneq ($(CONFIG_PACKAGE_php4-mod-mysql),)
235   PKG_CONFIGURE_OPTS+= --with-mysql=shared,"$(STAGING_DIR)/usr"
236 else
237   PKG_CONFIGURE_OPTS+= --without-mysql
238 endif
239 ifneq ($(CONFIG_PACKAGE_php4-mod-pcre),)
240   PKG_CONFIGURE_OPTS+= --with-pcre-regex=shared,"$(STAGING_DIR)/usr"
241 else
242   PKG_CONFIGURE_OPTS+= --without-pcre-regex
243 endif
244 ifneq ($(CONFIG_PACKAGE_php4-mod-pgsql),)
245   PKG_CONFIGURE_OPTS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
246 else
247   PKG_CONFIGURE_OPTS+= --without-pgsql
248 endif
249 ifneq ($(CONFIG_PACKAGE_php4-mod-sqlite),)
250   PKG_CONFIGURE_OPTS+= --with-sqlite=shared,"$(STAGING_DIR)/usr"
251 else
252   PKG_CONFIGURE_OPTS+= --without-sqlite
253 endif
254 ifneq ($(CONFIG_PACKAGE_php4-mod-xml),)
255   PKG_CONFIGURE_OPTS+= --enable-xml=shared \
256         --with-expat-dir="$(STAGING_DIR)/usr"
257 else
258   PKG_CONFIGURE_OPTS+= --disable-xml
259 endif
260
261 define Build/Configure
262 endef
263
264 ifneq ($(CONFIG_PACKAGE_php4-cli),)
265   define Build/Compile/php4-cli
266         -$(MAKE) -C $(PKG_BUILD_DIR) clean
267         $(call Build/Configure/Default, \
268                 $(PKG_CONFIGURE_OPTS) \
269                 --enable-cli \
270                 --disable-cgi \
271                 --disable-fastcgi \
272                 --enable-force-cgi-redirect \
273                 --enable-discard-path \
274                 , \
275                 LIBS="$(PKG_CONFIGURE_LIBS)" \
276                 php_cv_cc_rpath="no" \
277         )
278         $(MAKE) -C $(PKG_BUILD_DIR)
279         mv $(PKG_BUILD_DIR)/sapi/cli/php $(PKG_BUILD_DIR)/php-cli
280   endef
281 endif
282
283 ifneq ($(CONFIG_PACKAGE_php4-cgi),)
284   define Build/Compile/php4-cgi
285         -$(MAKE) -C $(PKG_BUILD_DIR) clean
286         $(call Build/Configure/Default, \
287                 $(PKG_CONFIGURE_OPTS) \
288                 --disable-cli \
289                 --enable-cgi \
290                 --disable-fastcgi \
291                 --enable-force-cgi-redirect \
292                 --enable-discard-path \
293                 , \
294                 LIBS="$(PKG_CONFIGURE_LIBS)" \
295                 php_cv_cc_rpath="no" \
296         )
297         $(MAKE) -C $(PKG_BUILD_DIR)
298         mv $(PKG_BUILD_DIR)/sapi/cgi/php $(PKG_BUILD_DIR)/php-cgi
299   endef
300 endif
301
302 ifneq ($(CONFIG_PACKAGE_php4-fastcgi),)
303   define Build/Compile/php4-fastcgi
304         -$(MAKE) -C $(PKG_BUILD_DIR) clean
305         $(call Build/Configure/Default, \
306                 $(PKG_CONFIGURE_OPTS) \
307                 --disable-cli \
308                 --enable-cgi \
309                 --enable-fastcgi \
310                 --enable-force-cgi-redirect \
311                 --enable-discard-path \
312                 , \
313                 LIBS="$(PKG_CONFIGURE_LIBS)" \
314                 php_cv_cc_rpath="no" \
315         )
316         $(MAKE) -C $(PKG_BUILD_DIR)
317         mv $(PKG_BUILD_DIR)/sapi/cgi/php $(PKG_BUILD_DIR)/php-fastcgi
318   endef
319 endif
320
321 define Build/Compile
322         $(call Build/Compile/php4-cli)
323         $(call Build/Compile/php4-cgi)
324         $(call Build/Compile/php4-fastcgi)
325 endef
326
327 define Package/php4/conffiles
328 /etc/php.ini
329 endef
330
331 define Package/php4/install
332         $(INSTALL_DIR) $(1)/etc
333         $(INSTALL_DATA) ./files/php.ini $(1)/etc/
334 endef
335
336 define Package/php4-cli/install
337         $(INSTALL_DIR) $(1)/usr/bin
338         $(CP) $(PKG_BUILD_DIR)/php-cli $(1)/usr/bin/php
339 endef
340
341 define Package/php4-cgi/install
342         $(INSTALL_DIR) $(1)/usr/bin
343         $(CP) $(PKG_BUILD_DIR)/php-cgi $(1)/usr/bin/php
344 endef
345
346 define Package/php4-fastcgi/install
347         $(INSTALL_DIR) $(1)/usr/sbin
348         $(CP) $(PKG_BUILD_DIR)/php-fastcgi $(1)/usr/sbin/php
349         $(INSTALL_DIR) $(1)/etc/init.d
350         $(INSTALL_BIN) ./files/php.init $(1)/etc/init.d/php
351 endef
352
353 define BuildPlugin
354   define Package/$(1)/install
355         [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib/php
356         for m in $(2); do \
357                 $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$$$$$$$${m}.so $$(1)/usr/lib/php/ ; \
358         done
359   endef
360
361   $$(eval $$(call BuildPackage,$(1)))
362 endef
363
364 $(eval $(call BuildPackage,php4))
365 $(eval $(call BuildPackage,php4-cli))
366 $(eval $(call BuildPackage,php4-cgi))
367 $(eval $(call BuildPackage,php4-fastcgi))
368 $(eval $(call BuildPlugin,php4-mod-curl,curl))
369 $(eval $(call BuildPlugin,php4-mod-ftp,ftp))
370 $(eval $(call BuildPlugin,php4-mod-gd,gd))
371 $(eval $(call BuildPlugin,php4-mod-gmp,gmp))
372 $(eval $(call BuildPlugin,php4-mod-ldap,ldap))
373 $(eval $(call BuildPlugin,php4-mod-mysql,mysql))
374 $(eval $(call BuildPlugin,php4-mod-openssl,openssl))
375 $(eval $(call BuildPlugin,php4-mod-pcre,pcre))
376 $(eval $(call BuildPlugin,php4-mod-pgsql,pgsql))
377 $(eval $(call BuildPlugin,php4-mod-session,session))
378 $(eval $(call BuildPlugin,php4-mod-sockets,sockets))
379 $(eval $(call BuildPlugin,php4-mod-sqlite,sqlite))
380 $(eval $(call BuildPlugin,php4-mod-xml,xml))
381