Magellan Linux

Annotation of /smage/branches/alx07x-stable/extras/apache2/apache2-2.4.16-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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