alpine-overlay/kubezero/falco-kernel/APKBUILD

72 lines
2.0 KiB
Plaintext
Raw Permalink Normal View History

# Contributor: Stefan Reimer <stefan@zero-downtime.net>
# Maintainer: Stefan Reimer <stefan@zero-downtime.net>
_flavor=lts
_extra_flavors=virt
pkgver=0.37.1
pkgrel=0
pkgname=falco-kernel-$_flavor
pkgdesc="Falco kernel module"
url="https://github.com/falcosecurity/falco"
arch="x86_64 aarch64"
license="AGPL-3.0"
makedepends="cmake linux-$_flavor-dev linux-headers"
# protobuf-dev jq-dev openssl-dev curl-dev c-ares-dev grpc-dev yaml-dev yaml-cpp-dev jsoncpp-dev re2-dev"
# perl autoconf elfutils-dev libtool argp-standalone musl-fts-dev musl-libintl musl-obstack-dev"
options="!check"
source="
falco-$pkgver.tar.gz::https://github.com/falcosecurity/falco/archive/refs/tags/$pkgver.tar.gz
"
builddir="$srcdir/falco-$pkgver"
for f in $_extra_flavors; do
makedepends="$makedepends linux-$f-dev"
subpackages="$subpackages falco-kernel-$f:_extra"
done
build() {
for flavor in $_flavor $_extra_flavors; do
mkdir -p $srcdir/falco-$pkgver/build-$flavor
# Hack running the build inside a container other uname -r returns host kernel
KERNEL_VERSION=$(basename $(ls -d /lib/modules/*-"$flavor"))
cd $srcdir/falco-$pkgver/build-$flavor
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DFALCO_VERSION=$pkgver \
-DCMAKE_INSTALL_PREFIX=/usr \
-DUSE_BUNDLED_DEPS=On \
-DMUSL_OPTIMIZED_BUILD=On
KERNELDIR=/lib/modules/$KERNEL_VERSION/build make driver
done
}
_package() {
local flavor=$1
local _out=$2
KERNEL_VERSION=$(basename $(ls -d /lib/modules/*-"$flavor"))
depends="linux-$flavor~$(echo $KERNEL_VERSION | sed -e 's/-.*$//')"
cd $srcdir/falco-$pkgver/build-$flavor
mkdir -p "$_out"/lib/modules/$KERNEL_VERSION/kernel
gzip -9 -c driver/falco.ko > "$_out"/lib/modules/$KERNEL_VERSION/kernel/falco.ko.gz
}
package() {
_package $_flavor $pkgdir
}
_extra() {
flavor=${subpkgname##*-}
_package $flavor $subpkgdir
}
sha512sums="
257d526c4d3eadbe2c79852221fdb8076f94e421aa66753628770ae7384137b4672064cbe1ba0a4d88d14e8a7d08e2521d5bd82a312c4b1442d8ea6fbbbb2f28 falco-0.37.1.tar.gz
"