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