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

Kirk McDonald kirklin.mcdonald at gmail.com
Fri Mar 30 02:27:18 PDT 2007


Andrei Alexandrescu (See Website for Email) wrote:
> 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
> 

I little while back I came up with a scheme for DMD/Windows, which I 
placed on the Tango wiki:

http://dsource.org/projects/tango/wiki/PhobosTangoCooperation

-- 
Kirk McDonald
http://kirkmcdonald.blogspot.com
Pyd: Connecting D and Python
http://pyd.dsource.org



More information about the Digitalmars-d mailing list