build: update the PKGBUILD to support sub packages.

Note: It also keep full compatibility with the unified package.
This commit is contained in:
Alexandre Pujol 2024-10-23 14:58:09 +01:00
parent 3020de1ba2
commit 17cee26dc0
Failed to generate hash of commit

View file

@ -3,19 +3,23 @@
# Warning: for development only, use https://aur.archlinux.org/packages/apparmor.d-git for production use.
pkgname=apparmor.d
pkgver=0.001
pkgbase=apparmor.d
pkgname=(
apparmor.d apparmor.d.base
apparmor.d.other
)
pkgver=0.0001
pkgrel=1
pkgdesc="Full set of apparmor profiles"
arch=("x86_64")
url="https://github.com/roddhjav/$pkgname"
pkgdesc="Full set of apparmor profiles (base)"
arch=("any")
url="https://github.com/roddhjav/apparmor.d"
license=('GPL2')
depends=('apparmor')
makedepends=('go' 'git' 'rsync')
conflicts=("$pkgname-git")
conflicts=("$pkgbase-git" "$pkgbase")
pkgver() {
cd "$srcdir/$pkgname"
cd "$srcdir/$pkgbase"
echo "0.$(git rev-list --count HEAD)"
}
@ -24,16 +28,33 @@ prepare() {
}
build() {
cd "$srcdir/$pkgname"
cd "$srcdir/$pkgbase"
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
export CGO_LDFLAGS="${LDFLAGS}"
export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
make DISTRIBUTION=arch
make BUILD=.buid.all DISTRIBUTION=arch
make packages DISTRIBUTION=arch
}
package() {
cd "$srcdir/$pkgname"
make install DESTDIR="$pkgdir"
package_apparmor.d() {
pkgdesc="Full set of apparmor profiles"
arch=("$CARCH")
conflicts=("${pkgname[@]:1}")
cd "$srcdir/$pkgbase"
make install BUILD=.buid.all DESTDIR="$pkgdir"
}
package_apparmor.d.base() {
arch=("$CARCH")
cd "$srcdir/$pkgbase"
make install-base DESTDIR="$pkgdir"
}
package_apparmor.d.other() {
pkgdesc="Full set of apparmor profiles (other)"
depends=(apparmor.d.base)
cd "$srcdir/$pkgbase"
make profiles-other DESTDIR="$pkgdir"
}