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