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://fr.php.net/distributions/
17 PKG_MD5SUM:=b5d4ca75bbb11ee5b830fa67213d9f7f
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 PKG_CONFIGURE_LIBS:= -lcrypto -lssl
154 PKG_CONFIGURE_OPTS:= \
162 --with-config-file-path=/etc \
164 --enable-magic-quotes \
165 --enable-memory-limit \
166 --disable-short-tags \
170 --enable-ftp=shared \
174 --without-libxml-dir \
177 --with-openssl=shared,"$(STAGING_DIR)/usr" \
179 --with-openssl-dir="$(STAGING_DIR)/usr" \
180 --enable-session=shared \
181 --disable-simplexml \
183 --enable-sockets=shared \
184 --disable-tokenizer \
185 --with-zlib="$(STAGING_DIR)/usr" \
186 --with-zlib-dir="$(STAGING_DIR)/usr" \
189 PKG_BUILDDEP:=libopenssl zlib libcurl libgd libgmp libopenldap libmysqlclient libpq libsqlite2 libexpat
190 # force PKG_CONFIGURE_{LIBS,OPTS} below when built in the SDK
191 CONFIG_PACKAGE_php5-cli:=m
192 CONFIG_PACKAGE_php5-cgi:=m
193 CONFIG_PACKAGE_php5-fastcgi:=m
194 CONFIG_PACKAGE_php5-mod-curl:=m
195 CONFIG_PACKAGE_php5-mod-gd:=m
196 CONFIG_PACKAGE_php5-mod-gmp:=m
197 CONFIG_PACKAGE_php5-mod-ldap:=m
198 CONFIG_PACKAGE_php5-mod-mysql:=m
199 CONFIG_PACKAGE_php5-mod-pcre:=m
200 CONFIG_PACKAGE_php5-mod-pgsql:=m
201 CONFIG_PACKAGE_php5-mod-sqlite:=m
202 CONFIG_PACKAGE_php5-mod-xml:=m
205 ifneq ($(CONFIG_PACKAGE_php5-mod-curl),)
206 PKG_CONFIGURE_OPTS+= --with-curl=shared,"$(STAGING_DIR)/usr"
208 PKG_CONFIGURE_OPTS+= --without-curl
210 ifneq ($(CONFIG_PACKAGE_php5-mod-gd),)
211 PKG_CONFIGURE_OPTS+= --with-gd=shared,"$(STAGING_DIR)/usr" \
212 --without-freetype-dir \
213 --with-jpeg-dir="$(STAGING_DIR)/usr" \
214 --with-png-dir="$(STAGING_DIR)/usr" \
218 --enable-gd-native-ttf \
219 --disable-gd-jis-conv
221 PKG_CONFIGURE_OPTS+= --without-gd
223 ifneq ($(CONFIG_PACKAGE_php5-mod-gmp),)
224 PKG_CONFIGURE_OPTS+= --with-gmp=shared,"$(STAGING_DIR)/usr"
226 PKG_CONFIGURE_OPTS+= --without-gmp
228 ifneq ($(CONFIG_PACKAGE_php5-mod-ldap),)
229 PKG_CONFIGURE_OPTS+= --with-ldap=shared,"$(STAGING_DIR)/usr" \
230 --with-ldap-sasl="$(STAGING_DIR)/usr"
232 PKG_CONFIGURE_OPTS+= --without-ldap
234 ifneq ($(CONFIG_PACKAGE_php5-mod-mysql),)
235 PKG_CONFIGURE_OPTS+= --with-mysql=shared,"$(STAGING_DIR)/usr"
237 PKG_CONFIGURE_OPTS+= --without-mysql
239 ifneq ($(CONFIG_PACKAGE_php5-mod-pcre),)
240 PKG_CONFIGURE_OPTS+= --with-pcre-regex=shared,"$(STAGING_DIR)/usr"
242 PKG_CONFIGURE_OPTS+= --without-pcre-regex
244 ifneq ($(CONFIG_PACKAGE_php5-mod-pgsql),)
245 PKG_CONFIGURE_OPTS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
247 PKG_CONFIGURE_OPTS+= --without-pgsql
249 ifneq ($(CONFIG_PACKAGE_php5-mod-sqlite),)
250 PKG_CONFIGURE_OPTS+= --with-sqlite=shared,"$(STAGING_DIR)/usr"
252 PKG_CONFIGURE_OPTS+= --without-sqlite
254 ifneq ($(CONFIG_PACKAGE_php5-mod-xml),)
255 PKG_CONFIGURE_OPTS+= --enable-xml=shared,"$(STAGING_DIR)/usr" \
256 --with-libexpat-dir="$(STAGING_DIR)/usr"
258 PKG_CONFIGURE_OPTS+= --disable-xml
261 define Build/Configure
264 ifneq ($(CONFIG_PACKAGE_php5-cli),)
265 define Build/Compile/php5-cli
266 -$(MAKE) -C $(PKG_BUILD_DIR) clean
267 $(call Build/Configure/Default, \
268 $(PKG_CONFIGURE_OPTS) \
272 --enable-force-cgi-redirect \
273 --enable-discard-path \
275 LIBS="$(PKG_CONFIGURE_LIBS)" \
276 php_cv_cc_rpath="no" \
278 $(MAKE) -C $(PKG_BUILD_DIR)
279 mv $(PKG_BUILD_DIR)/sapi/cli/php $(PKG_BUILD_DIR)/php-cli
283 ifneq ($(CONFIG_PACKAGE_php5-cgi),)
284 define Build/Compile/php5-cgi
285 -$(MAKE) -C $(PKG_BUILD_DIR) clean
286 $(call Build/Configure/Default, \
287 $(PKG_CONFIGURE_OPTS) \
291 --enable-force-cgi-redirect \
292 --enable-discard-path \
294 LIBS="$(PKG_CONFIGURE_LIBS)" \
295 php_cv_cc_rpath="no" \
297 $(MAKE) -C $(PKG_BUILD_DIR)
298 mv $(PKG_BUILD_DIR)/sapi/cgi/php $(PKG_BUILD_DIR)/php-cgi
302 ifneq ($(CONFIG_PACKAGE_php5-fastcgi),)
303 define Build/Compile/php5-fastcgi
304 -$(MAKE) -C $(PKG_BUILD_DIR) clean
305 $(call Build/Configure/Default, \
306 $(PKG_CONFIGURE_OPTS) \
310 --enable-force-cgi-redirect \
311 --enable-discard-path \
313 LIBS="$(PKG_CONFIGURE_LIBS)" \
314 php_cv_cc_rpath="no" \
316 $(MAKE) -C $(PKG_BUILD_DIR)
317 mv $(PKG_BUILD_DIR)/sapi/cgi/php $(PKG_BUILD_DIR)/php-fastcgi
322 $(call Build/Compile/php5-cli)
323 $(call Build/Compile/php5-cgi)
324 $(call Build/Compile/php5-fastcgi)
327 define Package/php5/install
328 $(INSTALL_DIR) $(1)/etc
329 $(INSTALL_DATA) ./files/php.ini $(1)/etc/
332 define Package/php5-cli/install
333 $(INSTALL_DIR) $(1)/usr/bin
334 $(CP) $(PKG_BUILD_DIR)/php-cli $(1)/usr/bin/php
337 define Package/php5-cgi/install
338 $(INSTALL_DIR) $(1)/usr/bin
339 $(CP) $(PKG_BUILD_DIR)/php-cgi $(1)/usr/bin/php
342 define Package/php5-fastcgi/install
343 $(INSTALL_DIR) $(1)/usr/sbin
344 $(CP) $(PKG_BUILD_DIR)/php-fastcgi $(1)/usr/sbin/php
345 $(INSTALL_DIR) $(1)/etc/init.d
346 $(INSTALL_BIN) ./files/php.init $(1)/etc/init.d/php
350 define Package/$(1)/install
351 [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib/php
353 $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$$$$$$$${m}.so $$(1)/usr/lib/php/ ; \
357 $$(eval $$(call BuildPackage,$(1)))
360 $(eval $(call BuildPackage,php5))
361 $(eval $(call BuildPackage,php5-cli))
362 $(eval $(call BuildPackage,php5-cgi))
363 $(eval $(call BuildPackage,php5-fastcgi))
364 $(eval $(call BuildPlugin,php5-mod-curl,curl))
365 $(eval $(call BuildPlugin,php5-mod-ftp,ftp))
366 $(eval $(call BuildPlugin,php5-mod-gd,gd))
367 $(eval $(call BuildPlugin,php5-mod-gmp,gmp))
368 $(eval $(call BuildPlugin,php5-mod-ldap,ldap))
369 $(eval $(call BuildPlugin,php5-mod-mysql,mysql))
370 $(eval $(call BuildPlugin,php5-mod-openssl,openssl))
371 $(eval $(call BuildPlugin,php5-mod-pcre,pcre))
372 $(eval $(call BuildPlugin,php5-mod-pgsql,pgsql))
373 $(eval $(call BuildPlugin,php5-mod-session,session))
374 $(eval $(call BuildPlugin,php5-mod-sockets,sockets))
375 $(eval $(call BuildPlugin,php5-mod-sqlite,sqlite))
376 $(eval $(call BuildPlugin,php5-mod-xml,xml))