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