Installing dmd

Adam D. Ruppe destructionator at gmail.com
Sun Mar 1 08:14:34 PST 2009


On Sun, Mar 01, 2009 at 05:37:05PM +0200, Georg Wrede wrote:
> This looks excellent!
> 
> So it's just the docs?

Yeah, the docs are overcomplicated. (I have to admit I never read them;
I just did the same thing I've been doing with dmc for years and it worked.)

Let me do a 'clean' install of the new version and record my steps here.
The goal: have dmd for D 1 and D 2 both working at the same time for native
binaries.

Secondary goal (something else I have working here): have the Windows dmd
working under Wine for building Windows exes from Linux.



First, I download the dmd zip files (I always get them from the changelog page.)

To have both 1.0 and 2.0 side by side, we'll make different directories for
them and put the respective zip file in that directory:

mkdir d2
mv dmd.2* d2
mkdir d1
mv dmd.1* d1

Go in and unzip it:

cd d2
unzip dmd.2*

Change the permissions (actually optional, see the end of this message for an
alternative):

cd dmd/linux/bin
chmod +x dmd
chmod +x dumpobj
chmod +x obj2asm
chmod +x rdmd


Now, it works, but we want it in our path. To do this, I just stick a script
in my path:

Create a file: /usr/bin/dmd with the contents:
==========
#!/bin/bash

/path/to/your/download/folder/d2/dmd/linux/bin/dmd $*
==========
Make it executable:
chmod +x /usr/bin/dmd

And boom, you can now run:

dmd test.d

And it works correctly.


Repeat the process for the D1 download, but call your convenience script
something else. I personally use /usr/bin/dmd-1.0 but you can do whatever
you want.

Now:
dmd test.d
It works!

dmd-1.0 testv1.d
It works too!

What about making Windows binaries?

It is trivial:

wine /path/to/your/download/d2/dmd/windows/bin/dmd.exe test.d

Boom, it worked too! Again, you might want a convenience script:

/usr/bin/dmd-win
=========
#!/bin/bash

wine /path/to/your/download/d2/dmd/windows/bin/dmd.exe $*
=========

(And repeat for D1.) And now you can make Linux or Windows binaries with D1
or D2, all side by side, all with ease.


When you want to update your compiler, simply grab the new zip in the same
download folder, unzip it, overwriting the old ones, chmod +x linux/bin/dmd,
and have fun.


Btw, if chmoding it every time is too much of a hassle, your convenience
scripts can render that unneeded too.

Just use

========
/bin/bash

/lib/ld-linux.so.2 /path/to/your/download/d2/dmd/linux/bin/dmd $*
==========

Instead. Thus you don't need to chmod +x the file from the zip.

If you go that way, updating your compiler is as simple as downloading
the new zip and unzipping it over your old install.



For a private install, just put your convenience scripts somewhere in your
home dir and add them to your path.

For a public install, make sure your download directory is world readable.


-- 
Adam D. Ruppe
http://arsdnet.net



More information about the Digitalmars-d mailing list