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