Add php5-exif module (#4188), bump release number
[packages.git] / lang / php5 / 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:=php
12 PKG_VERSION:=5.2.6
13 PKG_RELEASE:=2
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
16 PKG_SOURCE_URL:=http://www.php.net/distributions/
17 PKG_MD5SUM:=7380ffecebd95c6edb317ef861229ebd
18
19 include $(INCLUDE_DIR)/package.mk
20
21 define Package/php5/Default
22   SUBMENU:=PHP
23   SECTION:=lang
24   CATEGORY:=Languages
25   TITLE:=PHP5 Hypertext preprocessor
26   URL:=http://www.php.net/
27 endef
28
29 define Package/php5/Default/description
30  PHP is a widely-used general-purpose scripting language that is especially 
31  suited for Web development and can be embedded into HTML.
32 endef
33
34 define Package/php5
35   $(call Package/php5/Default)
36   DEPENDS:=+libopenssl +zlib
37 endef
38
39 define Package/php5/description
40 $(call Package/php5/Default/description)
41  This package contains only the PHP config file. You must actually choose 
42  your PHP flavour (cli, cgi or fastcgi).
43 endef
44
45 define Package/php5-cli
46   $(call Package/php5/Default)
47   DEPENDS:=php5
48   TITLE+= (CLI)
49 endef
50
51 define Package/php5-cli/description
52 $(call Package/php5/Default/description)
53  This package contains the CLI version of the PHP5 interpreter.
54 endef
55
56 define Package/php5-cgi
57   $(call Package/php5/Default)
58   DEPENDS:=php5
59   TITLE+= (CGI)
60 endef
61
62 define Package/php5-cgi/description
63 $(call Package/php5/Default/description)
64  This package contains the CGI version of the PHP5 interpreter.
65 endef
66
67 define Package/php5-fastcgi
68   $(call Package/php5/Default)
69   DEPENDS:=php5
70   TITLE+= (FastCGI)
71 endef
72
73 define Package/php5-fastcgi/description
74 $(call Package/php5/Default/description)
75  This package contains the FastCGI version of the PHP5 interpreter.
76 endef
77
78 define Package/php5-mod-curl
79   $(call Package/php5/Default)
80   DEPENDS:=php5 +libcurl
81   TITLE:=cURL module
82 endef
83
84 define Package/php5-mod-ftp
85   $(call Package/php5/Default)
86   DEPENDS:=php5
87   TITLE:=FTP module
88 endef
89
90 define Package/php5-mod-gd
91   $(call Package/php5/Default)
92   DEPENDS:=php5 +libgd
93   TITLE:=GD graphics module
94 endef
95
96 define Package/php5-mod-gmp
97   $(call Package/php5/Default)
98   DEPENDS:=php5 +libgmp
99   TITLE:=GMP module
100 endef
101
102 define Package/php5-mod-ldap
103   $(call Package/php5/Default)
104   DEPENDS:=php5 +libopenldap +libsasl2
105   TITLE:=LDAP module
106 endef
107
108 define Package/php5-mod-mysql
109   $(call Package/php5/Default)
110   DEPENDS:=php5 +libmysqlclient
111   TITLE:=MySQL module
112 endef
113
114 define Package/php5-mod-openssl
115   $(call Package/php5/Default)
116   DEPENDS:=php5 +libopenssl
117   TITLE:=OpenSSL module
118 endef
119
120 define Package/php5-mod-pcre
121   $(call Package/php5/Default)
122   DEPENDS:=php5 +libpcre
123   TITLE:=PCRE module
124 endef
125
126 define Package/php5-mod-pgsql
127   $(call Package/php5/Default)
128   DEPENDS:=php5 +libpq
129   TITLE:=PostgreSQL module
130 endef
131
132 define Package/php5-mod-session
133   $(call Package/php5/Default)
134   DEPENDS:=php5
135   TITLE:=Session module
136 endef
137
138 define Package/php5-mod-sockets
139   $(call Package/php5/Default)
140   DEPENDS:=php5
141   TITLE:=Sockets module
142 endef
143
144 define Package/php5-mod-sqlite
145   $(call Package/php5/Default)
146   DEPENDS:=php5 +libsqlite2
147   TITLE:=SQLite module
148 endef
149
150 define Package/php5-mod-pdo
151   $(call Package/php5/Default)
152   DEPENDS:=php5
153   TITLE:=PHP Data Objects module
154 endef
155
156 define Package/php5-mod-pdo-sqlite
157   $(call Package/php5/Default)
158   DEPENDS:=php5-mod-pdo +libsqlite3
159   TITLE:=PHP Data Objects module - SQLite support
160 endef
161
162 define Package/php5-mod-xml
163   $(call Package/php5/Default)
164   DEPENDS:=php5 +libexpat
165   TITLE:=XML module
166 endef
167
168 define Package/php5-mod-apc
169   $(call Package/php5/Default)
170   DEPENDS:=php5
171   TITLE:=APC Extension
172 endef
173
174 define Package/php5-mod-exif
175   $(call Package/php5/Default)
176   DEPENDS:=php5
177   TITLE:=EXIF Extension
178 endef
179
180 PKG_CONFIGURE_LIBS:= -lcrypto -lssl
181 PKG_CONFIGURE_OPTS:= \
182         --enable-shared \
183         --disable-static \
184         --disable-rpath \
185         --disable-debug \
186         --without-pear \
187         --disable-spl \
188         \
189         --with-config-file-path=/etc \
190         --disable-ipv6 \
191         --enable-magic-quotes \
192         --enable-memory-limit \
193         --disable-short-tags \
194         \
195         --disable-ctype \
196         --disable-dom \
197         --enable-ftp=shared \
198         --without-gettext \
199         --without-iconv \
200         --disable-libxml \
201           --without-libxml-dir \
202         --disable-xmlreader \
203         --disable-xmlwriter \
204         --disable-mbstring \
205         --disable-mbregex \
206         --with-openssl=shared,"$(STAGING_DIR)/usr" \
207           --with-kerberos=no \
208           --with-openssl-dir="$(STAGING_DIR)/usr" \
209         --enable-session=shared \
210         --disable-simplexml \
211         --disable-soap \
212         --enable-sockets=shared \
213         --disable-tokenizer \
214         --with-zlib="$(STAGING_DIR)/usr" \
215           --with-zlib-dir="$(STAGING_DIR)/usr" \
216         --disable-filter
217
218 ifneq ($(SDK),)
219   PKG_BUILD_DEPENDS:=libopenssl zlib libcurl libgd libgmp libopenldap libmysqlclient libpq libsqlite2 libexpat
220 # force PKG_CONFIGURE_{LIBS,OPTS} below when built in the SDK
221   CONFIG_PACKAGE_php5-cli:=m
222   CONFIG_PACKAGE_php5-cgi:=m
223   CONFIG_PACKAGE_php5-fastcgi:=m
224   CONFIG_PACKAGE_php5-mod-curl:=m
225   CONFIG_PACKAGE_php5-mod-gd:=m
226   CONFIG_PACKAGE_php5-mod-gmp:=m
227   CONFIG_PACKAGE_php5-mod-ldap:=m
228   CONFIG_PACKAGE_php5-mod-mysql:=m
229   CONFIG_PACKAGE_php5-mod-pcre:=m
230   CONFIG_PACKAGE_php5-mod-pgsql:=m
231   CONFIG_PACKAGE_php5-mod-sqlite:=m
232   CONFIG_PACKAGE_php5-mod-xml:=m
233 endif
234
235 ifneq ($(CONFIG_PACKAGE_php5-mod-curl),)
236   PKG_CONFIGURE_OPTS+= --with-curl=shared,"$(STAGING_DIR)/usr"
237 else
238   PKG_CONFIGURE_OPTS+= --without-curl
239 endif
240 ifneq ($(CONFIG_PACKAGE_php5-mod-gd),)
241   PKG_CONFIGURE_OPTS+= --with-gd=shared,"$(STAGING_DIR)/usr" \
242         --without-freetype-dir \
243         --with-jpeg-dir="$(STAGING_DIR)/usr" \
244         --with-png-dir="$(STAGING_DIR)/usr" \
245         --without-xpm-dir \
246         --without-ttf \
247         --without-t1lib \
248         --enable-gd-native-ttf \
249         --disable-gd-jis-conv
250 else
251   PKG_CONFIGURE_OPTS+= --without-gd
252 endif
253 ifneq ($(CONFIG_PACKAGE_php5-mod-gmp),)
254   PKG_CONFIGURE_OPTS+= --with-gmp=shared,"$(STAGING_DIR)/usr"
255 else
256   PKG_CONFIGURE_OPTS+= --without-gmp
257 endif
258 ifneq ($(CONFIG_PACKAGE_php5-mod-ldap),)
259   PKG_CONFIGURE_OPTS+= --with-ldap=shared,"$(STAGING_DIR)/usr" \
260         --with-ldap-sasl="$(STAGING_DIR)/usr"
261 else
262   PKG_CONFIGURE_OPTS+= --without-ldap
263 endif
264 ifneq ($(CONFIG_PACKAGE_php5-mod-mysql),)
265   PKG_CONFIGURE_OPTS+= --with-mysql=shared,"$(STAGING_DIR)/usr"
266 else
267   PKG_CONFIGURE_OPTS+= --without-mysql
268 endif
269 ifneq ($(CONFIG_PACKAGE_php5-mod-pcre),)
270   PKG_CONFIGURE_OPTS+= --with-pcre-regex=shared,"$(STAGING_DIR)/usr"
271 else
272   PKG_CONFIGURE_OPTS+= --without-pcre-regex
273 endif
274 ifneq ($(CONFIG_PACKAGE_php5-mod-pgsql),)
275   PKG_CONFIGURE_OPTS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
276 else
277   PKG_CONFIGURE_OPTS+= --without-pgsql
278 endif
279 ifneq ($(CONFIG_PACKAGE_php5-mod-sqlite),)
280   PKG_CONFIGURE_OPTS+= --with-sqlite=shared,"$(STAGING_DIR)/usr"
281 else
282   PKG_CONFIGURE_OPTS+= --without-sqlite
283 endif
284 ifneq ($(CONFIG_PACKAGE_php5-mod-pdo),)
285   PKG_CONFIGURE_OPTS+= --enable-pdo=shared
286   ifneq ($(CONFIG_PACKAGE_php5-mod-pdo-sqlite),)
287     PKG_CONFIGURE_OPTS+= --with-pdo-sqlite=shared,"$(STAGING_DIR)/usr"
288   endif
289 else
290   PKG_CONFIGURE_OPTS+= --disable-pdo
291 endif
292 ifneq ($(CONFIG_PACKAGE_php5-mod-xml),)
293   PKG_CONFIGURE_OPTS+= --enable-xml=shared,"$(STAGING_DIR)/usr" \
294         --with-libexpat-dir="$(STAGING_DIR)/usr"
295 else
296   PKG_CONFIGURE_OPTS+= --disable-xml
297 endif
298 ifneq ($(CONFIG_PACKAGE_php5-mod-apc),)
299   PKG_CONFIGURE_OPTS+= --enable-apc --disable-apc-mmap --disable-apc-pthreadmutex
300   PKG_CONFIGURE_LIBS+= -lrt
301 else
302   PKG_CONFIGURE_OPTS+= --disable-apc
303 endif
304 ifneq ($(CONFIG_PACKAGE_php5-mod-exif),)
305   PKG_CONFIGURE_OPTS+= --enable-exif
306 else
307   PKG_CONFIGURE_OPTS+= --disable-exif
308 endif
309
310 define Build/Configure
311 endef
312
313 ifneq ($(CONFIG_PACKAGE_php5-cli),)
314   define Build/Compile/php5-cli
315         -$(MAKE) -C $(PKG_BUILD_DIR) clean
316         $(call Build/Configure/Default, \
317                 $(PKG_CONFIGURE_OPTS) \
318                 --enable-cli \
319                 --disable-cgi \
320                 --disable-fastcgi \
321                 --enable-force-cgi-redirect \
322                 --enable-discard-path \
323                 , \
324                 LIBS="$(PKG_CONFIGURE_LIBS)" \
325                 php_cv_cc_rpath="no" \
326         )
327         $(MAKE) -C $(PKG_BUILD_DIR)
328         mv $(PKG_BUILD_DIR)/sapi/cli/php $(PKG_BUILD_DIR)/php-cli
329   endef
330 endif
331
332 ifneq ($(CONFIG_PACKAGE_php5-cgi),)
333   define Build/Compile/php5-cgi
334         -$(MAKE) -C $(PKG_BUILD_DIR) clean
335         $(call Build/Configure/Default, \
336                 $(PKG_CONFIGURE_OPTS) \
337                 --disable-cli \
338                 --enable-cgi \
339                 --disable-fastcgi \
340                 --enable-force-cgi-redirect \
341                 --enable-discard-path \
342                 , \
343                 LIBS="$(PKG_CONFIGURE_LIBS)" \
344                 php_cv_cc_rpath="no" \
345         )
346         $(MAKE) -C $(PKG_BUILD_DIR)
347         mv $(PKG_BUILD_DIR)/sapi/cgi/php-cgi $(PKG_BUILD_DIR)/php-cgi
348   endef
349 endif
350
351 ifneq ($(CONFIG_PACKAGE_php5-fastcgi),)
352   define Build/Compile/php5-fastcgi
353         -$(MAKE) -C $(PKG_BUILD_DIR) clean
354         rm $(PKG_BUILD_DIR)/configure
355         cd $(PKG_BUILD_DIR) && ./buildconf --force
356         $(call Build/Configure/Default, \
357                 $(PKG_CONFIGURE_OPTS) \
358                 --disable-cli \
359                 --enable-cgi \
360                 --enable-fastcgi \
361                 --enable-force-cgi-redirect \
362                 --enable-discard-path \
363                 , \
364                 LIBS="$(PKG_CONFIGURE_LIBS)" \
365                 php_cv_cc_rpath="no" \
366         )
367         $(MAKE) -C $(PKG_BUILD_DIR)
368         mv $(PKG_BUILD_DIR)/sapi/cgi/php-cgi $(PKG_BUILD_DIR)/php-fcgi
369   endef
370 endif
371
372 define Build/Compile
373         $(call Build/Compile/php5-cli)
374         $(call Build/Compile/php5-cgi)
375         $(call Build/Compile/php5-fastcgi)
376 endef
377
378 define Package/php5/conffiles
379 /etc/php.ini
380 endef
381
382 define Package/php5/install
383         $(INSTALL_DIR) $(1)/etc
384         $(INSTALL_DATA) ./files/php.ini $(1)/etc/
385 endef
386
387 define Package/php5-cli/install
388         $(INSTALL_DIR) $(1)/usr/bin
389         $(CP) $(PKG_BUILD_DIR)/php-cli $(1)/usr/bin/php-cli
390 endef
391
392 define Package/php5-cgi/install
393         $(INSTALL_DIR) $(1)/usr/bin
394         $(CP) $(PKG_BUILD_DIR)/php-cgi $(1)/usr/bin/php-cgi
395 endef
396
397 define Package/php5-fastcgi/install
398         $(INSTALL_DIR) $(1)/usr/bin
399         $(CP) $(PKG_BUILD_DIR)/php-fcgi $(1)/usr/bin/php-fcgi
400         $(INSTALL_DIR) $(1)/etc/init.d
401         $(INSTALL_BIN) ./files/php.init $(1)/etc/init.d/php
402 endef
403
404 define BuildPlugin
405   define Package/$(1)/install
406         [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib/php
407         for m in $(2); do \
408                 $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$$$$$$$${m}.so $$(1)/usr/lib/php/ ; \
409         done
410   endef
411
412   $$(eval $$(call BuildPackage,$(1)))
413 endef
414
415 $(eval $(call BuildPackage,php5))
416 $(eval $(call BuildPackage,php5-cli))
417 $(eval $(call BuildPackage,php5-cgi))
418 $(eval $(call BuildPackage,php5-fastcgi))
419 $(eval $(call BuildPlugin,php5-mod-curl,curl))
420 $(eval $(call BuildPlugin,php5-mod-ftp,ftp))
421 $(eval $(call BuildPlugin,php5-mod-gd,gd))
422 $(eval $(call BuildPlugin,php5-mod-gmp,gmp))
423 $(eval $(call BuildPlugin,php5-mod-ldap,ldap))
424 $(eval $(call BuildPlugin,php5-mod-mysql,mysql))
425 $(eval $(call BuildPlugin,php5-mod-openssl,openssl))
426 $(eval $(call BuildPlugin,php5-mod-pcre,pcre))
427 $(eval $(call BuildPlugin,php5-mod-pgsql,pgsql))
428 $(eval $(call BuildPlugin,php5-mod-session,session))
429 $(eval $(call BuildPlugin,php5-mod-sockets,sockets))
430 $(eval $(call BuildPlugin,php5-mod-sqlite,sqlite))
431 $(eval $(call BuildPlugin,php5-mod-pdo,pdo))
432 $(eval $(call BuildPlugin,php5-mod-pdo-sqlite,pdo_sqlite))
433 $(eval $(call BuildPlugin,php5-mod-xml,xml))
434 $(eval $(call BuildPlugin,php5-mod-apc))
435 $(eval $(call BuildPlugin,php5-mod-exif))