www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - DMD 1 & 2 coexisting

reply Jesse Phillips <jessekphillips gmail.com> writes:
The "OS X Installer" discussion found in "Reddit: why aren't people using 
D?" turned into a discussion about having DMD version 1 and 2 work 
together on the same system.

On Thu, 23 Jul 2009 12:13:47 -0700, Bill Baxter wrote:

 On versions of linux I think there are some fancy schemes for setting up
 symlinks to particular versions to be the default.  Can't recall what
 that system was called.  "Defaults" or something like it. Anyway, seems
 like on linux dmd should work with that rather than just going and
 changing the names of exes according to whim.
 
 --bb

Linux uses the program Alternatives. Since programs all exist in the same location, a program is named with its version and has a sym-link to the "active" version. I have come across only one issue in using this system, dmd.conf. DMD will look in /etc/ or the location of the executable. Since you can't use the same dmd.conf for both versions, because of phobos src, both a dmd and dmd.conf sym-link must be created and switched to change versions (I use a helper script instead of alternatives). It would be nice if you could specify a DFLAGS value for the different versions of dmd in the same file.
Jul 23 2009
next sibling parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
On Fri, Jul 24, 2009 at 02:31:31AM +0000, Jesse Phillips wrote:
 I have come across only one issue in using this system, dmd.conf. DMD 
 will look in /etc/ or the location of the executable. 

If you use my installation method - just plain unzip it, this isn't a problem. dmd will use the .conf file that it brought with it in the zip file. Then, you use a helper script somewhere in your PATH that is just two lines: #!/bin/bash /lib/ld-linux.so.2 /path/to/where/you/unzipped/dmd/dmd2/linux/bin/dmd $* You could potentially make that unzip path a variable of some sort for easy overriding. -- Adam D. Ruppe http://arsdnet.net
Jul 23 2009
parent Daniel Keep <daniel.keep.lists gmail.com> writes:
Adam D. Ruppe wrote:
 On Fri, Jul 24, 2009 at 02:31:31AM +0000, Jesse Phillips wrote:
 I have come across only one issue in using this system, dmd.conf. DMD 
 will look in /etc/ or the location of the executable. 

If you use my installation method - just plain unzip it, this isn't a problem. dmd will use the .conf file that it brought with it in the zip file. Then, you use a helper script somewhere in your PATH that is just two lines: #!/bin/bash /lib/ld-linux.so.2 /path/to/where/you/unzipped/dmd/dmd2/linux/bin/dmd $* You could potentially make that unzip path a variable of some sort for easy overriding.

I'm on Windows and I just have a folder that all my compilers go into, each with a unique name. I have a project that's locked at 1.027, Tango 0.99.8 with 1.035, Tango trunk and dir-reorg with 1.046 plus a smattering of D 2.x compilers.
Jul 23 2009
prev sibling next sibling parent Jesse Phillips <jessekphillips gmail.com> writes:
On Thu, 23 Jul 2009 22:51:36 -0400, Adam D. Ruppe wrote:

 On Fri, Jul 24, 2009 at 02:31:31AM +0000, Jesse Phillips wrote:
 I have come across only one issue in using this system, dmd.conf. DMD
 will look in /etc/ or the location of the executable.

If you use my installation method - just plain unzip it, this isn't a problem. dmd will use the .conf file that it brought with it in the zip file. Then, you use a helper script somewhere in your PATH that is just two lines: #!/bin/bash /lib/ld-linux.so.2 /path/to/where/you/unzipped/dmd/dmd2/linux/bin/dmd $* You could potentially make that unzip path a variable of some sort for easy overriding.

Yes, I realize this, but I don't want dmd in my home directory (I have root access!!) At which point the same method would just be applied by putting dmd into /opt I don't think the /lib/ld-linux.so.2 is needed either. As for why this is not an acceptable answer. DEBS/RPMS, general installation from a distro. These things should install in the same manner as everything else. In any case it isn't a big deal since it can be worked around.
Jul 23 2009
prev sibling next sibling parent "Adam D. Ruppe" <destructionator gmail.com> writes:
On Fri, Jul 24, 2009 at 02:57:52AM +0000, Jesse Phillips wrote:
 I don't think the /lib/ld-linux.so.2 is needed either.

It lets you skip the chmod +x dmd step, so it Just Works right out of the zip. Makes updating as simple as wget; unzip.
 These things should install in the same 
 manner as everything else. 

Even if everything else is overcomplicated and less flexible? If your package dropped the zip in /opt/dmd and made the magic script, the user would never know the difference, and it would be so simple to implement. -- Adam D. Ruppe http://arsdnet.net
Jul 23 2009
prev sibling parent Jesse Phillips <jessekphillips gmail.com> writes:
On Thu, 23 Jul 2009 23:24:00 -0400, Adam D. Ruppe wrote:

 Even if everything else is overcomplicated and less flexible?

Yes, even if everything else is overcomplicated and less flexible. There is a reason that Linux uses the file structure that it does, and it is a flexibility that you don't get with your method.
Jul 23 2009