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