summaryrefslogtreecommitdiff
blob: 3d4ff55cdf8e050de07ee68529a5e2a569113abf (plain)
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
71
72
73
74
75
76
77
78
79
80
81
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=6

PYTHON_COMPAT=( python2_7 )
DISTUTILS_OPTIONAL=1

inherit distutils-r1

DESCRIPTION="A generic library for injecting 802.11 frames"
HOMEPAGE="https://github.com/kismetwireless/lorcon"

if [[ ${PV} == "9999" ]] ; then
	#EGIT_REPO_URI="https://www.kismetwireless.net/lorcon.git"
	EGIT_REPO_URI="https://github.com/kismetwireless/lorcon.git"
	inherit git-r3
	KEYWORDS=""
	S="${WORKDIR}"/${P}
else
	GIT_HASH="d8637792f2e857f31849f29759c1022eb0518c83"
	SRC_URI="https://github.com/kismetwireless/lorcon/archive/${GIT_HASH}.tar.gz -> ${P}.tar.gz"
	S="${WORKDIR}"/"${PN}-${GIT_HASH}"
	KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux"
fi

LICENSE="GPL-2"
SLOT="0"
IUSE="python"

DEPEND="
	python? ( ${PYTHON_DEPS} )
	dev-libs/libnl:3=
	net-libs/libpcap"
RDEPEND="${DEPEND}"

REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"

src_unpack() {
	if [[ ${PV} == "9999" ]] ; then
		git-r3_src_unpack
		cp -R "${S}/" "${WORKDIR}/all"
	fi
	default_src_unpack
}

src_prepare() {
	sed -i 's#<lorcon2/lorcon.h>#"../lorcon.h"#' pylorcon2/PyLorcon2.c
	sed -i 's#<lorcon2/lorcon.h>#"../lorcon.h"#' pylorcon2/PyLorcon2.h
	sed -i 's#<lorcon2/lorcon_packet.h>#"../lorcon_packet.h"#' pylorcon2/PyLorcon2.c
	sed -i 's#<lorcon2/lorcon_packet.h>#"../lorcon_packet.h"#' pylorcon2/PyLorcon2.h
	sed -i 's#<lorcon2/lorcon_multi.h>#"../lorcon_multi.h"#' pylorcon2/PyLorcon2.c
	sed -i 's#<lorcon2/lorcon_multi.h>#"../lorcon_multi.h"#' pylorcon2/PyLorcon2.h
	default
	use python && distutils-r1_src_prepare
}

src_configure() {
	default_src_configure
}

src_compile() {
	default_src_compile
	if use python; then
		LDFLAGS+=" -L${S}/.libs/"
		cd pylorcon2 || die
		distutils-r1_src_compile
	fi
}

src_install() {
	emake DESTDIR="${ED}" install
	if use python; then
		cd pylorcon2 || die
		distutils-r1_src_install
	fi
}

src_test() {
	:
}