*/*: Discontinue Gentoo SuperH port
[gentoo.git] / net-misc / wget / wget-1.20.3-r3.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 PYTHON_COMPAT=( python3_{6,7} )
7
8 inherit flag-o-matic python-any-r1 toolchain-funcs
9
10 DESCRIPTION="Network utility to retrieve files from the WWW"
11 HOMEPAGE="https://www.gnu.org/software/wget/"
12 SRC_URI="mirror://gnu/wget/${P}.tar.gz"
13
14 LICENSE="GPL-3"
15 SLOT="0"
16 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
17 IUSE="cookie_check debug gnutls idn ipv6 libressl metalink nls ntlm pcre +ssl static test uuid zlib"
18 REQUIRED_USE=" ntlm? ( !gnutls ssl ) gnutls? ( ssl )"
19 RESTRICT="!test? ( test )"
20
21 # Force a newer libidn2 to avoid libunistring deps. #612498
22 LIB_DEPEND="
23         cookie_check? ( net-libs/libpsl )
24         idn? ( >=net-dns/libidn2-0.14:=[static-libs(+)] )
25         metalink? ( media-libs/libmetalink )
26         pcre? ( dev-libs/libpcre2[static-libs(+)] )
27         ssl? (
28                 gnutls? ( net-libs/gnutls:0=[static-libs(+)] )
29                 !gnutls? (
30                         !libressl? ( dev-libs/openssl:0=[static-libs(+)] )
31                         libressl? ( dev-libs/libressl:0=[static-libs(+)] )
32                 )
33         )
34         uuid? ( sys-apps/util-linux[static-libs(+)] )
35         zlib? ( sys-libs/zlib[static-libs(+)] )
36 "
37 RDEPEND="!static? ( ${LIB_DEPEND//\[static-libs(+)]} )"
38 DEPEND="
39         ${RDEPEND}
40         static? ( ${LIB_DEPEND} )
41         test? (
42                 ${PYTHON_DEPS}
43                 dev-lang/perl
44                 dev-perl/HTTP-Daemon
45                 dev-perl/HTTP-Message
46                 dev-perl/IO-Socket-SSL
47         )
48 "
49 BDEPEND="
50         app-arch/xz-utils
51         virtual/pkgconfig
52         nls? ( sys-devel/gettext )
53 "
54
55 DOCS=( AUTHORS MAILING-LIST NEWS README doc/sample.wgetrc )
56
57 pkg_setup() {
58         use test && python-any-r1_pkg_setup
59 }
60
61 src_prepare() {
62         default
63
64         # revert some hack that breaks linking, bug #585924
65         if [[ ${CHOST} == *-darwin* ]] \
66         || [[ ${CHOST} == *-solaris* ]] \
67         || [[ ${CHOST} == *-uclibc* ]] \
68         || [[ ${CHOST} == *-cygwin* ]] \
69         ; then
70                 sed -i \
71                         -e 's/^  LIBICONV=$/:/' \
72                         configure || die
73         fi
74 }
75
76 src_configure() {
77         # fix compilation on Solaris, we need filio.h for FIONBIO as used in
78         # the included gnutls -- force ioctl.h to include this header
79         [[ ${CHOST} == *-solaris* ]] && append-cppflags -DBSD_COMP=1
80
81         if use static ; then
82                 append-ldflags -static
83                 tc-export PKG_CONFIG
84                 PKG_CONFIG+=" --static"
85         fi
86
87         # There is no flag that controls this.  libunistring-prefix only
88         # controls the search path (which is why we turn it off below).
89         # Further, libunistring is only needed w/older libidn2 installs,
90         # and since we force the latest, we can force off libunistring. #612498
91         local myeconfargs=(
92                 --disable-assert
93                 --disable-pcre
94                 --disable-rpath
95                 --without-included-libunistring
96                 --without-libunistring-prefix
97                 $(use_enable debug)
98                 $(use_enable idn iri)
99                 $(use_enable ipv6)
100                 $(use_enable nls)
101                 $(use_enable ntlm)
102                 $(use_enable pcre pcre2)
103                 $(use_enable ssl digest)
104                 $(use_enable ssl opie)
105                 $(use_with cookie_check libpsl)
106                 $(use_with idn libidn)
107                 $(use_with metalink)
108                 $(use_with ssl ssl $(usex gnutls gnutls openssl))
109                 $(use_with uuid libuuid)
110                 $(use_with zlib)
111         )
112         ac_cv_libunistring=no \
113         econf "${myeconfargs[@]}"
114 }
115
116 src_install() {
117         default
118
119         sed -i \
120                 -e "s:/usr/local/etc:${EPREFIX}/etc:g" \
121                 "${ED}"/etc/wgetrc \
122                 "${ED}"/usr/share/man/man1/wget.1 \
123                 "${ED}"/usr/share/info/wget.info \
124                 || die
125 }