Mac OSX installer for dmd

Jacob Carlborg doob at me.com
Thu Aug 5 04:14:19 PDT 2010


On 2010-08-05 01:21, Michel Fortin wrote:
> On 2010-08-04 15:31:32 -0400, Walter Bright <newshound2 at digitalmars.com>
> said:
>
>> Michel Fortin wrote:
>>> As a side note, my D plugin for Xcode expects DMD to be available at
>>> /usr/local/bin/{dmd,dmd1,dmd2} and the runtime libraries should be in
>>> /usr/local/lib. It won't work if the files can't be found there,
>>> although I might change that if an official distribution of DMD
>>> installs itself elsewhere.
>>
>> To me, the biggest problem is deciding where the files should go.
>> There doesn't seem to be any consensus or culture in OS X about this.
>
> I agree. It took me quite a while to decide to do things as I did. The
> goals were:
>
> 1. It should be easy to manually replace DMD from a new package from
> Digital Mars.
> 2. It should work on the command line with no user intervention (no need
> to add something to $PATH in the bash profile for instance).
> 3. It should not mess with the system directories.
>
> Except when it come from third party package managers (fink, MacPorts),
> most Unix software not coming from Apple installs in /usr/local on Mac
> OS X (for instance I have: MySQL, Git, Mercurial, Doxygen, 7za and a
> couple others there). So it makes a lot of sense to install it there.
>
> To make manual replacement easy, I wanted to preserve the dmd and dmd2
> directories from the zip archive intact, so it's easy to swap them for
> another one. Initially, I decided to use /usr/local/dmd and
> /usr/local/dmd2, and add with symlinks in /usr/local/{bin,lib,man} to
> make everything work from the command line without changing $PATH.
>
> Symlinks didn't work quite well: dmd takes the value of args[0] to know
> which directory to search for dmd.conf. I guess I could have installed a
> dmd.conf in /etc/ to override that, but then how do you install dmd1 and
> dmd2 side by side? So what I did is replace the symlinks with a sort of
> trampoline program that adjusts the value of the args[0] for the path of
> the DMD just before calling exec(), allowing a different dmd.conf to be
> used for each one.
>
> And using /usr/local/{dmd,dmd2} wasn't entirely satisfactory either. Mac
> OS X hides the /usr folder when you browse using the Finder. So
> replacing /usr/local/{dmd,dmd2} manually with a newer one isn't as
> straightforward as it should be. I settled on using
> /Library/Compilers/{dmd,dmd2}. This isn't entirely satisfactory either
> since it doesn't follow UNIX ways, but it's not too far of how Mac OS X
> is packaged and I told myself it'd be easier to support users that way.
>
> Now, the only missing piece for an easy manual replacement of DMD is a
> zip archive where the executable bit is set.

I would vote for something like this, making it easy to have dmd and dm2 
installed side by side and to easily manually update the compiler to a 
newer version. I would name the trampoline programs dmd1 and dmd2 and 
then make a symlink named dmd pointing to dmd1 or dmd2.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list