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.
9 include $(TOPDIR)/rules.mk
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
16 PKG_SOURCE_URL:=http://www.php.net/distributions/
17 PKG_MD5SUM:=7380ffecebd95c6edb317ef861229ebd
19 include $(INCLUDE_DIR)/package.mk
21 define Package/php5/Default
25 TITLE:=PHP5 Hypertext preprocessor
26 URL:=http://www.php.net/
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.
35 $(call Package/php5/Default)
36 DEPENDS:=+libopenssl +zlib
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).
45 define Package/php5-cli
46 $(call Package/php5/Default)
51 define Package/php5-cli/description
52 $(call Package/php5/Default/description)
53 This package contains the CLI version of the PHP5 interpreter.
56 define Package/php5-cgi
57 $(call Package/php5/Default)
62 define Package/php5-cgi/description
63 $(call Package/php5/Default/description)
64 This package contains the CGI version of the PHP5 interpreter.
67 define Package/php5-fastcgi
68 $(call Package/php5/Default)
73 define Package/php5-fastcgi/description
74 $(call Package/php5/Default/description)
75 This package contains the FastCGI version of the PHP5 interpreter.
78 define Package/php5-mod-curl
79 $(call Package/php5/Default)
80 DEPENDS:=php5 +libcurl
84 define Package/php5-mod-ftp
85 $(call Package/php5/Default)
90 define Package/php5-mod-gd
91 $(call Package/php5/Default)
93 TITLE:=GD graphics module
96 define Package/php5-mod-gmp
97 $(call Package/php5/Default)
102 define Package/php5-mod-ldap
103 $(call Package/php5/Default)
104 DEPENDS:=php5 +libopenldap +libsasl2
108 define Package/php5-mod-mysql
109 $(call Package/php5/Default)
110 DEPENDS:=php5 +libmysqlclient
114 define Package/php5-mod-openssl
115 $(call Package/php5/Default)
116 DEPENDS:=php5 +libopenssl
117 TITLE:=OpenSSL module
120 define Package/php5-mod-pcre
121 $(call Package/php5/Default)
122 DEPENDS:=php5 +libpcre
126 define Package/php5-mod-pgsql
127 $(call Package/php5/Default)
129 TITLE:=PostgreSQL module
132 define Package/php5-mod-session
133 $(call Package/php5/Default)
135 TITLE:=Session module
138 define Package/php5-mod-sockets
139 $(call Package/php5/Default)
141 TITLE:=Sockets module
144 define Package/php5-mod-sqlite
145 $(call Package/php5/Default)
146 DEPENDS:=php5 +libsqlite2
150 define Package/php5-mod-pdo
151 $(call Package/php5/Default)
153 TITLE:=PHP Data Objects module
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
162 define Package/php5-mod-xml
163 $(call Package/php5/Default)
164 DEPENDS:=php5 +libexpat
168 define Package/php5-mod-apc
169 $(call Package/php5/Default)
174 define Package/php5-mod-exif
175 $(call Package/php5/Default)
177 TITLE:=EXIF Extension
180 PKG_CONFIGURE_LIBS:= -lcrypto -lssl
181 PKG_CONFIGURE_OPTS:= \
189 --with-config-file-path=/etc \
191 --enable-magic-quotes \
192 --enable-memory-limit \
193 --disable-short-tags \
197 --enable-ftp=shared \
201 --without-libxml-dir \
202 --disable-xmlreader \
203 --disable-xmlwriter \
206 --with-openssl=shared,"$(STAGING_DIR)/usr" \
208 --with-openssl-dir="$(STAGING_DIR)/usr" \
209 --enable-session=shared \
210 --disable-simplexml \
212 --enable-sockets=shared \
213 --disable-tokenizer \
214 --with-zlib="$(STAGING_DIR)/usr" \
215 --with-zlib-dir="$(STAGING_DIR)/usr" \
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
235 ifneq ($(CONFIG_PACKAGE_php5-mod-curl),)
236 PKG_CONFIGURE_OPTS+= --with-curl=shared,"$(STAGING_DIR)/usr"
238 PKG_CONFIGURE_OPTS+= --without-curl
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" \
248 --enable-gd-native-ttf \
249 --disable-gd-jis-conv
251 PKG_CONFIGURE_OPTS+= --without-gd
253 ifneq ($(CONFIG_PACKAGE_php5-mod-gmp),)
254 PKG_CONFIGURE_OPTS+= --with-gmp=shared,"$(STAGING_DIR)/usr"
256 PKG_CONFIGURE_OPTS+= --without-gmp
258 ifneq ($(CONFIG_PACKAGE_php5-mod-ldap),)
259 PKG_CONFIGURE_OPTS+= --with-ldap=shared,"$(STAGING_DIR)/usr" \
260 --with-ldap-sasl="$(STAGING_DIR)/usr"
262 PKG_CONFIGURE_OPTS+= --without-ldap
264 ifneq ($(CONFIG_PACKAGE_php5-mod-mysql),)
265 PKG_CONFIGURE_OPTS+= --with-mysql=shared,"$(STAGING_DIR)/usr"
267 PKG_CONFIGURE_OPTS+= --without-mysql
269 ifneq ($(CONFIG_PACKAGE_php5-mod-pcre),)
270 PKG_CONFIGURE_OPTS+= --with-pcre-regex=shared,"$(STAGING_DIR)/usr"
272 PKG_CONFIGURE_OPTS+= --without-pcre-regex
274 ifneq ($(CONFIG_PACKAGE_php5-mod-pgsql),)
275 PKG_CONFIGURE_OPTS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
277 PKG_CONFIGURE_OPTS+= --without-pgsql
279 ifneq ($(CONFIG_PACKAGE_php5-mod-sqlite),)
280 PKG_CONFIGURE_OPTS+= --with-sqlite=shared,"$(STAGING_DIR)/usr"
282 PKG_CONFIGURE_OPTS+= --without-sqlite
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"
290 PKG_CONFIGURE_OPTS+= --disable-pdo
292 ifneq ($(CONFIG_PACKAGE_php5-mod-xml),)
293 PKG_CONFIGURE_OPTS+= --enable-xml=shared,"$(STAGING_DIR)/usr" \
294 --with-libexpat-dir="$(STAGING_DIR)/usr"
296 PKG_CONFIGURE_OPTS+= --disable-xml
298 ifneq ($(CONFIG_PACKAGE_php5-mod-apc),)
299 PKG_CONFIGURE_OPTS+= --enable-apc --disable-apc-mmap --disable-apc-pthreadmutex
300 PKG_CONFIGURE_LIBS+= -lrt
302 PKG_CONFIGURE_OPTS+= --disable-apc
304 ifneq ($(CONFIG_PACKAGE_php5-mod-exif),)
305 PKG_CONFIGURE_OPTS+= --enable-exif
307 PKG_CONFIGURE_OPTS+= --disable-exif
310 define Build/Configure
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) \
321 --enable-force-cgi-redirect \
322 --enable-discard-path \
324 LIBS="$(PKG_CONFIGURE_LIBS)" \
325 php_cv_cc_rpath="no" \
327 $(MAKE) -C $(PKG_BUILD_DIR)
328 mv $(PKG_BUILD_DIR)/sapi/cli/php $(PKG_BUILD_DIR)/php-cli
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) \
340 --enable-force-cgi-redirect \
341 --enable-discard-path \
343 LIBS="$(PKG_CONFIGURE_LIBS)" \
344 php_cv_cc_rpath="no" \
346 $(MAKE) -C $(PKG_BUILD_DIR)
347 mv $(PKG_BUILD_DIR)/sapi/cgi/php-cgi $(PKG_BUILD_DIR)/php-cgi
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) \
361 --enable-force-cgi-redirect \
362 --enable-discard-path \
364 LIBS="$(PKG_CONFIGURE_LIBS)" \
365 php_cv_cc_rpath="no" \
367 $(MAKE) -C $(PKG_BUILD_DIR)
368 mv $(PKG_BUILD_DIR)/sapi/cgi/php-cgi $(PKG_BUILD_DIR)/php-fcgi
373 $(call Build/Compile/php5-cli)
374 $(call Build/Compile/php5-cgi)
375 $(call Build/Compile/php5-fastcgi)
378 define Package/php5/conffiles
382 define Package/php5/install
383 $(INSTALL_DIR) $(1)/etc
384 $(INSTALL_DATA) ./files/php.ini $(1)/etc/
387 define Package/php5-cli/install
388 $(INSTALL_DIR) $(1)/usr/bin
389 $(CP) $(PKG_BUILD_DIR)/php-cli $(1)/usr/bin/php-cli
392 define Package/php5-cgi/install
393 $(INSTALL_DIR) $(1)/usr/bin
394 $(CP) $(PKG_BUILD_DIR)/php-cgi $(1)/usr/bin/php-cgi
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
405 define Package/$(1)/install
406 [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib/php
408 $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$$$$$$$${m}.so $$(1)/usr/lib/php/ ; \
412 $$(eval $$(call BuildPackage,$(1)))
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))