[packages] php5: fix dependencies for apc and sqlite3 (closes #9368)
[openwrt/svn-archive/archive.git] / lang / php5 / Makefile
1 #
2 # Copyright (C) 2006-2011 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.3.6
12 PKG_RELEASE:=6
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=http://www.php.net/distributions/
16 PKG_MD5SUM:=2286f5a82a6e8397955a0025c1c2ad98
17
18 PKG_FIXUP:=libtool no-autoreconf
19 PKG_BUILD_PARALLEL:=1
20
21 PHP5_MODULES = \
22 apc \
23 ctype curl \
24 fileinfo \
25 dio dom \
26 exif \
27 ftp \
28 gettext gd gmp \
29 hash \
30 iconv \
31 json \
32 ldap libevent \
33 mbstring mcrypt mysql \
34 openssl \
35 pcntl pdo pdo-mysql pdo-pgsql pdo-sqlite pgsql \
36 session simplexml soap sockets sqlite sqlite3 sysvmsg sysvsem sysvshm \
37 tokenizer \
38 xml xmlreader xmlwriter \
39
40 PKG_CONFIG_DEPENDS:= \
41 CONFIG_PACKAGE_php5-cgi CONFIG_PACKAGE_php5-cli \
42 $(patsubst %,CONFIG_PACKAGE_php5-mod-%,$(PHP5_MODULES)) \
43 CONFIG_PHP5_FILTER CONFIG_PHP5_LIBXML
44
45 include $(INCLUDE_DIR)/package.mk
46 include $(INCLUDE_DIR)/nls.mk
47
48 define Package/php5/Default
49 SUBMENU:=PHP
50 SECTION:=lang
51 CATEGORY:=Languages
52 TITLE:=PHP5 Hypertext preprocessor
53 URL:=http://www.php.net/
54 MAINTAINER:=Michael Heimpold <mhei@heimpold.de>
55 DEPENDS:=php5
56 endef
57
58 define Package/php5/Default/description
59 PHP is a widely-used general-purpose scripting language that is especially
60 suited for Web development and can be embedded into HTML.
61 endef
62
63 define Package/php5/config
64 config PHP5_FILTER
65 bool "PHP5 Filter support"
66 depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
67
68 config PHP5_LIBXML
69 bool "PHP5 LIBXML support"
70 depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
71 endef
72
73 define Package/php5
74 $(call Package/php5/Default)
75
76 DEPENDS:=+libpcre +zlib \
77 +PHP5_LIBXML:libxml2
78 endef
79
80 define Package/php5/description
81 $(call Package/php5/Default/description)
82 This package contains only the PHP config file. You must actually choose
83 your PHP flavour (cli, cgi or fastcgi).
84 endef
85
86 define Package/php5-cli
87 $(call Package/php5/Default)
88 TITLE+= (CLI)
89 endef
90
91 define Package/php5-cli/description
92 $(call Package/php5/Default/description)
93 This package contains the CLI version of the PHP5 interpreter.
94 endef
95
96 define Package/php5-cgi
97 $(call Package/php5/Default)
98 TITLE+= (CGI & FastCGI)
99 endef
100
101 define Package/php5-cgi/description
102 $(call Package/php5/Default/description)
103 This package contains the CGI version of the PHP5 interpreter.
104 endef
105
106 define Package/php5-fastcgi
107 $(call Package/php5/Default)
108 DEPENDS+= +php5-cgi
109 TITLE:=FastCGI startup script
110 endef
111
112 define Package/php5-fastcgi/description
113 As FastCGI support is now a core feature the php5-fastcgi package now depends
114 on the php5-cgi package, containing just the startup script.
115 endef
116
117 CONFIGURE_ARGS+= \
118 --enable-shared \
119 --disable-static \
120 --disable-rpath \
121 --disable-debug \
122 --without-pear \
123 \
124 --with-config-file-path=/etc \
125 --with-config-file-scan-dir=/etc/php5 \
126 --enable-magic-quotes \
127 --disable-short-tags \
128 \
129 --with-zlib="$(STAGING_DIR)/usr" \
130 --with-zlib-dir="$(STAGING_DIR)/usr" \
131 --with-pcre-regex="$(STAGING_DIR)/usr" \
132 --disable-phar
133
134 ifneq ($(SDK),)
135 PKG_BUILD_DEPENDS+=libopenssl zlib libcurl libgd libgmp libopenldap libmysqlclient libpq libsqlite2 libpthread libsqlite3 libpcre libxml2
136 # force PKG_CONFIGURE_{LIBS,OPTS} below when built in the SDK
137 CONFIG_PACKAGE_php5-cli:=m
138 CONFIG_PACKAGE_php5-cgi:=m
139 CONFIG_PACKAGE_php5-fastcgi:=m
140 CONFIG_PACKAGE_php5-mod-curl:=m
141 CONFIG_PACKAGE_php5-mod-gd:=m
142 CONFIG_PACKAGE_php5-mod-gmp:=m
143 CONFIG_PACKAGE_php5-mod-ldap:=m
144 CONFIG_PACKAGE_php5-mod-mysql:=m
145 CONFIG_PACKAGE_php5-mod-pgsql:=m
146 CONFIG_PACKAGE_php5-mod-sqlite:=m
147 CONFIG_PACKAGE_php5-mod-sqlite3:=m
148 CONFIG_PACKAGE_php5-mod-xml:=m
149 endif
150
151 ifneq ($(CONFIG_PACKAGE_php5-cli),)
152 CONFIGURE_ARGS+= --enable-cli
153 else
154 CONFIGURE_ARGS+= --disable-cli
155 endif
156
157 ifneq ($(CONFIG_PACKAGE_php5-cgi),)
158 CONFIGURE_ARGS+= --enable-cgi
159 else
160 CONFIGURE_ARGS+= --disable-cgi
161 endif
162
163 ifneq ($(CONFIG_PACKAGE_php5-mod-apc),)
164 CONFIGURE_ARGS+= --enable-apc=shared --disable-apc-mmap --disable-apc-pthreadmutex
165 else
166 CONFIGURE_ARGS+= --disable-apc
167 endif
168
169 ifneq ($(CONFIG_PACKAGE_php5-mod-ctype),)
170 CONFIGURE_ARGS+= --enable-ctype=shared
171 else
172 CONFIGURE_ARGS+= --disable-ctype
173 endif
174
175 ifneq ($(CONFIG_PACKAGE_php5-mod-curl),)
176 CONFIGURE_ARGS+= --with-curl=shared,"$(STAGING_DIR)/usr"
177 else
178 CONFIGURE_ARGS+= --without-curl
179 endif
180
181 ifneq ($(CONFIG_PACKAGE_php5-mod-fileinfo),)
182 CONFIGURE_ARGS+= --enable-fileinfo=shared
183 else
184 CONFIGURE_ARGS+= --disable-fileinfo
185 endif
186
187 ifneq ($(CONFIG_PACKAGE_php5-mod-gettext),)
188 CONFIGURE_ARGS+= --with-gettext=shared,"$(STAGING_DIR)/usr/lib/libintl-full"
189 else
190 CONFIGURE_ARGS+= --without-gettext
191 endif
192
193 ifneq ($(CONFIG_PACKAGE_php5-mod-dio),)
194 CONFIGURE_ARGS+= --enable-dio=shared
195 else
196 CONFIGURE_ARGS+= --disable-dio
197 endif
198
199 ifneq ($(CONFIG_PACKAGE_php5-mod-dom),)
200 CONFIGURE_ARGS+= --enable-dom=shared
201 else
202 CONFIGURE_ARGS+= --disable-dom
203 endif
204
205 ifneq ($(CONFIG_PACKAGE_php5-mod-exif),)
206 CONFIGURE_ARGS+= --enable-exif=shared
207 else
208 CONFIGURE_ARGS+= --disable-exif
209 endif
210
211 ifneq ($(CONFIG_PACKAGE_php5-mod-ftp),)
212 CONFIGURE_ARGS+= --enable-ftp=shared
213 else
214 CONFIGURE_ARGS+= --disable-ftp
215 endif
216
217 ifneq ($(CONFIG_PACKAGE_php5-mod-gd),)
218 CONFIGURE_ARGS+= \
219 --with-gd=shared,"$(STAGING_DIR)/usr" \
220 --without-freetype-dir \
221 --with-jpeg-dir="$(STAGING_DIR)/usr" \
222 --with-png-dir="$(STAGING_DIR)/usr" \
223 --without-xpm-dir \
224 --without-t1lib \
225 --enable-gd-native-ttf \
226 --disable-gd-jis-conv
227 else
228 CONFIGURE_ARGS+= --without-gd
229 endif
230
231 ifneq ($(CONFIG_PACKAGE_php5-mod-gmp),)
232 CONFIGURE_ARGS+= --with-gmp=shared,"$(STAGING_DIR)/usr"
233 else
234 CONFIGURE_ARGS+= --without-gmp
235 endif
236
237 ifneq ($(CONFIG_PACKAGE_php5-mod-hash),)
238 CONFIGURE_ARGS+= --enable-hash=shared
239 else
240 CONFIGURE_ARGS+= --disable-hash
241 endif
242
243 ifneq ($(CONFIG_PACKAGE_php5-mod-iconv),)
244 CONFIGURE_ARGS+= --with-iconv=shared,"$(ICONV_PREFIX)"
245 else
246 CONFIGURE_ARGS+= --without-iconv
247 endif
248
249 ifneq ($(CONFIG_PACKAGE_php5-mod-json),)
250 CONFIGURE_ARGS+= --enable-json=shared
251 else
252 CONFIGURE_ARGS+= --disable-json
253 endif
254
255 ifneq ($(CONFIG_PACKAGE_php5-mod-ldap),)
256 CONFIGURE_ARGS+= \
257 --with-ldap=shared,"$(STAGING_DIR)/usr" \
258 --with-ldap-sasl="$(STAGING_DIR)/usr"
259 else
260 CONFIGURE_ARGS+= --without-ldap
261 endif
262
263 ifneq ($(CONFIG_PACKAGE_php5-mod-libevent),)
264 CONFIGURE_ARGS+= --with-libevent=shared,"$(STAGING_DIR)/usr"
265 else
266 CONFIGURE_ARGS+= --without-libevent
267 endif
268
269 ifneq ($(CONFIG_PACKAGE_php5-mod-mbstring),)
270 CONFIGURE_ARGS+= --enable-mbstring=shared --enable-mbregex
271 else
272 CONFIGURE_ARGS+= --disable-mbstring
273 endif
274
275 ifneq ($(CONFIG_PACKAGE_php5-mod-mcrypt),)
276 CONFIGURE_ARGS+= --with-mcrypt=shared,"$(STAGING_DIR)/usr"
277 else
278 CONFIGURE_ARGS+= --without-mcrypt
279 endif
280
281 ifneq ($(CONFIG_PACKAGE_php5-mod-mysql),)
282 CONFIGURE_ARGS+= --with-mysql=shared,"$(STAGING_DIR)/usr"
283 else
284 CONFIGURE_ARGS+= --without-mysql
285 endif
286
287 ifneq ($(CONFIG_PACKAGE_php5-mod-openssl),)
288 CONFIGURE_ARGS+= \
289 --with-openssl=shared,"$(STAGING_DIR)/usr" \
290 --with-kerberos=no \
291 --with-openssl-dir="$(STAGING_DIR)/usr"
292 else
293 CONFIGURE_ARGS+= --without-openssl
294 endif
295
296 ifneq ($(CONFIG_PACKAGE_php5-mod-pcntl),)
297 CONFIGURE_ARGS+= --enable-pcntl=shared
298 else
299 CONFIGURE_ARGS+= --disable-pcntl
300 endif
301
302 ifneq ($(CONFIG_PACKAGE_php5-mod-pdo),)
303 CONFIGURE_ARGS+= --enable-pdo=shared
304 ifneq ($(CONFIG_PACKAGE_php5-mod-pdo-mysql),)
305 CONFIGURE_ARGS+= --with-pdo-mysql=shared,"$(STAGING_DIR)/usr"
306 else
307 CONFIGURE_ARGS+= --without-pdo-mysql
308 endif
309 ifneq ($(CONFIG_PACKAGE_php5-mod-pdo-pgsql),)
310 CONFIGURE_ARGS+= --with-pdo-pgsql=shared,"$(STAGING_DIR)/usr"
311 else
312 CONFIGURE_ARGS+= --without-pdo-pgsql
313 endif
314 ifneq ($(CONFIG_PACKAGE_php5-mod-pdo-sqlite),)
315 CONFIGURE_ARGS+= --with-pdo-sqlite=shared,"$(STAGING_DIR)/usr"
316 else
317 CONFIGURE_ARGS+= --without-pdo-sqlite
318 endif
319 else
320 CONFIGURE_ARGS+= --disable-pdo
321 endif
322
323 ifneq ($(CONFIG_PACKAGE_php5-mod-pgsql),)
324 CONFIGURE_ARGS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
325 else
326 CONFIGURE_ARGS+= --without-pgsql
327 endif
328
329 ifneq ($(CONFIG_PACKAGE_php5-mod-session),)
330 CONFIGURE_ARGS+= --enable-session=shared
331 else
332 CONFIGURE_ARGS+= --disable-session
333 endif
334
335 ifneq ($(CONFIG_PACKAGE_php5-mod-simplexml),)
336 CONFIGURE_ARGS+= --enable-simplexml=shared
337 else
338 CONFIGURE_ARGS+= --disable-simplexml
339 endif
340
341 ifneq ($(CONFIG_PACKAGE_php5-mod-soap),)
342 CONFIGURE_ARGS+= --enable-soap=shared
343 else
344 CONFIGURE_ARGS+= --disable-soap
345 endif
346
347 ifneq ($(CONFIG_PACKAGE_php5-mod-sockets),)
348 CONFIGURE_ARGS+= --enable-sockets=shared
349 else
350 CONFIGURE_ARGS+= --disable-sockets
351 endif
352
353 ifneq ($(CONFIG_PACKAGE_php5-mod-sqlite),)
354 CONFIGURE_ARGS+= --with-sqlite=shared,"$(STAGING_DIR)/usr"
355 else
356 CONFIGURE_ARGS+= --without-sqlite
357 endif
358
359 ifneq ($(CONFIG_PACKAGE_php5-mod-sqlite3),)
360 CONFIGURE_ARGS+= --with-sqlite3=shared,"$(STAGING_DIR)/usr"
361 else
362 CONFIGURE_ARGS+= --without-sqlite3
363 endif
364
365 ifneq ($(CONFIG_PACKAGE_php5-mod-sysvmsg),)
366 CONFIGURE_ARGS+= --enable-sysvmsg=shared
367 else
368 CONFIGURE_ARGS+= --disable-sysvmsg
369 endif
370
371 ifneq ($(CONFIG_PACKAGE_php5-mod-sysvsem),)
372 CONFIGURE_ARGS+= --enable-sysvsem=shared
373 else
374 CONFIGURE_ARGS+= --disable-sysvsem
375 endif
376
377 ifneq ($(CONFIG_PACKAGE_php5-mod-sysvshm),)
378 CONFIGURE_ARGS+= --enable-sysvshm=shared
379 else
380 CONFIGURE_ARGS+= --disable-sysvshm
381 endif
382
383 ifneq ($(CONFIG_PACKAGE_php5-mod-tokenizer),)
384 CONFIGURE_ARGS+= --enable-tokenizer=shared
385 else
386 CONFIGURE_ARGS+= --disable-tokenizer
387 endif
388
389 ifneq ($(CONFIG_PACKAGE_php5-mod-xml),)
390 CONFIGURE_ARGS+= --enable-xml=shared,"$(STAGING_DIR)/usr"
391 ifneq ($(CONFIG_PHP5_LIBXML),)
392 CONFIGURE_ARGS+= --with-libxml-dir="$(STAGING_DIR)/usr/include/libxml2"
393 else
394 CONFIGURE_ARGS+= --with-libexpat-dir="$(STAGING_DIR)/usr"
395 endif
396 else
397 CONFIGURE_ARGS+= --disable-xml
398 endif
399
400 ifneq ($(CONFIG_PACKAGE_php5-mod-xmlreader),)
401 CONFIGURE_ARGS+= --enable-xmlreader=shared,"$(STAGING_DIR)/usr"
402 else
403 CONFIGURE_ARGS+= --disable-xmlreader
404 endif
405
406 ifneq ($(CONFIG_PACKAGE_php5-mod-xmlwriter),)
407 CONFIGURE_ARGS+= --enable-xmlwriter=shared,"$(STAGING_DIR)/usr"
408 else
409 CONFIGURE_ARGS+= --disable-xmlwriter
410 endif
411
412 ifneq ($(CONFIG_PHP5_FILTER),)
413 CONFIGURE_ARGS+= --enable-filter
414 else
415 CONFIGURE_ARGS+= --disable-filter
416 endif
417
418 ifneq ($(CONFIG_PHP5_LIBXML),)
419 CONFIGURE_ARGS+= --enable-libxml
420 CONFIGURE_ARGS+= --with-libxml-dir="$(STAGING_DIR)/usr/include/libxml2"
421 else
422 CONFIGURE_ARGS+= --disable-libxml
423 endif
424
425 CONFIGURE_VARS+= \
426 LIBS="$(CONFIGURE_LIBS)" \
427 ac_cv_c_bigendian_php=$(if $(CONFIG_BIG_ENDIAN),yes,no) \
428 php_cv_cc_rpath="no" \
429 iconv_impl_name="gnu_libiconv" \
430 ac_cv_php_xml2_config_path="$(STAGING_DIR)/host/bin/xml2-config" \
431
432 define Package/php5/conffiles
433 /etc/php.ini
434 endef
435
436 define Package/php5/install
437 $(INSTALL_DIR) $(1)/etc
438 $(INSTALL_DATA) ./files/php.ini $(1)/etc/
439 endef
440
441 define Package/php5-cli/install
442 $(INSTALL_DIR) $(1)/usr/bin
443 $(CP) $(PKG_BUILD_DIR)/sapi/cli/php $(1)/usr/bin/php-cli
444 endef
445
446 define Package/php5-cgi/install
447 $(INSTALL_DIR) $(1)/usr/bin
448 $(CP) $(PKG_BUILD_DIR)/sapi/cgi/php-cgi $(1)/usr/bin/php-cgi
449 ln -sf php-cgi $(1)/usr/bin/php-fcgi
450 endef
451
452 define Package/php5-fastcgi/install
453 $(INSTALL_DIR) $(1)/etc/init.d
454 $(INSTALL_BIN) ./files/php.init $(1)/etc/init.d/php
455 endef
456
457 define BuildModule
458
459 define Package/php5-mod-$(1)
460 $(call Package/php5/Default)
461
462 ifneq ($(3),)
463 DEPENDS+=$(3)
464 endif
465
466 TITLE:=$(2) shared module
467 endef
468
469 define Package/php5-mod-$(1)/install
470 $(INSTALL_DIR) $$(1)/usr/lib/php
471 $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$(subst -,_,$(1)).so $$(1)/usr/lib/php/
472 $(INSTALL_DIR) $$(1)/etc/php5
473 echo "extension=$(subst -,_,$(1)).so" > $$(1)/etc/php5/$(subst -,_,$(1)).ini
474 endef
475
476 $$(eval $$(call BuildPackage,php5-mod-$(1)))
477
478 endef
479
480 $(eval $(call BuildPackage,php5))
481 $(eval $(call BuildPackage,php5-cli))
482 $(eval $(call BuildPackage,php5-cgi))
483 $(eval $(call BuildPackage,php5-fastcgi))
484
485 #$(eval $(call BuildModule,NAME,TITLE[,PKG DEPENDS]))
486 $(eval $(call BuildModule,apc,APC,+librt))
487 $(eval $(call BuildModule,ctype,Ctype))
488 $(eval $(call BuildModule,curl,cURL,+libcurl))
489 $(eval $(call BuildModule,fileinfo,Fileinfo,+libmagic))
490 $(eval $(call BuildModule,dio,Direct IO))
491 $(eval $(call BuildModule,dom,DOM,@PHP5_LIBXML +libxml2))
492 $(eval $(call BuildModule,exif,EXIF))
493 $(eval $(call BuildModule,ftp,FTP))
494 $(eval $(call BuildModule,gettext,Gettext,+libintl-full))
495 $(eval $(call BuildModule,gd,GD graphics,+libgd))
496 $(eval $(call BuildModule,gmp,GMP,+libgmp))
497 $(eval $(call BuildModule,hash,Hash))
498 $(eval $(call BuildModule,iconv,iConv,+libiconv))
499 $(eval $(call BuildModule,json,JSON))
500 $(eval $(call BuildModule,ldap,LDAP,+libopenldap +libsasl2))
501 $(eval $(call BuildModule,libevent,libevent,+libevent))
502 $(eval $(call BuildModule,mbstring,MBString))
503 $(eval $(call BuildModule,mcrypt,Mcrypt,+libmcrypt +libltdl))
504 $(eval $(call BuildModule,mysql,MySQL,+libmysqlclient))
505 $(eval $(call BuildModule,openssl,OpenSSL,+libopenssl))
506 $(eval $(call BuildModule,pcntl,PCNTL))
507 $(eval $(call BuildModule,pdo,PHP Data Objects))
508 $(eval $(call BuildModule,pdo-mysql,PDO driver for MySQL,php5-mod-pdo +libmysqlclient))
509 $(eval $(call BuildModule,pdo-pgsql,PDO driver for PostgreSQL,php5-mod-pdo +libpq))
510 $(eval $(call BuildModule,pdo-sqlite,PDO driver for SQLite 3.x,php5-mod-pdo +libsqlite3 +libpthread))
511 $(eval $(call BuildModule,pgsql,PostgreSQL,+libpq))
512 $(eval $(call BuildModule,session,Session))
513 $(eval $(call BuildModule,simplexml,SimpleXML,@PHP5_LIBXML +libxml2))
514 $(eval $(call BuildModule,soap,SOAP,@PHP5_LIBXML +libxml2))
515 $(eval $(call BuildModule,sockets,Sockets))
516 $(eval $(call BuildModule,sqlite,SQLite 2.x,+libsqlite2))
517 $(eval $(call BuildModule,sqlite3,SQLite3,+libsqlite3 +libpthread))
518 $(eval $(call BuildModule,sysvmsg,System V messages))
519 $(eval $(call BuildModule,sysvsem,System V shared memory))
520 $(eval $(call BuildModule,sysvshm,System V semaphore))
521 $(eval $(call BuildModule,tokenizer,Tokenizer))
522 $(eval $(call BuildModule,xml,XML,+PHP5_LIBXML:libxml2 +!PHP5_LIBXML:libexpat))
523 $(eval $(call BuildModule,xmlreader,XMLReader,@PHP5_LIBXML +libxml2 +libiconv))
524 $(eval $(call BuildModule,xmlwriter,XMLWriter,@PHP5_LIBXML +libxml2 +libiconv))