script for configuring dmd to work with phobos and tango on linux

Andrei Alexandrescu (See Website for Email) SeeWebsiteForEmail at erdani.org
Thu Mar 29 14:57:56 PDT 2007


I previously sent a little script that configured the environment
variable DFLAGS, but then I figured that it's best to mess with the
config file directly. This way the advantage of different consoles with
different dmd configuration is lost, but then there is the advantage
that the configuration is persistent, which help certain modus operandi.
YMMV.

Paste the code below into a file e.g. dmdc, make it executable, and then
run either "dmdc phobos" or "dmdc tango". Adding more parameters after
that invokes the compiler, temporarily overriding the .conf file with
the requested environment; the old environment is then restored


HTH,

Andrei

#!/bin/sh

D_BIN=$(dirname $(which dmd))
WHICH=$1

if [ "$WHICH" = "phobos" ]; then
     DFLAGS="-I$D_BIN/../src/phobos -L-L$D_BIN/../lib
-L-L$D_BIN/../../dm/lib"
elif [ "$WHICH" = "tango" ]; then
     DFLAGS="-I$D_BIN/../../tango-0.96-bin -version=Tango -version=Posix"
     DFLAGS="$DFLAGS -L-L$D_BIN/../../tango-0.96-bin/lib libtango.a"
else
     echo "Please pass either phobos or tango as the first argument"
     WHICH=""
fi

if [ ! -z "$WHICH" ]; then
     shift
     mv $D_BIN/dmd.conf $D_BIN/dmd.conf.bak
     if [ "$*" != "" ]; then
	dmd $*
	mv $D_BIN/dmd.conf.bak $D_BIN/dmd.conf
     else
	echo "[Environment]" >$D_BIN/dmd.conf
	echo "DFLAGS=$DFLAGS" >>$D_BIN/dmd.conf
     fi
fi




More information about the Digitalmars-d mailing list