OS X Installer
Sergey Gromov
snake.scaly at gmail.com
Sat Aug 1 17:15:41 PDT 2009
Sat, 1 Aug 2009 07:55:08 -0400, Michel Fortin wrote:
> 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.
Here's a nice document about directory layout in UNIX-like OSes:
http://www.pathname.com/fhs/pub/fhs-2.3.html
I think MacOS should follow this layout at least in part. In particular
/usr/local/ is used for locally installed packages which otherwise
respect the standard directory structure found in / or /usr/. That is,
binaries go into /usr/local/bin/, libraries in /usr/local/lib/ etc. If
a package wants to keep its own structure it's supposted to go into
/opt/, like /opt/dmd2/whatever.
More information about the Digitalmars-d
mailing list