2 # Copyright (C) 2006-2011 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR)/rules.mk
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=http://www.php.net/distributions/
16 PKG_MD5SUM:=2286f5a82a6e8397955a0025c1c2ad98
18 PKG_FIXUP:=libtool no-autoreconf
33 mbstring mcrypt mysql \
35 pcntl pdo pdo-mysql pdo-pgsql pdo-sqlite pgsql \
36 session simplexml soap sockets sqlite sqlite3 sysvmsg sysvsem sysvshm \
38 xml xmlreader xmlwriter \
40 PKG_CONFIG_DEPENDS:= \
41 CONFIG_PACKAGE_php5-cgi CONFIG_PACKAGE_php5-cli \
42 $(patsubst %,CONFIG_PACKAGE_%,$(PHP5_MODULES)) \
43 CONFIG_PHP5_FILTER CONFIG_PHP5_LIBXML
45 include $(INCLUDE_DIR)/package.mk
46 include $(INCLUDE_DIR)/nls.mk
48 define Package/php5/Default
52 TITLE:=PHP5 Hypertext preprocessor
53 URL:=http://www.php.net/
54 MAINTAINER:=Michael Heimpold <mhei@heimpold.de>
57 define Package/php5/Default/description
58 PHP is a widely-used general-purpose scripting language that is especially
59 suited for Web development and can be embedded into HTML.
62 define Package/php5/config
64 bool "PHP5 Filter support"
65 depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
68 bool "PHP5 LIBXML support"
69 depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
73 $(call Package/php5/Default)
74 DEPENDS:=+libpcre +zlib
75 ifneq ($(CONFIG_PHP5_LIBXML),)
78 ifneq ($(CONFIG_PACKAGE_php5-mod-apc),)
81 ifneq ($(CONFIG_PACKAGE_php5-mod-sqlite3)$(CONFIG_PACKAGE_php5-mod-pdo-sqlite),)
82 DEPENDS+= +libsqlite3 +libpthread
86 define Package/php5/description
87 $(call Package/php5/Default/description)
88 This package contains only the PHP config file. You must actually choose
89 your PHP flavour (cli, cgi or fastcgi).
92 define Package/php5-cli
93 $(call Package/php5/Default)
98 define Package/php5-cli/description
99 $(call Package/php5/Default/description)
100 This package contains the CLI version of the PHP5 interpreter.
103 define Package/php5-cgi
104 $(call Package/php5/Default)
106 TITLE+= (CGI & FastCGI)
109 define Package/php5-cgi/description
110 $(call Package/php5/Default/description)
111 This package contains the CGI version of the PHP5 interpreter.
114 define Package/php5-fastcgi
115 $(call Package/php5/Default)
116 DEPENDS:=php5 +php5-cgi
117 TITLE:=FastCGI startup script
120 define Package/php5-fastcgi/description
121 As FastCGI support is now a core feature the php5-fastcgi package now depends
122 on the php5-cgi package, containing just the startup script.
132 --with-config-file-path=/etc \
133 --with-config-file-scan-dir=/etc/php5 \
134 --enable-magic-quotes \
135 --disable-short-tags \
138 --with-zlib="$(STAGING_DIR)/usr" \
139 --with-zlib-dir="$(STAGING_DIR)/usr" \
140 --with-pcre-regex="$(STAGING_DIR)/usr" \
144 PKG_BUILD_DEPENDS+=libopenssl zlib libcurl libgd libgmp libopenldap libmysqlclient libpq libsqlite2 libpthread libsqlite3 libpcre libxml2
145 # force PKG_CONFIGURE_{LIBS,OPTS} below when built in the SDK
146 CONFIG_PACKAGE_php5-cli:=m
147 CONFIG_PACKAGE_php5-cgi:=m
148 CONFIG_PACKAGE_php5-fastcgi:=m
149 CONFIG_PACKAGE_php5-mod-curl:=m
150 CONFIG_PACKAGE_php5-mod-gd:=m
151 CONFIG_PACKAGE_php5-mod-gmp:=m
152 CONFIG_PACKAGE_php5-mod-ldap:=m
153 CONFIG_PACKAGE_php5-mod-mysql:=m
154 CONFIG_PACKAGE_php5-mod-pgsql:=m
155 CONFIG_PACKAGE_php5-mod-sqlite:=m
156 CONFIG_PACKAGE_php5-mod-sqlite3:=m
157 CONFIG_PACKAGE_php5-mod-xml:=m
160 ifneq ($(CONFIG_PACKAGE_php5-cli),)
161 CONFIGURE_ARGS+= --enable-cli
163 CONFIGURE_ARGS+= --disable-cli
166 ifneq ($(CONFIG_PACKAGE_php5-cgi),)
167 CONFIGURE_ARGS+= --enable-cgi
169 CONFIGURE_ARGS+= --disable-cgi
172 ifneq ($(CONFIG_PACKAGE_php5-mod-apc),)
173 CONFIGURE_ARGS+= --enable-apc=shared --disable-apc-mmap --disable-apc-pthreadmutex
174 CONFIGURE_LIBS+= -lrt
176 CONFIGURE_ARGS+= --disable-apc
179 ifneq ($(CONFIG_PACKAGE_php5-mod-ctype),)
180 CONFIGURE_ARGS+= --enable-ctype=shared
182 CONFIGURE_ARGS+= --disable-ctype
185 ifneq ($(CONFIG_PACKAGE_php5-mod-curl),)
186 CONFIGURE_ARGS+= --with-curl=shared,"$(STAGING_DIR)/usr"
188 CONFIGURE_ARGS+= --without-curl
191 ifneq ($(CONFIG_PACKAGE_php5-mod-fileinfo),)
192 CONFIGURE_ARGS+= --enable-fileinfo=shared
194 CONFIGURE_ARGS+= --disable-fileinfo
197 ifneq ($(CONFIG_PACKAGE_php5-mod-dom),)
198 CONFIGURE_ARGS+= --enable-dom=shared
200 CONFIGURE_ARGS+= --disable-dom
203 ifneq ($(CONFIG_PACKAGE_php5-mod-exif),)
204 CONFIGURE_ARGS+= --enable-exif=shared
206 CONFIGURE_ARGS+= --disable-exif
209 ifneq ($(CONFIG_PACKAGE_php5-mod-ftp),)
210 CONFIGURE_ARGS+= --enable-ftp=shared
212 CONFIGURE_ARGS+= --disable-ftp
215 ifneq ($(CONFIG_PACKAGE_php5-mod-gd),)
217 --with-gd=shared,"$(STAGING_DIR)/usr" \
218 --without-freetype-dir \
219 --with-jpeg-dir="$(STAGING_DIR)/usr" \
220 --with-png-dir="$(STAGING_DIR)/usr" \
223 --enable-gd-native-ttf \
224 --disable-gd-jis-conv
226 CONFIGURE_ARGS+= --without-gd
229 ifneq ($(CONFIG_PACKAGE_php5-mod-gmp),)
230 CONFIGURE_ARGS+= --with-gmp=shared,"$(STAGING_DIR)/usr"
232 CONFIGURE_ARGS+= --without-gmp
235 ifneq ($(CONFIG_PACKAGE_php5-mod-hash),)
236 CONFIGURE_ARGS+= --enable-hash=shared
238 CONFIGURE_ARGS+= --disable-hash
241 ifneq ($(CONFIG_PACKAGE_php5-mod-iconv),)
242 CONFIGURE_ARGS+= --with-iconv=shared,"$(ICONV_PREFIX)"
244 CONFIGURE_ARGS+= --without-iconv
247 ifneq ($(CONFIG_PACKAGE_php5-mod-json),)
248 CONFIGURE_ARGS+= --enable-json=shared
250 CONFIGURE_ARGS+= --disable-json
253 ifneq ($(CONFIG_PACKAGE_php5-mod-ldap),)
255 --with-ldap=shared,"$(STAGING_DIR)/usr" \
256 --with-ldap-sasl="$(STAGING_DIR)/usr"
258 CONFIGURE_ARGS+= --without-ldap
261 ifneq ($(CONFIG_PACKAGE_php5-mod-mbstring),)
262 CONFIGURE_ARGS+= --enable-mbstring=shared --enable-mbregex
264 CONFIGURE_ARGS+= --disable-mbstring
267 ifneq ($(CONFIG_PACKAGE_php5-mod-mcrypt),)
268 CONFIGURE_ARGS+= --with-mcrypt=shared,"$(STAGING_DIR)/usr"
270 CONFIGURE_ARGS+= --without-mcrypt
273 ifneq ($(CONFIG_PACKAGE_php5-mod-mysql),)
274 CONFIGURE_ARGS+= --with-mysql=shared,"$(STAGING_DIR)/usr"
276 CONFIGURE_ARGS+= --without-mysql
279 ifneq ($(CONFIG_PACKAGE_php5-mod-openssl),)
281 --with-openssl=shared,"$(STAGING_DIR)/usr" \
283 --with-openssl-dir="$(STAGING_DIR)/usr"
285 CONFIGURE_ARGS+= --without-openssl
288 ifneq ($(CONFIG_PACKAGE_php5-mod-pcntl),)
289 CONFIGURE_ARGS+= --enable-pcntl=shared
291 CONFIGURE_ARGS+= --disable-pcntl
294 ifneq ($(CONFIG_PACKAGE_php5-mod-pdo),)
295 CONFIGURE_ARGS+= --enable-pdo=shared
296 ifneq ($(CONFIG_PACKAGE_php5-mod-pdo-mysql),)
297 CONFIGURE_ARGS+= --with-pdo-mysql=shared,"$(STAGING_DIR)/usr"
299 CONFIGURE_ARGS+= --without-pdo-mysql
301 ifneq ($(CONFIG_PACKAGE_php5-mod-pdo-pgsql),)
302 CONFIGURE_ARGS+= --with-pdo-pgsql=shared,"$(STAGING_DIR)/usr"
304 CONFIGURE_ARGS+= --without-pdo-pgsql
306 ifneq ($(CONFIG_PACKAGE_php5-mod-pdo-sqlite),)
307 CONFIGURE_ARGS+= --with-pdo-sqlite=shared,"$(STAGING_DIR)/usr"
308 CONFIGURE_LIBS+= -lsqlite3 -lpthread
310 CONFIGURE_ARGS+= --without-pdo-sqlite
313 CONFIGURE_ARGS+= --disable-pdo
316 ifneq ($(CONFIG_PACKAGE_php5-mod-pgsql),)
317 CONFIGURE_ARGS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
319 CONFIGURE_ARGS+= --without-pgsql
322 ifneq ($(CONFIG_PACKAGE_php5-mod-session),)
323 CONFIGURE_ARGS+= --enable-session=shared
325 CONFIGURE_ARGS+= --disable-session
328 ifneq ($(CONFIG_PACKAGE_php5-mod-simplexml),)
329 CONFIGURE_ARGS+= --enable-simplexml=shared
331 CONFIGURE_ARGS+= --disable-simplexml
334 ifneq ($(CONFIG_PACKAGE_php5-mod-soap),)
335 CONFIGURE_ARGS+= --enable-soap=shared
337 CONFIGURE_ARGS+= --disable-soap
340 ifneq ($(CONFIG_PACKAGE_php5-mod-sockets),)
341 CONFIGURE_ARGS+= --enable-sockets=shared
343 CONFIGURE_ARGS+= --disable-sockets
346 ifneq ($(CONFIG_PACKAGE_php5-mod-sqlite),)
347 CONFIGURE_ARGS+= --with-sqlite=shared,"$(STAGING_DIR)/usr"
349 CONFIGURE_ARGS+= --without-sqlite
352 ifneq ($(CONFIG_PACKAGE_php5-mod-sqlite3),)
353 CONFIGURE_ARGS+= --with-sqlite3=shared,"$(STAGING_DIR)/usr"
354 CONFIGURE_LIBS+= -lsqlite3 -lpthread
356 CONFIGURE_ARGS+= --without-sqlite3
359 ifneq ($(CONFIG_PACKAGE_php5-mod-sysvmsg),)
360 CONFIGURE_ARGS+= --enable-sysvmsg=shared
362 CONFIGURE_ARGS+= --disable-sysvmsg
365 ifneq ($(CONFIG_PACKAGE_php5-mod-sysvsem),)
366 CONFIGURE_ARGS+= --enable-sysvsem=shared
368 CONFIGURE_ARGS+= --disable-sysvsem
371 ifneq ($(CONFIG_PACKAGE_php5-mod-sysvshm),)
372 CONFIGURE_ARGS+= --enable-sysvshm=shared
374 CONFIGURE_ARGS+= --disable-sysvshm
377 ifneq ($(CONFIG_PACKAGE_php5-mod-tokenizer),)
378 CONFIGURE_ARGS+= --enable-tokenizer=shared
380 CONFIGURE_ARGS+= --disable-tokenizer
383 ifneq ($(CONFIG_PACKAGE_php5-mod-xml),)
384 CONFIGURE_ARGS+= --enable-xml=shared,"$(STAGING_DIR)/usr"
385 ifneq ($(CONFIG_PHP5_LIBXML),)
386 CONFIGURE_ARGS+= --with-libxml-dir="$(STAGING_DIR)/usr/include/libxml2"
388 CONFIGURE_ARGS+= --with-libexpat-dir="$(STAGING_DIR)/usr"
391 CONFIGURE_ARGS+= --disable-xml
394 ifneq ($(CONFIG_PACKAGE_php5-mod-xmlreader),)
395 CONFIGURE_ARGS+= --enable-xmlreader=shared,"$(STAGING_DIR)/usr"
397 CONFIGURE_ARGS+= --disable-xmlreader
400 ifneq ($(CONFIG_PACKAGE_php5-mod-xmlwriter),)
401 CONFIGURE_ARGS+= --enable-xmlwriter=shared,"$(STAGING_DIR)/usr"
403 CONFIGURE_ARGS+= --disable-xmlwriter
406 ifneq ($(CONFIG_PHP5_FILTER),)
407 CONFIGURE_ARGS+= --enable-filter
409 CONFIGURE_ARGS+= --disable-filter
412 ifneq ($(CONFIG_PHP5_LIBXML),)
413 CONFIGURE_ARGS+= --enable-libxml
414 CONFIGURE_ARGS+= --with-libxml-dir="$(STAGING_DIR)/usr/include/libxml2"
416 CONFIGURE_ARGS+= --disable-libxml
420 LIBS="$(CONFIGURE_LIBS)" \
421 ac_cv_c_bigendian_php=$(if $(CONFIG_BIG_ENDIAN),yes,no) \
422 php_cv_cc_rpath="no" \
423 iconv_impl_name="gnu_libiconv" \
424 ac_cv_php_xml2_config_path="$(STAGING_DIR)/host/bin/xml2-config" \
426 define Package/php5/conffiles
430 define Package/php5/install
431 $(INSTALL_DIR) $(1)/etc
432 $(INSTALL_DATA) ./files/php.ini $(1)/etc/
435 define Package/php5-cli/install
436 $(INSTALL_DIR) $(1)/usr/bin
437 $(CP) $(PKG_BUILD_DIR)/sapi/cli/php $(1)/usr/bin/php-cli
440 define Package/php5-cgi/install
441 $(INSTALL_DIR) $(1)/usr/bin
442 $(CP) $(PKG_BUILD_DIR)/sapi/cgi/php-cgi $(1)/usr/bin/php-cgi
443 ln -sf php-cgi $(1)/usr/bin/php-fcgi
446 define Package/php5-fastcgi/install
447 $(INSTALL_DIR) $(1)/etc/init.d
448 $(INSTALL_BIN) ./files/php.init $(1)/etc/init.d/php
453 define Package/php5-mod-$(1)
454 $(call Package/php5/Default)
460 TITLE:=$(2) shared module
463 define Package/php5-mod-$(1)/config
464 depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
468 define Package/php5-mod-$(1)/install
469 $(INSTALL_DIR) $$(1)/usr/lib/php
470 $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$(subst -,_,$(1)).so $$(1)/usr/lib/php/
471 $(INSTALL_DIR) $$(1)/etc/php5
472 echo "extension=$(subst -,_,$(1)).so" > $$(1)/etc/php5/$(subst -,_,$(1)).ini
475 $$(eval $$(call BuildPackage,php5-mod-$(1)))
479 $(eval $(call BuildPackage,php5))
480 $(eval $(call BuildPackage,php5-cli))
481 $(eval $(call BuildPackage,php5-cgi))
482 $(eval $(call BuildPackage,php5-fastcgi))
484 #$(eval $(call BuildModule,NAME,TITLE[,PKG DEPENDS[,CONFIG DEPENDS]]))
485 $(eval $(call BuildModule,apc,APC))
486 $(eval $(call BuildModule,ctype,Ctype))
487 $(eval $(call BuildModule,curl,cURL,php5 +libcurl))
488 $(eval $(call BuildModule,fileinfo,Fileinfo,php5 +libmagic))
489 $(eval $(call BuildModule,dom,DOM,php5 +libxml2,depends on PHP5_LIBXML))
490 $(eval $(call BuildModule,exif,EXIF))
491 $(eval $(call BuildModule,ftp,FTP))
492 $(eval $(call BuildModule,gd,GD graphics,php5 +libgd))
493 $(eval $(call BuildModule,gmp,GMP,php5 +libgmp))
494 $(eval $(call BuildModule,hash,Hash))
495 $(eval $(call BuildModule,iconv,iConv,php5 +libiconv))
496 $(eval $(call BuildModule,json,JSON))
497 $(eval $(call BuildModule,ldap,LDAP,php5 +libopenldap +libsasl2))
498 $(eval $(call BuildModule,mbstring,MBString))
499 $(eval $(call BuildModule,mcrypt,Mcrypt,php5 +libmcrypt +libltdl))
500 $(eval $(call BuildModule,mysql,MySQL,php5 +libmysqlclient))
501 $(eval $(call BuildModule,openssl,OpenSSL,php5 +libopenssl))
502 $(eval $(call BuildModule,pcntl,PCNTL))
503 $(eval $(call BuildModule,pdo,PHP Data Objects))
504 $(eval $(call BuildModule,pdo-mysql,PDO driver for MySQL,php5-mod-pdo +libmysqlclient))
505 $(eval $(call BuildModule,pdo-pgsql,PDO driver for PostgreSQL,php5-mod-pdo +libpq))
506 $(eval $(call BuildModule,pdo-sqlite,PDO driver for SQLite 3.x,php5-mod-pdo +libsqlite3 +libpthread))
507 $(eval $(call BuildModule,pgsql,PostgreSQL,php5 +libpq))
508 $(eval $(call BuildModule,session,Session))
509 $(eval $(call BuildModule,simplexml,SimpleXML,php5 +libxml2,depends on PHP5_LIBXML))
510 $(eval $(call BuildModule,soap,SOAP,php5 +libxml2,depends on PHP5_LIBXML))
511 $(eval $(call BuildModule,sockets,Sockets))
512 $(eval $(call BuildModule,sqlite,SQLite 2.x,php5 +libsqlite2))
513 $(eval $(call BuildModule,sqlite3,SQLite3,php5 +libsqlite3 +libpthread))
514 $(eval $(call BuildModule,sysvmsg,System V messages))
515 $(eval $(call BuildModule,sysvsem,System V shared memory))
516 $(eval $(call BuildModule,sysvshm,System V semaphore))
517 $(eval $(call BuildModule,tokenizer,Tokenizer))
518 $(eval $(call BuildModule,xml,XML,php5 $(if $(CONFIG_PHP5_LIBXML),+libxml2,+libexpat)))
519 $(eval $(call BuildModule,xmlreader,XMLReader,php5 +libxml2 +libiconv,depends on PHP5_LIBXML))
520 $(eval $(call BuildModule,xmlwriter,XMLWriter,php5 +libxml2 +libiconv,depends on PHP5_LIBXML))