ovaldi-5.10.1.4.ebuild 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. # Copyright 1999-2014 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit eutils toolchain-funcs
  5. DESCRIPTION="Free implementation of OVAL"
  6. HOMEPAGE="http://oval.mitre.org/language/interpreter.html"
  7. SRC_URI="mirror://sourceforge/${PN}/${P}-src.tar.bz2"
  8. LICENSE="BSD"
  9. SLOT="0"
  10. KEYWORDS="~amd64 ~x86"
  11. IUSE="acl ldap rpm selinux"
  12. CDEPEND="dev-libs/libgcrypt:0
  13. dev-libs/libpcre
  14. dev-libs/xalan-c
  15. dev-libs/xerces-c
  16. sys-apps/util-linux
  17. sys-libs/libcap
  18. acl? ( sys-apps/acl )
  19. ldap? ( net-nds/openldap )
  20. rpm? ( app-arch/rpm )"
  21. DEPEND="${CDEPEND}
  22. sys-apps/sed"
  23. RDEPEND="${CDEPEND}
  24. selinux? ( sys-libs/libselinux )"
  25. S="${WORKDIR}/${P}-src"
  26. src_prepare() {
  27. #Ovaldi do not support xerces 3, but portage have only that
  28. epatch "${FILESDIR}"/${P}-xerces3.patch
  29. sed -i 's,xercesc::DOMBuilder,xercesc::DOMLSParser,' src/XmlProcessor.h || die
  30. sed -i 's,DOMBuilder,DOMLSParser,' src/XmlProcessor.cpp || die
  31. epatch "${FILESDIR}"/${P}-strnicmp.patch
  32. if ! use ldap ; then
  33. einfo "Disabling LDAP probes"
  34. sed -i 's,.*ldap,//&,' src/linux/ProbeFactory.cpp || die
  35. sed -i 's,.*LDAP,//&,' src/linux/ProbeFactory.cpp || die
  36. sed -i 's/-lldap//' project/linux/Makefile || die
  37. sed -i 's/-llber//' project/linux/Makefile || die
  38. sed -i 's/.*LDAPProbe.h.*//' src/linux/ProbeFactory.h || die
  39. rm src/probes/independent/LDAPProbe.{cpp,h} || die
  40. fi
  41. if ! use acl ; then
  42. sed -i 's,.*libacl,//&,' src/probes/unix/FileProbe.h || die
  43. epatch "${FILESDIR}"/disable-acl.patch
  44. sed -i 's, -lacl , ,' project/linux/Makefile || die
  45. fi
  46. # rpm probes support is build dependant only on the presence of the rpm binary
  47. if use rpm ; then
  48. #Same problems as bug 274679, so i do a local copy of the header and patch it
  49. cp /usr/include/rpm/rpmdb.h src/probes/linux/ || die
  50. epatch "${FILESDIR}"/use_local_rpmdb.patch
  51. epatch "${FILESDIR}"/rpmdb.patch
  52. else
  53. einfo "Disabling rpm probes"
  54. sed -i 's/^PACKAGE_RPM/#PACKAGE_RPM/' project/linux/Makefile || die
  55. fi
  56. # same thing for dpkg, but package dpkg is not sufficient, needs app-arch/apt-pkg that is not on tree
  57. einfo "Disabling dpkg probes"
  58. sed -i 's/^PACKAGE_DPKG/#PACKAGE_DPKG/' project/linux/Makefile || die
  59. #Disabling SELinux support
  60. if ! use selinux ; then
  61. rm src/probes/linux/SelinuxSecurityContextProbe.cpp || die
  62. rm src/probes/linux/SelinuxBooleanProbe.cpp || die
  63. rm src/probes/linux/SelinuxBooleanProbe.h || die
  64. epatch "${FILESDIR}"/${P}-disable-selinux-probes.patch
  65. sed -i 's,.*selinux.*,//&,' src/linux/ProbeFactory.cpp || die
  66. sed -i 's,.*Selinux.*,//&,' src/linux/ProbeFactory.cpp || die
  67. sed -i 's,.*selinux.*,//&,' src/linux/ProbeFactory.h || die
  68. sed -i 's,.*Selinux.*,//&,' src/linux/ProbeFactory.h || die
  69. sed -i 's,.*SecurityContextGuard.h.*,//&,' src/probes/unix/Process58Probe.cpp || die
  70. rm src/linux/SecurityContextGuard.h || die
  71. sed -i 's, -lselinux,,' project/linux/Makefile || die
  72. fi
  73. # respect CXXFLAGS and CXX
  74. sed -i -e '/^CPPFLAGS/s/$(INCDIRS)/$(CXXFLAGS) \0/' project/linux/Makefile || die
  75. tc-export CXX
  76. }
  77. src_compile () {
  78. emake -C project/linux
  79. }
  80. src_install () {
  81. # no make install in Makefile
  82. dosbin project/linux/Release/ovaldi project/linux/ovaldi.sh
  83. dodir /var/log/${PN}
  84. insinto /usr/share/${PN}
  85. doins xml/*
  86. dodoc docs/{README.txt,version.txt}
  87. doman docs/ovaldi.1
  88. }