www.digitalmars.com         C & C++   DMDScript  

D.gnu - DFLAGS and gdc

reply "John Colvin" <john.loughran.colvin gmail.com> writes:
Does gdc have an equivalent to the DFLAGS environment variable?
Jul 08 2014
next sibling parent "Iain Buclaw via D.gnu" <d.gnu puremagic.com> writes:
On 8 July 2014 16:46, John Colvin via D.gnu <d.gnu puremagic.com> wrote:
 Does gdc have an equivalent to the DFLAGS environment variable?
My stance at the moment is that DFLAGS should be recognised by the build tool, not the compiler. Regards Iain.
Jul 08 2014
prev sibling parent reply "Joseph Rushton Wakeling via D.gnu" <d.gnu puremagic.com> writes:
On 08/07/14 17:58, Iain Buclaw via D.gnu wrote:
 My stance at the moment is that DFLAGS should be recognised by the
 build tool, not the compiler.
I wonder if John's specific concern may be to do with how dmd uses the DFLAGS environment variable to specify the standard import and library paths. Is there an equivalent for gdc, or does it simply assume that imports and libraries will be in well-defined locations relative to where the executable is located?
Jul 10 2014
next sibling parent Johannes Pfau <nospam example.com> writes:
Am Fri, 11 Jul 2014 00:49:48 +0200
schrieb "Joseph Rushton Wakeling via D.gnu" <d.gnu puremagic.com>:

 On 08/07/14 17:58, Iain Buclaw via D.gnu wrote:
 My stance at the moment is that DFLAGS should be recognised by the
 build tool, not the compiler.
I wonder if John's specific concern may be to do with how dmd uses the DFLAGS environment variable to specify the standard import and library paths. Is there an equivalent for gdc, or does it simply assume that imports and libraries will be in well-defined locations relative to where the executable is located?
Yes, gdc searchs these files in some standard search paths (the exact details depend on whether you used a sysroot, the --prefix configure option and a few more things). You could implement a DFLAGS like variable with a little known GCC feature, spec files (spec files can read env variables, IIRC): https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/Spec-Files.html But if you only want to set import paths, we have a D_IMPORT_PATH env variable: https://github.com/D-Programming-GDC/GDC/blob/master/gcc/d/d-incpath.cc#L208
Jul 10 2014
prev sibling parent "Timo Sintonen" <t.sintonen luukku.com> writes:
On Thursday, 10 July 2014 at 23:54:08 UTC, Joseph Rushton 
Wakeling via D.gnu wrote:
 On 08/07/14 17:58, Iain Buclaw via D.gnu wrote:
 My stance at the moment is that DFLAGS should be recognised by 
 the
 build tool, not the compiler.
I wonder if John's specific concern may be to do with how dmd uses the DFLAGS environment variable to specify the standard import and library paths. Is there an equivalent for gdc, or does it simply assume that imports and libraries will be in well-defined locations relative to where the executable is located?
As an ordinary user I might say that the basic idea is a little different. Dmd is more a standalone tool. All options, files, libs etc are passed to it at the same time. Gdc and other gcc tools are more like parts in a toolchain. It is not meant to call them directly. It is the job of a build system like make to parse the environment. When using gcc it is common to compile each file separately and then link all of them together. This is a make rule I have been using to compile a d file: $(dobjects): %.o: %.d $(deps) $(gccprefix)$(gdc) -c $(dflags) $(flags) $(includes) $< -o $ I think that if libraries are installed to standard place, they are found automatically. A special feature of D language is that full library sources have to be available for imports. I do not know where they are located in different distros but it may be necessary always to give gdc the correct path for imports.
Jul 10 2014