aboutsummaryrefslogtreecommitdiffstats
path: root/testing/apparmor/APKBUILD
blob: 4fc3eb6f29522740db7a3212174761584c73dde4 (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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# Contributor: Allan Garret <allan.garret@gmail.com>
# Maintainer: Allan Garret <allan.garret@gmail.com>
pkgname=apparmor
pkgver=2.13.2
pkgrel=1
pkgdesc="Linux application security framework - mandatory access control for programs"
url="https://gitlab.com/apparmor/apparmor/wikis/home"
arch="all"
license="GPL"
depends="bash"
makedepends="bash sed python3 autoconf automake libtool bison flex perl-dev swig gettext-dev python3-dev linux-pam-dev linux-headers"
checkdepends="dejagnu py3-pyflakes python2"

subpackages="
	libapparmor:_libapparmor
	libapparmor-doc:_libapparmor_doc
	libapparmor-dev:_libapparmor_dev
	py3-$pkgname:_py3_apparmor
	perl-$pkgname:_perl_apparmor
	$pkgname-utils:_apparmor_utils
	$pkgname-utils-doc:_apparmor_utils_doc
	$pkgname-utils-lang:_apparmor_utils_lang
	$pkgname-profiles:_apparmor_profiles:noarch
	$pkgname-pam:_apparmor_pam
	$pkgname-vim:_apparmor_vim:noarch
	$pkgname-openrc
	$pkgname-doc
	$pkgname-lang
	"
source="
	https://gitlab.com/apparmor/apparmor/-/archive/v$pkgver/apparmor-v$pkgver.tar.gz

	apparmor.initd

	0001-Fix-linking-against-gettext-on-musl-libc.patch
	0002-utils-remove-vim-from-the-default-build.patch
	0003-parser-remove-specific-tests-for-rttime.patch
	0004-parser-remove-specific-tests-for-ofile.patch
	0005-utils-adjust-tests-to-match-the-Alpine-layout.patch
	0006-utils-adjust-rc-functions-for-aa-remove-unknown.patch
	0007-Remove-Locale-gettext-from-parser-tests.patch
	"

builddir="$srcdir"/$pkgname-v$pkgver

build() {
	export PYTHON_VERSION=3
	export PYTHON_VERSIONS=python3
	export PYTHON=/usr/bin/python3

	cd "$builddir"/libraries/libapparmor
	msg "Building: libapparmor"
	./autogen.sh
	./configure --prefix=/usr --with-python --with-perl
	make

	cd "$builddir"
	msg "Building: apparmor parser"
	make -C parser

	msg "Building: apparmor-binutils"
	make -C binutils

	msg "Building: apparmor-utils"
	make -C utils

	msg "Building: apparmor-profiles"
	make -C profiles

	msg "Building: apparmor-pam"
	make -C changehat/pam_apparmor

	msg "Building: apparmor-vim"
	make -C utils/vim
}

check() {
	cd "$builddir"/libraries/libapparmor
	make check

	cd "$builddir"
	make -C parser check
	make -C binutils check
	make -e PYFLAKES=pyflakes-3 -C utils check
}

package() {
	cd "$builddir"

	make -C parser install DESTDIR="$pkgdir"
	mv "$pkgdir"/lib "$pkgdir"/usr/lib
	mkdir -p "$pkgdir"/usr/libexec/apparmor
	mv "$pkgdir"/usr/lib/apparmor/rc.apparmor.functions \
		"$pkgdir"/usr/libexec/apparmor/
	rmdir "$pkgdir"/usr/lib/apparmor
	install -Dm755 "$srcdir"/apparmor.initd \
		"$pkgdir"/etc/init.d/apparmor
}

_libapparmor() {
	pkgdesc="AppArmor library"
	depends="bash sed"

	cd "$builddir"
	make -C libraries/libapparmor install DESTDIR="$subpkgdir"

	# Move development files
	mkdir -p "$subpkgdir"-dev/usr
	mv "$subpkgdir"/usr/include "$subpkgdir"-dev/usr/
	mkdir -p "$subpkgdir"-dev/usr/lib
	mv "$subpkgdir"/usr/lib/libapparmor.a "$subpkgdir"-dev/usr/lib/
	mv "$subpkgdir"/usr/lib/pkgconfig "$subpkgdir"-dev/usr/lib/

	# Move python3 files
	mkdir -p "$subpkgdir"/../py3-$pkgname/usr/lib
	mv "$subpkgdir"/usr/lib/python3.* "$subpkgdir"/../py3-$pkgname/usr/lib

	# Move perl files
	mkdir -p "$subpkgdir"/../perl-$pkgname/usr/lib
	mv "$subpkgdir"/usr/lib/perl5 "$subpkgdir"/../perl-$pkgname/usr/lib

	# Move doc files
	mkdir -p "$subpkgdir-doc"/usr/share
	mv "$subpkgdir"/usr/share/man "$subpkgdir-doc"/usr/share/
}

_libapparmor_doc() {
	pkgdesc="AppArmor Library (doc files)"

	cd "$builddir"
	for i in 2 3; do
		find "$subpkgdir"/usr/share/man/man"$i" -type f -exec gzip -9v {} +
	done
}

_libapparmor_dev() {
	pkgdesc="AppArmor Library (development files)"
}

_py3_apparmor() {
	pkgdesc="Python3 module for apparmor"
	depends="libapparmor python3"
}

_perl_apparmor() {
	pkgdesc="Perl module for apparmor"
	depends="libapparmor perl"
}

_apparmor_utils() {
	pkgdesc="AppArmor userspace utilities"
	depends="libapparmor perl python3 bash"

	cd "$builddir"
	make -C utils install DESTDIR="$subpkgdir" BINDIR="$subpkgdir"/usr/bin

	cd "$builddir"
	make -C binutils install DESTDIR="$subpkgdir" BINDIR="$subpkgdir"/usr/bin

	mkdir -p "$subpkgdir"-doc/usr/share
	mv "$subpkgdir"/usr/share/man "$subpkgdir"-doc/usr/share/

	mkdir -p "$subpkgdir"-lang/usr/share
	mv "$subpkgdir"/usr/share/locale "$subpkgdir"-lang/usr/share/
}

_apparmor_utils_doc() {
	pkgdesc="AppArmor userspace utilites (doc files)"

	cd "$builddir"
	for i in 1 5 8; do
		find "$subpkgdir"/usr/share/man/man"$i" -type f -exec gzip -9v {} +
	done
	cd "$subpkgdir"/usr/share/man/man8
	rm apparmor_status.8
	ln -s aa-status.8.gz apparmor_status.8.gz
}

_apparmor_utils_lang() {
	pkgdesc="Languages for package $subpkgname"
}

_apparmor_profiles() {
	pkgdesc="AppArmor sample pre-made profiles"
	depends="apparmor"

	cd "$builddir"
	make -C profiles install DESTDIR="$subpkgdir"
}

_apparmor_pam() {
	pkgdesc="AppArmor PAM library"
	depends="libapparmor pam"

	cd "$builddir"
	make -C changehat/pam_apparmor install DESTDIR="$subpkgdir"/usr
}

_apparmor_pam_doc() {
	pkgdesc="AppArmor PAM library (doc files)"

	cd "$builddir"
	mkdir -p "$subpkgdir"/usr/share/doc/apparmor
	install -Dm644 changehat/pam_apparmor/README \
		"$subpkgdir"/usr/share/doc/apparmor/README.pam_apparmor
}

_apparmor_vim() {
	pkgdesc="AppArmor VIM support"
	depends="vim"

	cd "$builddir"/utils/vim
	install -Dm644 apparmor.vim \
		"$subpkgdir"/usr/share/vim/vimfiles/syntax/apparmor.vim
}



sha512sums="8d29511a4dc4d9734e915620c2ef0da17aff017a4b2171aa36b607afed6e9d899d9fdf3711ce5ba0421b70190188b2c88b53e6517883c2b096f3444ad3dca534  apparmor-v2.13.2.tar.gz
1a57cc577ba3aedfbe10ef6148c1e8f5d0bbf65c99e60eec80c52409c9dab59ae002024500c6e4fd0e01e8c7aeb0c85e3e6b41cacee08c17fdd869d31bca614e  apparmor.initd
e94f44427ed3c6f64462170939ffc92ce9ac1a58c61c7c7c3483fe16fe8e1c419daade9d56cdd342132e4d823dcac1963a86ad889f10bf71fd52b7f54c4694ed  0001-Fix-linking-against-gettext-on-musl-libc.patch
20817633590c40eb5f6132c11396cf0bbd532b6e436aa90b6ccc61d7c914794d868ec981b91406f6c11f550102aa25a32982610445cc8e5e703ee90697233263  0002-utils-remove-vim-from-the-default-build.patch
568e10bda27745ac6e1b9495bb6863e93466ee1c387912393c2c7396bcedd7400b13ee233dd953f82460328e3aae45dd2f7aba92962edef31330d6b4dbc9951b  0003-parser-remove-specific-tests-for-rttime.patch
3a84fb3b2b19ccf52e179190e98ec0da2469727eaaa73d0094b0e9c85b80738c9cb9da9242d17a472a649e6042933bedb5f78c3f574d555369a4ece38a1d8a8a  0004-parser-remove-specific-tests-for-ofile.patch
618b96c9d5e6059dff9fabb51ab9138ee8f7a6978a94f5805297b3dc4bd3836026ad50ec4f8496baa8f7978d17fe0a10ebfa3ff96e3d65f362e1cba33da8e115  0005-utils-adjust-tests-to-match-the-Alpine-layout.patch
38ebb30a0185f8eabd9103925959da365f64ef485f66ffb10180ac596fc172f9c98df39baec0b035138e9ab32056148e69a066faba9faebf9e92bf7a09c150c0  0006-utils-adjust-rc-functions-for-aa-remove-unknown.patch
093c2f216776c5cc67294a134af6ef788dd5a82477592093abbdd244d65591006890a7c911d4f72d7c0ceac5d3ee33927b055a6d3731284701057b35372e7265  0007-Remove-Locale-gettext-from-parser-tests.patch"