net-libs/libssh: WITH_STATIC_LIB -> BUILD_SHARED_LIBS
[gentoo.git] / net-libs / liboping / liboping-1.10.0-r2.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="6"
5
6 inherit autotools fcaps perl-module
7
8 DESCRIPTION="Protocol independent ANSI-C ping library and command line utility"
9 HOMEPAGE="https://noping.cc/"
10 SRC_URI="https://noping.cc/files/${P}.tar.bz2"
11
12 LICENSE="LGPL-2.1 GPL-2"
13 SLOT="0/0.3"
14 KEYWORDS="alpha amd64 arm x86"
15 IUSE="+filecaps ncurses perl"
16
17 DEPEND="ncurses? ( sys-libs/ncurses:0= )"
18 RDEPEND=${DEPEND}
19
20 PATCHES=(
21         "${FILESDIR}"/${PN}-1.10.0-no-werror.patch
22         "${FILESDIR}/${PN}-1.6.2-nouidmagic.patch"
23         "${FILESDIR}"/${P}-gcc8-fix.patch
24         "${FILESDIR}"/${P}-do-not-quit-when-ping_send-fail.patch
25         "${FILESDIR}"/${P}-report-right-error-msg-when-select-fails.patch
26 )
27
28 src_prepare() {
29         default
30
31         eautoreconf
32 }
33
34 src_configure() {
35         econf \
36                 $(use_with perl perl-bindings INSTALLDIRS=vendor) \
37                 $(use_with ncurses)
38 }
39
40 src_test() {
41         if use perl; then
42                 pushd bindings/perl >/dev/null || die
43                 perl-module_src_test
44                 popd >/dev/null || die
45         fi
46 }
47
48 src_install() {
49         default
50
51         find "${ED}"usr/lib* -name '*.la' -o -name '*.a' -delete || die
52 }
53
54 pkg_postinst() {
55         if use filecaps; then
56                 local _caps_str="CAP_NET_RAW"
57                 _files=( "${EROOT%/}/usr/bin/oping")
58
59                 if use ncurses; then
60                         _files+=( "${EROOT%/}/usr/bin/noping")
61                 fi
62
63                 fcaps "${_caps_str}" "${_files[@]}"
64
65                 elog "Capabilities for"
66                 elog ""
67
68                 local _file=
69                 for _file in "${_files[@]}"; do
70                         elog "  ${_file}"
71                 done
72
73                 elog ""
74                 elog "set to ${_caps_str}+EP due to set 'filecaps' USE flag."
75                 elog
76         fi
77 }