#!/bin/bash

# this is teknohog, trying to install cross compilers for ppc on x86
# while using tmpfs and shared binaries as usual

#THOST=armv5tejl-softfloat-linux-gnueabi
#THOST=armv5tel-softfloat-linux-gnueabi
#THOST=armv6j-unknown-linux-gnueabi
#THOST=i686-pc-linux-gnu
THOST=mips64el-unknown-linux-gnu
#THOST=powerpc-unknown-linux-gnu
#THOST=x86_64-pc-linux-gnu

TMPSIZE=2G
TMPDIR=/var/tmp/portage

# help with the "Link tests are not allowed.." bug?
export USE="-fortran"

# this is different from its usual Gentoo meaning >.<
export PORTDIR_OVERLAY="/usr/portage/local/teknohog"

if [ ! -d $TMPDIR ]; then mkdir -p $TMPDIR || exit; fi

mount -t tmpfs -o size=$TMPSIZE none $TMPDIR || exit

if [ "$1" == "clean" ]; then
	yes y | crossdev -C $THOST
	shift
fi

crossdev -t $THOST $@
#crossdev -t $THOST $@ -P "-ku"

umount $TMPDIR

