lorcon-9999.ebuild 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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 )
  5. DISTUTILS_OPTIONAL=1
  6. USE_RUBY="ruby20 ruby21"
  7. RUBY_OPTIONAL=yes
  8. inherit distutils-r1 ruby-ng
  9. DESCRIPTION="A generic library for injecting 802.11 frames"
  10. HOMEPAGE="http://802.11ninja.net/lorcon"
  11. if [[ ${PV} == "9999" ]] ; then
  12. EGIT_REPO_URI="https://code.google.com/p/lorcon/"
  13. inherit git-r3
  14. KEYWORDS=""
  15. else
  16. SRC_URI="https://dev.gentoo.org/~zerochaos/distfiles/${P}.tar.xz"
  17. KEYWORDS="~amd64 ~arm ~ppc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux"
  18. fi
  19. LICENSE="GPL-2"
  20. SLOT="0"
  21. IUSE="python ruby"
  22. DEPEND="ruby? ( $(ruby_implementations_depend) )
  23. python? ( ${PYTHON_DEPS} )
  24. dev-libs/libnl:3=
  25. net-libs/libpcap"
  26. RDEPEND="${DEPEND}"
  27. REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
  28. S="${WORKDIR}"/${P}
  29. pkg_setup() {
  30. use ruby && ruby-ng_pkg_setup
  31. }
  32. src_unpack() {
  33. if [[ ${PV} == "9999" ]] ; then
  34. git-r3_src_unpack
  35. cp -R "${S}/" "${WORKDIR}/all"
  36. fi
  37. default_src_unpack
  38. #ruby-ng_src_unpack doesn't seem to like mixing with git so we just copy things above
  39. use ruby && ruby-ng_src_unpack
  40. }
  41. src_prepare() {
  42. sed -i 's#<lorcon2/lorcon.h>#"../lorcon.h"#' pylorcon2/PyLorcon2.c
  43. sed -i 's#find_library("orcon2", "lorcon_list_drivers", "lorcon2/lorcon.h") and ##' ruby-lorcon/extconf.rb
  44. sed -i 's#<lorcon2/lorcon.h>#"../lorcon.h"#' ruby-lorcon/Lorcon2.h
  45. use python && distutils-r1_src_prepare
  46. use ruby && ruby-ng_src_prepare
  47. }
  48. src_configure() {
  49. default_src_configure
  50. }
  51. src_compile() {
  52. default_src_compile
  53. use ruby && ruby-ng_src_compile
  54. if use python; then
  55. LDFLAGS+=" -L${S}/.libs/"
  56. cd pylorcon2 || die
  57. distutils-r1_src_compile
  58. fi
  59. }
  60. src_install() {
  61. emake DESTDIR="${ED}" install
  62. use ruby && ruby-ng_src_install
  63. if use python; then
  64. cd pylorcon2 || die
  65. distutils-r1_src_install
  66. fi
  67. }
  68. src_test() {
  69. :
  70. }
  71. each_ruby_compile() {
  72. sed -i "s#-I/usr/include/lorcon2#-I${WORKDIR}/${P}/ruby-lorcon -L${WORKDIR}/${P}/.libs#" ruby-lorcon/extconf.rb
  73. "${RUBY}" -C ruby-lorcon extconf.rb || die
  74. sed -i 's#<lorcon2/lorcon.h>#"../lorcon.h"#' ruby-lorcon/Lorcon2.h
  75. sed -i -e "s#-L\.#-L. -L${WORKDIR}/${P}/.libs -lorcon2 #g" \
  76. -e "s#-Wl,--no-undefined##" ruby-lorcon/Makefile || die
  77. emake V=1 -C ruby-lorcon
  78. }
  79. each_ruby_install() {
  80. DESTDIR="${ED}" emake -C ruby-lorcon install
  81. }