Installing dmd

Georg Wrede georg.wrede at iki.fi
Sun Mar 1 08:56:50 PST 2009


Adam D. Ruppe wrote:
> 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.

That's a neat one!!!

> 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.

Ever since stone age, one's PATH contains ~/bin for one's own binaries. 
I believe this is with all Linux distros, and IIRC on Solaris. Probably 
on OSX too. The ~/bin isn't created for you, but that's the canonical 
place for the small dmd invocators.

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

I was just trying to figure out what the INSTALL.TXT should say about 
that. Somehow /usr/local/bin would seem the right place, but it doesn't 
usually contain other than executables, and certainly not subdirectories.

So looks like the dmd tree has to be put somewhere else.

OTOH, http://www.faqs.org/docs/linux_admin/x542.html says that no distro 
is allowed to put anything here because it is reserved for stuff the 
local admin wants to install. Now, D being a "manual install" thing, it 
rightfully could reside here.

Only problem is that subdirectories of /usr/local/bin aren't in the 
path, so one would have to create here the starter scripts you've done.

Any ideas?



More information about the Digitalmars-d mailing list