app-arch/pax: amd64 stable wrt bug #537522
[gentoo.git] / app-arch / pax / pax-20161104.ebuild
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 inherit unpacker toolchain-funcs flag-o-matic
6
7 DESCRIPTION="pax (Portable Archive eXchange) is the POSIX standard archive tool"
8 HOMEPAGE="https://www.mirbsd.org/pax.htm"
9 SRC_URI="https://www.mirbsd.org/MirOS/dist/mir/cpio/paxmirabilis-${PV}.cpio.gz"
10
11 LICENSE="BSD"
12 SLOT="0"
13 KEYWORDS="~alpha amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh sparc x86"
14
15 RDEPEND="
16         dev-libs/libbsd
17         elibc_musl? ( sys-libs/fts-standalone )
18 "
19 DEPEND="
20         ${RDEPEND}
21         $(unpacker_src_uri_depends)
22 "
23 PATCHES=(
24         "${FILESDIR}/${PN}-20160306-glibc-to-linux.patch"
25 )
26 S=${WORKDIR}/${PN}
27
28 src_prepare() {
29         # Newer C libraries omit this include from sys/types.h.
30         sed -i '1i#include <sys/sysmacros.h>' extern.h || die
31         default
32 }
33
34 src_configure() {
35         tc-export CC PKG_CONFIG
36 }
37
38 src_compile() {
39         use elibc_musl && append-ldflags "-lfts"
40
41         # We can't rely on LFS flags as it uses the fts.h interface which lacks 64-bit support.
42         set -- \
43                 ${CC} ${CPPFLAGS} ${CFLAGS} \
44                 -DPAX_SAFE_PATH=\"/bin:/usr/bin\" \
45                 -DHAVE_STRLCPY -DHAVE_VIS -DHAVE_STRMODE \
46                 -DLONG_OFF_T -DHAVE_LINKAT \
47                 $(${PKG_CONFIG} --cflags libbsd-overlay) \
48                 -Wall ${LDFLAGS} *.c -o ${PN} \
49                 $(${PKG_CONFIG} --libs libbsd-overlay)
50         echo "$@"
51         "$@" || die
52 }
53
54 src_install() {
55         dobin ${PN}
56         doman ${PN}.1
57
58         dosym pax /usr/bin/paxcpio
59         newman cpio.1 paxcpio.1
60
61         dosym pax /usr/bin/paxtar
62         newman tar.1 paxtar.1
63 }