Magellan Linux

Annotation of /trunk/extras/apache2/apache2-2.4.29-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 30102 - (hide annotations) (download)
Thu Oct 26 10:56:07 2017 UTC (6 years, 7 months ago) by niro
File size: 7463 byte(s)
-re-diffed server root patch
1 niro 30101 # $Id$
2    
3     PNAME="apache2"
4     PVER="2.4.29"
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.6
16     >= dev-libs/apr-util-1.6
17     >= dev-libs/libxml2-2.9
18     >= dev-libs/libpcre-8.37
19     >= dev-libs/openssl-1.1
20     >= dev-db/db-6.2
21     >= dev-lang/perl-5.26
22     >= sys-libs/libuuid-2.30
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     SVC_REV=1.2
31     LOG_REV=1.2
32    
33     sminclude mtools systemd
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 niro 30102 mirror://${PNAME}/${PNAME}-2.4.29-default-server-root.patch
42 niro 30101 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.4.3-mod_systemd.patch
48     mirror://${PNAME}/apache2.service-${SVC_REV}
49     mirror://${PNAME}/apache2.tmpfilesd
50     mirror://${PNAME}/apache2.logrotate-${LOG_REV}
51     mirror://${PNAME}/gentestcrt.sh
52     )
53    
54     UP2DATE="updatecmd http://www.apache.org/dist/httpd/ | grep httpd- | lasttarball"
55    
56     pkg_setup()
57     {
58     preinstall
59     }
60    
61     src_prepare()
62     {
63     munpack ${SRCFILE} || die
64     cd ${SRCDIR}
65    
66     # add our own layout
67     # renewed patch using /run
68     mpatch ${PNAME}-2.4.3-magellan-layout.patch || die
69    
70     # report version description with 'Magellan' instead of 'UNIX'
71     mpatch ${PNAME}-2.2.4-magellan-vendor.patch || die
72    
73     # use 'apache' as http-user instead of daemon
74     mpatch ${PNAME}-2.2.8-default-user.patch || die
75    
76     # fixes the default server root in the httpd.conf
77     # defaults to $(prefix) but $(libdir)/apache2 is safer
78 niro 30102 mpatch ${PNAME}-2.4.29-default-server-root.patch || die
79 niro 30101
80     # fixes the default pid- and lockfile
81     # try to be compatible with apache1 and apache2 installations
82     # -> the pidfile should be named apache2.pid
83     # also all other unneeded mpm settings are removed
84     mpatch ${PNAME}-2.4.3-default-mpm-settings.patch || die
85    
86     # use same sane default dav settings that match our layout
87     mpatch ${PNAME}-2.2.9-default-dav-settings.patch || die
88    
89     # fixes the default ssl pathes
90     mpatch ${PNAME}-2.4.3-default-ssl-settings.patch || die
91    
92     # use modules.d instead of extra directory for addons
93     # and renamed the config files without the 'httpd-' prefix
94     # and now load mpm.conf and default.conf
95     mpatch ${PNAME}-2.4.3-default-httpd-config-2.patch || die
96    
97     # fixes apxs to not use progname.conf but httpd.conf as httpd config
98     # and fixes to modules path relative to server root also
99     mpatch ${PNAME}-2.2.4-apxs-httpd-config-2.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-${SVC_REV} apache2.service || die
191     minstalltmp apache2.tmpfilesd apache2.conf || die
192    
193     # rename apache2.conf
194     mv ${BINDIR}/etc/apache2/{apache2,httpd}.conf || die
195    
196     # rename extra dir to modules.d and remove the 'httpd-'
197     # prefix from every module configuration file
198     mv ${BINDIR}/etc/apache2/{extra,modules.d} || die
199     local i
200     for i in ${BINDIR}/etc/apache2/modules.d/*
201     do
202     if [[ ${i/httpd-/} != ${i} ]]
203     then
204     mv ${i} ${i/httpd-/} || die ${i}
205     fi
206     done
207    
208     # prune backup files
209     if [[ -d ${BINDIR}/etc/apache2/original ]]
210     then
211     rm -r ${BINDIR}/etc/apache2/original || die
212     fi
213    
214     # add /var/www to CONFIG_PROTECT
215     minstalldir /etc/env.d || die
216     echo "CONFIG_PROTECT=\"/var/www\"" > ${BINDIR}/etc/env.d/30apache2 || die
217     echo "CONFIG_PROTECT_MASK=\"/var/www/manual\"" >> ${BINDIR}/etc/env.d/30apache2 || die
218     }
219    
220     preinstall()
221     {
222     # adding apache user
223     mgroupadd -o "-g 81" apache
224     museradd -o "-u 81 -g apache -d /var/lib/apache -s /bin/false" apache
225     }
226    
227     postinstall()
228     {
229     # taken from gentoo - generate a test ssl certificate
230     if [[ ! -e ${MROOT}/etc/apache2/ssl/server.crt ]]
231     then
232     [[ -d ${MROOT}/etc/apache2/ssl ]] && install -d ${MROOT}/etc/apache2/ssl
233     cd ${MROOT}/etc/apache2/ssl
234     echo
235     echo "Generating self-signed test certificate in ${MROOT}/etc/apache2/ssl ..."
236     echo
237     yes "" 2> /dev/null | ${MROOT}/usr/sbin/gentestcrt > /dev/null 2>&1
238     fi
239    
240     mstartunit apache2
241     }
242    
243     postremove()
244     {
245     [[ ! -f /usr/sbin/apache2 ]] && mstopunit apache2
246     }