Blob Blame Raw
#!/bin/bash

function toolchain() {
	if [ -z "$INITIAL_PATH" ]; then
		export INITIAL_PATH="$PATH"
		export INITIAL_LD_LIBRARY_PATH="$LD_LIBRARY_PATH"
		export INITIAL_LDFLAGS="$INITIAL_LDFLAGS"
	fi

	export HOST="$1"
	local PREFIX="/usr/$HOST"
	local BINPREFIX="/usr/bin/$HOST-"
	if [ -z "$HOST" ]; then
		PREFIX="/usr"
		BINPREFIX="/usr/bin/"
	fi

	#export PATH="$PREFIX/bin:$INITIAL_PATH"
	#export LD_LIBRARY_PATH="$PREFIX/lib:$INITIAL_LD_LIBRARY_PATH"

	export ADDR2LINE=${BINPREFIX}addr2line
	export AS=${BINPREFIX}as
	export AR=${BINPREFIX}ar
	export CC=${BINPREFIX}gcc
	export CXXFILT=${BINPREFIX}c++filt
	export CXX=${BINPREFIX}c++
	export CPP=${BINPREFIX}cpp
	export DLLTOOL=${BINPREFIX}dlltool
	export DLLWRAP=${BINPREFIX}dllwrap
	export ELFEDIT=${BINPREFIX}elfedit
	export FORTRAN=${BINPREFIX}gfortran
	export GXX=${BINPREFIX}g++
	export GCC=${BINPREFIX}gcc
	export GCOV=${BINPREFIX}gcov
	export GCOV_TOOL=${BINPREFIX}gcov-tool
	export GFORTRAN=${BINPREFIX}gfortran
	export GPROF=${BINPREFIX}gprof
	export LD=${BINPREFIX}ld
	export LD_BFD=${BINPREFIX}ld.bfd
	export NM=${BINPREFIX}nm
	export OBJCOPY=${BINPREFIX}objcopy
	export OBJDUMP=${BINPREFIX}objdump
	export RANLIB=${BINPREFIX}ranlib
	export READELF=${BINPREFIX}readelf
	export SIZE=${BINPREFIX}size
	export STRINGS=${BINPREFIX}strings
	export STRIP=${BINPREFIX}strip
	export WINDMC=${BINPREFIX}windmc
	export RC=${BINPREFIX}windres
	export WINDRES=${BINPREFIX}windres

	#export LDFLAGS=" -L$PREFIX/lib $INITIAL_LDFLAGS"
}