b9d87aa10f63434264c1ac1cfc773eac417cf403
[gentoo.git] / app-misc / realpath / realpath-1.17.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=4
5 inherit eutils toolchain-funcs flag-o-matic multilib prefix
6
7 DESCRIPTION="Return the canonicalized absolute pathname"
8 HOMEPAGE="http://packages.debian.org/unstable/utils/realpath"
9 SRC_URI="
10         mirror://debian/pool/main/r/${PN}/${PN}_${PV}.tar.gz
11         nls? ( mirror://debian/pool/main/r/${PN}/${PN}_${PV}_i386.deb )"
12
13 LICENSE="GPL-2"
14 SLOT="0"
15 KEYWORDS="~alpha amd64 arm hppa ~ia64 m68k ~mips ppc ppc64 s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
16 IUSE="nls"
17
18 RDEPEND="!sys-freebsd/freebsd-bin
19         nls? ( virtual/libintl )"
20 DEPEND="${RDEPEND}
21         nls? ( sys-devel/gettext )
22         elibc_mintlib? ( virtual/libiconv )"
23
24 src_unpack() {
25         unpack ${PN}_${PV}.tar.gz
26
27         if use nls; then
28                 # Unpack the .deb file, in order to get the preprocessed man page
29                 # translations. This way we avoid a dependency on app-text/po4a.
30                 mkdir deb
31                 cd deb
32                 unpack ${PN}_${PV}_i386.deb
33                 unpack ./data.tar.gz
34         fi
35 }
36
37 src_prepare() {
38         use nls || epatch "${FILESDIR}"/${PN}-1.16-nonls.patch
39         epatch "${FILESDIR}"/${PN}-1.17-build.patch
40         epatch "${FILESDIR}"/${PN}-1.14-no-po4a.patch
41         epatch "${FILESDIR}"/${PN}-1.15-prefix.patch
42         eprefixify common.mk
43 }
44
45 src_compile() {
46         tc-export CC
47         use nls && use !elibc_glibc && append-libs -lintl
48         [[ ${CHOST} == *-mint* ]] && append-libs "-liconv"
49
50         local subdir
51         for subdir in src man $(usex nls po ''); do
52                 emake MAKE_VERBOSE=yes VERSION="${PV}" -C ${subdir}
53         done
54 }
55
56 src_install() {
57         emake VERSION="${PV}" SUBDIRS="src man $(usex nls po '')" \
58                 DESTDIR="${D}" install
59         newdoc debian/changelog ChangeLog.debian
60
61         if use nls; then
62                 local dir
63                 for dir in "${WORKDIR}"/deb/usr/share/man/*; do
64                         [ -f "${dir}"/man1/realpath.1 ] || continue
65                         newman "${dir}"/man1/realpath.1 realpath.${dir##*/}.1
66                 done
67         fi
68 }