www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Shipping the DMD compiler with code

reply "Colin Grogan" <grogan.colin gmail.com> writes:
I have a project I may need to write that is pretty performance 
intensive, but also needs to be quite customiseable.

We previously had this done with Perl, and the customising came 
from adding functions to a file and the main script would call 
those functions as required.
Problem is, the Perl program is performing very slowly.

Im thinking of doing this with D, and using string mixins to add 
in customised functions at compile time. All well and good I 
think.

However, I dont want to have the hassle of telling users to 
install a D compiler on their systems.
Ideally, the user should be able to unzip this tool and run it 
with rdmd.

Is it possible to ship the D compiler with the code, and not have 
to worry about any libs and config files being missing?

I'm specifically thinking about libphobos.a and dmd.conf, can 
they just be in the same folder as the D compiler or do they need 
to be in /usr/lib and /etc ?

Thanks folks!
Nov 01 2013
next sibling parent reply "bearophile" <bearophileHUGS lycos.com> writes:
Colin Grogan:

 Is it possible to ship the D compiler with the code, and not 
 have to worry about any libs and config files being missing?
I think you are not allowed to redistribute the DMD compiler. So you have to use GDC or LDC (where LDC = LDC2). Bye, bearophile
Nov 01 2013
parent reply Joseph Rushton Wakeling <joseph.wakeling webdrake.net> writes:
On 01/11/13 17:01, bearophile wrote:
 I think you are not allowed to redistribute the DMD compiler. So you have to
use
 GDC or LDC (where LDC = LDC2).
Many things are possible if you get permission from the right person ... :-) Depending on the use-case it may be preferable to ship GDC or LDC anyway, but if DMD is desired, ask Walter directly. The worst that can happen is he says no (and if he does, it'll most likely be because his hands are tied).
Nov 01 2013
parent "Colin Grogan" <grogan.colin gmail.com> writes:
On Friday, 1 November 2013 at 16:12:10 UTC, Joseph Rushton 
Wakeling wrote:
 On 01/11/13 17:01, bearophile wrote:
 I think you are not allowed to redistribute the DMD compiler. 
 So you have to use
 GDC or LDC (where LDC = LDC2).
Many things are possible if you get permission from the right person ... :-) Depending on the use-case it may be preferable to ship GDC or LDC anyway, but if DMD is desired, ask Walter directly. The worst that can happen is he says no (and if he does, it'll most likely be because his hands are tied).
Theres should be no issue in using gdc, and I wouldn't like to hassle Walter with that. He should be busy making fixing bugs in the new dmd release anyway! ;)
Nov 01 2013
prev sibling next sibling parent reply "John Colvin" <john.loughran.colvin gmail.com> writes:
On Friday, 1 November 2013 at 15:47:56 UTC, Colin Grogan wrote:
 I have a project I may need to write that is pretty performance 
 intensive, but also needs to be quite customiseable.

 We previously had this done with Perl, and the customising came 
 from adding functions to a file and the main script would call 
 those functions as required.
 Problem is, the Perl program is performing very slowly.

 Im thinking of doing this with D, and using string mixins to 
 add in customised functions at compile time. All well and good 
 I think.

 However, I dont want to have the hassle of telling users to 
 install a D compiler on their systems.
 Ideally, the user should be able to unzip this tool and run it 
 with rdmd.

 Is it possible to ship the D compiler with the code, and not 
 have to worry about any libs and config files being missing?

 I'm specifically thinking about libphobos.a and dmd.conf, can 
 they just be in the same folder as the D compiler or do they 
 need to be in /usr/lib and /etc ?

 Thanks folks!
dmd.conf can be in the same folder as the dmd executable. All the rest of the linking etc. is specified in dmd.conf so you just need to set that up appropriately. The legal side of things is a different matter. I quote from src/backendlicense.txt : "The Software is copyrighted and comes with a single user license, and may not be redistributed. If you wish to obtain a redistribution license, please contact Digital Mars." Walter may be able to grant redistribution rights if you ask him, IIRC this has happened before?? If not, you could just add a tiny downloader that grabs the zip file on the clients machine, which contains everything you need with no installation necessary.
Nov 01 2013
parent "Colin Grogan" <grogan.colin gmail.com> writes:
On Friday, 1 November 2013 at 17:07:48 UTC, John Colvin wrote:
 On Friday, 1 November 2013 at 15:47:56 UTC, Colin Grogan wrote:
 I have a project I may need to write that is pretty 
 performance intensive, but also needs to be quite 
 customiseable.

 We previously had this done with Perl, and the customising 
 came from adding functions to a file and the main script would 
 call those functions as required.
 Problem is, the Perl program is performing very slowly.

 Im thinking of doing this with D, and using string mixins to 
 add in customised functions at compile time. All well and good 
 I think.

 However, I dont want to have the hassle of telling users to 
 install a D compiler on their systems.
 Ideally, the user should be able to unzip this tool and run it 
 with rdmd.

 Is it possible to ship the D compiler with the code, and not 
 have to worry about any libs and config files being missing?

 I'm specifically thinking about libphobos.a and dmd.conf, can 
 they just be in the same folder as the D compiler or do they 
 need to be in /usr/lib and /etc ?

 Thanks folks!
dmd.conf can be in the same folder as the dmd executable. All the rest of the linking etc. is specified in dmd.conf so you just need to set that up appropriately. The legal side of things is a different matter. I quote from src/backendlicense.txt : "The Software is copyrighted and comes with a single user license, and may not be redistributed. If you wish to obtain a redistribution license, please contact Digital Mars." Walter may be able to grant redistribution rights if you ask him, IIRC this has happened before?? If not, you could just add a tiny downloader that grabs the zip file on the clients machine, which contains everything you need with no installation necessary.
Yeah, I guess I can put this in a script that will check everytime the program is run if dmd (or gdc etc) exists, and if not go and download it. Thanks for the info folks!
Nov 01 2013
prev sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2013-11-01 16:47, Colin Grogan wrote:
 I have a project I may need to write that is pretty performance
 intensive, but also needs to be quite customiseable.

 We previously had this done with Perl, and the customising came from
 adding functions to a file and the main script would call those
 functions as required.
 Problem is, the Perl program is performing very slowly.

 Im thinking of doing this with D, and using string mixins to add in
 customised functions at compile time. All well and good I think.

 However, I dont want to have the hassle of telling users to install a D
 compiler on their systems.
 Ideally, the user should be able to unzip this tool and run it with rdmd.

 Is it possible to ship the D compiler with the code, and not have to
 worry about any libs and config files being missing?
Due to license issue you're not allowed to distribute the DMD without permission from Walter, which he usually give. But perhaps you could tell the user to download the DMD zip themselves.
 I'm specifically thinking about libphobos.a and dmd.conf, can they just
 be in the same folder as the D compiler or do they need to be in
 /usr/lib and /etc ?
The DMD from the zip will work out of the box. No need to install anything. Just download and unpack the zip. You could also create a tool that downloads and unzip the compiler. Then you might want to take a look at DVM, which already does that: https://github.com/jacob-carlborg/dvm -- /Jacob Carlborg
Nov 02 2013
parent "Colin Grogan" <grogan.colin gmail.com> writes:
On Saturday, 2 November 2013 at 11:40:59 UTC, Jacob Carlborg 
wrote:
 On 2013-11-01 16:47, Colin Grogan wrote:
 I have a project I may need to write that is pretty performance
 intensive, but also needs to be quite customiseable.

 We previously had this done with Perl, and the customising 
 came from
 adding functions to a file and the main script would call those
 functions as required.
 Problem is, the Perl program is performing very slowly.

 Im thinking of doing this with D, and using string mixins to 
 add in
 customised functions at compile time. All well and good I 
 think.

 However, I dont want to have the hassle of telling users to 
 install a D
 compiler on their systems.
 Ideally, the user should be able to unzip this tool and run it 
 with rdmd.

 Is it possible to ship the D compiler with the code, and not 
 have to
 worry about any libs and config files being missing?
Due to license issue you're not allowed to distribute the DMD without permission from Walter, which he usually give. But perhaps you could tell the user to download the DMD zip themselves.
 I'm specifically thinking about libphobos.a and dmd.conf, can 
 they just
 be in the same folder as the D compiler or do they need to be 
 in
 /usr/lib and /etc ?
The DMD from the zip will work out of the box. No need to install anything. Just download and unpack the zip. You could also create a tool that downloads and unzip the compiler. Then you might want to take a look at DVM, which already does that: https://github.com/jacob-carlborg/dvm
Looks very useful, I'll look into it!
Nov 04 2013