summaryrefslogtreecommitdiff
blob: a9db3b0d13f7aa8a3658fed8982e687908bbf5f7 (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
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit toolchain-funcs flag-o-matic

DESCRIPTION="http protocol ping-like program"
HOMEPAGE="https://www.vanheusden.com/httping/"
SRC_URI="https://github.com/folkertvanheusden/HTTPing/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}"/HTTPing-${PV}

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="amd64 ~arm64 ~hppa ~mips ~ppc ppc64 ~riscv ~sparc x86"
IUSE="debug fftw l10n_nl ncurses ssl +tfo"

RDEPEND="
	fftw? ( sci-libs/fftw:3.0 )
	ncurses? ( sys-libs/ncurses:= )
	ssl? ( dev-libs/openssl:= )
"
DEPEND="${RDEPEND}"
BDEPEND="ncurses? ( virtual/pkgconfig )"

# This would bring in test? ( dev-util/cppcheck ) but unlike
# upstream we should only care about compile/run time testing
RESTRICT="test"

PATCHES=(
	"${FILESDIR}"/${PN}-2.2.1-flags.patch
	"${FILESDIR}"/${PN}-2.9-c99.patch
)

src_prepare() {
	default

	# Don't clobber toolchain defaults
	sed -i -e 's:-D_FORTIFY_SOURCE=2::' Makefile || die

	# doman does not get PN-LANG.CAT so we move things around and then point at
	# it later
	if use l10n_nl; then
		mkdir nl || die
		mv httping-nl.1 nl/httping.1 || die
	fi

}

src_configure() {
	# not an autotools script
	echo > makefile.inc || die

	if use ncurses ; then
		local ncurses_flags="$($(tc-getPKG_CONFIG) --libs ncurses)"

		# Don't require ncurses with unicode support
		# bug #731950
		sed -i -e "s/-lncursesw/${ncurses_flags}/" Makefile || die
		append-libs "${ncurses_flags}"
	fi
}

src_compile() {
	emake \
		CC="$(tc-getCC)" \
		FW=$(usex fftw) \
		DEBUG=$(usex debug) \
		NC=$(usex ncurses) \
		SSL=$(usex ssl) \
		TFO=$(usex tfo)
}

src_install() {
	dobin httping
	doman httping.1

	use l10n_nl && doman -i18n=nl nl/httping.1
}