proj/gentoo: Initial commit
[gentoo.git] / dev-util / pkgconfig / pkgconfig-0.28-r3.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6
7 # Do not inherit autotools in non-live ebuild - causes circular dependency, bug #550856
8 inherit eutils flag-o-matic libtool multilib multilib-minimal
9
10 MY_P=pkg-config-${PV}
11
12 if [[ ${PV} == *9999* ]]; then
13         # 1.12 is only needed for tests due to some am__check_pre / LOG_DRIVER
14         # weirdness with "/bin/bash /bin/sh" in arguments chain with >=1.13
15         WANT_AUTOMAKE=1.12
16         EGIT_REPO_URI="git://anongit.freedesktop.org/pkg-config"
17         EGIT_CHECKOUT_DIR=${WORKDIR}/${MY_P}
18         inherit autotools git-r3
19 else
20         KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~arm-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
21         SRC_URI="http://pkgconfig.freedesktop.org/releases/${MY_P}.tar.gz"
22 fi
23
24 DESCRIPTION="Package config system that manages compile/link flags"
25 HOMEPAGE="http://pkgconfig.freedesktop.org/wiki/"
26
27 LICENSE="GPL-2"
28 SLOT="0"
29 IUSE="elibc_FreeBSD elibc_glibc hardened internal-glib"
30
31 RDEPEND="!internal-glib? ( >=dev-libs/glib-2.34.3[${MULTILIB_USEDEP}] )
32         !dev-util/pkgconf[pkg-config]
33         !dev-util/pkg-config-lite
34         !dev-util/pkgconfig-openbsd[pkg-config]"
35 DEPEND="${RDEPEND}"
36
37 S=${WORKDIR}/${MY_P}
38
39 DOCS=( AUTHORS NEWS README )
40
41 src_prepare() {
42         epatch "${FILESDIR}"/${P}-strip_system_library_dirs_reliably.patch
43
44         sed -i -e "s|^prefix=/usr\$|prefix=${EPREFIX}/usr|" check/simple.pc || die #434320
45
46         # Large file support, fixed in upstream git; bug #550508
47         epatch "${FILESDIR}"/${P}-lfs.patch
48         # lfs patch touches config.h.in; need this hack to prevent autoreconf and automake
49         touch aclocal.m4 config.h.in Makefile.in
50
51         epatch_user
52
53         if [[ ${PV} == *9999* ]]; then
54                 eautoreconf
55         else
56                 elibtoolize # Required for FreeMiNT wrt #333429
57         fi
58 }
59
60 multilib_src_configure() {
61         local myconf
62
63         if use internal-glib; then
64                 myconf+=' --with-internal-glib'
65                 # non-glibc platforms use GNU libiconv, but configure needs to
66                 # know about that not to get confused when it finds something
67                 # outside the prefix too
68                 if use prefix && use !elibc_glibc ; then
69                         myconf+=" --with-libiconv=gnu"
70                         # add the libdir for libtool, otherwise it'll make love with system
71                         # installed libiconv
72                         append-ldflags "-L${EPREFIX}/usr/$(get_libdir)"
73                 fi
74         else
75                 if ! has_version dev-util/pkgconfig; then
76                         export GLIB_CFLAGS="-I${EPREFIX}/usr/include/glib-2.0 -I${EPREFIX}/usr/$(get_libdir)/glib-2.0/include"
77                         export GLIB_LIBS="-lglib-2.0"
78                 fi
79         fi
80
81         use ppc64 && use hardened && replace-flags -O[2-3] -O1
82
83         # Force using all the requirements when linking, so that needed -pthread
84         # lines are inherited between libraries
85         use elibc_FreeBSD && myconf+=' --enable-indirect-deps'
86
87         [[ ${PV} == *9999* ]] && myconf+=' --enable-maintainer-mode'
88
89         ECONF_SOURCE=${S} \
90         econf \
91                 --docdir="${EPREFIX}"/usr/share/doc/${PF}/html \
92                 --with-system-include-path="${EPREFIX}"/usr/include \
93                 --with-system-library-path="${EPREFIX}"/usr/$(get_libdir) \
94                 ${myconf}
95 }
96
97 multilib_src_install() {
98         emake DESTDIR="${D}" install
99
100         if use prefix; then
101                 # Add an explicit reference to $EPREFIX to PKG_CONFIG_PATH to
102                 # simplify cross-prefix builds
103                 echo "PKG_CONFIG_PATH=${EPREFIX}/usr/$(get_libdir)/pkgconfig:${EPREFIX}/usr/share/pkgconfig" >> "${T}"/99${PN}
104                 doenvd "${T}"/99${PN}
105         fi
106 }