update to php 5.2.3, bugfixes and security fixes... note, the binaries have changed...
[openwrt/svn-archive/archive.git] / lang / php5 / Makefile
1 #
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=php
12 PKG_VERSION:=5.2.3
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
16 PKG_SOURCE_URL:=http://www.php.net/distributions/
17 PKG_MD5SUM:=eb50b751c8e1ced05bd012d5a0e4dec3
18 PKG_CAT:=bzcat
19
20 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
21
22 include $(INCLUDE_DIR)/package.mk
23
24 define Package/php5/Default
25 SECTION:=lang
26 CATEGORY:=Languages
27 TITLE:=PHP5 Hypertext preprocessor
28 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.
31 URL:=http://www.php.net/
32 endef
33
34 define Package/php5
35 $(call Package/php5/Default)
36 DEPENDS:=+libopenssl +zlib
37 DESCRIPTION+=\\\
38 \\\
39 This package contains only the PHP config file. You must actually choose your \\\
40 PHP flavour (cli, cgi or fastcgi).
41 MENU:=1
42 endef
43
44 define Package/php5/conffiles
45 /etc/php.ini
46 endef
47
48 define Package/php5-cli
49 $(call Package/php5/Default)
50 DEPENDS:=php5
51 TITLE+= (CLI)
52 DESCRIPTION+=\\\
53 \\\
54 This package contains the CLI version of the PHP5 interpreter.
55 endef
56
57 define Package/php5-cgi
58 $(call Package/php5/Default)
59 DEPENDS:=php5
60 TITLE+= (CGI)
61 DESCRIPTION+=\\\
62 \\\
63 This package contains the CGI version of the PHP5 interpreter.
64 endef
65
66 define Package/php5-fastcgi
67 $(call Package/php5/Default)
68 DEPENDS:=php5
69 TITLE+= (FastCGI)
70 DESCRIPTION+=\\\
71 \\\
72 This package contains the FastCGI version of the PHP5 interpreter.
73 endef
74
75 define Package/php5-mod-curl
76 $(call Package/php5/Default)
77 DEPENDS:=php5 +libcurl
78 TITLE:=cURL module
79 endef
80
81 define Package/php5-mod-ftp
82 $(call Package/php5/Default)
83 DEPENDS:=php5
84 TITLE:=FTP module
85 endef
86
87 define Package/php5-mod-gd
88 $(call Package/php5/Default)
89 DEPENDS:=php5 +libgd
90 TITLE:=GD graphics module
91 endef
92
93 define Package/php5-mod-gmp
94 $(call Package/php5/Default)
95 DEPENDS:=php5 +libgmp
96 TITLE:=GMP module
97 endef
98
99 define Package/php5-mod-ldap
100 $(call Package/php5/Default)
101 DEPENDS:=php5 +libopenldap
102 TITLE:=LDAP module
103 endef
104
105 define Package/php5-mod-mysql
106 $(call Package/php5/Default)
107 DEPENDS:=php5 +libmysqlclient
108 TITLE:=MySQL module
109 endef
110
111 define Package/php5-mod-openssl
112 $(call Package/php5/Default)
113 DEPENDS:=php5 +libopenssl
114 TITLE:=OpenSSL module
115 endef
116
117 define Package/php5-mod-pcre
118 $(call Package/php5/Default)
119 DEPENDS:=php5 +libpcre
120 TITLE:=PCRE module
121 endef
122
123 define Package/php5-mod-pgsql
124 $(call Package/php5/Default)
125 DEPENDS:=php5 +libpq
126 TITLE:=PostgreSQL module
127 endef
128
129 define Package/php5-mod-session
130 $(call Package/php5/Default)
131 DEPENDS:=php5
132 TITLE:=Session module
133 endef
134
135 define Package/php5-mod-sockets
136 $(call Package/php5/Default)
137 DEPENDS:=php5
138 TITLE:=Sockets module
139 endef
140
141 define Package/php5-mod-sqlite
142 $(call Package/php5/Default)
143 DEPENDS:=php5 +libsqlite2
144 TITLE:=SQLite module
145 endef
146
147 define Package/php5-mod-xml
148 $(call Package/php5/Default)
149 DEPENDS:=php5 +libexpat
150 TITLE:=XML module
151 endef
152
153 define Package/php5-mod-apc
154 $(call Package/php5/Default)
155 DEPENDS:=php5
156 TITLE:=APC Extension
157 endef
158
159 PKG_CONFIGURE_LIBS:= -lcrypto -lssl
160 PKG_CONFIGURE_OPTS:= \
161 --enable-shared \
162 --disable-static \
163 --disable-rpath \
164 --disable-debug \
165 --without-pear \
166 --disable-spl \
167 \
168 --with-config-file-path=/etc \
169 --disable-ipv6 \
170 --enable-magic-quotes \
171 --enable-memory-limit \
172 --disable-short-tags \
173 \
174 --disable-ctype \
175 --disable-dom \
176 --enable-ftp=shared \
177 --without-gettext \
178 --without-iconv \
179 --disable-libxml \
180 --without-libxml-dir \
181 --disable-xmlreader \
182 --disable-xmlwriter \
183 --disable-mbstring \
184 --disable-mbregex \
185 --with-openssl=shared,"$(STAGING_DIR)/usr" \
186 --with-kerberos=no \
187 --with-openssl-dir="$(STAGING_DIR)/usr" \
188 --enable-session=shared \
189 --disable-simplexml \
190 --disable-soap \
191 --enable-sockets=shared \
192 --disable-tokenizer \
193 --with-zlib="$(STAGING_DIR)/usr" \
194 --with-zlib-dir="$(STAGING_DIR)/usr" \
195 --disable-filter
196
197 ifneq ($(SDK),)
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
212 endif
213
214 ifneq ($(CONFIG_PACKAGE_php5-mod-curl),)
215 PKG_CONFIGURE_OPTS+= --with-curl=shared,"$(STAGING_DIR)/usr"
216 else
217 PKG_CONFIGURE_OPTS+= --without-curl
218 endif
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" \
224 --without-xpm-dir \
225 --without-ttf \
226 --without-t1lib \
227 --enable-gd-native-ttf \
228 --disable-gd-jis-conv
229 else
230 PKG_CONFIGURE_OPTS+= --without-gd
231 endif
232 ifneq ($(CONFIG_PACKAGE_php5-mod-gmp),)
233 PKG_CONFIGURE_OPTS+= --with-gmp=shared,"$(STAGING_DIR)/usr"
234 else
235 PKG_CONFIGURE_OPTS+= --without-gmp
236 endif
237 ifneq ($(CONFIG_PACKAGE_php5-mod-ldap),)
238 PKG_CONFIGURE_OPTS+= --with-ldap=shared,"$(STAGING_DIR)/usr" \
239 --with-ldap-sasl="$(STAGING_DIR)/usr"
240 else
241 PKG_CONFIGURE_OPTS+= --without-ldap
242 endif
243 ifneq ($(CONFIG_PACKAGE_php5-mod-mysql),)
244 PKG_CONFIGURE_OPTS+= --with-mysql=shared,"$(STAGING_DIR)/usr"
245 else
246 PKG_CONFIGURE_OPTS+= --without-mysql
247 endif
248 ifneq ($(CONFIG_PACKAGE_php5-mod-pcre),)
249 PKG_CONFIGURE_OPTS+= --with-pcre-regex=shared,"$(STAGING_DIR)/usr"
250 else
251 PKG_CONFIGURE_OPTS+= --without-pcre-regex
252 endif
253 ifneq ($(CONFIG_PACKAGE_php5-mod-pgsql),)
254 PKG_CONFIGURE_OPTS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
255 else
256 PKG_CONFIGURE_OPTS+= --without-pgsql
257 endif
258 ifneq ($(CONFIG_PACKAGE_php5-mod-sqlite),)
259 PKG_CONFIGURE_OPTS+= --with-sqlite=shared,"$(STAGING_DIR)/usr"
260 else
261 PKG_CONFIGURE_OPTS+= --without-sqlite
262 endif
263 ifneq ($(CONFIG_PACKAGE_php5-mod-xml),)
264 PKG_CONFIGURE_OPTS+= --enable-xml=shared,"$(STAGING_DIR)/usr" \
265 --with-libexpat-dir="$(STAGING_DIR)/usr"
266 else
267 PKG_CONFIGURE_OPTS+= --disable-xml
268 endif
269 ifneq ($(CONFIG_PACKAGE_php5-mod-apc),)
270 PKG_CONFIGURE_OPTS+= --enable-apc --disable-apc-mmap
271 PKG_CONFIGURE_LIBS+= -lrt
272 else
273 PKG_CONFIGURE_OPTS+= --disable-apc
274 endif
275
276 define Build/Configure
277 endef
278
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) \
284 --enable-cli \
285 --disable-cgi \
286 --disable-fastcgi \
287 --enable-force-cgi-redirect \
288 --enable-discard-path \
289 , \
290 LIBS="$(PKG_CONFIGURE_LIBS)" \
291 php_cv_cc_rpath="no" \
292 )
293 $(MAKE) -C $(PKG_BUILD_DIR)
294 mv $(PKG_BUILD_DIR)/sapi/cli/php $(PKG_BUILD_DIR)/php-cli
295 endef
296 endif
297
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) \
303 --disable-cli \
304 --enable-cgi \
305 --disable-fastcgi \
306 --enable-force-cgi-redirect \
307 --enable-discard-path \
308 , \
309 LIBS="$(PKG_CONFIGURE_LIBS)" \
310 php_cv_cc_rpath="no" \
311 )
312 $(MAKE) -C $(PKG_BUILD_DIR)
313 mv $(PKG_BUILD_DIR)/sapi/cgi/php-cgi $(PKG_BUILD_DIR)/php-cgi
314 endef
315 endif
316
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) \
324 --disable-cli \
325 --enable-cgi \
326 --enable-fastcgi \
327 --enable-force-cgi-redirect \
328 --enable-discard-path \
329 , \
330 LIBS="$(PKG_CONFIGURE_LIBS)" \
331 php_cv_cc_rpath="no" \
332 )
333 $(MAKE) -C $(PKG_BUILD_DIR)
334 mv $(PKG_BUILD_DIR)/sapi/cgi/php-cgi $(PKG_BUILD_DIR)/php-fcgi
335 endef
336 endif
337
338 define Build/Compile
339 $(call Build/Compile/php5-cli)
340 $(call Build/Compile/php5-cgi)
341 $(call Build/Compile/php5-fastcgi)
342 endef
343
344 define Package/php5/install
345 $(INSTALL_DIR) $(1)/etc
346 $(INSTALL_DATA) ./files/php.ini $(1)/etc/
347 endef
348
349 define Package/php5-cli/install
350 $(INSTALL_DIR) $(1)/usr/bin
351 $(CP) $(PKG_BUILD_DIR)/php-cli $(1)/usr/bin/php-cli
352 endef
353
354 define Package/php5-cgi/install
355 $(INSTALL_DIR) $(1)/usr/bin
356 $(CP) $(PKG_BUILD_DIR)/php-cgi $(1)/usr/bin/php-cgi
357 endef
358
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
364 endef
365
366 define BuildPlugin
367 define Package/$(1)/install
368 [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib/php
369 for m in $(2); do \
370 $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$$$$$$$${m}.so $$(1)/usr/lib/php/ ; \
371 done
372 endef
373
374 $$(eval $$(call BuildPackage,$(1)))
375 endef
376
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))