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