Magellan Linux

Contents of /smage/branches/alx07x-stable/extras/apache2/apache2-2.4.46-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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