summaryrefslogtreecommitdiff
blob: eb5d63f9c867ae4d98a404f9cf33253fd6876586 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-libs/uclibc++/uclibc++-0.2.0.ebuild,v 1.3 2006/03/04 04:26:31 vapier Exp $

inherit eutils toolchain-funcs

export CTARGET=${CTARGET:-${CHOST}}
if [[ ${CTARGET} == ${CHOST} ]] ; then
	if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
		export CTARGET=${CATEGORY/cross-}
	fi
fi

DESCRIPTION="embedded C++ library"
HOMEPAGE="http://cxx.uclibc.org/"
SRC_URI="http://cxx.uclibc.org/src/uClibc++-${PV}.tbz"

LICENSE="GPL-2"
[[ ${CTARGET} != ${CHOST} ]] \
	&& SLOT="${CTARGET}" \
	|| SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ppc ~x86"
IUSE="debug static"

DEPEND=""

S=${WORKDIR}/uClibc++-${PV}

src_unpack() {
	cp "${DISTDIR}"/${A} ${A}2
	unpack ./${A}2
	cd "${S}"
	make -s defconfig || die "defconfig failed"

	local target
	case $(tc-arch ${CTARGET}) in
		alpha)	target="alpha";;
		amd64)  target="x86_64";;
		arm)	target="arm";;
		hppa)	target="hppa";;
		mips)	target="mips";;
		ppc)	target="powerpc";;
		x86)	target="i386";;
		*)		die "$(tc-arch ${CTARGET}) lists no defaults :/";;
	esac

	sed -i \
		-e '/^UCLIBCXX_RUNTIME_PREFIX=/d' \
		-e '/^TARGET_'${target}'/d' \
		.config

	echo "UCLIBCXX_RUNTIME_PREFIX=\"/usr/${CTARGET}\"" >> .config
	echo "TARGET_${target}=y" >> .config
	use debug && echo "CONFIG_DODEBUG=y" >> .config

	yes "" | make -s oldconfig || die "oldconfig failed"

	# has to come after make oldconfig, else it will be disabled
	echo "BUILD_STATIC_LIB=y" >> .config
	if use static ; then
		echo "BUILD_ONLY_STATIC_LIB=y" >> .config
	fi
}

src_compile() {
	emake -j1 ARCH_CFLAGS="${CFLAGS}" CROSS=${CTARGET}- || die "make failed"
}

src_test() {
	make test || die "test failed"
}

src_install() {
	make install PREFIX="${D}" || die
	dodir /usr/bin
	dosym /usr/${CTARGET}/bin/g++-uc /usr/bin/g++-uc
	dodoc ChangeLog README TODO
}