OS X Installer

Michel Fortin michel.fortin at michelf.com
Sat Aug 1 04:55:08 PDT 2009


On 2009-08-01 04:41:38 -0400, Anders F Björklund <afb at algonet.se> said:

> Jacob Carlborg wrote:
> 
>>> Speaking of that OS X DMD installer, are you sure installing it at
>>> /usr/share/dmd/ is a good idea? [...]
>> I looked at a gdc installer and looked where it placed the compiler and 
>> did the same. I don't know where it's best to place the compiler.
> 
> You can use /opt/dmd and /opt/dmd2, if you don't
> want to use the regular file hierarchy in hier(7)
> 
> DMD = /opt/dmd2/osx/bin/dmd
> 
> Or you can use e.g. /usr/local/bin and rename to
> dmd2 and dmd2.conf (which takes some trickery...)
> 
> DMD = dmd2

In hier(7), it says that "/usr/local" is for "executables, libraries, 
etc. not included by the basic operating system", so I guess DMD fits 
this quite well.

I'm preparing an installer for D for Xcode and made it install DMD at 
/usr/local/dmd and /usr/local/dmd2, with symlinks at /usr/local/bin/dmd 
(system-prefered version) /usr/local/bin/dmd1 (1.x) and 
/usr/local/bin/dmd2 (2.x). This makes it easy to choose the version you 
want within Xcode.

For some reasons, the symlinks works fine with Xcode. But they aren't 
working from the command line (dmd complains that it can't find 
object.o). I've made a small C program to replace the symlink:

	#include <unistd.h>

	int main(unsigned int argc, char **argv) {
		argv[0] = "/usr/local/dmd/osx/bin/dmd";
		execv("/usr/local/dmd/osx/bin/dmd", argv);
	}

No more problem from the command line.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list