Magellan Linux

Contents of /smage/branches/alx08x-stable/extras/apache2/apache2-2.4.59-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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