2 # Copyright (C) 2006,2007 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:=7380ffecebd95c6edb317ef861229ebd
18 include $(INCLUDE_DIR)/package.mk
20 define Package/php5/Default
24 TITLE:=PHP5 Hypertext preprocessor
25 URL:=http://www.php.net/
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.
34 $(call Package/php5/Default)
35 DEPENDS:=+libopenssl +zlib
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).
44 define Package/php5-cli
45 $(call Package/php5/Default)
50 define Package/php5-cli/description
51 $(call Package/php5/Default/description)
52 This package contains the CLI version of the PHP5 interpreter.
55 define Package/php5-cgi
56 $(call Package/php5/Default)
61 define Package/php5-cgi/description
62 $(call Package/php5/Default/description)
63 This package contains the CGI version of the PHP5 interpreter.
66 define Package/php5-fastcgi
67 $(call Package/php5/Default)
72 define Package/php5-fastcgi/description
73 $(call Package/php5/Default/description)
74 This package contains the FastCGI version of the PHP5 interpreter.
77 define Package/php5-mod-curl
78 $(call Package/php5/Default)
79 DEPENDS:=php5 +libcurl
83 define Package/php5-mod-ftp
84 $(call Package/php5/Default)
89 define Package/php5-mod-gd
90 $(call Package/php5/Default)
92 TITLE:=GD graphics module
95 define Package/php5-mod-gmp
96 $(call Package/php5/Default)
101 define Package/php5-mod-ldap
102 $(call Package/php5/Default)
103 DEPENDS:=php5 +libopenldap +libsasl2
107 define Package/php5-mod-mysql
108 $(call Package/php5/Default)
109 DEPENDS:=php5 +libmysqlclient
113 define Package/php5-mod-openssl
114 $(call Package/php5/Default)
115 DEPENDS:=php5 +libopenssl
116 TITLE:=OpenSSL module
119 define Package/php5-mod-pcre
120 $(call Package/php5/Default)
121 DEPENDS:=php5 +libpcre
125 define Package/php5-mod-pgsql
126 $(call Package/php5/Default)
128 TITLE:=PostgreSQL module
131 define Package/php5-mod-session
132 $(call Package/php5/Default)
134 TITLE:=Session module
137 define Package/php5-mod-sockets
138 $(call Package/php5/Default)
140 TITLE:=Sockets module
143 define Package/php5-mod-sqlite
144 $(call Package/php5/Default)
145 DEPENDS:=php5 +libsqlite2
149 define Package/php5-mod-pdo
150 $(call Package/php5/Default)
152 TITLE:=PHP Data Objects module
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
161 define Package/php5-mod-xml
162 $(call Package/php5/Default)
163 DEPENDS:=php5 +libexpat
167 define Package/php5-mod-apc
168 $(call Package/php5/Default)
173 define Package/php5-mod-exif
174 $(call Package/php5/Default)
176 TITLE:=EXIF Extension
179 PKG_CONFIGURE_LIBS:= -lcrypto -lssl
180 PKG_CONFIGURE_OPTS:= \
188 --with-config-file-path=/etc \
190 --enable-magic-quotes \
191 --enable-memory-limit \
192 --disable-short-tags \
196 --enable-ftp=shared \
200 --without-libxml-dir \
201 --disable-xmlreader \
202 --disable-xmlwriter \
205 --with-openssl=shared,"$(STAGING_DIR)/usr" \
207 --with-openssl-dir="$(STAGING_DIR)/usr" \
208 --enable-session=shared \
209 --disable-simplexml \
211 --enable-sockets=shared \
212 --disable-tokenizer \
213 --with-zlib="$(STAGING_DIR)/usr" \
214 --with-zlib-dir="$(STAGING_DIR)/usr" \
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
234 ifneq ($(CONFIG_PACKAGE_php5-mod-curl),)
235 PKG_CONFIGURE_OPTS+= --with-curl=shared,"$(STAGING_DIR)/usr"
237 PKG_CONFIGURE_OPTS+= --without-curl
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" \
247 --enable-gd-native-ttf \
248 --disable-gd-jis-conv
250 PKG_CONFIGURE_OPTS+= --without-gd
252 ifneq ($(CONFIG_PACKAGE_php5-mod-gmp),)
253 PKG_CONFIGURE_OPTS+= --with-gmp=shared,"$(STAGING_DIR)/usr"
255 PKG_CONFIGURE_OPTS+= --without-gmp
257 ifneq ($(CONFIG_PACKAGE_php5-mod-ldap),)
258 PKG_CONFIGURE_OPTS+= --with-ldap=shared,"$(STAGING_DIR)/usr" \
259 --with-ldap-sasl="$(STAGING_DIR)/usr"
261 PKG_CONFIGURE_OPTS+= --without-ldap
263 ifneq ($(CONFIG_PACKAGE_php5-mod-mysql),)
264 PKG_CONFIGURE_OPTS+= --with-mysql=shared,"$(STAGING_DIR)/usr"
266 PKG_CONFIGURE_OPTS+= --without-mysql
268 ifneq ($(CONFIG_PACKAGE_php5-mod-pcre),)
269 PKG_CONFIGURE_OPTS+= --with-pcre-regex=shared,"$(STAGING_DIR)/usr"
271 PKG_CONFIGURE_OPTS+= --without-pcre-regex
273 ifneq ($(CONFIG_PACKAGE_php5-mod-pgsql),)
274 PKG_CONFIGURE_OPTS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
276 PKG_CONFIGURE_OPTS+= --without-pgsql
278 ifneq ($(CONFIG_PACKAGE_php5-mod-sqlite),)
279 PKG_CONFIGURE_OPTS+= --with-sqlite=shared,"$(STAGING_DIR)/usr"
281 PKG_CONFIGURE_OPTS+= --without-sqlite
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"
289 PKG_CONFIGURE_OPTS+= --disable-pdo
291 ifneq ($(CONFIG_PACKAGE_php5-mod-xml),)
292 PKG_CONFIGURE_OPTS+= --enable-xml=shared,"$(STAGING_DIR)/usr" \
293 --with-libexpat-dir="$(STAGING_DIR)/usr"
295 PKG_CONFIGURE_OPTS+= --disable-xml
297 ifneq ($(CONFIG_PACKAGE_php5-mod-apc),)
298 PKG_CONFIGURE_OPTS+= --enable-apc --disable-apc-mmap --disable-apc-pthreadmutex
299 PKG_CONFIGURE_LIBS+= -lrt
301 PKG_CONFIGURE_OPTS+= --disable-apc
303 ifneq ($(CONFIG_PACKAGE_php5-mod-exif),)
304 PKG_CONFIGURE_OPTS+= --enable-exif
306 PKG_CONFIGURE_OPTS+= --disable-exif
309 define Build/Configure
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) \
320 --enable-force-cgi-redirect \
321 --enable-discard-path \
323 LIBS="$(PKG_CONFIGURE_LIBS)" \
324 php_cv_cc_rpath="no" \
326 $(MAKE) -C $(PKG_BUILD_DIR)
327 mv $(PKG_BUILD_DIR)/sapi/cli/php $(PKG_BUILD_DIR)/php-cli
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) \
339 --enable-force-cgi-redirect \
340 --enable-discard-path \
342 LIBS="$(PKG_CONFIGURE_LIBS)" \
343 php_cv_cc_rpath="no" \
345 $(MAKE) -C $(PKG_BUILD_DIR)
346 mv $(PKG_BUILD_DIR)/sapi/cgi/php-cgi $(PKG_BUILD_DIR)/php-cgi
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) \
360 --enable-force-cgi-redirect \
361 --enable-discard-path \
363 LIBS="$(PKG_CONFIGURE_LIBS)" \
364 php_cv_cc_rpath="no" \
366 $(MAKE) -C $(PKG_BUILD_DIR)
367 mv $(PKG_BUILD_DIR)/sapi/cgi/php-cgi $(PKG_BUILD_DIR)/php-fcgi
372 $(call Build/Compile/php5-cli)
373 $(call Build/Compile/php5-cgi)
374 $(call Build/Compile/php5-fastcgi)
377 define Package/php5/conffiles
381 define Package/php5/install
382 $(INSTALL_DIR) $(1)/etc
383 $(INSTALL_DATA) ./files/php.ini $(1)/etc/
386 define Package/php5-cli/install
387 $(INSTALL_DIR) $(1)/usr/bin
388 $(CP) $(PKG_BUILD_DIR)/php-cli $(1)/usr/bin/php-cli
391 define Package/php5-cgi/install
392 $(INSTALL_DIR) $(1)/usr/bin
393 $(CP) $(PKG_BUILD_DIR)/php-cgi $(1)/usr/bin/php-cgi
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
404 define Package/$(1)/install
405 [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib/php
407 $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$$$$$$$${m}.so $$(1)/usr/lib/php/ ; \
411 $$(eval $$(call BuildPackage,$(1)))
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))