aboutsummaryrefslogtreecommitdiff
blob: 72eca91e956048bbb1000ce208c7b1fa1f334dfa (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
#!/bin/sh
# Copyright 2008-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

if [ -z "${CHOST}" ] ; then
	CHOST=${0##*/}
	CHOST=${CHOST%-emerge}
fi
export CHOST

: ${SYSROOT=/usr/${CHOST}}
: ${PORTAGE_CONFIGROOT=${SYSROOT}}
export SYSROOT PORTAGE_CONFIGROOT

if [ -z "${CHOST}" ] || [ ! -d "${SYSROOT}" ] ; then
	echo "cross-emerge: CHOST is not set properly"
	exit 1
fi

: ${CBUILD=$(portageq envvar CBUILD)}
: ${BUILD_CFLAGS=$(env -i portageq envvar CFLAGS)}
: ${BUILD_CXXFLAGS=$(env -i portageq envvar CXXFLAGS)}
: ${BUILD_CPPFLAGS=$(env -i portageq envvar CPPFLAGS)}
export CBUILD BUILD_CFLAGS BUILD_CXXFLAGS BUILD_CPPFLAGS

FAKEROOT=
if [ $(id -u) -ne 0 ] ; then
	type -P fakeroot >/dev/null && FAKEROOT=fakeroot
fi

: ${CROSS_CMD:=emerge --root-deps=rdeps}
exec ${FAKEROOT} ${CROSS_CMD} -q "$@"