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: Nicky726 <Nicky726 [at] gmail [dot] com>
# Contributor: Xiao-Long Chen <[email protected]>

pkgname=selinux-setools
_origname=setools
pkgver=3.3.7
pkgrel=4
pkgdesc="SELinux SETools GUI and CLI tools and libraries for SELinux policy analysis"
groups=('selinux' 'selinux-extras')
arch=('i686' 'x86_64')
url="http://oss.tresys.com/projects/setools/"
license=('GPL' 'LGPL')
depends=('flex' 'bison' 'selinux-usr-libselinux>=2.0.87' 'selinux-usr-libsepol>=2.0.38' 'selinux-usr-libsepol' 'libxml2' 'sqlite3>=3.6.20' 'tcl>=8.4.9' 'tk>=8.4.9' 'libglade>=2.6.4')
optdepends=('glib2:needed to build graphical tools'
'gtk2>=2.8:needed to build graphical tools'
'bwidget>=1.8:needed to build graphical tools')
makedepends=('swig>=1.3.28' 'python' 'java-environment' 'pkgconfig' 'autoconf>=2.60')
source=("http://oss.tresys.com/projects/${_origname}/chrome/site/dists/${_origname}-${pkgver}/${_origname}-${pkgver}.tar.bz2"
        '0001-add-setools-seinfo-and-sesearch-python-bindings.patch'
        '0002-setools-should-exit-with-an-error-status-if-it-gets-.patch'
        '0003-Since-we-do-not-ship-neverallow-rules-all-always-fai.patch'
        '0004-Fix-man-pages-and-getoptions.patch'
        '0005-Fix-sepol-calls-to-work-with-latest-libsepol.patch'
        '0006-Changes-to-support-named-file_trans-rules.patch'
        '0007-Remove-unused-variables.patch'
        '0008-Fix-output-to-match-policy-lines.patch')
sha512sums=('ae45a8ae11a3b7952da61b6b4c51adbb6b1b7caa6b15fdbfa71f6f150b6bc55d2d918e9e7720f868b4f432a5df6ed35d63d53a1c7640f015d9fa9c415d6e6a21'
            '48545a1126eff7b9b1e1e124df03a0c28f7030f420944339d09811fc26286c6af3831c3f4e081167d87bcf478ee999f58f22e2ff82d0be167cf1a455bb1df712'
            '73475e725bfe5a3d6a9ed3e6f1b1f9922a08a7442fe43407d838bb56fc533234562027ed3cf26255c2f18e841535e1b50e122099857c6724d7c0f04529d0265e'
            '085a41fb797234d07127b3f1c6a60d17b7bd8068b94970eeb67fdf43d0a3f5cb704c70ebe37ca000b534316d9b2824fead6220c607db5d39f2187eef1dd8588d'
            '1f82298f81ea2e8393da3395c1fef74ea904956fee184061b4d32c795d99a0df59e0fb9e314c9c225a66470e072f4773005e0114b031a26dfe6937c84d4ab022'
            'f1ea743a7c6106953baee618c08795314b48cf0af31bdff61923bdd50b05c4b3b020f2678e8cf15fc6fedcd0765cc5afdca84c37ace5d16b8e33f57dcb018b44'
            'ddf9220662530b0b54d3fb2ce3f1e5ddbb80cd184328f3145c246309744a1b496125c3e5fac349ea09aa42757c03e858493be349bab0bd593e9d591b619af80f'
            'c04956704a2489bb060284447314980ce2e611d3d7fb1e60ca0ff25e2a0aded770aeeacdfaa4580a050a8ac89cecf655627da2c0a939a2edfaf54b6b2333fed4'
            'a9a3373b5ff0ae8c4dfed6bca363004b5e35c9812c62189dc13177d5805abd3918317575fb88e4f7c52f2b5042d230ce7838a3a91b3ae8873012280c271083c4')

build() {
  cd "${srcdir}/${_origname}-${pkgver}"

  # Python 2 fix
  export PYTHON=/usr/bin/python2

  # Apply Fedora patches
  autoreconf -vfi # This is needed to generate Makefile.in for one of the patches
  patch -Np1 -i "${srcdir}/0001-add-setools-seinfo-and-sesearch-python-bindings.patch"
  patch -Np1 -i "${srcdir}/0002-setools-should-exit-with-an-error-status-if-it-gets-.patch"
  patch -Np1 -i "${srcdir}/0003-Since-we-do-not-ship-neverallow-rules-all-always-fai.patch"
  patch -Np1 -i "${srcdir}/0004-Fix-man-pages-and-getoptions.patch"
  patch -Np1 -i "${srcdir}/0005-Fix-sepol-calls-to-work-with-latest-libsepol.patch"
  patch -Np1 -i "${srcdir}/0006-Changes-to-support-named-file_trans-rules.patch"
  patch -Np1 -i "${srcdir}/0007-Remove-unused-variables.patch"
  patch -Np1 -i "${srcdir}/0008-Fix-output-to-match-policy-lines.patch"

  # Fix expected version of SWIG
  sed -i -e "s|AC_PROG_SWIG(1.3.28)|AC_PROG_SWIG(2.0.0)|g" configure.ac
  autoreconf -i -s
  #Arch uses rather nonstandard directory for policy sources
  ./configure \
    --enable-swig-java \
    --with-java-prefix="$JAVA_HOME" \
    --with-default-policy=/etc/selinux/refpolicy/src/policy \
    --disable-bwidget-check \
    --prefix=/usr
  make
}

package() {
  cd "${srcdir}/${_origname}-${pkgver}"
  make DESTDIR="${pkgdir}" install
}