summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 23e79d0dfd8591518fe5ee3005d6e5953267b073 (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
# Maintainer: Amish <contact at via dot aur>
# Contributor: Iacopo Isimbaldi <isiachi@rhye.it>
# Contributor: Lubomir Krajcovic <lubomir.krajcovic(AT)gmail(DOT)com>
# Contributor: Vladimir Kutyavin <vlkut(AT)bk(DOT)ru>
pkgname=xtables-addons-dkms
_pkgname="${pkgname%-*}"
pkgver=3.31
pkgrel=2
pkgdesc='DKMS for additional extensions for Xtables packet filter present in the Linux kernel'
arch=('x86_64' 'aarch64')
license=(' GPL-2.0-or-later')
url="https://inai.de/projects/${_pkgname}/"
depends=('dkms')
optdepends=('perl-text-csv-xs: required for building GeoIP database'
            'perl-net-cidr-lite: required for building GeoIP database'
            'wget: required for building GeoIP database'
            'unzip: required for building GeoIP database')
conflicts=("${_pkgname}" "${_pkgname}-git" "${_pkgname}-multikernel")
replaces=("${_pkgname}" "${_pkgname}-git" "${_pkgname}-multikernel")
#source=("https://inai.de/files/${_pkgname}/${_pkgname}-${pkgver}.tar.zst"
source=("https://codeberg.org/jengelh/${_pkgname}/releases/download/v${pkgver}/${_pkgname}-${pkgver}.tar.zst"
        dkms.conf)
sha256sums=('e22efc25b7bbb3436d1b7cdc309b1857ea933f7e5c7d88fbe6951a1e3e582a80'
            '5e131d43ce1b282ada4b02599d2c203a01e2444817f5835bd11ba55578e49111')

prepare() {
    cd "${_pkgname}-${pkgver}"
    # disable install-exec-hook (avoids useless calling of depmod -a at 'make install' stage)
    sed -i 's/^install-exec-hook:$/dont-run:/' Makefile.am
    # disable building of xt_ECHO (it's an example module, and it breaks the build)
    sed -i 's/^build_ECHO=.*$/build_ECHO=n/' mconfig
    autoreconf -fvi
}

build() {
    cd "${_pkgname}-${pkgver}"
    export CFLAGS="${CFLAGS} ${DEBUG_CFLAGS}"
    export CXXLAGS="${CXXFLAGS} ${DEBUG_CXXFLAGS}"
    export LDFLAGS="${LDFLAGS}"
    ./configure \
        --prefix=/usr \
        --sysconfdir=/etc \
        --bindir=/usr/bin \
        --sbindir=/usr/bin \
        --libdir=/usr/lib \
        --includedir=/usr/include \
        --mandir=/usr/share/man \
        --docdir=/usr/share/doc \
        --libexecdir=/usr/lib/xtables \
        --with-xtlibdir=/usr/lib/xtables \
        --without-kbuild
    make
}

check() {
    cd "${_pkgname}-${pkgver}"
    make check
}

package() {
    cd "${_pkgname}-${pkgver}"

    # prepare dkms build tree
    dkmsDst="${pkgdir}/usr/src/${_pkgname}-${pkgver}"
    install -Dm644 -t "${dkmsDst}" "${srcdir}/dkms.conf"
    sed -i -e "s/@_PKGNAME/${_pkgname}/" -e "s/@PKGVER@/${pkgver}/" "${dkmsDst}/dkms.conf"
    cp -r . "${dkmsDst}"

    make DESTDIR="${pkgdir}" install
}