badvpn-1.999.126.ebuild 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. # Copyright 1999-2012 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit eutils cmake-utils user toolchain-funcs
  5. MY_P=${PN}-${PV/_rc/rc}
  6. DESCRIPTION="Peer-to-peer VPN, NCD scripting language, tun2socks proxifier"
  7. HOMEPAGE="https://code.google.com/p/badvpn/"
  8. SRC_URI="https://badvpn.googlecode.com/files/${MY_P}.tar.bz2"
  9. LICENSE="BSD"
  10. KEYWORDS="~amd64 ~arm ~x86"
  11. SLOT="0"
  12. TARGETS="+client +ncd +server +tun2socks +udpgw"
  13. IUSE="${TARGETS} debug"
  14. # tests are only ncd related
  15. RESTRICT="!ncd? ( test )"
  16. COMMON_DEPEND="
  17. client? (
  18. dev-libs/nspr
  19. dev-libs/nss
  20. dev-libs/openssl
  21. )
  22. server? (
  23. dev-libs/nspr
  24. dev-libs/nss
  25. dev-libs/openssl
  26. )
  27. ncd? (
  28. dev-libs/openssl
  29. )"
  30. RDEPEND="${COMMON_DEPEND}
  31. ncd? (
  32. sys-apps/iproute2
  33. >=virtual/udev-171
  34. )"
  35. DEPEND="${COMMON_DEPEND}
  36. virtual/pkgconfig"
  37. # we need at least one target
  38. REQUIRED_USE="|| ( ${TARGETS//+/} )"
  39. S=${WORKDIR}/${MY_P}
  40. pkg_setup() {
  41. enewuser ${PN}
  42. }
  43. src_prepare() {
  44. # allow user to easily apply patches
  45. epatch_user
  46. }
  47. src_configure() {
  48. local mycmakeargs=(
  49. -DBUILD_NOTHING_BY_DEFAULT=1
  50. $(cmake-utils_use_build client CLIENT)
  51. $(cmake-utils_use_build server SERVER)
  52. $(cmake-utils_use_build ncd NCD)
  53. $(cmake-utils_use_build tun2socks TUN2SOCKS)
  54. $(cmake-utils_use_build udpgw UDPGW)
  55. )
  56. cmake-utils_src_configure
  57. }
  58. src_test() {
  59. # OOHMSA: do this on portage level?
  60. tc-is-cross-compiler && die "these tests do not work when cross compiling!"
  61. einfo "Running NCD tests"
  62. cd "${S}"/ncd/tests || die
  63. bash ./run_tests "${CMAKE_BUILD_DIR}/ncd/badvpn-ncd" \
  64. || die "one or more tests failed"
  65. }
  66. src_install() {
  67. cmake-utils_src_install
  68. dodoc ChangeLog
  69. if use server; then
  70. newinitd "${FILESDIR}"/${PN}-server.init ${PN}-server
  71. newconfd "${FILESDIR}"/${PN}-server.conf ${PN}-server
  72. fi
  73. if use ncd; then
  74. newinitd "${FILESDIR}"/${PN}-ncd.init ${PN}-ncd
  75. newconfd "${FILESDIR}"/${PN}-ncd.conf ${PN}-ncd
  76. fi
  77. }