source: packages/lang/php5/Makefile @ 26823

Last change on this file since 26823 was 26823, checked in by mhei, 6 years ago

[packages] php5: whitespace fixes only

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