build: move build logic in the Makefile.

This commit is contained in:
Alexandre Pujol 2022-10-15 23:11:31 +01:00
parent 62f2163875
commit a470063f0f
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
4 changed files with 28 additions and 49 deletions

View file

@ -23,7 +23,6 @@ pkgver() {
prepare() {
rsync -a --delete "$startdir" "$srcdir"
cd "$srcdir/$pkgname"
./configure --complain
}
@ -34,32 +33,10 @@ build() {
export CGO_CXXFLAGS="${CXXFLAGS}"
export CGO_LDFLAGS="${LDFLAGS}"
export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
go build -o .build/ ./cmd/aa-log
make
}
package() {
local _build='.build'
cd "$srcdir/$pkgname"
# Install all system files
mapfile -t root < <(find "$_build/root" -type f -printf "%P\n")
for file in "${root[@]}"; do
install -Dm0644 "$_build/root/$file" "$pkgdir/$file"
done
# Install all apparmor profiles
mapfile -t profiles < <(find "$_build/apparmor.d" -type f -printf "%P\n")
for file in "${profiles[@]}"; do
install -Dm0644 "$_build/apparmor.d/$file" "$pkgdir/etc/apparmor.d/$file"
done
# Ensure some systemd services do not start before apparmor rules are loaded
for file in systemd/*; do
service=$(basename "$file")
install -Dm0644 "$file" \
"$pkgdir/usr/lib/systemd/system/$service.d/apparmor.conf"
done
# Internal tool
install -Dm755 .build/aa-log "$pkgdir"/usr/bin/aa-log
make install DESTDIR="$pkgdir"
}