let ipkg fail when a package file to be installed is not found
[openwrt.git] / openwrt / package / php5 / Makefile
1 # $Id$
2
3 include $(TOPDIR)/rules.mk
4
5 PKG_NAME:=php
6 PKG_VERSION:=5.0.5
7 PKG_RELEASE:=1
8 PKG_MD5SUM:=b5d4ca75bbb11ee5b830fa67213d9f7f
9
10 PKG_SOURCE_URL:=http://fr.php.net/distributions/
11 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
12 PKG_CAT:=bzcat
13
14 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
15
16 include $(TOPDIR)/package/rules.mk
17
18 define PKG_mod_template
19
20 $$(IPKG_$(1)):
21         install -d -m0755 $$(IDIR_$(1))/usr/lib/php
22         install -m0755 $(PKG_BUILD_DIR)/modules/$(2).so $$(IDIR_$(1))/usr/lib/php
23         $(RSTRIP) $$(IDIR_$(1))
24         $(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR)
25
26 endef
27
28 PKG_CONFIGURE_OPTS:= \
29         --enable-shared \
30         --disable-static \
31         --disable-rpath \
32         --disable-debug \
33         --without-pear \
34         --disable-spl \
35         \
36         --with-config-file-path=/etc \
37         --disable-ipv6 \
38         --enable-magic-quotes \
39         --enable-memory-limit \
40         --disable-short-tags \
41         \
42         --disable-ctype \
43         --disable-dom \
44         --enable-ftp=shared \
45         --without-gettext \
46         --without-iconv \
47         --disable-libxml \
48           --without-libxml-dir \
49         --disable-mbstring \
50         --disable-mbregex \
51         --with-openssl=shared,"$(STAGING_DIR)/usr" \
52           --with-kerberos=no \
53           --with-openssl-dir="$(STAGING_DIR)/usr" \
54         --enable-session=shared \
55         --disable-simplexml \
56         --disable-soap \
57         --enable-sockets=shared \
58         --disable-tokenizer \
59         --with-zlib="$(STAGING_DIR)/usr" \
60           --with-zlib-dir="$(STAGING_DIR)/usr" \
61
62 ifneq ($(BR2_PACKAGE_PHP5_MOD_CURL),)
63 PKG_CONFIGURE_OPTS+= --with-curl=shared,"$(STAGING_DIR)/usr"
64 else
65 PKG_CONFIGURE_OPTS+= --without-curl
66 endif
67 ifneq ($(BR2_PACKAGE_PHP5_MOD_GD),)
68 PKG_CONFIGURE_OPTS+= --with-gd=shared,"$(STAGING_DIR)/usr" \
69         --without-freetype-dir \
70         --with-jpeg-dir="$(STAGING_DIR)/usr" \
71         --with-png-dir="$(STAGING_DIR)/usr" \
72         --without-xpm-dir \
73         --without-ttf \
74         --without-t1lib \
75         --enable-gd-native-ttf \
76         --disable-gd-jis-conv
77 else
78 PKG_CONFIGURE_OPTS+= --without-gd
79 endif
80 ifneq ($(BR2_PACKAGE_PHP5_MOD_GMP),)
81 PKG_CONFIGURE_OPTS+= --with-gmp=shared,"$(STAGING_DIR)/usr"
82 else
83 PKG_CONFIGURE_OPTS+= --without-gmp
84 endif
85 ifneq ($(BR2_PACKAGE_PHP5_MOD_LDAP),)
86 PKG_CONFIGURE_OPTS+= --with-ldap=shared,"$(STAGING_DIR)/usr" \
87         --with-ldap-sasl="$(STAGING_DIR)/usr"
88 else
89 PKG_CONFIGURE_OPTS+= --without-ldap
90 endif
91 ifneq ($(BR2_PACKAGE_PHP5_MOD_MYSQL),)
92 PKG_CONFIGURE_OPTS+= --with-mysql=shared,"$(STAGING_DIR)/usr"
93 else
94 PKG_CONFIGURE_OPTS+= --without-mysql
95 endif
96 ifneq ($(BR2_PACKAGE_PHP5_MOD_PCRE),)
97 PKG_CONFIGURE_OPTS+= --with-pcre-regex=shared,"$(STAGING_DIR)/usr"
98 else
99 PKG_CONFIGURE_OPTS+= --without-pcre-regex
100 endif
101 ifneq ($(BR2_PACKAGE_PHP5_MOD_PGSQL),)
102 PKG_CONFIGURE_OPTS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
103 else
104 PKG_CONFIGURE_OPTS+= --without-pgsql
105 endif
106 ifneq ($(BR2_PACKAGE_PHP5_MOD_SQLITE),)
107 PKG_CONFIGURE_OPTS+= --with-sqlite=shared,"$(STAGING_DIR)/usr"
108 else
109 PKG_CONFIGURE_OPTS+= --without-sqlite
110 endif
111 ifneq ($(BR2_PACKAGE_PHP5_MOD_XML),)
112 PKG_CONFIGURE_OPTS+= --enable-xml=shared,"$(STAGING_DIR)/usr" \
113         --with-libexpat-dir="$(STAGING_DIR)/usr"
114 else
115 PKG_CONFIGURE_OPTS+= --disable-xml
116 endif
117
118 $(eval $(call PKG_template,PHP5_CLI,php5-cli,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
119 $(eval $(call PKG_template,PHP5_CGI,php5-cgi,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
120 $(eval $(call PKG_template,PHP5_FASTCGI,php5-fastcgi,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
121
122 $(eval $(call PKG_template,PHP5_MOD_CURL,php5-mod-curl,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
123 $(eval $(call PKG_template,PHP5_MOD_FTP,php5-mod-ftp,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
124 $(eval $(call PKG_template,PHP5_MOD_GD,php5-mod-gd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
125 $(eval $(call PKG_template,PHP5_MOD_GMP,php5-mod-gmp,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
126 $(eval $(call PKG_template,PHP5_MOD_LDAP,php5-mod-ldap,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
127 $(eval $(call PKG_template,PHP5_MOD_MYSQL,php5-mod-mysql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
128 $(eval $(call PKG_template,PHP5_MOD_OPENSSL,php5-mod-openssl,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
129 $(eval $(call PKG_template,PHP5_MOD_PCRE,php5-mod-pcre,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
130 $(eval $(call PKG_template,PHP5_MOD_PGSQL,php5-mod-pgsql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
131 $(eval $(call PKG_template,PHP5_MOD_SESSION,php5-mod-session,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
132 $(eval $(call PKG_template,PHP5_MOD_SOCKETS,php5-mod-sockets,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
133 $(eval $(call PKG_template,PHP5_MOD_SQLITE,php5-mod-sqlite,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
134 $(eval $(call PKG_template,PHP5_MOD_XML,php5-mod-xml,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
135
136 $(eval $(call PKG_mod_template,PHP5_MOD_CURL,curl))
137 $(eval $(call PKG_mod_template,PHP5_MOD_FTP,ftp))
138 $(eval $(call PKG_mod_template,PHP5_MOD_GD,gd))
139 $(eval $(call PKG_mod_template,PHP5_MOD_GMP,gmp))
140 $(eval $(call PKG_mod_template,PHP5_MOD_LDAP,ldap))
141 $(eval $(call PKG_mod_template,PHP5_MOD_MYSQL,mysql))
142 $(eval $(call PKG_mod_template,PHP5_MOD_OPENSSL,openssl))
143 $(eval $(call PKG_mod_template,PHP5_MOD_PCRE,pcre))
144 $(eval $(call PKG_mod_template,PHP5_MOD_PGSQL,pgsql))
145 $(eval $(call PKG_mod_template,PHP5_MOD_SESSION,session))
146 $(eval $(call PKG_mod_template,PHP5_MOD_SOCKETS,sockets))
147 $(eval $(call PKG_mod_template,PHP5_MOD_SQLITE,sqlite))
148 $(eval $(call PKG_mod_template,PHP5_MOD_XML,xml))
149
150
151 $(PKG_BUILD_DIR)/.configured:
152         touch $@
153
154 $(PKG_BUILD_DIR)/.built:
155         (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status} ; \
156                 $(TARGET_CONFIGURE_OPTS) \
157                 CFLAGS="$(TARGET_CFLAGS)" \
158                 CPPFLAGS="-I$(STAGING_DIR)/usr/include" \
159                 LDFLAGS="-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib" \
160                 LIBS="-lcrypto -lssl" \
161                 php_cv_cc_rpath="no" \
162                 ./configure \
163                   --target=$(GNU_TARGET_NAME) \
164                   --host=$(GNU_TARGET_NAME) \
165                   --build=$(GNU_HOST_NAME) \
166                   --program-prefix="" \
167                   --program-suffix="" \
168                   --prefix=/usr \
169                   --exec-prefix=/usr \
170                   --bindir=/usr/bin \
171                   --datadir=/usr/share \
172                   --includedir=/usr/include \
173                   --infodir=/usr/share/info \
174                   --libdir=/usr/lib \
175                   --libexecdir=/usr/lib \
176                   --localstatedir=/var \
177                   --mandir=/usr/share/man \
178                   --sbindir=/usr/sbin \
179                   --sysconfdir=/etc \
180                   $(DISABLE_LARGEFILE) \
181                   $(DISABLE_NLS) \
182                   $(PKG_CONFIGURE_OPTS) \
183                   --enable-cli \
184                   --disable-cgi \
185                   --disable-fastcgi \
186                   --enable-force-cgi-redirect \
187                   --enable-discard-path \
188         );
189         $(MAKE) -C $(PKG_BUILD_DIR)
190         mv $(PKG_BUILD_DIR)/sapi/cli/php $(PKG_BUILD_DIR)/php-cli
191         (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status} ; \
192                 $(TARGET_CONFIGURE_OPTS) \
193                 CFLAGS="$(TARGET_CFLAGS)" \
194                 CPPFLAGS="-I$(STAGING_DIR)/usr/include" \
195                 LDFLAGS="-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib" \
196                 LIBS="-lcrypto -lssl" \
197                 php_cv_cc_rpath="no" \
198                 ./configure \
199                   --target=$(GNU_TARGET_NAME) \
200                   --host=$(GNU_TARGET_NAME) \
201                   --build=$(GNU_HOST_NAME) \
202                   --program-prefix="" \
203                   --program-suffix="" \
204                   --prefix=/usr \
205                   --exec-prefix=/usr \
206                   --bindir=/usr/bin \
207                   --datadir=/usr/share \
208                   --includedir=/usr/include \
209                   --infodir=/usr/share/info \
210                   --libdir=/usr/lib \
211                   --libexecdir=/usr/lib \
212                   --localstatedir=/var \
213                   --mandir=/usr/share/man \
214                   --sbindir=/usr/sbin \
215                   --sysconfdir=/etc \
216                   $(DISABLE_LARGEFILE) \
217                   $(DISABLE_NLS) \
218                   $(PKG_CONFIGURE_OPTS) \
219                   --disable-cli \
220                   --enable-cgi \
221                   --disable-fastcgi \
222                   --enable-force-cgi-redirect \
223                   --enable-discard-path \
224         );
225         $(MAKE) -C $(PKG_BUILD_DIR)
226         mv $(PKG_BUILD_DIR)/sapi/cgi/php $(PKG_BUILD_DIR)/php-cgi
227         $(MAKE) -C $(PKG_BUILD_DIR) clean
228         (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status} ; \
229                 $(TARGET_CONFIGURE_OPTS) \
230                 CFLAGS="$(TARGET_CFLAGS)" \
231                 CPPFLAGS="-I$(STAGING_DIR)/usr/include" \
232                 LDFLAGS="-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib" \
233                 LIBS="-lcrypto -lssl" \
234                 php_cv_cc_rpath="no" \
235                 ./configure \
236                   --target=$(GNU_TARGET_NAME) \
237                   --host=$(GNU_TARGET_NAME) \
238                   --build=$(GNU_HOST_NAME) \
239                   --program-prefix="" \
240                   --program-suffix="" \
241                   --prefix=/usr \
242                   --exec-prefix=/usr \
243                   --bindir=/usr/sbin \
244                   --datadir=/usr/share \
245                   --includedir=/usr/include \
246                   --infodir=/usr/share/info \
247                   --libdir=/usr/lib \
248                   --libexecdir=/usr/lib \
249                   --localstatedir=/var \
250                   --mandir=/usr/share/man \
251                   --sbindir=/usr/sbin \
252                   --sysconfdir=/etc \
253                   $(DISABLE_LARGEFILE) \
254                   $(DISABLE_NLS) \
255                   $(PKG_CONFIGURE_OPTS) \
256                   --disable-cli \
257                   --enable-cgi \
258                   --enable-fastcgi \
259                   --enable-force-cgi-redirect \
260                   --enable-discard-path \
261         );
262         $(MAKE) -C $(PKG_BUILD_DIR)
263         mv $(PKG_BUILD_DIR)/sapi/cgi/php $(PKG_BUILD_DIR)/php-fastcgi
264         touch $@
265
266 $(IPKG_PHP5_CLI):
267         install -m0755 -d $(IDIR_PHP5_CLI)/etc
268         install -m0644 ./files/php.ini $(IDIR_PHP5_CLI)/etc/
269         install -m0755 -d $(IDIR_PHP5_CLI)/usr/bin
270         $(CP) $(PKG_BUILD_DIR)/php-cli $(IDIR_PHP5_CLI)/usr/bin/php
271         $(RSTRIP) $(IDIR_PHP5_CLI)
272         $(IPKG_BUILD) $(IDIR_PHP5_CLI) $(PACKAGE_DIR)
273
274 $(IPKG_PHP5_CGI):
275         install -m0755 -d $(IDIR_PHP5_CGI)/etc
276         install -m0644 ./files/php.ini $(IDIR_PHP5_CGI)/etc/
277         install -m0755 -d $(IDIR_PHP5_CGI)/usr/bin
278         $(CP) $(PKG_BUILD_DIR)/php-cgi $(IDIR_PHP5_CGI)/usr/bin/php
279         $(RSTRIP) $(IDIR_PHP5_CGI)
280         $(IPKG_BUILD) $(IDIR_PHP5_CGI) $(PACKAGE_DIR)
281
282 $(IPKG_PHP5_FASTCGI):
283         install -m0755 -d $(IDIR_PHP5_FASTCGI)/etc
284         install -m0644 ./files/php.ini $(IDIR_PHP5_FASTCGI)/etc/
285         install -m0755 -d $(IDIR_PHP5_FASTCGI)/etc/init.d
286         install -m0755 ./files/php.init $(IDIR_PHP5_FASTCGI)/etc/init.d/php
287         install -m0755 -d $(IDIR_PHP5_FASTCGI)/usr/sbin
288         $(CP) $(PKG_BUILD_DIR)/php-fastcgi $(IDIR_PHP5_FASTCGI)/usr/sbin/php
289         $(RSTRIP) $(IDIR_PHP5_FASTCGI)
290         $(IPKG_BUILD) $(IDIR_PHP5_FASTCGI) $(PACKAGE_DIR)
291