net-p2p/amule: Resolve merge conflicts.
[gentoo.git] / sys-libs / newlib / newlib-9999.ebuild
1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI="4"
6
7 inherit flag-o-matic toolchain-funcs eutils
8
9 if [[ ${PV} == "9999" ]] ; then
10         EGIT_REPO_URI="git://sourceware.org/git/newlib-cygwin.git"
11         inherit git-r3
12 else
13         SRC_URI="ftp://sourceware.org/pub/newlib/${P}.tar.gz"
14         if [[ ${PV} != *.201[5-9]???? ]] ; then
15                 KEYWORDS="-* ~arm ~hppa ~m68k ~mips ~ppc ~ppc64 ~sh ~sparc ~x86"
16         fi
17 fi
18
19 export CBUILD=${CBUILD:-${CHOST}}
20 export CTARGET=${CTARGET:-${CHOST}}
21 if [[ ${CTARGET} == ${CHOST} ]] ; then
22         if [[ ${CATEGORY} == cross-* ]] ; then
23                 export CTARGET=${CATEGORY#cross-}
24         fi
25 fi
26
27 DESCRIPTION="Newlib is a C library intended for use on embedded systems"
28 HOMEPAGE="http://sourceware.org/newlib/"
29
30 LICENSE="NEWLIB LIBGLOSS GPL-2"
31 SLOT="0"
32 IUSE="nls threads unicode crosscompile_opts_headers-only"
33 RESTRICT="strip"
34
35 NEWLIBBUILD="${WORKDIR}/build"
36
37 pkg_setup() {
38         # Reject newlib-on-glibc type installs
39         if [[ ${CTARGET} == ${CHOST} ]] ; then
40                 case ${CHOST} in
41                         *-newlib|*-elf) ;;
42                         *) die "Use sys-devel/crossdev to build a newlib toolchain" ;;
43                 esac
44         fi
45 }
46
47 src_prepare() {
48         epatch_user
49 }
50
51 src_configure() {
52         # we should fix this ...
53         unset LDFLAGS
54         CHOST=${CTARGET} strip-unsupported-flags
55
56         local myconf=""
57         [[ ${CTARGET} == "spu" ]] \
58                 && myconf="${myconf} --disable-newlib-multithread" \
59                 || myconf="${myconf} $(use_enable threads newlib-multithread)"
60
61         mkdir -p "${NEWLIBBUILD}"
62         cd "${NEWLIBBUILD}"
63
64         ECONF_SOURCE=${S} \
65         econf \
66                 $(use_enable unicode newlib-mb) \
67                 $(use_enable nls) \
68                 ${myconf}
69 }
70
71 src_compile() {
72         emake -C "${NEWLIBBUILD}"
73 }
74
75 src_install() {
76         cd "${NEWLIBBUILD}"
77         emake -j1 DESTDIR="${D}" install
78 #       env -uRESTRICT CHOST=${CTARGET} prepallstrip
79         # minor hack to keep things clean
80         rm -fR "${D}"/usr/share/info
81         rm -fR "${D}"/usr/info
82 }