summaryrefslogtreecommitdiff
blob: 6f65020dd57731046a87e726e980626b16f01161 (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7
inherit git-r3 toolchain-funcs

DESCRIPTION="Parallelized network login hacker"
HOMEPAGE="https://github.com/vanhauser-thc/thc-hydra"
EGIT_REPO_URI="https://github.com/vanhauser-thc/thc-hydra"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS=""
IUSE="
	debug firebird gcrypt gtk idn libressl memcached mongodb mysql ncp ncurses
	oracle pcre postgres rdp libssh subversion zlib
"

RDEPEND="
	gtk? (
		dev-libs/atk
		dev-libs/glib:2
		x11-libs/gdk-pixbuf:2
		x11-libs/gtk+:2
	)
	firebird? ( dev-db/firebird )
	gcrypt? ( dev-libs/libgcrypt )
	idn? ( net-dns/libidn:0= )
	!libressl? ( dev-libs/openssl:0= )
	libressl? ( dev-libs/libressl:0= )
	memcached? ( dev-libs/libmemcached[sasl] )
	mongodb? ( dev-libs/mongo-c-driver )
	mysql? ( dev-db/mysql-connector-c:0= )
	ncp? ( net-fs/ncpfs )
	ncurses? ( sys-libs/ncurses:= )
	oracle? ( dev-db/oracle-instantclient-basic )
	pcre? ( dev-libs/libpcre )
	postgres? ( dev-db/postgresql:* )
	rdp? ( net-misc/freerdp )
	libssh? ( >=net-libs/libssh-0.4.0 )
	subversion? ( dev-vcs/subversion )
	zlib? ( sys-libs/zlib )
"
DEPEND="
	${RDEPEND}
	virtual/pkgconfig
"
PATCHES=(
	"${FILESDIR}"/${PN}-9.0-fcommon-gtk.patch
	"${FILESDIR}"/${PN}-9.0-fcommon-mod.patch
	"${FILESDIR}"/${PN}-9.0-fcommon-mods.patch
	"${FILESDIR}"/${PN}-9.0-unneeded-buf.patch
	"${FILESDIR}"/${PN}-9.0-vnc.patch
	"${FILESDIR}"/${PN}-9999999-fcommon-http.patch
)

src_prepare() {
	default

	# None of the settings in Makefile.unix are useful to us
	mv Makefile.unix{,.gentoo_unused} || die
	touch Makefile.unix || die

	sed -i \
		-e 's:|| echo.*$::' \
		-e '/\t-$(CC)/s:-::' \
		-e '/^OPTS/{s|=|+=|;s| -O3||}' \
		-e '/ -o /s:$(OPTS):& $(LDFLAGS):g' \
		Makefile.am || die
}

src_configure() {
	# Note: the top level configure script is not autoconf-based
	tc-export CC PKG_CONFIG

	export OPTS="${CFLAGS}"

	hydra_sed() {
		if use ${1}; then
			einfo "Enabling ${1}"
			if [[ -n "${3}" ]]; then
				sed -i 's#'"${2}"'#'"${3}"'#' configure || die
			fi
		else
			einfo "Disabling ${1}"
			sed -i 's#'"${2}"'##; s#'"${4}"'##' configure || die
		fi
	}

	hydra_sed firebird '-lfbclient' '' '-DLIBFIREBIRD'
	hydra_sed gcrypt '-lgcrypt' '$( ${CTARGET:-${CHOST}}-libgcrypt-config --libs )' '-DHAVE_GCRYPT'
	hydra_sed idn '-lidn' '$( "${PKG_CONFIG}" --libs libidn )' '-DLIBIDN -DHAVE_PR29_H'
	hydra_sed libssh '-lssh' '$( "${PKG_CONFIG}" --libs libssh )' '-DLIBSSH'
	hydra_sed memcached '-lmemcached' '$( "${PKG_CONFIG}" --libs libmemcached )' '-DLIBMCACHED'
	hydra_sed mongodb '-lmongoc-1.0' '$( "${PKG_CONFIG}" --libs libmongoc-1.0 )' '-DLIBMONGODB\|-DLIBBSON'
	hydra_sed mysql '-lmysqlclient' '$( ${CTARGET:-${CHOST}}-mysql_config --libs )' '-DLIBMYSQLCLIENT'
	hydra_sed ncp '-lncp' '' '-DLIBNCP'
	hydra_sed ncurses '-lcurses' '$( "${PKG_CONFIG}" --libs ncurses )' '-DLIBNCURSES'
	hydra_sed pcre '-lpcre' '$( "${PKG_CONFIG}" --libs libpcre )' '-DHAVE_PCRE'
	hydra_sed postgres '-lpq' '$( "${PKG_CONFIG}" --libs libpq )' '-DLIBPOSTGRES'
	hydra_sed oracle '-locci -lclntsh' '' '-DLIBORACLE'
	hydra_sed rdp '-lfreerdp2' '$( "${PKG_CONFIG}" --libs freerdp2 )' '-DLIBFREERDP2'
	# TODO: https://bugs.gentoo.org/686148
	#hydra_sed subversion '-lsvn_client-1 -lapr-1 -laprutil-1 -lsvn_subr-1' '$( "${PKG_CONFIG}" --libs libsvn_client )' '-DLIBSVN'
	hydra_sed subversion '-lsvn_client-1 -lapr-1 -laprutil-1 -lsvn_subr-1' '' '-DLIBSVN'
	hydra_sed zlib '-lz' '$( "${PKG_CONFIG}" --libs zlib )' '-DHAVE_ZLIB'

	sh configure \
		$(use gtk || echo --disable-xhydra) \
		$(usex debug '--debug' '') \
		--nostrip \
		--prefix=/usr \
		|| die

	if use gtk ; then
		pushd hydra-gtk || die
		econf
	fi
}

src_compile() {
	emake XLIBPATHS=''
	use gtk && emake -C hydra-gtk
}

src_install() {
	dobin hydra pw-inspector
	use gtk && dobin hydra-gtk/src/xhydra
	dodoc CHANGES README.md
}