Magellan Linux

Contents of /branches/R11-stable/extras/apache2/apache2-2.4.6-r2.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 19611 - (show annotations) (download)
Mon Oct 7 08:26:04 2013 UTC (10 years, 8 months ago) by niro
File size: 7746 byte(s)
-release branches/R11-stable
1 # $Id$
2
3 PNAME="apache2"
4 PVER="2.4.6"
5 PBUILD="r2"
6
7 PCAT="net-www"
8
9 DESCRIPTION="The Apache HTTP web server."
10 HOMEPAGE="http://httpd.apache.org/"
11
12 # systemd is required by mod_systemd
13 # perl is required for serveral tools like apxs, dbmmanage
14 DEPEND=">= virtual/glibc
15 >= dev-libs/apr-1.4
16 >= dev-libs/apr-util-1.5
17 >= dev-libs/libxml2-2.9
18 >= dev-libs/libpcre-8.33
19 >= dev-libs/openssl-1.0.1
20 >= dev-db/db-6.0
21 >= dev-lang/perl-5.18
22 >= sys-libs/libuuid-2.23
23 >= sys-libs/zlib-1.2
24 >= sys-apps/systemd-206"
25
26 PROVIDE="virtual/httpd"
27
28 SRCFILE="httpd-${PVER}.tar.bz2"
29 SRCDIR="${BUILDDIR}/httpd-${PVER}"
30
31 LOG_REV=1.2
32
33 sminclude mtools
34
35 SRC_URI=(
36 http://www.apache.org/dist/httpd/${SRCFILE}
37 mirror://${PNAME}/${SRCFILE}
38 mirror://${PNAME}/${PNAME}-2.4.3-magellan-layout.patch
39 mirror://${PNAME}/${PNAME}-2.2.4-magellan-vendor.patch
40 mirror://${PNAME}/${PNAME}-2.2.8-default-user.patch
41 mirror://${PNAME}/${PNAME}-2.4.3-default-server-root.patch
42 mirror://${PNAME}/${PNAME}-2.4.3-default-mpm-settings.patch
43 mirror://${PNAME}/${PNAME}-2.2.9-default-dav-settings.patch
44 mirror://${PNAME}/${PNAME}-2.4.3-default-ssl-settings.patch
45 mirror://${PNAME}/${PNAME}-2.4.3-default-httpd-config-2.patch
46 mirror://${PNAME}/${PNAME}-2.2.4-apxs-httpd-config-2.patch
47 mirror://${PNAME}/${PNAME}-2.2.4-mod_dir-adddirectoryindex.patch
48 mirror://${PNAME}/${PNAME}-2.4.3-mod_systemd.patch
49 mirror://${PNAME}/apache2.service
50 mirror://${PNAME}/apache2.tmpfilesd
51 mirror://${PNAME}/apache2.confd
52 mirror://${PNAME}/apache2.logrotate-${LOG_REV}
53 mirror://${PNAME}/gentestcrt.sh
54 )
55
56 UP2DATE="updatecmd http://www.apache.org/dist/httpd/ | grep httpd- | lasttarball"
57
58 src_prepare()
59 {
60 munpack ${SRCFILE} || die
61 cd ${SRCDIR}
62
63 # add our own layout
64 # renewed patch using /run
65 mpatch ${PNAME}-2.4.3-magellan-layout.patch || die
66
67 # report version description with 'Magellan' instead of 'UNIX'
68 mpatch ${PNAME}-2.2.4-magellan-vendor.patch || die
69
70 # use 'apache' as http-user instead of daemon
71 mpatch ${PNAME}-2.2.8-default-user.patch || die
72
73 # fixes the default server root in the httpd.conf
74 # defaults to $(prefix) but $(libdir)/apache2 is safer
75 mpatch ${PNAME}-2.4.3-default-server-root.patch || die
76
77 # fixes the default pid- and lockfile
78 # try to be compatible with apache1 and apache2 installations
79 # -> the pidfile should be named apache2.pid
80 # also all other unneeded mpm settings are removed
81 mpatch ${PNAME}-2.4.3-default-mpm-settings.patch || die
82
83 # use same sane default dav settings that match our layout
84 mpatch ${PNAME}-2.2.9-default-dav-settings.patch || die
85
86 # fixes the default ssl pathes
87 mpatch ${PNAME}-2.4.3-default-ssl-settings.patch || die
88
89 # use modules.d instead of extra directory for addons
90 # and renamed the config files without the 'httpd-' prefix
91 # and now load mpm.conf and default.conf
92 mpatch ${PNAME}-2.4.3-default-httpd-config-2.patch || die
93
94 # fixes apxs to not use progname.conf but httpd.conf as httpd config
95 # and fixes to modules path relative to server root also
96 mpatch ${PNAME}-2.2.4-apxs-httpd-config-2.patch || die
97
98 # taken from gentoo: provides AddDirectyIndex directive
99 # better support for adding indexes, needed at least by php5
100 mpatch ${PNAME}-2.2.4-mod_dir-adddirectoryindex.patch || die
101
102 # add systemd support
103 mpatch ${PNAME}-2.4.3-mod_systemd.patch || die
104 }
105
106 src_compile()
107 {
108 cd ${SRCDIR}
109
110 # beware! mconfigure overwrite our layout pathes!
111 mconfigure \
112 --libexecdir=/usr/$(mlibdir)/apache2/modules \
113 --includedir=/usr/include/apache2 \
114 --datadir=/var/www \
115 --sysconfdir=/etc/apache2 \
116 --localstatedir=/var \
117 --enable-layout=Magellan \
118 --with-program-name=apache2 \
119 --with-port=80 \
120 --enable-so \
121 --enable-modules=all \
122 --enable-mods-shared=all \
123 --enable-suexec \
124 --with-suexec-safepath='/usr/local/bin:/usr/bin:/bin' \
125 --with-suexec-logfile=/var/log/apache2/suexec_log \
126 --with-suexec-bin=/usr/sbin/suexec \
127 --with-suexec-userdir=public_html \
128 --with-suexec-caller=apache \
129 --with-suexec-docroot=/var/www \
130 --with-suexec-uidmin=1000 \
131 --with-suexec-gidmin=100 \
132 --with-suexec-umask=077 \
133 --with-ssl=/usr \
134 --enable-ssl \
135 --enable-deflate \
136 --with-gdbm \
137 --with-mpm=prefork \
138 --with-pcre \
139 --with-pcre=/usr \
140 --with-perl=/usr/bin/perl \
141 --with-expat=/usr \
142 --with-z=/usr \
143 --with-apr=/usr \
144 --with-apr-util=/usr \
145 || die
146
147 # include/ap_config_auto.h is created by configure and
148 # --with-program-name renames http.conf to the given program name,
149 # but we want to use httpd.conf instead of apache2.conf
150 sed -i 's:apache2\.conf:httpd.conf:' include/ap_config_auto.h || die
151 # fix up the server root, default is $prefix but we want /usr/lib/apache2
152 sed -i "s:^\(#define HTTPD_ROOT \).*:\1\"/usr/$(mlibdir)/apache2\":" include/ap_config_auto.h || die
153 # multilib build fixes, like this one:
154 # /usr/lib64/apr-1/build/libtool --silent --mode=link x86_64-pc-linux-gnu-gcc -pthread -L/usr/lib -o htpasswd htpasswd.lo -lm -L/usr/lib64 -lpcre /usr/lib64/libaprutil-1.la -ldb -lexpat /usr/lib64/libapr-1.la -luuid -lrt -lcrypt -lpthread -ldl
155 # /usr/bin/ld: skipping incompatible /usr/lib/libm.so when searching for -lm
156 # /usr/bin/ld: skipping incompatible /usr/lib/libm.a when searching for -lm
157 # /usr/lib/libexpat.so: could not read symbols: File in wrong format
158 sed -i "s:/usr/lib$:/usr/$(mlibdir):" build/config_vars.mk || die
159
160 mmake || die
161 }
162
163 src_install()
164 {
165 cd ${SRCDIR}
166 mmake DESTDIR=${BINDIR} install || die
167 minstalldocs ABOUT* CHANGES LICENSE NOTICE README* ROADMAP VERSIONING || die
168
169 # fix permissions of suexec
170 mchown root:apache /usr/sbin/suexec || die
171 mchmod 4710 /usr/sbin/suexec || die
172
173 # create some needed dirs
174 mkeepdir /etc/apache2/ssl || die
175 mkeepdir /var/lib/apache || die
176 mchown apache:apache /var/lib/apache || die
177 mkeepdir /var/lib/dav || die
178 mchown apache:apache /var/lib/dav || die
179 mkeepdir /var/log/apache2 || die
180 mchown apache:apache /var/log/apache2 || die
181 mkeepdir /var/cache/apache2/proxy || die
182 mchown apache:apache /var/cache/apache2/proxy || die
183
184 # install certificate helper
185 minstallexec -s gentestcrt.sh /usr/sbin/gentestcrt || die
186
187 # install logrotate config
188 minstalllog apache2.logrotate-${LOG_REV} apache2 || die
189
190 # install systemd unit and files
191 minstallunit apache2.service || die
192 minstalltmp apache2.tmpfilesd apache2.conf || die
193 minstallconf apache2.confd apache2 || die
194
195 # rename apache2.conf
196 mv ${BINDIR}/etc/apache2/{apache2,httpd}.conf || die
197
198 # rename extra dir to modules.d and remove the 'httpd-'
199 # prefix from every module configuration file
200 mv ${BINDIR}/etc/apache2/{extra,modules.d} || die
201 local i
202 for i in ${BINDIR}/etc/apache2/modules.d/*
203 do
204 if [[ ${i/httpd-/} != ${i} ]]
205 then
206 mv ${i} ${i/httpd-/} || die ${i}
207 fi
208 done
209
210 # prune backup files
211 if [[ -d ${BINDIR}/etc/apache2/original ]]
212 then
213 rm -r ${BINDIR}/etc/apache2/original || die
214 fi
215
216 # add /var/www to CONFIG_PROTECT
217 minstalldir /etc/env.d || die
218 echo "CONFIG_PROTECT=\"/var/www\"" > ${BINDIR}/etc/env.d/30apache2 || die
219 echo "CONFIG_PROTECT_MASK=\"/var/www/manual\"" >> ${BINDIR}/etc/env.d/30apache2 || die
220 }
221
222 preinstall()
223 {
224 # adding apache user
225 ${MLIBDIR}/mgroupadd -o "-g 81" apache
226 ${MLIBDIR}/museradd -o "-u 81 -g apache -d /var/lib/apache -s /bin/false" apache
227 }
228
229 postinstall()
230 {
231 # taken from gentoo - generate a test ssl certificate
232 if [[ ! -e ${MROOT}/etc/apache2/ssl/server.crt ]]
233 then
234 [[ -d ${MROOT}/etc/apache2/ssl ]] && install -d ${MROOT}/etc/apache2/ssl
235 cd ${MROOT}/etc/apache2/ssl
236 echo
237 echo "Generating self-signed test certificate in ${MROOT}/etc/apache2/ssl ..."
238 echo
239 yes "" 2> /dev/null | ${MROOT}/usr/sbin/gentestcrt > /dev/null 2>&1
240 fi
241
242 mstartunit apache2
243 }
244
245 postremove()
246 {
247 [[ ! -f /usr/sbin/apache2 ]] && mstopunit apache2
248 }