setools-3.3.8-r7.ebuild 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="5"
  4. PYTHON_COMPAT=( python2_7 python3_4 )
  5. inherit autotools java-pkg-opt-2 python-r1 eutils toolchain-funcs
  6. DESCRIPTION="SELinux policy tools"
  7. HOMEPAGE="https://github.com/TresysTechnology/setools/wiki"
  8. SRC_URI="http://oss.tresys.com/projects/setools/chrome/site/dists/${P}/${P}.tar.bz2
  9. https://dev.gentoo.org/~perfinion/patches/setools/${P}-04-gentoo-patches.tar.bz2"
  10. LICENSE="GPL-2"
  11. SLOT="0"
  12. KEYWORDS="amd64 ~arm ~arm64 ~mips x86"
  13. IUSE="X debug java python"
  14. COMMONDEPEND=">=sys-libs/libsepol-2.4
  15. >=sys-libs/libselinux-2.4
  16. >=dev-db/sqlite-3.2:3
  17. dev-libs/libxml2:2
  18. python? ( ${PYTHON_DEPS} )
  19. X? (
  20. >=dev-lang/tk-8.4.9:0=
  21. >=gnome-base/libglade-2.0
  22. >=x11-libs/gtk+-2.8:2
  23. )"
  24. DEPEND="${COMMONDEPEND}
  25. >=sys-devel/automake-1.12.1
  26. sys-devel/bison
  27. sys-devel/flex
  28. virtual/pkgconfig
  29. java? ( dev-lang/swig
  30. virtual/jdk:= )
  31. python? ( dev-lang/swig )"
  32. RDEPEND="${COMMONDEPEND}
  33. java? ( >=virtual/jre-1.4:= )
  34. X? ( >=dev-tcltk/bwidget-1.8 )"
  35. RESTRICT="test"
  36. # setools dirs that contain python code to build
  37. PYTHON_DIRS="libapol/swig/python libpoldiff/swig/python libqpol/swig/python libseaudit/swig/python libsefs/swig/python python"
  38. pkg_setup() {
  39. if use java; then
  40. java-pkg-opt-2_pkg_setup
  41. fi
  42. }
  43. src_prepare() {
  44. EPATCH_MULTI_MSG="Applying various (Gentoo) setool fixes... " \
  45. EPATCH_SUFFIX="patch" \
  46. EPATCH_SOURCE="${WORKDIR}/gentoo-patches" \
  47. EPATCH_FORCE="yes" \
  48. epatch
  49. epatch "${FILESDIR}"/${PN}-3.3.8-no-check-file.patch
  50. epatch "${FILESDIR}"/${PN}-3.3.8-policy-max.patch
  51. # Fix build failure due to double __init__.py installation
  52. sed -e "s/^wrappedpy_DATA = qpol.py \$(pkgpython_PYTHON)/wrappedpy_DATA = qpol.py/" -i libqpol/swig/python/Makefile.am || die
  53. # Disable broken check for SWIG version. Bug #542032
  54. sed -e "s/AC_PROG_SWIG(2.0.0)/AC_PROG_SWIG/" -i configure.ac || die "sed failed"
  55. local dir
  56. for dir in ${PYTHON_DIRS}; do
  57. # Python bindings are built/installed manually.
  58. sed -e "s/MAYBE_PYSWIG = python/MAYBE_PYSWIG =/" -i ${dir%python}Makefile.am || die "sed failed"
  59. # Make PYTHON_LDFLAGS replaceable during running `make`.
  60. sed -e "/^AM_LDFLAGS =/s/@PYTHON_LDFLAGS@/\$(PYTHON_LDFLAGS)/" -i ${dir}/Makefile.am || die "sed failed"
  61. done
  62. epatch_user
  63. eautoreconf
  64. # Disable byte-compilation of Python modules.
  65. echo '#!/bin/sh' > py-compile
  66. }
  67. src_configure() {
  68. tc-ld-disable-gold #467136
  69. econf \
  70. --with-java-prefix=${JAVA_HOME} \
  71. --disable-selinux-check \
  72. --disable-bwidget-check \
  73. $(use_enable python swig-python) \
  74. $(use_enable java swig-java) \
  75. $(use_enable X swig-tcl) \
  76. $(use_enable X gui) \
  77. $(use_enable debug)
  78. # work around swig c99 issues. it does not require
  79. # c99 anyway.
  80. sed -i -e 's/-std=gnu99//' "${S}/libseaudit/swig/python/Makefile"
  81. }
  82. src_compile() {
  83. emake
  84. if use python; then
  85. building() {
  86. python_export PYTHON_INCLUDEDIR
  87. python_export PYTHON_SITEDIR
  88. python_export PYTHON_LIBS
  89. emake \
  90. SWIG_PYTHON_CPPFLAGS="-I${PYTHON_INCLUDEDIR}" \
  91. PYTHON_LDFLAGS="${PYTHON_LIBS}" \
  92. pyexecdir="${PYTHON_SITEDIR}" \
  93. pythondir="${PYTHON_SITEDIR}" \
  94. -C "$1"
  95. }
  96. local dir
  97. for dir in ${PYTHON_DIRS}; do
  98. python_foreach_impl building ${dir}
  99. done
  100. fi
  101. }
  102. src_install() {
  103. emake DESTDIR="${D}" install
  104. if use python; then
  105. installation() {
  106. python_export PYTHON_SITEDIR
  107. emake DESTDIR="${D}" \
  108. pyexecdir="${PYTHON_SITEDIR}" \
  109. pythondir="${PYTHON_SITEDIR}" \
  110. -C "$1" install
  111. }
  112. local dir
  113. for dir in ${PYTHON_DIRS}; do
  114. python_foreach_impl installation "${dir}"
  115. done
  116. fi
  117. }