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
# Maintainer: Nicky726 (Nicky726 <at> gmail <dot> com)
# Contributor: Sergej Pupykin (pupykin <dot> s+arch <at> gmail <dot> com)
# Contributor: Angelux (xangelux) (xangelux <at> gmail <dot> com)

pkgname=selinux-usr-libselinux
_origname=libselinux
_release=20120924
pkgver=2.1.12
pkgrel=2
pkgdesc="SELinux userspace (libselinux including python bindings)"
arch=('i686' 'x86_64')
url="http://userspace.selinuxproject.org"
license=('GPL')
groups=('selinux' 'selinux-userspace')
depends=('selinux-usr-libsepol>=2.1.0' 'glibc' 'python2')
makedepends=('swig')
conflicts=('selinux-usr-libselinux-python')
options=(!emptydirs buildflags)
source=(http://userspace.selinuxproject.org/releases/${_release}/${_origname}-${pkgver}.tar.gz)
sha256sums=('8dad879380e0ce1e4ab67195a08f6052c1396493bcb12fe92a033f49f7dbca9e ')

build() {
  CFLAGS="${CFLAGS} -L/usr/local/lib -lpcre"
  cd "${srcdir}/${_origname}-${pkgver}"
  # Meant for python2
  sed -i -e "s/shell python -c/shell python2 -c/" "src/Makefile"
  sed -i -e "s/PYTHON ?= python/PYTHON ?= python-2.7/" "src/Makefile"
  make 
  # Build python wrapper, which is needed for semanage tool
  make pywrap
}

package(){
  cd "${srcdir}/${_origname}-${pkgver}"
  make DESTDIR="${pkgdir}" install
  make DESTDIR="${pkgdir}" install-pywrap
	# /lib -> /usr/lib
	mv "${pkgdir}/lib/"* "${pkgdir}/usr/lib/"
	rm "${pkgdir}/usr/lib/libselinux.so"
	cd "${pkgdir}/usr/lib/"
	ln -s libselinux.so.1 libselinux.so
}