[package] update amule to 2.2.6 (#5914)
[openwrt/svn-archive/archive.git] / lang / php5 / Makefile
1 #
2 # Copyright (C) 2006-2009 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=php
11 PKG_VERSION:=5.2.6
12 PKG_RELEASE:=3
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=http://www.php.net/distributions/
16 PKG_MD5SUM:=7380ffecebd95c6edb317ef861229ebd
17
18 include $(INCLUDE_DIR)/package.mk
19
20 define Package/php5/Default
21 SUBMENU:=PHP
22 SECTION:=lang
23 CATEGORY:=Languages
24 TITLE:=PHP5 Hypertext preprocessor
25 URL:=http://www.php.net/
26 endef
27
28 define Package/php5/Default/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 endef
32
33 define Package/php5/config
34 choice
35 prompt "PHP5 SPL Options"
36 depends PACKAGE_php5
37 default PACKAGE_php5_without_spl
38
39 config PACKAGE_php5_with_spl
40 bool "With SPL (and pcre) static"
41
42 config PACKAGE_php5_without_spl
43 bool "without SPL (pcre may be enabled)"
44 endchoice
45
46 config PHP5_APC
47 bool "PHP5 APC support"
48
49 config PHP5_EXIF
50 bool "PHP5 EXIF support"
51 endef
52
53 define Package/php5
54 $(call Package/php5/Default)
55 ifneq ($(CONFIG_PACKAGE_php5_with_spl),)
56 DEPENDS:=+libopenssl +zlib
57 CONFIG_PACKAGE_php5-mod-pcre:=
58 else
59 DEPENDS:=+libopenssl +zlib +libpcre
60 endif
61 endef
62
63 define Package/php5/description
64 $(call Package/php5/Default/description)
65 This package contains only the PHP config file. You must actually choose
66 your PHP flavour (cli, cgi or fastcgi).
67 endef
68
69 define Package/php5-cli
70 $(call Package/php5/Default)
71 DEPENDS:=php5
72 TITLE+= (CLI)
73 endef
74
75 define Package/php5-cli/description
76 $(call Package/php5/Default/description)
77 This package contains the CLI version of the PHP5 interpreter.
78 endef
79
80 define Package/php5-cgi
81 $(call Package/php5/Default)
82 DEPENDS:=php5
83 TITLE+= (CGI)
84 endef
85
86 define Package/php5-cgi/description
87 $(call Package/php5/Default/description)
88 This package contains the CGI version of the PHP5 interpreter.
89 endef
90
91 define Package/php5-fastcgi
92 $(call Package/php5/Default)
93 DEPENDS:=php5
94 TITLE+= (FastCGI)
95 endef
96
97 define Package/php5-fastcgi/description
98 $(call Package/php5/Default/description)
99 This package contains the FastCGI version of the PHP5 interpreter.
100 endef
101
102 define Package/php5-mod-curl
103 $(call Package/php5/Default)
104 DEPENDS:=php5 +libcurl
105 TITLE:=cURL module
106 endef
107
108 define Package/php5-mod-ftp
109 $(call Package/php5/Default)
110 DEPENDS:=php5
111 TITLE:=FTP module
112 endef
113
114 define Package/php5-mod-gd
115 $(call Package/php5/Default)
116 DEPENDS:=php5 +libgd
117 TITLE:=GD graphics module
118 endef
119
120 define Package/php5-mod-gmp
121 $(call Package/php5/Default)
122 DEPENDS:=php5 +libgmp
123 TITLE:=GMP module
124 endef
125
126 define Package/php5-mod-ldap
127 $(call Package/php5/Default)
128 DEPENDS:=php5 +libopenldap +libsasl2
129 TITLE:=LDAP module
130 endef
131
132 define Package/php5-mod-mysql
133 $(call Package/php5/Default)
134 DEPENDS:=php5 +libmysqlclient
135 TITLE:=MySQL module
136 endef
137
138 define Package/php5-mod-openssl
139 $(call Package/php5/Default)
140 DEPENDS:=php5 +libopenssl
141 TITLE:=OpenSSL module
142 endef
143
144 define Package/php5-mod-pcre
145 $(call Package/php5/Default)
146 DEPENDS:=php5 +libpcre
147 TITLE:=PCRE module
148 endef
149
150 define Package/php5-mod-pgsql
151 $(call Package/php5/Default)
152 DEPENDS:=php5 +libpq
153 TITLE:=PostgreSQL module
154 endef
155
156 define Package/php5-mod-session
157 $(call Package/php5/Default)
158 DEPENDS:=php5
159 TITLE:=Session module
160 endef
161
162 define Package/php5-mod-sockets
163 $(call Package/php5/Default)
164 DEPENDS:=php5
165 TITLE:=Sockets module
166 endef
167
168 define Package/php5-mod-sqlite
169 $(call Package/php5/Default)
170 DEPENDS:=php5 +libsqlite2
171 TITLE:=SQLite module
172 endef
173
174 define Package/php5-mod-pdo
175 $(call Package/php5/Default)
176 DEPENDS:=php5
177 TITLE:=PHP Data Objects module
178 endef
179
180 define Package/php5-mod-pdo-sqlite
181 $(call Package/php5/Default)
182 DEPENDS:=php5-mod-pdo +libsqlite3
183 TITLE:=PHP Data Objects module - SQLite support
184 endef
185
186 define Package/php5-mod-xml
187 $(call Package/php5/Default)
188 DEPENDS:=php5 +libexpat
189 TITLE:=XML module
190 endef
191
192 PKG_CONFIGURE_LIBS:= -lcrypto -lssl
193 PKG_CONFIGURE_OPTS:= \
194 --enable-shared \
195 --disable-static \
196 --disable-rpath \
197 --disable-debug \
198 --without-pear \
199 \
200 --with-config-file-path=/etc \
201 --enable-magic-quotes \
202 --enable-memory-limit \
203 --disable-short-tags \
204 \
205 --disable-ctype \
206 --disable-dom \
207 --enable-ftp=shared \
208 --without-gettext \
209 --without-iconv \
210 --disable-libxml \
211 --without-libxml-dir \
212 --disable-xmlreader \
213 --disable-xmlwriter \
214 --disable-mbstring \
215 --disable-mbregex \
216 --with-openssl=shared,"$(STAGING_DIR)/usr" \
217 --with-kerberos=no \
218 --with-openssl-dir="$(STAGING_DIR)/usr" \
219 --enable-session=shared \
220 --disable-simplexml \
221 --disable-soap \
222 --enable-sockets=shared \
223 --disable-tokenizer \
224 --with-zlib="$(STAGING_DIR)/usr" \
225 --with-zlib-dir="$(STAGING_DIR)/usr" \
226 --disable-filter
227
228 ifneq ($(SDK),)
229 PKG_BUILD_DEPENDS:=libopenssl zlib libcurl libgd libgmp libopenldap libmysqlclient libpq libsqlite2 libexpat
230 # force PKG_CONFIGURE_{LIBS,OPTS} below when built in the SDK
231 CONFIG_PACKAGE_php5-cli:=m
232 CONFIG_PACKAGE_php5-cgi:=m
233 CONFIG_PACKAGE_php5-fastcgi:=m
234 CONFIG_PACKAGE_php5-mod-curl:=m
235 CONFIG_PACKAGE_php5-mod-gd:=m
236 CONFIG_PACKAGE_php5-mod-gmp:=m
237 CONFIG_PACKAGE_php5-mod-ldap:=m
238 CONFIG_PACKAGE_php5-mod-mysql:=m
239 ifneq ($(CONFIG_PACKAGE_php5_with_spl),)
240 CONFIG_PACKAGE_php5-mod-pcre:=n
241 else
242 CONFIG_PACKAGE_php5-mod-pcre:=m
243 endif
244 CONFIG_PACKAGE_php5-mod-pgsql:=m
245 CONFIG_PACKAGE_php5-mod-sqlite:=m
246 CONFIG_PACKAGE_php5-mod-xml:=m
247 endif
248
249 ifneq ($(CONFIG_PACKAGE_php5-mod-curl),)
250 PKG_CONFIGURE_OPTS+= --with-curl=shared,"$(STAGING_DIR)/usr"
251 else
252 PKG_CONFIGURE_OPTS+= --without-curl
253 endif
254 ifneq ($(CONFIG_PACKAGE_php5-mod-gd),)
255 PKG_CONFIGURE_OPTS+= --with-gd=shared,"$(STAGING_DIR)/usr" \
256 --without-freetype-dir \
257 --with-jpeg-dir="$(STAGING_DIR)/usr" \
258 --with-png-dir="$(STAGING_DIR)/usr" \
259 --without-xpm-dir \
260 --without-ttf \
261 --without-t1lib \
262 --enable-gd-native-ttf \
263 --disable-gd-jis-conv
264 else
265 PKG_CONFIGURE_OPTS+= --without-gd
266 endif
267 ifneq ($(CONFIG_PACKAGE_php5-mod-gmp),)
268 PKG_CONFIGURE_OPTS+= --with-gmp=shared,"$(STAGING_DIR)/usr"
269 else
270 PKG_CONFIGURE_OPTS+= --without-gmp
271 endif
272 ifneq ($(CONFIG_PACKAGE_php5-mod-ldap),)
273 PKG_CONFIGURE_OPTS+= --with-ldap=shared,"$(STAGING_DIR)/usr" \
274 --with-ldap-sasl="$(STAGING_DIR)/usr"
275 else
276 PKG_CONFIGURE_OPTS+= --without-ldap
277 endif
278 ifneq ($(CONFIG_PACKAGE_php5-mod-mysql),)
279 PKG_CONFIGURE_OPTS+= --with-mysql=shared,"$(STAGING_DIR)/usr"
280 else
281 PKG_CONFIGURE_OPTS+= --without-mysql
282 endif
283 ifneq ($(CONFIG_PACKAGE_php5_with_spl),)
284 PKG_CONFIGURE_OPTS+= --with-pcre-dir="$(STAGING_DIR)/usr"
285 PKG_CONFIGURE_OPTS+= --enable-spl
286 else
287 PKG_CONFIGURE_OPTS+= --disable-spl
288 ifneq ($(CONFIG_PACKAGE_php5-mod-pcre),)
289 PKG_CONFIGURE_OPTS+= --with-pcre-regex=shared,"$(STAGING_DIR)/usr"
290 else
291 PKG_CONFIGURE_OPTS+= --without-pcre-regex
292 endif
293 endif
294 ifneq ($(CONFIG_PACKAGE_php5-mod-pgsql),)
295 PKG_CONFIGURE_OPTS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
296 else
297 PKG_CONFIGURE_OPTS+= --without-pgsql
298 endif
299 ifneq ($(CONFIG_PACKAGE_php5-mod-sqlite),)
300 PKG_CONFIGURE_OPTS+= --with-sqlite=shared,"$(STAGING_DIR)/usr"
301 else
302 PKG_CONFIGURE_OPTS+= --without-sqlite
303 endif
304 ifneq ($(CONFIG_PACKAGE_php5-mod-pdo),)
305 PKG_CONFIGURE_OPTS+= --enable-pdo=shared
306 ifneq ($(CONFIG_PACKAGE_php5-mod-pdo-sqlite),)
307 PKG_CONFIGURE_OPTS+= --with-pdo-sqlite=shared,"$(STAGING_DIR)/usr"
308 endif
309 else
310 PKG_CONFIGURE_OPTS+= --disable-pdo
311 endif
312 ifneq ($(CONFIG_PACKAGE_php5-mod-xml),)
313 PKG_CONFIGURE_OPTS+= --enable-xml=shared,"$(STAGING_DIR)/usr" \
314 --with-libexpat-dir="$(STAGING_DIR)/usr"
315 else
316 PKG_CONFIGURE_OPTS+= --disable-xml
317 endif
318 ifneq ($(CONFIG_PHP5_APC),)
319 PKG_CONFIGURE_OPTS+= --enable-apc --disable-apc-mmap --disable-apc-pthreadmutex
320 PKG_CONFIGURE_LIBS+= -lrt
321 else
322 PKG_CONFIGURE_OPTS+= --disable-apc
323 endif
324 ifneq ($(CONFIG_PHP5_EXIF),)
325 PKG_CONFIGURE_OPTS+= --enable-exif
326 else
327 PKG_CONFIGURE_OPTS+= --disable-exif
328 endif
329
330 define Build/Configure
331 endef
332
333 ifneq ($(CONFIG_PACKAGE_php5-cli),)
334 define Build/Compile/php5-cli
335 -$(MAKE) -C $(PKG_BUILD_DIR) clean
336 $(call Build/Configure/Default, \
337 $(PKG_CONFIGURE_OPTS) \
338 --enable-cli \
339 --disable-cgi \
340 --disable-fastcgi \
341 --enable-force-cgi-redirect \
342 --enable-discard-path \
343 , \
344 LIBS="$(PKG_CONFIGURE_LIBS)" \
345 php_cv_cc_rpath="no" \
346 )
347 $(MAKE) -C $(PKG_BUILD_DIR)
348 mv $(PKG_BUILD_DIR)/sapi/cli/php $(PKG_BUILD_DIR)/php-cli
349 endef
350 endif
351
352 ifneq ($(CONFIG_PACKAGE_php5-cgi),)
353 define Build/Compile/php5-cgi
354 -$(MAKE) -C $(PKG_BUILD_DIR) clean
355 $(call Build/Configure/Default, \
356 $(PKG_CONFIGURE_OPTS) \
357 --disable-cli \
358 --enable-cgi \
359 --disable-fastcgi \
360 --enable-force-cgi-redirect \
361 --enable-discard-path \
362 , \
363 LIBS="$(PKG_CONFIGURE_LIBS)" \
364 php_cv_cc_rpath="no" \
365 )
366 $(MAKE) -C $(PKG_BUILD_DIR)
367 mv $(PKG_BUILD_DIR)/sapi/cgi/php-cgi $(PKG_BUILD_DIR)/php-cgi
368 endef
369 endif
370
371 ifneq ($(CONFIG_PACKAGE_php5-fastcgi),)
372 define Build/Compile/php5-fastcgi
373 -$(MAKE) -C $(PKG_BUILD_DIR) clean
374 rm $(PKG_BUILD_DIR)/configure
375 cd $(PKG_BUILD_DIR) && ./buildconf --force
376 $(call Build/Configure/Default, \
377 $(PKG_CONFIGURE_OPTS) \
378 --disable-cli \
379 --enable-cgi \
380 --enable-fastcgi \
381 --enable-force-cgi-redirect \
382 --enable-discard-path \
383 , \
384 LIBS="$(PKG_CONFIGURE_LIBS)" \
385 php_cv_cc_rpath="no" \
386 )
387 $(MAKE) -C $(PKG_BUILD_DIR)
388 mv $(PKG_BUILD_DIR)/sapi/cgi/php-cgi $(PKG_BUILD_DIR)/php-fcgi
389 endef
390 endif
391
392 define Build/Compile
393 $(call Build/Compile/php5-cli)
394 $(call Build/Compile/php5-cgi)
395 $(call Build/Compile/php5-fastcgi)
396 endef
397
398 define Package/php5/conffiles
399 /etc/php.ini
400 endef
401
402 define Package/php5/install
403 $(INSTALL_DIR) $(1)/etc
404 $(INSTALL_DATA) ./files/php.ini $(1)/etc/
405 endef
406
407 define Package/php5-cli/install
408 $(INSTALL_DIR) $(1)/usr/bin
409 $(CP) $(PKG_BUILD_DIR)/php-cli $(1)/usr/bin/php-cli
410 endef
411
412 define Package/php5-cgi/install
413 $(INSTALL_DIR) $(1)/usr/bin
414 $(CP) $(PKG_BUILD_DIR)/php-cgi $(1)/usr/bin/php-cgi
415 endef
416
417 define Package/php5-fastcgi/install
418 $(INSTALL_DIR) $(1)/usr/bin
419 $(CP) $(PKG_BUILD_DIR)/php-fcgi $(1)/usr/bin/php-fcgi
420 $(INSTALL_DIR) $(1)/etc/init.d
421 $(INSTALL_BIN) ./files/php.init $(1)/etc/init.d/php
422 endef
423
424 define BuildPlugin
425 define Package/$(1)/install
426 [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib/php
427 for m in $(2); do \
428 [ -z "$(CONFIG_PACKAGE_$(1))" ] \
429 || $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$$$$$$$${m}.so $$(1)/usr/lib/php/ ; \
430 done
431 endef
432
433 $$(eval $$(call BuildPackage,$(1)))
434 endef
435
436 $(eval $(call BuildPackage,php5))
437 $(eval $(call BuildPackage,php5-cli))
438 $(eval $(call BuildPackage,php5-cgi))
439 $(eval $(call BuildPackage,php5-fastcgi))
440 $(eval $(call BuildPlugin,php5-mod-curl,curl))
441 $(eval $(call BuildPlugin,php5-mod-ftp,ftp))
442 $(eval $(call BuildPlugin,php5-mod-gd,gd))
443 $(eval $(call BuildPlugin,php5-mod-gmp,gmp))
444 $(eval $(call BuildPlugin,php5-mod-ldap,ldap))
445 $(eval $(call BuildPlugin,php5-mod-mysql,mysql))
446 $(eval $(call BuildPlugin,php5-mod-openssl,openssl))
447 $(eval $(call BuildPlugin,php5-mod-pcre,pcre))
448 $(eval $(call BuildPlugin,php5-mod-pgsql,pgsql))
449 $(eval $(call BuildPlugin,php5-mod-session,session))
450 $(eval $(call BuildPlugin,php5-mod-sockets,sockets))
451 $(eval $(call BuildPlugin,php5-mod-sqlite,sqlite))
452 $(eval $(call BuildPlugin,php5-mod-pdo,pdo))
453 $(eval $(call BuildPlugin,php5-mod-pdo-sqlite,pdo_sqlite))
454 $(eval $(call BuildPlugin,php5-mod-xml,xml))