2 # Copyright (C) 2006 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:=eb50b751c8e1ced05bd012d5a0e4dec3
20 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
22 include $(INCLUDE_DIR)/package.mk
24 define Package/php5/Default
27 TITLE:=PHP5 Hypertext preprocessor
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 URL:=http://www.php.net/
35 $(call Package/php5/Default)
36 DEPENDS:=+libopenssl +zlib
39 This package contains only the PHP config file. You must actually choose your \\\
40 PHP flavour (cli, cgi or fastcgi).
44 define Package/php5/conffiles
48 define Package/php5-cli
49 $(call Package/php5/Default)
54 This package contains the CLI version of the PHP5 interpreter.
57 define Package/php5-cgi
58 $(call Package/php5/Default)
63 This package contains the CGI version of the PHP5 interpreter.
66 define Package/php5-fastcgi
67 $(call Package/php5/Default)
72 This package contains the FastCGI version of the PHP5 interpreter.
75 define Package/php5-mod-curl
76 $(call Package/php5/Default)
77 DEPENDS:=php5 +libcurl
81 define Package/php5-mod-ftp
82 $(call Package/php5/Default)
87 define Package/php5-mod-gd
88 $(call Package/php5/Default)
90 TITLE:=GD graphics module
93 define Package/php5-mod-gmp
94 $(call Package/php5/Default)
99 define Package/php5-mod-ldap
100 $(call Package/php5/Default)
101 DEPENDS:=php5 +libopenldap
105 define Package/php5-mod-mysql
106 $(call Package/php5/Default)
107 DEPENDS:=php5 +libmysqlclient
111 define Package/php5-mod-openssl
112 $(call Package/php5/Default)
113 DEPENDS:=php5 +libopenssl
114 TITLE:=OpenSSL module
117 define Package/php5-mod-pcre
118 $(call Package/php5/Default)
119 DEPENDS:=php5 +libpcre
123 define Package/php5-mod-pgsql
124 $(call Package/php5/Default)
126 TITLE:=PostgreSQL module
129 define Package/php5-mod-session
130 $(call Package/php5/Default)
132 TITLE:=Session module
135 define Package/php5-mod-sockets
136 $(call Package/php5/Default)
138 TITLE:=Sockets module
141 define Package/php5-mod-sqlite
142 $(call Package/php5/Default)
143 DEPENDS:=php5 +libsqlite2
147 define Package/php5-mod-xml
148 $(call Package/php5/Default)
149 DEPENDS:=php5 +libexpat
153 define Package/php5-mod-apc
154 $(call Package/php5/Default)
159 PKG_CONFIGURE_LIBS:= -lcrypto -lssl
160 PKG_CONFIGURE_OPTS:= \
168 --with-config-file-path=/etc \
170 --enable-magic-quotes \
171 --enable-memory-limit \
172 --disable-short-tags \
176 --enable-ftp=shared \
180 --without-libxml-dir \
181 --disable-xmlreader \
182 --disable-xmlwriter \
185 --with-openssl=shared,"$(STAGING_DIR)/usr" \
187 --with-openssl-dir="$(STAGING_DIR)/usr" \
188 --enable-session=shared \
189 --disable-simplexml \
191 --enable-sockets=shared \
192 --disable-tokenizer \
193 --with-zlib="$(STAGING_DIR)/usr" \
194 --with-zlib-dir="$(STAGING_DIR)/usr" \
198 PKG_BUILD_DEPENDS:=libopenssl zlib libcurl libgd libgmp libopenldap libmysqlclient libpq libsqlite2 libexpat
199 # force PKG_CONFIGURE_{LIBS,OPTS} below when built in the SDK
200 CONFIG_PACKAGE_php5-cli:=m
201 CONFIG_PACKAGE_php5-cgi:=m
202 CONFIG_PACKAGE_php5-fastcgi:=m
203 CONFIG_PACKAGE_php5-mod-curl:=m
204 CONFIG_PACKAGE_php5-mod-gd:=m
205 CONFIG_PACKAGE_php5-mod-gmp:=m
206 CONFIG_PACKAGE_php5-mod-ldap:=m
207 CONFIG_PACKAGE_php5-mod-mysql:=m
208 CONFIG_PACKAGE_php5-mod-pcre:=m
209 CONFIG_PACKAGE_php5-mod-pgsql:=m
210 CONFIG_PACKAGE_php5-mod-sqlite:=m
211 CONFIG_PACKAGE_php5-mod-xml:=m
214 ifneq ($(CONFIG_PACKAGE_php5-mod-curl),)
215 PKG_CONFIGURE_OPTS+= --with-curl=shared,"$(STAGING_DIR)/usr"
217 PKG_CONFIGURE_OPTS+= --without-curl
219 ifneq ($(CONFIG_PACKAGE_php5-mod-gd),)
220 PKG_CONFIGURE_OPTS+= --with-gd=shared,"$(STAGING_DIR)/usr" \
221 --without-freetype-dir \
222 --with-jpeg-dir="$(STAGING_DIR)/usr" \
223 --with-png-dir="$(STAGING_DIR)/usr" \
227 --enable-gd-native-ttf \
228 --disable-gd-jis-conv
230 PKG_CONFIGURE_OPTS+= --without-gd
232 ifneq ($(CONFIG_PACKAGE_php5-mod-gmp),)
233 PKG_CONFIGURE_OPTS+= --with-gmp=shared,"$(STAGING_DIR)/usr"
235 PKG_CONFIGURE_OPTS+= --without-gmp
237 ifneq ($(CONFIG_PACKAGE_php5-mod-ldap),)
238 PKG_CONFIGURE_OPTS+= --with-ldap=shared,"$(STAGING_DIR)/usr" \
239 --with-ldap-sasl="$(STAGING_DIR)/usr"
241 PKG_CONFIGURE_OPTS+= --without-ldap
243 ifneq ($(CONFIG_PACKAGE_php5-mod-mysql),)
244 PKG_CONFIGURE_OPTS+= --with-mysql=shared,"$(STAGING_DIR)/usr"
246 PKG_CONFIGURE_OPTS+= --without-mysql
248 ifneq ($(CONFIG_PACKAGE_php5-mod-pcre),)
249 PKG_CONFIGURE_OPTS+= --with-pcre-regex=shared,"$(STAGING_DIR)/usr"
251 PKG_CONFIGURE_OPTS+= --without-pcre-regex
253 ifneq ($(CONFIG_PACKAGE_php5-mod-pgsql),)
254 PKG_CONFIGURE_OPTS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
256 PKG_CONFIGURE_OPTS+= --without-pgsql
258 ifneq ($(CONFIG_PACKAGE_php5-mod-sqlite),)
259 PKG_CONFIGURE_OPTS+= --with-sqlite=shared,"$(STAGING_DIR)/usr"
261 PKG_CONFIGURE_OPTS+= --without-sqlite
263 ifneq ($(CONFIG_PACKAGE_php5-mod-xml),)
264 PKG_CONFIGURE_OPTS+= --enable-xml=shared,"$(STAGING_DIR)/usr" \
265 --with-libexpat-dir="$(STAGING_DIR)/usr"
267 PKG_CONFIGURE_OPTS+= --disable-xml
269 ifneq ($(CONFIG_PACKAGE_php5-mod-apc),)
270 PKG_CONFIGURE_OPTS+= --enable-apc --disable-apc-mmap
271 PKG_CONFIGURE_LIBS+= -lrt
273 PKG_CONFIGURE_OPTS+= --disable-apc
276 define Build/Configure
279 ifneq ($(CONFIG_PACKAGE_php5-cli),)
280 define Build/Compile/php5-cli
281 -$(MAKE) -C $(PKG_BUILD_DIR) clean
282 $(call Build/Configure/Default, \
283 $(PKG_CONFIGURE_OPTS) \
287 --enable-force-cgi-redirect \
288 --enable-discard-path \
290 LIBS="$(PKG_CONFIGURE_LIBS)" \
291 php_cv_cc_rpath="no" \
293 $(MAKE) -C $(PKG_BUILD_DIR)
294 mv $(PKG_BUILD_DIR)/sapi/cli/php $(PKG_BUILD_DIR)/php-cli
298 ifneq ($(CONFIG_PACKAGE_php5-cgi),)
299 define Build/Compile/php5-cgi
300 -$(MAKE) -C $(PKG_BUILD_DIR) clean
301 $(call Build/Configure/Default, \
302 $(PKG_CONFIGURE_OPTS) \
306 --enable-force-cgi-redirect \
307 --enable-discard-path \
309 LIBS="$(PKG_CONFIGURE_LIBS)" \
310 php_cv_cc_rpath="no" \
312 $(MAKE) -C $(PKG_BUILD_DIR)
313 mv $(PKG_BUILD_DIR)/sapi/cgi/php-cgi $(PKG_BUILD_DIR)/php-cgi
317 ifneq ($(CONFIG_PACKAGE_php5-fastcgi),)
318 define Build/Compile/php5-fastcgi
319 -$(MAKE) -C $(PKG_BUILD_DIR) clean
320 rm $(PKG_BUILD_DIR)/configure
321 cd $(PKG_BUILD_DIR) && ./buildconf --force
322 $(call Build/Configure/Default, \
323 $(PKG_CONFIGURE_OPTS) \
327 --enable-force-cgi-redirect \
328 --enable-discard-path \
330 LIBS="$(PKG_CONFIGURE_LIBS)" \
331 php_cv_cc_rpath="no" \
333 $(MAKE) -C $(PKG_BUILD_DIR)
334 mv $(PKG_BUILD_DIR)/sapi/cgi/php-cgi $(PKG_BUILD_DIR)/php-fcgi
339 $(call Build/Compile/php5-cli)
340 $(call Build/Compile/php5-cgi)
341 $(call Build/Compile/php5-fastcgi)
344 define Package/php5/install
345 $(INSTALL_DIR) $(1)/etc
346 $(INSTALL_DATA) ./files/php.ini $(1)/etc/
349 define Package/php5-cli/install
350 $(INSTALL_DIR) $(1)/usr/bin
351 $(CP) $(PKG_BUILD_DIR)/php-cli $(1)/usr/bin/php-cli
354 define Package/php5-cgi/install
355 $(INSTALL_DIR) $(1)/usr/bin
356 $(CP) $(PKG_BUILD_DIR)/php-cgi $(1)/usr/bin/php-cgi
359 define Package/php5-fastcgi/install
360 $(INSTALL_DIR) $(1)/usr/bin
361 $(CP) $(PKG_BUILD_DIR)/php-fcgi $(1)/usr/bin/php-fcgi
362 $(INSTALL_DIR) $(1)/etc/init.d
363 $(INSTALL_BIN) ./files/php.init $(1)/etc/init.d/php
367 define Package/$(1)/install
368 [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib/php
370 $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$$$$$$$${m}.so $$(1)/usr/lib/php/ ; \
374 $$(eval $$(call BuildPackage,$(1)))
377 $(eval $(call BuildPackage,php5))
378 $(eval $(call BuildPackage,php5-cli))
379 $(eval $(call BuildPackage,php5-cgi))
380 $(eval $(call BuildPackage,php5-fastcgi))
381 $(eval $(call BuildPlugin,php5-mod-curl,curl))
382 $(eval $(call BuildPlugin,php5-mod-ftp,ftp))
383 $(eval $(call BuildPlugin,php5-mod-gd,gd))
384 $(eval $(call BuildPlugin,php5-mod-gmp,gmp))
385 $(eval $(call BuildPlugin,php5-mod-ldap,ldap))
386 $(eval $(call BuildPlugin,php5-mod-mysql,mysql))
387 $(eval $(call BuildPlugin,php5-mod-openssl,openssl))
388 $(eval $(call BuildPlugin,php5-mod-pcre,pcre))
389 $(eval $(call BuildPlugin,php5-mod-pgsql,pgsql))
390 $(eval $(call BuildPlugin,php5-mod-session,session))
391 $(eval $(call BuildPlugin,php5-mod-sockets,sockets))
392 $(eval $(call BuildPlugin,php5-mod-sqlite,sqlite))
393 $(eval $(call BuildPlugin,php5-mod-xml,xml))
394 $(eval $(call BuildPlugin,php5-mod-apc))