summaryrefslogtreecommitdiff
path: root/skip/apache2/apache2.xibuild
blob: f2de5a4351f66968071d864551fc00e5a2bb87ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/bin/sh

NAME="apache2"
DESC="A high performance Unix-based HTTP server"

MAKEDEPS=" apr apr-util autoconf automake brotli libxml2 lua nghttp2 openssl-dev>3 pcre sed zlib"

_pkgreal=httpd

PKG_VER=2.4.54
SOURCE="https://dlcdn.apache.org/$_pkgreal/$_pkgreal-$PKG_VER.tar.bz2"

ADDITIONAL="
alpine.layout
apache2-ssl.post-install
apache2.confd
apache2.initd
apache2.logrotate
apache2.pre-install
apache2.pre-upgrade
conf
"

prepare() {
	for i in $source; do
		case $i in
		*.patch) echo $i; patch -p1 -i "$BUILD_ROOT"/$(basename $i);;
		esac
	done

	cat "$BUILD_ROOT/alpine.layout" >> config.layout
}

build() {
	./configure \
		--prefix=/usr \
		--enable-so \
		--enable-suexec \
		--with-suexec-caller=apache \
		--with-suexec-docroot=/var/www \
		--with-suexec-logfile=/var/log/apache2/suexec.log \
		--with-suexec-bin=/usr/sbin/suexec \
		--with-suexec-uidmin=99 \
		--with-suexec-gidmin=99 \
		--with-apr=/usr/bin/apr-1-config \
		--with-apr-util=/usr/bin/apu-1-config \
		--with-pcre=/usr \
		--enable-mods-shared=all \
		--enable-mpms-shared=all \
		--with-mpm=prefork \
		--enable-ssl \
		--with-ssl \
		--enable-proxy \
		--enable-cache \
		--enable-disk-cache \
		--enable-mem-cache \
		--enable-file-cache \
		--enable-ldap \
		--enable-authnz-ldap \
		--enable-cgid \
		--enable-cgi \
		--enable-authn-anon \
		--enable-authn-alias \
		--disable-imagemap \
		--enable-proxy-connect \
		--enable-proxy-http \
		--enable-proxy-ftp \
		--enable-deflate \
		--enable-dbd \
		--enable-exception-hook \
		--enable-dav \
		--enable-dav-fs \
		--enable-dav-lock
	make
}

package() {
	make -j1 DESTDIR="$PKG_DEST" install

	# config
	rm -r "$PKG_DEST"/etc/apache2/extra/httpd-vhosts.conf \
		"$PKG_DEST"/etc/apache2/original
	mv "$PKG_DEST"/etc/apache2/extra "$PKG_DEST"/etc/apache2/conf.d
	for file in "$PKG_DEST"/etc/apache2/conf.d/httpd-*; do
		mv "$file" \
			"$(dirname $file)/${file#$PKG_DEST/etc/apache2/conf.d/httpd-}"
	done
	sed -Ei \
		's:^(\t?#?LoadModule .+ )lib/apache2/:\1modules/:;ta;b;:a;s/^#?LoadModule (dav.*|lbmethod_.+|.*ldap|lua|proxy.*|ssl|xml2enc)_module //;tb;b;:b;d' \
		"$PKG_DEST"/etc/apache2/httpd.conf

	# init scripts and logrotate
	install -D -m755 "$BUILD_ROOT"/apache2.initd \
		"$PKG_DEST"/etc/init.d/apache2
	install -D -m644 "$BUILD_ROOT"/apache2.logrotate \
		"$PKG_DEST"/etc/logrotate.d/apache2
	install -D -m644 "$BUILD_ROOT"/apache2.confd \
		"$PKG_DEST"/etc/conf.d/apache2

	install -d "$PKG_DEST"/var/www
	install -d -m 2750 -g wheel "$PKG_DEST"/var/log/apache2
	ln -fs /var/log/apache2 "$PKG_DEST"/var/www/logs
	ln -fs /run/apache2 "$PKG_DEST"/var/www/run
	ln -fs /usr/lib/apache2 "$PKG_DEST"/var/www/modules
	rm -fr "$PKG_DEST"/run

	# verify all MPMs are built
	# ref #2866
	for i in prefork event worker; do
		if ! [ -e "$PKG_DEST"/usr/lib/apache2/mod_mpm_$i.so ]; then
			error "$i MPM was not built"
		fi
	done

	# create the run directory
	# ref #9982
	mkdir -p "$PKG_DEST"/run/apache2
}