#! /bin/sh
sed "s/warn_on debug/warn_on release/" LDView.pro > LDView.release.pro
mv LDView.release.pro LDView.pro
if [ "$HOSTTYPE" = x86_64 ] ; then
	export qplatform=linux-g++-64
else
	export qplatform=linux-g++
fi

if gcc -v --help 2>/dev/null | grep -q std=c++11 ; then
	export cpp11=DEFINES+=USE_CPP11
else
	export cpp11=DEFINES-=USE_CPP11
fi

if which qmake-qt5 >/dev/null 2>/dev/null ; then
	qmake-qt5 -spec $qplatform $cpp11
elif which qmake-qt4 >/dev/null 2>/dev/null ; then
	qmake-qt4 -spec $platforma $cpp11
else
	qmake -spec $qplatform
fi

rm -f LDView
make all
if [ "$1" = "-s" ]; then
	strip LDView;
fi
cd ../OSMesa
make
