root/trunk/make/apache.mk

Revision 11467, 11.5 kB (checked in by bzhou, 5 days ago)

apache: 2.2.14 -> 2.2.15

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1 ###########################################################
2 #
3 # apache
4 #
5 ###########################################################
6 #
7 # $id$
8 #
9 # APACHE_VERSION, APACHE_SITE and APACHE_SOURCE define
10 # the upstream location of the source code for the package.
11 # APACHE_DIR is the directory which is created when the source
12 # archive is unpacked.
13 # APACHE_UNZIP is the command used to unzip the source.
14 # It is usually "zcat" (for .gz) or "bzcat" (for .bz2)
15 #
16 APACHE_SITE=http://archive.apache.org/dist/httpd
17 APACHE_VERSION=2.2.15
18 APACHE_SOURCE=httpd-$(APACHE_VERSION).tar.bz2
19 APACHE_DIR=httpd-$(APACHE_VERSION)
20 APACHE_UNZIP=bzcat
21 APACHE_MAINTAINER=NSLU2 Linux <nslu2-linux@yahoogroups.com>
22 APACHE_DESCRIPTION=The most popular web server on the internet
23 APACHE_SECTION=lib
24 APACHE_PRIORITY=optional
25 APACHE_DEPENDS=apr (>= $(APR_VERSION)), apr-util (>= $(APR_UTIL_VERSION)), \
26         e2fsprogs, expat, openssl, zlib $(APACHE_TARGET_DEPENDS)
27
28 APACHE_MPM=worker
29 #APACHE_MPM=prefork
30
31 #
32 # APACHE_IPK_VERSION should be incremented when the ipk changes.
33 #
34 APACHE_IPK_VERSION=1
35
36 #
37 # APACHE_CONFFILES should be a list of user-editable files
38 #
39 APACHE_CONFFILES=/opt/etc/apache2/httpd.conf \
40                 /opt/etc/apache2/extra/httpd-ssl.conf \
41                 /opt/etc/init.d/S80apache
42
43 #
44 # APACHE_LOCALES defines which locales get installed
45 #
46 APACHE_LOCALES=
47
48 #
49 # APACHE_CONFFILES should be a list of user-editable files
50 #APACHE_CONFFILES=/opt/etc/apache.conf /opt/etc/init.d/SXXapache
51
52 #
53 # APACHE_PATCHES should list any patches, in the the order in
54 # which they should be applied to the source code.
55 #
56 APACHE_PATCHES=$(APACHE_SOURCE_DIR)/hostcc.patch \
57                 $(APACHE_SOURCE_DIR)/hostcc-pcre.patch \
58                 $(APACHE_SOURCE_DIR)/apxs.patch \
59                 $(APACHE_SOURCE_DIR)/ulimit.patch
60 # if the platform does not have a daemon user and group, use nobody/-1
61 ifneq ($(OPTWARE_TARGET), $(filter slugosbe slugosle, $(OPTWARE_TARGET)))
62 APACHE_PATCHES += $(APACHE_SOURCE_DIR)/httpd-conf-in.patch
63 endif
64
65 #
66 # If the compilation of the package requires additional
67 # compilation or linking flags, then list them here.
68 #
69 APACHE_CPPFLAGS=
70 APACHE_LDFLAGS=
71
72 # We need this because openldap does not build on some platforms.
73 ifeq (openldap, $(filter openldap, $(PACKAGES)))
74 APACHE_CONFIGURE_TARGET_ARGS= \
75                 --enable-ldap \
76                 --enable-auth-ldap
77 APACHE_TARGET_DEPENDS=,openldap-libs
78 else
79 APACHE_CONFIGURE_TARGET_ARGS=
80 APACHE_TARGET_DEPENDS=
81 endif
82
83 #
84 # APACHE_BUILD_DIR is the directory in which the build is done.
85 # APACHE_SOURCE_DIR is the directory which holds all the
86 # patches and ipkg control files.
87 # APACHE_IPK_DIR is the directory in which the ipk is built.
88 # APACHE_IPK is the name of the resulting ipk files.
89 #
90 # You should not change any of these variables.
91 #
92 APACHE_BUILD_DIR=$(BUILD_DIR)/apache
93 APACHE_SOURCE_DIR=$(SOURCE_DIR)/apache
94 APACHE_IPK_DIR=$(BUILD_DIR)/apache-$(APACHE_VERSION)-ipk
95 APACHE_IPK=$(BUILD_DIR)/apache_$(APACHE_VERSION)-$(APACHE_IPK_VERSION)_$(TARGET_ARCH).ipk
96 APACHE_MANUAL_IPK_DIR=$(BUILD_DIR)/apache-manual-$(APACHE_VERSION)-ipk
97 APACHE_MANUAL_IPK=$(BUILD_DIR)/apache-manual_$(APACHE_VERSION)-$(APACHE_IPK_VERSION)_$(TARGET_ARCH).ipk
98
99 .PHONY: apache-source apache-unpack apache apache-stage apache-ipk apache-clean apache-dirclean apache-check
100
101 #
102 # Automatically create a ipkg control file
103 #
104 $(APACHE_IPK_DIR)/CONTROL/control:
105         @install -d $(APACHE_IPK_DIR)/CONTROL
106         @rm -f $@
107         @echo "Package: apache" >>$@
108         @echo "Architecture: $(TARGET_ARCH)" >>$@
109         @echo "Priority: $(APACHE_PRIORITY)" >>$@
110         @echo "Section: $(APACHE_SECTION)" >>$@
111         @echo "Version: $(APACHE_VERSION)-$(APACHE_IPK_VERSION)" >>$@
112         @echo "Maintainer: $(APACHE_MAINTAINER)" >>$@
113         @echo "Source: $(APACHE_SITE)/$(APACHE_SOURCE)" >>$@
114         @echo "Description: $(APACHE_DESCRIPTION)" >>$@
115         @echo "Depends: $(APACHE_DEPENDS)" >>$@
116
117 $(APACHE_MANUAL_IPK_DIR)/CONTROL/control:
118         @install -d $(APACHE_MANUAL_IPK_DIR)/CONTROL
119         @rm -f $@
120         @echo "Package: apache-manual" >>$@
121         @echo "Architecture: $(TARGET_ARCH)" >>$@
122         @echo "Priority: $(APACHE_PRIORITY)" >>$@
123         @echo "Section: $(APACHE_SECTION)" >>$@
124         @echo "Version: $(APACHE_VERSION)-$(APACHE_IPK_VERSION)" >>$@
125         @echo "Maintainer: $(APACHE_MAINTAINER)" >>$@
126         @echo "Source: $(APACHE_SITE)/$(APACHE_SOURCE)" >>$@
127         @echo "Description: Online documentation for the apache webserver" >>$@
128
129 #
130 # This is the dependency on the source code.  If the source is missing,
131 # then it will be fetched from the site using wget.
132 #
133 $(DL_DIR)/$(APACHE_SOURCE):
134         $(WGET) -P $(DL_DIR) $(APACHE_SITE)/$(APACHE_SOURCE) || \
135         $(WGET) -P $(DL_DIR) $(SOURCES_NLO_SITE)/$(APACHE_SOURCE)
136
137 #
138 # The source code depends on it existing within the download directory.
139 # This target will be called by the top level Makefile to download the
140 # source code's archive (.tar.gz, .bz2, etc.)
141 #
142 apache-source: $(DL_DIR)/$(APACHE_SOURCE) $(APACHE_PATCHES)
143
144 #
145 # This target unpacks the source code in the build directory.
146 # If the source archive is not .tar.gz or .tar.bz2, then you will need
147 # to change the commands here.  Patches to the source code are also
148 # applied in this target as required.
149 #
150 # This target also configures the build within the build directory.
151 # Flags such as LDFLAGS and CPPFLAGS should be passed into configure
152 # and NOT $(MAKE) below.  Passing it to configure causes configure to
153 # correctly BUILD the Makefile with the right paths, where passing it
154 # to Make causes it to override the default search paths of the compiler.
155 #
156 # If the compilation of the package requires other packages to be staged
157 # first, then do that first (e.g. "$(MAKE) <bar>-stage <baz>-stage").
158
159 #
160 $(APACHE_BUILD_DIR)/.configured: $(DL_DIR)/$(APACHE_SOURCE) $(APACHE_PATCHES) make/apache.mk
161         if test -d $(STAGING_INCLUDE_DIR)/apache2; then \
162                 cd $(STAGING_INCLUDE_DIR)/apache2/ && rm -f `ls | egrep -v '^apr|^apu'`; \
163         fi
164         $(MAKE) zlib-stage e2fsprogs-stage expat-stage openssl-stage apr-util-stage
165         rm -rf $(BUILD_DIR)/$(APACHE_DIR) $(@D)
166         $(APACHE_UNZIP) $(DL_DIR)/$(APACHE_SOURCE) | tar -C $(BUILD_DIR) -xvf -
167         mv $(BUILD_DIR)/$(APACHE_DIR) $(@D)
168         cat $(APACHE_PATCHES) |patch -p0 -d $(@D)
169         sed -i -e "s% *installbuilddir: .*% installbuilddir: $(STAGING_DIR)/opt/share/apache2/build%" \
170                 -e 's%[ \t]\{1,\}prefix: .*%    prefix: /opt%' \
171                 -e "s% *htdocsdir: .*% htdocsdir: /opt/share/www%" \
172                 $(@D)/config.layout
173         #cp $(APACHE_SOURCE_DIR)/httpd-std.conf.in $(@D)/docs/conf
174         autoreconf -vif $(@D)
175         (cd $(@D); \
176                 $(TARGET_CONFIGURE_OPTS) \
177                 CPPFLAGS="$(STAGING_CPPFLAGS) $(APACHE_CPPFLAGS)" \
178                 LDFLAGS="$(STAGING_LDFLAGS) $(APACHE_LDFLAGS)" \
179                 PKG_CONFIG_PATH="$(STAGING_LIB_DIR)/pkgconfig" \
180                 PKG_CONFIG_LIBDIR="$(STAGING_LIB_DIR)/pkgconfig" \
181                 ap_cv_void_ptr_lt_long=no \
182                 ./configure \
183                 --build=$(GNU_HOST_NAME) \
184                 --host=$(GNU_TARGET_NAME) \
185                 --target=$(GNU_TARGET_NAME) \
186                 --prefix=/opt \
187                 --enable-layout=GNU \
188                 --with-mpm=$(APACHE_MPM) \
189                 --enable-mods-shared=all \
190                 --enable-ssl \
191                 --enable-proxy \
192                 --enable-cache \
193                 --enable-disk-cache \
194                 --enable-file-cache \
195                 --enable-mem-cache \
196                 --enable-deflate \
197                 $(APACHE_CONFIGURE_TARGET_ARGS) \
198                 --with-z=$(STAGING_PREFIX) \
199                 --with-ssl=$(STAGING_PREFIX) \
200                 --with-apr=$(STAGING_PREFIX) \
201                 --with-apr-util=$(STAGING_PREFIX) \
202                 --with-expat=/opt \
203                 --with-port=8000 \
204         )
205         touch $@
206
207 apache-unpack: $(APACHE_BUILD_DIR)/.configured
208
209 #
210 # This builds the actual binary.  You should change the target to refer
211 # directly to the main binary which is built.
212 #
213 $(APACHE_BUILD_DIR)/.built: $(APACHE_BUILD_DIR)/.configured
214         rm -f $@
215         $(MAKE) -C $(@D) HOSTCC=$(HOSTCC)
216         touch $@
217
218 #
219 # You should change the dependency to refer directly to the main binary
220 # which is built.
221 #
222 apache: $(APACHE_BUILD_DIR)/.built
223
224 #
225 # If you are building a library, then you need to stage it too.
226 #
227 $(APACHE_BUILD_DIR)/.staged: $(APACHE_BUILD_DIR)/.built
228         rm -f $@
229         rm -f $(STAGING_PREFIX)/libexec/mod_*.so
230         $(MAKE) -C $(@D) install installbuilddir=/opt/share/apache2/build DESTDIR=$(STAGING_DIR)
231         sed -i -e 's!includedir = .*!includedir = $(STAGING_DIR)/opt/include/apache2!' $(STAGING_PREFIX)/share/apache2/build/config_vars.mk
232         touch $@
233
234 apache-stage: $(APACHE_BUILD_DIR)/.staged
235
236 #
237 # This builds the IPK file.
238 #
239 # Binaries should be installed into $(APACHE_IPK_DIR)/opt/sbin or $(APACHE_IPK_DIR)/opt/bin
240 # (use the location in a well-known Linux distro as a guide for choosing sbin or bin).
241 # Libraries and include files should be installed into $(APACHE_IPK_DIR)/opt/{lib,include}
242 # Configuration files should be installed in $(APACHE_IPK_DIR)/opt/etc/apache/...
243 # Documentation files should be installed in $(APACHE_IPK_DIR)/opt/doc/apache/...
244 # Daemon startup scripts should be installed in $(APACHE_IPK_DIR)/opt/etc/init.d/S??apache
245 #
246 # You may need to patch your application to make it use these locations.
247 #
248 $(APACHE_IPK) $(APACHE_MANUAL_IPK): $(APACHE_BUILD_DIR)/.built
249         rm -rf $(APACHE_IPK_DIR) $(BUILD_DIR)/apache_*_$(TARGET_ARCH).ipk $(APACHE_MANUAL_IPK_DIR) $(BUILD_DIR)/apache-manual_*_$(TARGET_ARCH).ipk
250         $(MAKE) -C $(APACHE_BUILD_DIR) DESTDIR=$(APACHE_IPK_DIR) installbuilddir=/opt/share/apache2/build install
251         rm -rf $(APACHE_IPK_DIR)/opt/share/apache2/manual
252         $(TARGET_STRIP) $(APACHE_IPK_DIR)/opt/libexec/*.so
253         $(TARGET_STRIP) $(APACHE_IPK_DIR)/opt/sbin/ab
254         $(TARGET_STRIP) $(APACHE_IPK_DIR)/opt/sbin/checkgid
255         $(TARGET_STRIP) $(APACHE_IPK_DIR)/opt/sbin/htcacheclean
256         $(TARGET_STRIP) $(APACHE_IPK_DIR)/opt/sbin/htdbm
257         $(TARGET_STRIP) $(APACHE_IPK_DIR)/opt/sbin/htdigest
258         $(TARGET_STRIP) $(APACHE_IPK_DIR)/opt/sbin/htpasswd
259         $(TARGET_STRIP) $(APACHE_IPK_DIR)/opt/sbin/httxt2dbm
260         $(TARGET_STRIP) $(APACHE_IPK_DIR)/opt/sbin/httpd
261         $(TARGET_STRIP) $(APACHE_IPK_DIR)/opt/sbin/logresolve
262         $(TARGET_STRIP) $(APACHE_IPK_DIR)/opt/sbin/rotatelogs
263         mv $(APACHE_IPK_DIR)/opt/sbin/httpd $(APACHE_IPK_DIR)/opt/sbin/apache-httpd
264         mv $(APACHE_IPK_DIR)/opt/sbin/htpasswd $(APACHE_IPK_DIR)/opt/sbin/apache-htpasswd
265         rm -f $(APACHE_IPK_DIR)/opt/man/man1/htpasswd.1
266         sed -i -e "s%$(STAGING_DIR)%%" $(APACHE_IPK_DIR)/opt/sbin/apxs
267         sed -i -e "s%^#!.*perl%#!/opt/bin/perl%" $(APACHE_IPK_DIR)/opt/sbin/apxs
268         sed -i -e "s%^#!.*perl%#!/opt/bin/perl%" $(APACHE_IPK_DIR)/opt/sbin/dbmmanage
269         install -d $(APACHE_IPK_DIR)/opt/etc/apache2/conf.d
270         install -d $(APACHE_IPK_DIR)/opt/etc/init.d
271         install -m 755 $(APACHE_SOURCE_DIR)/rc.apache $(APACHE_IPK_DIR)/opt/etc/init.d/S80apache
272         $(MAKE) $(APACHE_IPK_DIR)/CONTROL/control
273         install -m 755 $(APACHE_SOURCE_DIR)/prerm $(APACHE_IPK_DIR)/CONTROL/prerm
274         install -m 755 $(APACHE_SOURCE_DIR)/postinst $(APACHE_IPK_DIR)/CONTROL/postinst
275         if test -n "$(UPD-ALT_PREFIX)"; then \
276                 sed -i -e '/^[  ]*update-alternatives /s|update-alternatives|$(UPD-ALT_PREFIX)/bin/&|' \
277                         $(APACHE_IPK_DIR)/CONTROL/postinst $(APACHE_IPK_DIR)/CONTROL/prerm; \
278         fi
279         echo $(APACHE_CONFFILES) | sed -e 's/ /\n/g' > $(APACHE_IPK_DIR)/CONTROL/conffiles
280         cd $(BUILD_DIR); $(IPKG_BUILD) $(APACHE_IPK_DIR)
281         $(MAKE) -C $(APACHE_BUILD_DIR) DESTDIR=$(APACHE_MANUAL_IPK_DIR) installbuilddir=/opt/share/apache2/build install-man
282         rm -rf $(APACHE_MANUAL_IPK_DIR)/opt/man
283         $(MAKE) $(APACHE_MANUAL_IPK_DIR)/CONTROL/control
284         cd $(BUILD_DIR); $(IPKG_BUILD) $(APACHE_MANUAL_IPK_DIR)
285
286 #
287 # This is called from the top level makefile to create the IPK file.
288 #
289 apache-ipk: $(APACHE_IPK) $(APACHE_MANUAL_IPK)
290
291 #
292 # This is called from the top level makefile to clean all of the built files.
293 #
294 apache-clean:
295         -$(MAKE) -C $(APACHE_BUILD_DIR) clean
296
297 #
298 # This is called from the top level makefile to clean all dynamically created
299 # directories.
300 #
301 apache-dirclean:
302         rm -rf $(BUILD_DIR)/$(APACHE_DIR) $(APACHE_BUILD_DIR) $(APACHE_IPK_DIR) $(APACHE_IPK) $(APACHE_MANUAL_IPK_DIR) $(APACHE_MANUAL_IPK)
303
304 #
305 # Some sanity check for the package.
306 #
307 apache-check: $(APACHE_IPK)
308         perl scripts/optware-check-package.pl --target=$(OPTWARE_TARGET) $(APACHE_IPK) $(APACHE_MANUAL_IPK)
Note: See TracBrowser for help on using the browser.