add option to compile APC for php5
[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.1.6
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
16 PKG_SOURCE_URL:=http://fr.php.net/distributions/
17 PKG_MD5SUM:=08e423aa314369d4392a36b3f7246afc
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
196 ifneq ($(SDK),)
197 PKG_BUILD_DEPENDS:=libopenssl zlib libcurl libgd libgmp libopenldap libmysqlclient libpq libsqlite2 libexpat
198 # force PKG_CONFIGURE_{LIBS,OPTS} below when built in the SDK
199 CONFIG_PACKAGE_php5-cli:=m
200 CONFIG_PACKAGE_php5-cgi:=m
201 CONFIG_PACKAGE_php5-fastcgi:=m
202 CONFIG_PACKAGE_php5-mod-curl:=m
203 CONFIG_PACKAGE_php5-mod-gd:=m
204 CONFIG_PACKAGE_php5-mod-gmp:=m
205 CONFIG_PACKAGE_php5-mod-ldap:=m
206 CONFIG_PACKAGE_php5-mod-mysql:=m
207 CONFIG_PACKAGE_php5-mod-pcre:=m
208 CONFIG_PACKAGE_php5-mod-pgsql:=m
209 CONFIG_PACKAGE_php5-mod-sqlite:=m
210 CONFIG_PACKAGE_php5-mod-xml:=m
211 endif
212
213 ifneq ($(CONFIG_PACKAGE_php5-mod-curl),)
214 PKG_CONFIGURE_OPTS+= --with-curl=shared,"$(STAGING_DIR)/usr"
215 else
216 PKG_CONFIGURE_OPTS+= --without-curl
217 endif
218 ifneq ($(CONFIG_PACKAGE_php5-mod-gd),)
219 PKG_CONFIGURE_OPTS+= --with-gd=shared,"$(STAGING_DIR)/usr" \
220 --without-freetype-dir \
221 --with-jpeg-dir="$(STAGING_DIR)/usr" \
222 --with-png-dir="$(STAGING_DIR)/usr" \
223 --without-xpm-dir \
224 --without-ttf \
225 --without-t1lib \
226 --enable-gd-native-ttf \
227 --disable-gd-jis-conv
228 else
229 PKG_CONFIGURE_OPTS+= --without-gd
230 endif
231 ifneq ($(CONFIG_PACKAGE_php5-mod-gmp),)
232 PKG_CONFIGURE_OPTS+= --with-gmp=shared,"$(STAGING_DIR)/usr"
233 else
234 PKG_CONFIGURE_OPTS+= --without-gmp
235 endif
236 ifneq ($(CONFIG_PACKAGE_php5-mod-ldap),)
237 PKG_CONFIGURE_OPTS+= --with-ldap=shared,"$(STAGING_DIR)/usr" \
238 --with-ldap-sasl="$(STAGING_DIR)/usr"
239 else
240 PKG_CONFIGURE_OPTS+= --without-ldap
241 endif
242 ifneq ($(CONFIG_PACKAGE_php5-mod-mysql),)
243 PKG_CONFIGURE_OPTS+= --with-mysql=shared,"$(STAGING_DIR)/usr"
244 else
245 PKG_CONFIGURE_OPTS+= --without-mysql
246 endif
247 ifneq ($(CONFIG_PACKAGE_php5-mod-pcre),)
248 PKG_CONFIGURE_OPTS+= --with-pcre-regex=shared,"$(STAGING_DIR)/usr"
249 else
250 PKG_CONFIGURE_OPTS+= --without-pcre-regex
251 endif
252 ifneq ($(CONFIG_PACKAGE_php5-mod-pgsql),)
253 PKG_CONFIGURE_OPTS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
254 else
255 PKG_CONFIGURE_OPTS+= --without-pgsql
256 endif
257 ifneq ($(CONFIG_PACKAGE_php5-mod-sqlite),)
258 PKG_CONFIGURE_OPTS+= --with-sqlite=shared,"$(STAGING_DIR)/usr"
259 else
260 PKG_CONFIGURE_OPTS+= --without-sqlite
261 endif
262 ifneq ($(CONFIG_PACKAGE_php5-mod-xml),)
263 PKG_CONFIGURE_OPTS+= --enable-xml=shared,"$(STAGING_DIR)/usr" \
264 --with-libexpat-dir="$(STAGING_DIR)/usr"
265 else
266 PKG_CONFIGURE_OPTS+= --disable-xml
267 endif
268 ifneq ($(CONFIG_PACKAGE_php5-mod-apc),)
269 PKG_CONFIGURE_OPTS+= --enable-apc --disable-apc-mmap
270 PKG_CONFIGURE_LIBS+= -lrt
271 else
272 PKG_CONFIGURE_OPTS+= --disable-apc
273 endif
274
275 define Build/Configure
276 endef
277
278 ifneq ($(CONFIG_PACKAGE_php5-cli),)
279 define Build/Compile/php5-cli
280 -$(MAKE) -C $(PKG_BUILD_DIR) clean
281 $(call Build/Configure/Default, \
282 $(PKG_CONFIGURE_OPTS) \
283 --enable-cli \
284 --disable-cgi \
285 --disable-fastcgi \
286 --enable-force-cgi-redirect \
287 --enable-discard-path \
288 , \
289 LIBS="$(PKG_CONFIGURE_LIBS)" \
290 php_cv_cc_rpath="no" \
291 )
292 $(MAKE) -C $(PKG_BUILD_DIR)
293 mv $(PKG_BUILD_DIR)/sapi/cli/php $(PKG_BUILD_DIR)/php-cli
294 endef
295 endif
296
297 ifneq ($(CONFIG_PACKAGE_php5-cgi),)
298 define Build/Compile/php5-cgi
299 -$(MAKE) -C $(PKG_BUILD_DIR) clean
300 $(call Build/Configure/Default, \
301 $(PKG_CONFIGURE_OPTS) \
302 --disable-cli \
303 --enable-cgi \
304 --disable-fastcgi \
305 --enable-force-cgi-redirect \
306 --enable-discard-path \
307 , \
308 LIBS="$(PKG_CONFIGURE_LIBS)" \
309 php_cv_cc_rpath="no" \
310 )
311 $(MAKE) -C $(PKG_BUILD_DIR)
312 mv $(PKG_BUILD_DIR)/sapi/cgi/php $(PKG_BUILD_DIR)/php-cgi
313 endef
314 endif
315
316 ifneq ($(CONFIG_PACKAGE_php5-fastcgi),)
317 define Build/Compile/php5-fastcgi
318 -$(MAKE) -C $(PKG_BUILD_DIR) clean
319 rm $(PKG_BUILD_DIR)/configure
320 cd $(PKG_BUILD_DIR) && ./buildconf --force
321 $(call Build/Configure/Default, \
322 $(PKG_CONFIGURE_OPTS) \
323 --disable-cli \
324 --enable-cgi \
325 --enable-fastcgi \
326 --enable-force-cgi-redirect \
327 --enable-discard-path \
328 , \
329 LIBS="$(PKG_CONFIGURE_LIBS)" \
330 php_cv_cc_rpath="no" \
331 )
332 $(MAKE) -C $(PKG_BUILD_DIR)
333 mv $(PKG_BUILD_DIR)/sapi/cgi/php $(PKG_BUILD_DIR)/php-fastcgi
334 endef
335 endif
336
337 define Build/Compile
338 $(call Build/Compile/php5-cli)
339 $(call Build/Compile/php5-cgi)
340 $(call Build/Compile/php5-fastcgi)
341 endef
342
343 define Package/php5/install
344 $(INSTALL_DIR) $(1)/etc
345 $(INSTALL_DATA) ./files/php.ini $(1)/etc/
346 endef
347
348 define Package/php5-cli/install
349 $(INSTALL_DIR) $(1)/usr/bin
350 $(CP) $(PKG_BUILD_DIR)/php-cli $(1)/usr/bin/php
351 endef
352
353 define Package/php5-cgi/install
354 $(INSTALL_DIR) $(1)/usr/bin
355 $(CP) $(PKG_BUILD_DIR)/php-cgi $(1)/usr/bin/php
356 endef
357
358 define Package/php5-fastcgi/install
359 $(INSTALL_DIR) $(1)/usr/sbin
360 $(CP) $(PKG_BUILD_DIR)/php-fastcgi $(1)/usr/sbin/php
361 $(INSTALL_DIR) $(1)/etc/init.d
362 $(INSTALL_BIN) ./files/php.init $(1)/etc/init.d/php
363 endef
364
365 define BuildPlugin
366 define Package/$(1)/install
367 [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib/php
368 for m in $(2); do \
369 $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$$$$$$$${m}.so $$(1)/usr/lib/php/ ; \
370 done
371 endef
372
373 $$(eval $$(call BuildPackage,$(1)))
374 endef
375
376 $(eval $(call BuildPackage,php5))
377 $(eval $(call BuildPackage,php5-cli))
378 $(eval $(call BuildPackage,php5-cgi))
379 $(eval $(call BuildPackage,php5-fastcgi))
380 $(eval $(call BuildPlugin,php5-mod-curl,curl))
381 $(eval $(call BuildPlugin,php5-mod-ftp,ftp))
382 $(eval $(call BuildPlugin,php5-mod-gd,gd))
383 $(eval $(call BuildPlugin,php5-mod-gmp,gmp))
384 $(eval $(call BuildPlugin,php5-mod-ldap,ldap))
385 $(eval $(call BuildPlugin,php5-mod-mysql,mysql))
386 $(eval $(call BuildPlugin,php5-mod-openssl,openssl))
387 $(eval $(call BuildPlugin,php5-mod-pcre,pcre))
388 $(eval $(call BuildPlugin,php5-mod-pgsql,pgsql))
389 $(eval $(call BuildPlugin,php5-mod-session,session))
390 $(eval $(call BuildPlugin,php5-mod-sockets,sockets))
391 $(eval $(call BuildPlugin,php5-mod-sqlite,sqlite))
392 $(eval $(call BuildPlugin,php5-mod-xml,xml))
393 $(eval $(call BuildPlugin,php5-mod-apc))