summaryrefslogtreecommitdiff
path: root/pcr/libsemanage/PKGBUILD
blob: 1626732bf10c66bdd0b7051e78503e66be352358 (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
# Maintainer (AUR): Nicolas Iooss (nicolas <dot> iooss <at> m4x <dot> org)
# Contributor (AUR): Timothée Ravier <tim@siosm.fr>
# Contributor (AUR): Nicky726 (Nicky726 <at> gmail <dot> com)
# Contributor (AUR): Sergej Pupykin (pupykin <dot> s+arch <at> gmail <dot> com)

# parabola changes and rationale:
# - Added armv7h

pkgname=libsemanage
pkgver=3.2
pkgrel=1
pkgdesc="SELinux binary policy manipulation library"
arch=('i686' 'x86_64')
arch+=('armv7h')
url='https://github.com/SELinuxProject/selinux'
license=('LGPL2.1')
groups=('selinux')
makedepends=('flex' 'pkgconf' 'python' 'ruby' 'swig')
depends=('libselinux>=3.2' 'audit')
optdepends=('python: python bindings'
            'ruby: ruby bindings')
options=(!emptydirs) # For /var/lib/selinux
install=libsemanage.install
conflicts=("selinux-usr-${pkgname}")
provides=("selinux-usr-${pkgname}=${pkgver}-${pkgrel}")
source=("https://github.com/SELinuxProject/selinux/releases/download/${pkgver}/${pkgname}-${pkgver}.tar.gz"
        "semanage.conf")
sha256sums=('d722a55ca4fe2d4e2b30527720db657e6238b28079e69e2e4affeb8e733ee511'
            '5b0e6929428e095b561701ccdfa9c8b0c3d70dad3fc46e667eb46a85b246a4a0')

build() {
  cd "${pkgname}-${pkgver}"

  export CFLAGS="${CFLAGS} -fno-semantic-interposition"
  make swigify
  make all
  make PYTHON=/usr/bin/python3 pywrap
  make RUBY=/usr/bin/ruby rubywrap

  # Build a libsemanage.so.1 to ease the transition from libsemanage 3.1 to 3.2
  make -C src LIBVERSION=1 libsemanage.so.1
  rm src/libsemanage.so
}

package() {
  cd "${pkgname}-${pkgver}"
  make DESTDIR="${pkgdir}" LIBEXECDIR=/usr/lib SHLIBDIR=/usr/lib install
  make DESTDIR="${pkgdir}" PYTHON=/usr/bin/python3 LIBEXECDIR=/usr/lib SHLIBDIR=/usr/lib install-pywrap
  make DESTDIR="${pkgdir}" RUBY=/usr/bin/ruby LIBEXECDIR=/usr/lib SHLIBDIR=/usr/lib install-rubywrap
  /usr/bin/python3 -m compileall "${pkgdir}/$(/usr/bin/python3 -c 'from distutils.sysconfig import *; print(get_python_lib(plat_specific=1))')"

  install -D -m0644 "${srcdir}/semanage.conf" "${pkgdir}/etc/selinux/semanage.conf"

  install -Dm755 src/libsemanage.so.1 "${pkgdir}/usr/lib"

  # Create /var/lib/selinux for the policy store
  mkdir -p "${pkgdir}/var/lib/selinux"
}