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