Magellan Linux

Contents of /trunk/extras/apache2/apache2-2.4.3-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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