logo

overlay

My (experimental) gentoo overlay

aircrack-ng-1.2.ebuild (3103B)


      1 # Copyright 1999-2018 Gentoo Foundation
      2 # Distributed under the terms of the GNU General Public License v2
      3 
      4 EAPI="6"
      5 
      6 PYTHON_COMPAT=( python2_7 )
      7 DISTUTILS_OPTIONAL=1
      8 
      9 inherit toolchain-funcs distutils-r1 flag-o-matic autotools
     10 
     11 DESCRIPTION="WLAN tools for breaking 802.11 WEP/WPA keys"
     12 HOMEPAGE="http://www.aircrack-ng.org"
     13 
     14 MY_PV=${PV/_/-}
     15 SRC_URI="http://download.${PN}.org/${PN}-${MY_PV}.tar.gz"
     16 KEYWORDS="~amd64 ~arm ~ppc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux"
     17 
     18 LICENSE="GPL-2"
     19 SLOT="0"
     20 
     21 IUSE="+airdrop-ng +airgraph-ng kernel_linux kernel_FreeBSD libressl +netlink +pcre +sqlite +experimental"
     22 
     23 DEPEND="net-libs/libpcap
     24 	!libressl? ( dev-libs/openssl:0= )
     25 	libressl? ( dev-libs/libressl:0= )
     26 	netlink? ( dev-libs/libnl:3 )
     27 	pcre? ( dev-libs/libpcre )
     28 	airdrop-ng? ( ${PYTHON_DEPS} )
     29 	airgraph-ng? ( ${PYTHON_DEPS} )
     30 	experimental? ( sys-libs/zlib )
     31 	sqlite? ( >=dev-db/sqlite-3.4 )"
     32 RDEPEND="${DEPEND}"
     33 PDEPEND="kernel_linux? (
     34 		net-wireless/iw
     35 		net-wireless/wireless-tools
     36 		sys-apps/ethtool
     37 		sys-apps/usbutils
     38 		sys-apps/pciutils )
     39 	sys-apps/hwids
     40 	airdrop-ng? ( net-wireless/lorcon[python,${PYTHON_USEDEP}] )"
     41 
     42 REQUIRED_USE="airdrop-ng? ( ${PYTHON_REQUIRED_USE} )
     43 		airgraph-ng? ( ${PYTHON_REQUIRED_USE} )"
     44 
     45 S="${WORKDIR}/${PN}-${MY_PV}"
     46 
     47 pkg_setup() {
     48 	MAKE_COMMON=(
     49 		CC="$(tc-getCC)" \
     50 		CXX="$(tc-getCXX)" \
     51 		AR="$(tc-getAR)" \
     52 		LD="$(tc-getLD)" \
     53 		RANLIB="$(tc-getRANLIB)" \
     54 		DESTDIR="${ED}"
     55 	)
     56 }
     57 
     58 src_prepare() {
     59 	epatch "${FILESDIR}"/aircrack-ng-1.2-no-force-stack-protector.patch
     60 	eapply_user
     61 	eautoreconf
     62 }
     63 
     64 src_configure() {
     65 	econf \
     66 		--disable-asan \
     67 		$(use_enable netlink libnl) \
     68 		$(use_with experimental) \
     69 		$(use_with sqlite sqlite3) \
     70 		--enable-shared \
     71 		--disable-static \
     72 		--without-opt
     73 }
     74 
     75 src_compile() {
     76 	if [[ $($(tc-getCC) --version) == clang* ]] ; then
     77 		#https://bugs.gentoo.org/show_bug.cgi?id=472890
     78 		filter-flags -frecord-gcc-switches
     79 	fi
     80 
     81 	emake "${MAKE_COMMON[@]}"
     82 
     83 	if use airgraph-ng; then
     84 		cd "${S}/scripts/airgraph-ng"
     85 		distutils-r1_src_compile
     86 	fi
     87 	if use airdrop-ng; then
     88 		cd "${S}/scripts/airdrop-ng"
     89 		distutils-r1_src_compile
     90 	fi
     91 }
     92 
     93 src_test() {
     94 	emake "${MAKE_COMMON[@]}" check
     95 }
     96 
     97 src_install() {
     98 	einstalldocs
     99 	emake "${MAKE_COMMON[@]}" install
    100 
    101 	if use airgraph-ng; then
    102 		cd "${S}/scripts/airgraph-ng"
    103 		distutils-r1_src_install
    104 	fi
    105 	if use airdrop-ng; then
    106 		cd "${S}/scripts/airdrop-ng"
    107 		distutils-r1_src_install
    108 	fi
    109 
    110 	#we don't need aircrack-ng's oui updater, we have our own
    111 	rm "${ED}"/usr/sbin/airodump-ng-oui-update
    112 }
    113 
    114 pkg_postinst() {
    115 	# Message is (c) FreeBSD
    116 	# http://www.freebsd.org/cgi/cvsweb.cgi/ports/net-mgmt/aircrack-ng/files/pkg-message.in?rev=1.5
    117 	if use kernel_FreeBSD ; then
    118 		einfo "Contrary to Linux, it is not necessary to use airmon-ng to enable the monitor"
    119 		einfo "mode of your wireless card.  So do not care about what the manpages say about"
    120 		einfo "airmon-ng, airodump-ng sets monitor mode automatically."
    121 		echo
    122 		einfo "To return from monitor mode, issue the following command:"
    123 		einfo "    ifconfig \${INTERFACE} -mediaopt monitor"
    124 		einfo
    125 		einfo "For aireplay-ng you need FreeBSD >= 7.0."
    126 	fi
    127 }