59fcdcf2c3f9f4313d7fb295db4a65f2ada172ef
[openwrt/svn-archive/archive.git] / lang / php5 / Makefile
1 #
2 # Copyright (C) 2006-2011 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.3.6
12 PKG_RELEASE:=2
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=http://www.php.net/distributions/
16 PKG_MD5SUM:=2286f5a82a6e8397955a0025c1c2ad98
17
18 PKG_FIXUP:=libtool no-autoreconf
19 PKG_BUILD_PARALLEL:=1
20
21 PHP5_MODULES = \
22 apc \
23 ctype curl \
24 fileinfo \
25 dom \
26 exif \
27 ftp \
28 gd gmp \
29 hash \
30 iconv \
31 json \
32 ldap \
33 mbstring mcrypt mysql \
34 openssl \
35 pcntl pdo pdo-mysql pdo-pgsql pdo-sqlite pgsql \
36 session simplexml soap sockets sqlite sqlite3 sysvmsg sysvsem sysvshm \
37 tokenizer \
38 xml xmlreader xmlwriter \
39
40 PKG_CONFIG_DEPENDS:= \
41 CONFIG_PACKAGE_php5-cgi CONFIG_PACKAGE_php5-cli \
42 $(patsubst %,CONFIG_PACKAGE_php5-mod-%,$(PHP5_MODULES)) \
43 CONFIG_PHP5_FILTER CONFIG_PHP5_LIBXML
44
45 include $(INCLUDE_DIR)/package.mk
46 include $(INCLUDE_DIR)/nls.mk
47
48 define Package/php5/Default
49 SUBMENU:=PHP
50 SECTION:=lang
51 CATEGORY:=Languages
52 TITLE:=PHP5 Hypertext preprocessor
53 URL:=http://www.php.net/
54 MAINTAINER:=Michael Heimpold <mhei@heimpold.de>
55 DEPENDS:=php5
56 endef
57
58 define Package/php5/Default/description
59 PHP is a widely-used general-purpose scripting language that is especially
60 suited for Web development and can be embedded into HTML.
61 endef
62
63 define Package/php5/config
64 config PHP5_FILTER
65 bool "PHP5 Filter support"
66 depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
67
68 config PHP5_LIBXML
69 bool "PHP5 LIBXML support"
70 depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
71 endef
72
73 define Package/php5
74 $(call Package/php5/Default)
75
76 DEPENDS:=+libpcre +zlib \
77 +PHP5_LIBXML:libxml2 \
78 +PACKAGE_php5-mod-apc:librt \
79 +(PACKAGE_php5-mod-sqlite3||PACKAGE_php5-mod-pdo-sqlite):libsqlite3 \
80 +(PACKAGE_php5-mod-sqlite3||PACKAGE_php5-mod-pdo-sqlite):libpthread
81 endef
82
83 define Package/php5/description
84 $(call Package/php5/Default/description)
85 This package contains only the PHP config file. You must actually choose
86 your PHP flavour (cli, cgi or fastcgi).
87 endef
88
89 define Package/php5-cli
90 $(call Package/php5/Default)
91 TITLE+= (CLI)
92 endef
93
94 define Package/php5-cli/description
95 $(call Package/php5/Default/description)
96 This package contains the CLI version of the PHP5 interpreter.
97 endef
98
99 define Package/php5-cgi
100 $(call Package/php5/Default)
101 TITLE+= (CGI & FastCGI)
102 endef
103
104 define Package/php5-cgi/description
105 $(call Package/php5/Default/description)
106 This package contains the CGI version of the PHP5 interpreter.
107 endef
108
109 define Package/php5-fastcgi
110 $(call Package/php5/Default)
111 DEPENDS+= +php5-cgi
112 TITLE:=FastCGI startup script
113 endef
114
115 define Package/php5-fastcgi/description
116 As FastCGI support is now a core feature the php5-fastcgi package now depends
117 on the php5-cgi package, containing just the startup script.
118 endef
119
120 CONFIGURE_ARGS+= \
121 --enable-shared \
122 --disable-static \
123 --disable-rpath \
124 --disable-debug \
125 --without-pear \
126 \
127 --with-config-file-path=/etc \
128 --with-config-file-scan-dir=/etc/php5 \
129 --enable-magic-quotes \
130 --disable-short-tags \
131 \
132 --without-gettext \
133 --with-zlib="$(STAGING_DIR)/usr" \
134 --with-zlib-dir="$(STAGING_DIR)/usr" \
135 --with-pcre-regex="$(STAGING_DIR)/usr" \
136 --disable-phar
137
138 ifneq ($(SDK),)
139 PKG_BUILD_DEPENDS+=libopenssl zlib libcurl libgd libgmp libopenldap libmysqlclient libpq libsqlite2 libpthread libsqlite3 libpcre libxml2
140 # force PKG_CONFIGURE_{LIBS,OPTS} below when built in the SDK
141 CONFIG_PACKAGE_php5-cli:=m
142 CONFIG_PACKAGE_php5-cgi:=m
143 CONFIG_PACKAGE_php5-fastcgi:=m
144 CONFIG_PACKAGE_php5-mod-curl:=m
145 CONFIG_PACKAGE_php5-mod-gd:=m
146 CONFIG_PACKAGE_php5-mod-gmp:=m
147 CONFIG_PACKAGE_php5-mod-ldap:=m
148 CONFIG_PACKAGE_php5-mod-mysql:=m
149 CONFIG_PACKAGE_php5-mod-pgsql:=m
150 CONFIG_PACKAGE_php5-mod-sqlite:=m
151 CONFIG_PACKAGE_php5-mod-sqlite3:=m
152 CONFIG_PACKAGE_php5-mod-xml:=m
153 endif
154
155 ifneq ($(CONFIG_PACKAGE_php5-cli),)
156 CONFIGURE_ARGS+= --enable-cli
157 else
158 CONFIGURE_ARGS+= --disable-cli
159 endif
160
161 ifneq ($(CONFIG_PACKAGE_php5-cgi),)
162 CONFIGURE_ARGS+= --enable-cgi
163 else
164 CONFIGURE_ARGS+= --disable-cgi
165 endif
166
167 ifneq ($(CONFIG_PACKAGE_php5-mod-apc),)
168 CONFIGURE_ARGS+= --enable-apc=shared --disable-apc-mmap --disable-apc-pthreadmutex
169 CONFIGURE_LIBS+= -lrt
170 else
171 CONFIGURE_ARGS+= --disable-apc
172 endif
173
174 ifneq ($(CONFIG_PACKAGE_php5-mod-ctype),)
175 CONFIGURE_ARGS+= --enable-ctype=shared
176 else
177 CONFIGURE_ARGS+= --disable-ctype
178 endif
179
180 ifneq ($(CONFIG_PACKAGE_php5-mod-curl),)
181 CONFIGURE_ARGS+= --with-curl=shared,"$(STAGING_DIR)/usr"
182 else
183 CONFIGURE_ARGS+= --without-curl
184 endif
185
186 ifneq ($(CONFIG_PACKAGE_php5-mod-fileinfo),)
187 CONFIGURE_ARGS+= --enable-fileinfo=shared
188 else
189 CONFIGURE_ARGS+= --disable-fileinfo
190 endif
191
192 ifneq ($(CONFIG_PACKAGE_php5-mod-dom),)
193 CONFIGURE_ARGS+= --enable-dom=shared
194 else
195 CONFIGURE_ARGS+= --disable-dom
196 endif
197
198 ifneq ($(CONFIG_PACKAGE_php5-mod-exif),)
199 CONFIGURE_ARGS+= --enable-exif=shared
200 else
201 CONFIGURE_ARGS+= --disable-exif
202 endif
203
204 ifneq ($(CONFIG_PACKAGE_php5-mod-ftp),)
205 CONFIGURE_ARGS+= --enable-ftp=shared
206 else
207 CONFIGURE_ARGS+= --disable-ftp
208 endif
209
210 ifneq ($(CONFIG_PACKAGE_php5-mod-gd),)
211 CONFIGURE_ARGS+= \
212 --with-gd=shared,"$(STAGING_DIR)/usr" \
213 --without-freetype-dir \
214 --with-jpeg-dir="$(STAGING_DIR)/usr" \
215 --with-png-dir="$(STAGING_DIR)/usr" \
216 --without-xpm-dir \
217 --without-t1lib \
218 --enable-gd-native-ttf \
219 --disable-gd-jis-conv
220 else
221 CONFIGURE_ARGS+= --without-gd
222 endif
223
224 ifneq ($(CONFIG_PACKAGE_php5-mod-gmp),)
225 CONFIGURE_ARGS+= --with-gmp=shared,"$(STAGING_DIR)/usr"
226 else
227 CONFIGURE_ARGS+= --without-gmp
228 endif
229
230 ifneq ($(CONFIG_PACKAGE_php5-mod-hash),)
231 CONFIGURE_ARGS+= --enable-hash=shared
232 else
233 CONFIGURE_ARGS+= --disable-hash
234 endif
235
236 ifneq ($(CONFIG_PACKAGE_php5-mod-iconv),)
237 CONFIGURE_ARGS+= --with-iconv=shared,"$(ICONV_PREFIX)"
238 else
239 CONFIGURE_ARGS+= --without-iconv
240 endif
241
242 ifneq ($(CONFIG_PACKAGE_php5-mod-json),)
243 CONFIGURE_ARGS+= --enable-json=shared
244 else
245 CONFIGURE_ARGS+= --disable-json
246 endif
247
248 ifneq ($(CONFIG_PACKAGE_php5-mod-ldap),)
249 CONFIGURE_ARGS+= \
250 --with-ldap=shared,"$(STAGING_DIR)/usr" \
251 --with-ldap-sasl="$(STAGING_DIR)/usr"
252 else
253 CONFIGURE_ARGS+= --without-ldap
254 endif
255
256 ifneq ($(CONFIG_PACKAGE_php5-mod-mbstring),)
257 CONFIGURE_ARGS+= --enable-mbstring=shared --enable-mbregex
258 else
259 CONFIGURE_ARGS+= --disable-mbstring
260 endif
261
262 ifneq ($(CONFIG_PACKAGE_php5-mod-mcrypt),)
263 CONFIGURE_ARGS+= --with-mcrypt=shared,"$(STAGING_DIR)/usr"
264 else
265 CONFIGURE_ARGS+= --without-mcrypt
266 endif
267
268 ifneq ($(CONFIG_PACKAGE_php5-mod-mysql),)
269 CONFIGURE_ARGS+= --with-mysql=shared,"$(STAGING_DIR)/usr"
270 else
271 CONFIGURE_ARGS+= --without-mysql
272 endif
273
274 ifneq ($(CONFIG_PACKAGE_php5-mod-openssl),)
275 CONFIGURE_ARGS+= \
276 --with-openssl=shared,"$(STAGING_DIR)/usr" \
277 --with-kerberos=no \
278 --with-openssl-dir="$(STAGING_DIR)/usr"
279 else
280 CONFIGURE_ARGS+= --without-openssl
281 endif
282
283 ifneq ($(CONFIG_PACKAGE_php5-mod-pcntl),)
284 CONFIGURE_ARGS+= --enable-pcntl=shared
285 else
286 CONFIGURE_ARGS+= --disable-pcntl
287 endif
288
289 ifneq ($(CONFIG_PACKAGE_php5-mod-pdo),)
290 CONFIGURE_ARGS+= --enable-pdo=shared
291 ifneq ($(CONFIG_PACKAGE_php5-mod-pdo-mysql),)
292 CONFIGURE_ARGS+= --with-pdo-mysql=shared,"$(STAGING_DIR)/usr"
293 else
294 CONFIGURE_ARGS+= --without-pdo-mysql
295 endif
296 ifneq ($(CONFIG_PACKAGE_php5-mod-pdo-pgsql),)
297 CONFIGURE_ARGS+= --with-pdo-pgsql=shared,"$(STAGING_DIR)/usr"
298 else
299 CONFIGURE_ARGS+= --without-pdo-pgsql
300 endif
301 ifneq ($(CONFIG_PACKAGE_php5-mod-pdo-sqlite),)
302 CONFIGURE_ARGS+= --with-pdo-sqlite=shared,"$(STAGING_DIR)/usr"
303 CONFIGURE_LIBS+= -lsqlite3 -lpthread
304 else
305 CONFIGURE_ARGS+= --without-pdo-sqlite
306 endif
307 else
308 CONFIGURE_ARGS+= --disable-pdo
309 endif
310
311 ifneq ($(CONFIG_PACKAGE_php5-mod-pgsql),)
312 CONFIGURE_ARGS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
313 else
314 CONFIGURE_ARGS+= --without-pgsql
315 endif
316
317 ifneq ($(CONFIG_PACKAGE_php5-mod-session),)
318 CONFIGURE_ARGS+= --enable-session=shared
319 else
320 CONFIGURE_ARGS+= --disable-session
321 endif
322
323 ifneq ($(CONFIG_PACKAGE_php5-mod-simplexml),)
324 CONFIGURE_ARGS+= --enable-simplexml=shared
325 else
326 CONFIGURE_ARGS+= --disable-simplexml
327 endif
328
329 ifneq ($(CONFIG_PACKAGE_php5-mod-soap),)
330 CONFIGURE_ARGS+= --enable-soap=shared
331 else
332 CONFIGURE_ARGS+= --disable-soap
333 endif
334
335 ifneq ($(CONFIG_PACKAGE_php5-mod-sockets),)
336 CONFIGURE_ARGS+= --enable-sockets=shared
337 else
338 CONFIGURE_ARGS+= --disable-sockets
339 endif
340
341 ifneq ($(CONFIG_PACKAGE_php5-mod-sqlite),)
342 CONFIGURE_ARGS+= --with-sqlite=shared,"$(STAGING_DIR)/usr"
343 else
344 CONFIGURE_ARGS+= --without-sqlite
345 endif
346
347 ifneq ($(CONFIG_PACKAGE_php5-mod-sqlite3),)
348 CONFIGURE_ARGS+= --with-sqlite3=shared,"$(STAGING_DIR)/usr"
349 CONFIGURE_LIBS+= -lsqlite3 -lpthread
350 else
351 CONFIGURE_ARGS+= --without-sqlite3
352 endif
353
354 ifneq ($(CONFIG_PACKAGE_php5-mod-sysvmsg),)
355 CONFIGURE_ARGS+= --enable-sysvmsg=shared
356 else
357 CONFIGURE_ARGS+= --disable-sysvmsg
358 endif
359
360 ifneq ($(CONFIG_PACKAGE_php5-mod-sysvsem),)
361 CONFIGURE_ARGS+= --enable-sysvsem=shared
362 else
363 CONFIGURE_ARGS+= --disable-sysvsem
364 endif
365
366 ifneq ($(CONFIG_PACKAGE_php5-mod-sysvshm),)
367 CONFIGURE_ARGS+= --enable-sysvshm=shared
368 else
369 CONFIGURE_ARGS+= --disable-sysvshm
370 endif
371
372 ifneq ($(CONFIG_PACKAGE_php5-mod-tokenizer),)
373 CONFIGURE_ARGS+= --enable-tokenizer=shared
374 else
375 CONFIGURE_ARGS+= --disable-tokenizer
376 endif
377
378 ifneq ($(CONFIG_PACKAGE_php5-mod-xml),)
379 CONFIGURE_ARGS+= --enable-xml=shared,"$(STAGING_DIR)/usr"
380 ifneq ($(CONFIG_PHP5_LIBXML),)
381 CONFIGURE_ARGS+= --with-libxml-dir="$(STAGING_DIR)/usr/include/libxml2"
382 else
383 CONFIGURE_ARGS+= --with-libexpat-dir="$(STAGING_DIR)/usr"
384 endif
385 else
386 CONFIGURE_ARGS+= --disable-xml
387 endif
388
389 ifneq ($(CONFIG_PACKAGE_php5-mod-xmlreader),)
390 CONFIGURE_ARGS+= --enable-xmlreader=shared,"$(STAGING_DIR)/usr"
391 else
392 CONFIGURE_ARGS+= --disable-xmlreader
393 endif
394
395 ifneq ($(CONFIG_PACKAGE_php5-mod-xmlwriter),)
396 CONFIGURE_ARGS+= --enable-xmlwriter=shared,"$(STAGING_DIR)/usr"
397 else
398 CONFIGURE_ARGS+= --disable-xmlwriter
399 endif
400
401 ifneq ($(CONFIG_PHP5_FILTER),)
402 CONFIGURE_ARGS+= --enable-filter
403 else
404 CONFIGURE_ARGS+= --disable-filter
405 endif
406
407 ifneq ($(CONFIG_PHP5_LIBXML),)
408 CONFIGURE_ARGS+= --enable-libxml
409 CONFIGURE_ARGS+= --with-libxml-dir="$(STAGING_DIR)/usr/include/libxml2"
410 else
411 CONFIGURE_ARGS+= --disable-libxml
412 endif
413
414 CONFIGURE_VARS+= \
415 LIBS="$(CONFIGURE_LIBS)" \
416 ac_cv_c_bigendian_php=$(if $(CONFIG_BIG_ENDIAN),yes,no) \
417 php_cv_cc_rpath="no" \
418 iconv_impl_name="gnu_libiconv" \
419 ac_cv_php_xml2_config_path="$(STAGING_DIR)/host/bin/xml2-config" \
420
421 define Package/php5/conffiles
422 /etc/php.ini
423 endef
424
425 define Package/php5/install
426 $(INSTALL_DIR) $(1)/etc
427 $(INSTALL_DATA) ./files/php.ini $(1)/etc/
428 endef
429
430 define Package/php5-cli/install
431 $(INSTALL_DIR) $(1)/usr/bin
432 $(CP) $(PKG_BUILD_DIR)/sapi/cli/php $(1)/usr/bin/php-cli
433 endef
434
435 define Package/php5-cgi/install
436 $(INSTALL_DIR) $(1)/usr/bin
437 $(CP) $(PKG_BUILD_DIR)/sapi/cgi/php-cgi $(1)/usr/bin/php-cgi
438 ln -sf php-cgi $(1)/usr/bin/php-fcgi
439 endef
440
441 define Package/php5-fastcgi/install
442 $(INSTALL_DIR) $(1)/etc/init.d
443 $(INSTALL_BIN) ./files/php.init $(1)/etc/init.d/php
444 endef
445
446 define BuildModule
447
448 define Package/php5-mod-$(1)
449 $(call Package/php5/Default)
450
451 ifneq ($(3),)
452 DEPENDS+=$(3)
453 endif
454
455 TITLE:=$(2) shared module
456 endef
457
458 define Package/php5-mod-$(1)/install
459 $(INSTALL_DIR) $$(1)/usr/lib/php
460 $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$(subst -,_,$(1)).so $$(1)/usr/lib/php/
461 $(INSTALL_DIR) $$(1)/etc/php5
462 echo "extension=$(subst -,_,$(1)).so" > $$(1)/etc/php5/$(subst -,_,$(1)).ini
463 endef
464
465 $$(eval $$(call BuildPackage,php5-mod-$(1)))
466
467 endef
468
469 $(eval $(call BuildPackage,php5))
470 $(eval $(call BuildPackage,php5-cli))
471 $(eval $(call BuildPackage,php5-cgi))
472 $(eval $(call BuildPackage,php5-fastcgi))
473
474 #$(eval $(call BuildModule,NAME,TITLE[,PKG DEPENDS]))
475 $(eval $(call BuildModule,apc,APC,+librt))
476 $(eval $(call BuildModule,ctype,Ctype))
477 $(eval $(call BuildModule,curl,cURL,+libcurl))
478 $(eval $(call BuildModule,fileinfo,Fileinfo,+libmagic))
479 $(eval $(call BuildModule,dom,DOM,@PHP5_LIBXML +libxml2))
480 $(eval $(call BuildModule,exif,EXIF))
481 $(eval $(call BuildModule,ftp,FTP))
482 $(eval $(call BuildModule,gd,GD graphics,+libgd))
483 $(eval $(call BuildModule,gmp,GMP,+libgmp))
484 $(eval $(call BuildModule,hash,Hash))
485 $(eval $(call BuildModule,iconv,iConv,+libiconv))
486 $(eval $(call BuildModule,json,JSON))
487 $(eval $(call BuildModule,ldap,LDAP,+libopenldap +libsasl2))
488 $(eval $(call BuildModule,mbstring,MBString))
489 $(eval $(call BuildModule,mcrypt,Mcrypt,+libmcrypt +libltdl))
490 $(eval $(call BuildModule,mysql,MySQL,+libmysqlclient))
491 $(eval $(call BuildModule,openssl,OpenSSL,+libopenssl))
492 $(eval $(call BuildModule,pcntl,PCNTL))
493 $(eval $(call BuildModule,pdo,PHP Data Objects))
494 $(eval $(call BuildModule,pdo-mysql,PDO driver for MySQL,php5-mod-pdo +libmysqlclient))
495 $(eval $(call BuildModule,pdo-pgsql,PDO driver for PostgreSQL,php5-mod-pdo +libpq))
496 $(eval $(call BuildModule,pdo-sqlite,PDO driver for SQLite 3.x,php5-mod-pdo +libsqlite3 +libpthread))
497 $(eval $(call BuildModule,pgsql,PostgreSQL,+libpq))
498 $(eval $(call BuildModule,session,Session))
499 $(eval $(call BuildModule,simplexml,SimpleXML,@PHP5_LIBXML +libxml2))
500 $(eval $(call BuildModule,soap,SOAP,@PHP5_LIBXML +libxml2))
501 $(eval $(call BuildModule,sockets,Sockets))
502 $(eval $(call BuildModule,sqlite,SQLite 2.x,+libsqlite2))
503 $(eval $(call BuildModule,sqlite3,SQLite3,+libsqlite3 +libpthread))
504 $(eval $(call BuildModule,sysvmsg,System V messages))
505 $(eval $(call BuildModule,sysvsem,System V shared memory))
506 $(eval $(call BuildModule,sysvshm,System V semaphore))
507 $(eval $(call BuildModule,tokenizer,Tokenizer))
508 $(eval $(call BuildModule,xml,XML,+PHP5_LIBXML:libxml2 +!PHP5_LIBXML:libexpat))
509 $(eval $(call BuildModule,xmlreader,XMLReader,@PHP5_LIBXML +libxml2 +libiconv))
510 $(eval $(call BuildModule,xmlwriter,XMLWriter,@PHP5_LIBXML +libxml2 +libiconv))