archrelease: copy trunk to extra-x86_64
[arch-packages.git] / audit / repos / core-x86_64 / PKGBUILD
blob1d5eceb64619f4d285448e667e744a9d1afdebb1
1 # Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
2 # Maintainer: David Runge <dvzrv@archlinux.org>
3 # Contributor: Christian Rebischke <Chris.Rebischke@archlinux.org>
4 # Contributor: Daniel Micay <danielmicay@gmail.com>
5 # Contributor: <kang@insecure.ws>
6 # Contributor: Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
7 # Contributor: Connor Behan <connor.behan@gmail.com>
8 # Contributor: henning mueller <henning@orgizm.net>
10 pkgbase=audit
11 _name=audit-userspace
12 pkgname=(
13   audit
14   python-audit
16 pkgver=3.1.1
17 pkgrel=1
18 pkgdesc='Userspace components of the audit framework'
19 url='https://people.redhat.com/sgrubb/audit'
20 arch=(x86_64)
21 license=(
22   GPL2
23   LGPL2.1
25 makedepends=(
26   glibc
27   krb5
28   libcap-ng
29   libldap
30   linux-api-headers
31   python
32   swig
34 options=(emptydirs)
35 source=(
36   https://github.com/linux-audit/$_name/archive/v$pkgver/$_name-v$pkgver.tar.gz
37   $pkgbase-3.0.8-config_paths.patch
38   $pkgbase-3.0.9-flex_array_workaround.patch
39   $pkgbase-3.0.9-undo_flex_array_workaround.patch
41 sha512sums=('58a8bb5f4432e035f2abcd336927b92789fe1f43dd5a71c508c3d79b94cbae2f979a02d79164f813fef4e42f7ad747b0d868f186d2197dd5987b0b98234399f9'
42             'bc699123f810abcf9300728bf61d7fcfcc83677b75fbeb713fb24cc11b2f9edf687661aab70766acde7c3c41c6a62f8e0a54cdfb49d1c7ce2246b67fbe3feec5'
43             '442bffac895abbd0abe455c36ebc03ed5a9faee16b57347ef1f37c0d9c33777e204da917be3bbe11c56173c2ec96eed60646ac7214da47f828eef5fa104c1ebb'
44             '92ba0f9b3d3721bf64b56e2f3e2ac4e54b2b6acd9d5646a5ee97eea244cb165e19a56c362de16834925ae063c79e6505687749f1dd67dd0f2997919aea7cb2ef')
45 b2sums=('36f632550dd34ac130be408562aeaeea07c513e3ac76ba1689eb2c588e3312772dae99510584cd8b5e3878905a1695f907fa7216b7f9ab208b48d14d0cfe5f7a'
46         '50be1b4f76ace20d8d14b4c57a9bb69daa3da35fd654aca8730bc287682fe38f1c1917b37469fb087daf9f309ffc15cca15f54166ece0a055f540c2604778fc6'
47         '2241c3dd29c803493ac8e85afd6031749a46b583514829b8761c24ae12061999b7c95107ec2948dd7edb239f805ca088b7b24229abb5445a4767702539779b0f'
48         'd89110c32da33c2ca9292391ead930352e4c8935aa86111640130d9e3fbc0ebe27b069a83812530dfbbf28f4ddd33545658c8061d87bfac9a9d3a6a5ff0be4b8')
50 _pick() {
51   local p="$1" f d; shift
52   for f; do
53     d="$srcdir/$p/${f#$pkgdir/}"
54     mkdir -p "$(dirname "$d")"
55     mv "$f" "$d"
56     rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")"
57   done
60 prepare() {
61   # replace the use of /sbin with /usr/bin in configs
62   patch -Np1 -d $pkgbase-userspace-$pkgver -i ../$pkgbase-3.0.8-config_paths.patch
64   # fix broken userspace build due to swig: https://listman.redhat.com/archives/linux-audit/2022-February/018843.html
65   cp -v /usr/include/linux/audit.h $pkgbase-userspace-$pkgver/lib/
66   patch -Np1 -d $pkgbase-userspace-$pkgver -i ../$pkgbase-3.0.9-flex_array_workaround.patch
68   cd $_name-$pkgver
69   autoreconf -fiv
72 build() {
73   local configure_options=(
74     --prefix=/usr
75     --sbindir=/usr/bin
76     --sysconfdir=/etc
77     --libexecdir=/usr/lib/audit
78     --enable-gssapi-krb5=yes
79     --enable-systemd=yes
80     --with-io_uring=yes
81     --with-libcap-ng=yes
82   )
84   cd $_name-$pkgver
85   ./configure "${configure_options[@]}"
86   # prevent excessive overlinking due to libtool
87   sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
88   make
89   [ -n "$SOURCE_DATE_EPOCH" ] && touch -h -d @$SOURCE_DATE_EPOCH bindings/swig/python/audit.py
92 package_audit() {
93   depends=(
94     glibc
95     krb5 libkrb5.so libgssapi_krb5.so
96     libcap-ng libcap-ng.so
97   )
98   optdepends=(
99     'libldap: for audispd-zos-remote'
100     'sh: for augenrules'
101   )
102   provides=(
103     libaudit.so
104     libauparse.so
105   )
106   backup=(
107     etc/libaudit.conf
108     etc/audit/audit-stop.rules
109     etc/audit/auditd.conf
110     etc/audit/audisp-remote.conf
111     etc/audit/zos-remote.conf
112     etc/audit/plugins.d/af_unix.conf
113     etc/audit/plugins.d/au-remote.conf
114     etc/audit/plugins.d/audispd-zos-remote.conf
115     etc/audit/plugins.d/syslog.conf
116   )
118   make DESTDIR="$pkgdir" install -C $_name-$pkgver
120   # undo fix for broken swig, so that other programs may use the header file correctly
121   patch -Np0 -d "$pkgdir" -i "$srcdir/$pkgbase-3.0.9-undo_flex_array_workaround.patch"
122   rm -v "$pkgdir/usr/include/libaudit.h.orig"
124   # add log dir
125   install -vdm 700 "$pkgdir/var/log/$pkgname/"
126   # add rules.d dir to satisfy augenrules
127   install -vdm 755 "$pkgdir/etc/audit/rules.d/"
129   # remove legacy files
130   rm -frv "$pkgdir/usr/lib/audit"
132   (
133     cd "$pkgdir"
134     _pick python-audit usr/lib/python*
135   )
138 package_python-audit() {
139   pkgdesc+=' - Python bindings'
140   depends=(
141     audit libaudit.so libauparse.so
142     glibc
143     python
144   )
146   mv -v $pkgname/* "$pkgdir"
149 # vim: ts=2 sw=2 et: