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:=08e423aa314369d4392a36b3f7246afc
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 \
175 --disable-xmlreader \
176 --disable-xmlwriter \
179 --with-openssl=shared,"$(STAGING_DIR)/usr" \
181 --with-openssl-dir="$(STAGING_DIR)/usr" \
182 --enable-session=shared \
183 --disable-simplexml \
185 --enable-sockets=shared \
186 --disable-tokenizer \
187 --with-zlib="$(STAGING_DIR)/usr" \
188 --with-zlib-dir="$(STAGING_DIR)/usr" \
191 PKG_BUILD_DEPENDS:=libopenssl zlib libcurl libgd libgmp libopenldap libmysqlclient libpq libsqlite2 libexpat
192 # force PKG_CONFIGURE_{LIBS,OPTS} below when built in the SDK
193 CONFIG_PACKAGE_php5-cli:=m
194 CONFIG_PACKAGE_php5-cgi:=m
195 CONFIG_PACKAGE_php5-fastcgi:=m
196 CONFIG_PACKAGE_php5-mod-curl:=m
197 CONFIG_PACKAGE_php5-mod-gd:=m
198 CONFIG_PACKAGE_php5-mod-gmp:=m
199 CONFIG_PACKAGE_php5-mod-ldap:=m
200 CONFIG_PACKAGE_php5-mod-mysql:=m
201 CONFIG_PACKAGE_php5-mod-pcre:=m
202 CONFIG_PACKAGE_php5-mod-pgsql:=m
203 CONFIG_PACKAGE_php5-mod-sqlite:=m
204 CONFIG_PACKAGE_php5-mod-xml:=m
207 ifneq ($(CONFIG_PACKAGE_php5-mod-curl),)
208 PKG_CONFIGURE_OPTS+= --with-curl=shared,"$(STAGING_DIR)/usr"
210 PKG_CONFIGURE_OPTS+= --without-curl
212 ifneq ($(CONFIG_PACKAGE_php5-mod-gd),)
213 PKG_CONFIGURE_OPTS+= --with-gd=shared,"$(STAGING_DIR)/usr" \
214 --without-freetype-dir \
215 --with-jpeg-dir="$(STAGING_DIR)/usr" \
216 --with-png-dir="$(STAGING_DIR)/usr" \
220 --enable-gd-native-ttf \
221 --disable-gd-jis-conv
223 PKG_CONFIGURE_OPTS+= --without-gd
225 ifneq ($(CONFIG_PACKAGE_php5-mod-gmp),)
226 PKG_CONFIGURE_OPTS+= --with-gmp=shared,"$(STAGING_DIR)/usr"
228 PKG_CONFIGURE_OPTS+= --without-gmp
230 ifneq ($(CONFIG_PACKAGE_php5-mod-ldap),)
231 PKG_CONFIGURE_OPTS+= --with-ldap=shared,"$(STAGING_DIR)/usr" \
232 --with-ldap-sasl="$(STAGING_DIR)/usr"
234 PKG_CONFIGURE_OPTS+= --without-ldap
236 ifneq ($(CONFIG_PACKAGE_php5-mod-mysql),)
237 PKG_CONFIGURE_OPTS+= --with-mysql=shared,"$(STAGING_DIR)/usr"
239 PKG_CONFIGURE_OPTS+= --without-mysql
241 ifneq ($(CONFIG_PACKAGE_php5-mod-pcre),)
242 PKG_CONFIGURE_OPTS+= --with-pcre-regex=shared,"$(STAGING_DIR)/usr"
244 PKG_CONFIGURE_OPTS+= --without-pcre-regex
246 ifneq ($(CONFIG_PACKAGE_php5-mod-pgsql),)
247 PKG_CONFIGURE_OPTS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
249 PKG_CONFIGURE_OPTS+= --without-pgsql
251 ifneq ($(CONFIG_PACKAGE_php5-mod-sqlite),)
252 PKG_CONFIGURE_OPTS+= --with-sqlite=shared,"$(STAGING_DIR)/usr"
254 PKG_CONFIGURE_OPTS+= --without-sqlite
256 ifneq ($(CONFIG_PACKAGE_php5-mod-xml),)
257 PKG_CONFIGURE_OPTS+= --enable-xml=shared,"$(STAGING_DIR)/usr" \
258 --with-libexpat-dir="$(STAGING_DIR)/usr"
260 PKG_CONFIGURE_OPTS+= --disable-xml
263 define Build/Configure
266 ifneq ($(CONFIG_PACKAGE_php5-cli),)
267 define Build/Compile/php5-cli
268 -$(MAKE) -C $(PKG_BUILD_DIR) clean
269 $(call Build/Configure/Default, \
270 $(PKG_CONFIGURE_OPTS) \
274 --enable-force-cgi-redirect \
275 --enable-discard-path \
277 LIBS="$(PKG_CONFIGURE_LIBS)" \
278 php_cv_cc_rpath="no" \
280 $(MAKE) -C $(PKG_BUILD_DIR)
281 mv $(PKG_BUILD_DIR)/sapi/cli/php $(PKG_BUILD_DIR)/php-cli
285 ifneq ($(CONFIG_PACKAGE_php5-cgi),)
286 define Build/Compile/php5-cgi
287 -$(MAKE) -C $(PKG_BUILD_DIR) clean
288 $(call Build/Configure/Default, \
289 $(PKG_CONFIGURE_OPTS) \
293 --enable-force-cgi-redirect \
294 --enable-discard-path \
296 LIBS="$(PKG_CONFIGURE_LIBS)" \
297 php_cv_cc_rpath="no" \
299 $(MAKE) -C $(PKG_BUILD_DIR)
300 mv $(PKG_BUILD_DIR)/sapi/cgi/php $(PKG_BUILD_DIR)/php-cgi
304 ifneq ($(CONFIG_PACKAGE_php5-fastcgi),)
305 define Build/Compile/php5-fastcgi
306 -$(MAKE) -C $(PKG_BUILD_DIR) clean
307 $(call Build/Configure/Default, \
308 $(PKG_CONFIGURE_OPTS) \
312 --enable-force-cgi-redirect \
313 --enable-discard-path \
315 LIBS="$(PKG_CONFIGURE_LIBS)" \
316 php_cv_cc_rpath="no" \
318 $(MAKE) -C $(PKG_BUILD_DIR)
319 mv $(PKG_BUILD_DIR)/sapi/cgi/php $(PKG_BUILD_DIR)/php-fastcgi
324 $(call Build/Compile/php5-cli)
325 $(call Build/Compile/php5-cgi)
326 $(call Build/Compile/php5-fastcgi)
329 define Package/php5/install
330 $(INSTALL_DIR) $(1)/etc
331 $(INSTALL_DATA) ./files/php.ini $(1)/etc/
334 define Package/php5-cli/install
335 $(INSTALL_DIR) $(1)/usr/bin
336 $(CP) $(PKG_BUILD_DIR)/php-cli $(1)/usr/bin/php
339 define Package/php5-cgi/install
340 $(INSTALL_DIR) $(1)/usr/bin
341 $(CP) $(PKG_BUILD_DIR)/php-cgi $(1)/usr/bin/php
344 define Package/php5-fastcgi/install
345 $(INSTALL_DIR) $(1)/usr/sbin
346 $(CP) $(PKG_BUILD_DIR)/php-fastcgi $(1)/usr/sbin/php
347 $(INSTALL_DIR) $(1)/etc/init.d
348 $(INSTALL_BIN) ./files/php.init $(1)/etc/init.d/php
352 define Package/$(1)/install
353 [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib/php
355 $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$$$$$$$${m}.so $$(1)/usr/lib/php/ ; \
359 $$(eval $$(call BuildPackage,$(1)))
362 $(eval $(call BuildPackage,php5))
363 $(eval $(call BuildPackage,php5-cli))
364 $(eval $(call BuildPackage,php5-cgi))
365 $(eval $(call BuildPackage,php5-fastcgi))
366 $(eval $(call BuildPlugin,php5-mod-curl,curl))
367 $(eval $(call BuildPlugin,php5-mod-ftp,ftp))
368 $(eval $(call BuildPlugin,php5-mod-gd,gd))
369 $(eval $(call BuildPlugin,php5-mod-gmp,gmp))
370 $(eval $(call BuildPlugin,php5-mod-ldap,ldap))
371 $(eval $(call BuildPlugin,php5-mod-mysql,mysql))
372 $(eval $(call BuildPlugin,php5-mod-openssl,openssl))
373 $(eval $(call BuildPlugin,php5-mod-pcre,pcre))
374 $(eval $(call BuildPlugin,php5-mod-pgsql,pgsql))
375 $(eval $(call BuildPlugin,php5-mod-session,session))
376 $(eval $(call BuildPlugin,php5-mod-sockets,sockets))
377 $(eval $(call BuildPlugin,php5-mod-sqlite,sqlite))
378 $(eval $(call BuildPlugin,php5-mod-xml,xml))