summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/engine/SCons/Tool/dmd.py18
-rw-r--r--src/engine/SCons/Tool/dmd.xml14
-rw-r--r--src/engine/SCons/Tool/gdc.py16
-rw-r--r--src/engine/SCons/Tool/gdc.xml144
-rw-r--r--src/engine/SCons/Tool/ldc.py16
-rw-r--r--src/engine/SCons/Tool/ldc.xml144
-rw-r--r--test/D/SharedObjects/Common/common.py22
-rw-r--r--test/D/SharedObjects/Image/SConstruct_template3
8 files changed, 331 insertions, 46 deletions
diff --git a/src/engine/SCons/Tool/dmd.py b/src/engine/SCons/Tool/dmd.py
index 7c142eb..6a64a72 100644
--- a/src/engine/SCons/Tool/dmd.py
+++ b/src/engine/SCons/Tool/dmd.py
@@ -107,9 +107,9 @@ def generate(env):
env['DLINKFLAGS'] = SCons.Util.CLVar('')
env['DLINKCOM'] = '$DLINK -of$TARGET $DLINKFLAGS $__DRPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS'
- env['DSHLINK'] = '$DC'
- env['DSHLINKFLAGS'] = SCons.Util.CLVar('$DLINKFLAGS -shared -defaultlib=libphobos2.so')
- env['SHDLINKCOM'] = '$DLINK -of$TARGET $DSHLINKFLAGS $__DSHLIBVERSIONFLAGS $__DRPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS'
+ env['SHDLINK'] = '$DC'
+ env['SHDLINKFLAGS'] = SCons.Util.CLVar('$DLINKFLAGS -shared -defaultlib=libphobos2.so')
+ env['SHDLINKCOM'] = '$DLINK -of$TARGET $SHDLINKFLAGS $__SHDLIBVERSIONFLAGS $__DRPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS'
env['DLIBLINKPREFIX'] = '' if env['PLATFORM'] == 'win32' else '-L-l'
env['DLIBLINKSUFFIX'] = '.lib' if env['PLATFORM'] == 'win32' else ''
@@ -134,15 +134,15 @@ def generate(env):
env['_DRPATH'] = '${_concat(DRPATHPREFIX, RPATH, DRPATHSUFFIX, __env__)}'
# Support for versioned libraries
- env['_DSHLIBVERSIONFLAGS'] = '$DSHLIBVERSIONFLAGS -L-soname=$_DSHLIBSONAME'
- env['_DSHLIBSONAME'] = '${DShLibSonameGenerator(__env__,TARGET)}'
+ env['_SHDLIBVERSIONFLAGS'] = '$SHDLIBVERSIONFLAGS -L-soname=$_SHDLIBSONAME'
+ env['_SHDLIBSONAME'] = '${DShLibSonameGenerator(__env__,TARGET)}'
# NOTE: this is a quick hack, the soname will only work if there is
# c/c++ linker loaded which provides callback for the ShLibSonameGenerator
env['DShLibSonameGenerator'] = SCons.Tool.ShLibSonameGenerator
- # NOTE: this is only for further reference, currently $DSHLIBVERSION does
+ # NOTE: this is only for further reference, currently $SHDLIBVERSION does
# not work, the user must use $SHLIBVERSION
- env['DSHLIBVERSION'] = '$SHLIBVERSION'
- env['DSHLIBVERSIONFLAGS'] = []
+ env['SHDLIBVERSION'] = '$SHLIBVERSION'
+ env['SHDLIBVERSIONFLAGS'] = []
env['BUILDERS']['ProgramAllAtOnce'] = SCons.Builder.Builder(
action='$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -of$TARGET $DLINKFLAGS $__DRPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS',
@@ -151,7 +151,7 @@ def generate(env):
def exists(env):
- return env.Detect(['dmd', 'gdmd'])
+ return env.Detect(['dmd', 'ldmd2', 'gdmd'])
# Local Variables:
diff --git a/src/engine/SCons/Tool/dmd.xml b/src/engine/SCons/Tool/dmd.xml
index 8fb22ce..7e220dc 100644
--- a/src/engine/SCons/Tool/dmd.xml
+++ b/src/engine/SCons/Tool/dmd.xml
@@ -63,8 +63,11 @@ Sets construction variables for D language compiler DMD.
<item>DLIBFLAGSUFFIX</item>
<item>DLINKFLAGPREFIX</item>
<item>DLINKFLAGSUFFIX</item>
-<item>RPATHPREFIX</item>
-<item>RPATHSUFFIX</item>
+<item>DRPATHPREFIX</item>
+<item>DRPATHSUFFIX</item>
+<item>DShLibSonameGenerator</item>
+<item>SHDLIBVERSION</item>
+<item>SHDLIBVERSIONFLAGS</item>
</sets>
<uses>
</uses>
@@ -160,8 +163,6 @@ List of linker flags.
</summary>
</cvar>
-
-
<cvar name="SHDC">
<summary>
<para>
@@ -204,7 +205,6 @@ List of linker flags.
</summary>
</cvar>
-<!-- The following are re-added because their removal breaks doc validation -->
<cvar name="DVERSUFFIX">
<summary>
<para>
@@ -342,10 +342,6 @@ List of linker flags.
</summary>
</cvar>
-
-<!-- Validation fix to here -->
-
-
<builder name="ProgramAllAtOnce">
<summary>
<para>
diff --git a/src/engine/SCons/Tool/gdc.py b/src/engine/SCons/Tool/gdc.py
index a8e037c..0c6a8ab 100644
--- a/src/engine/SCons/Tool/gdc.py
+++ b/src/engine/SCons/Tool/gdc.py
@@ -97,9 +97,9 @@ def generate(env):
env['DLINKFLAGS'] = SCons.Util.CLVar('')
env['DLINKCOM'] = '$DLINK -o $TARGET $DLINKFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS'
- env['DSHLINK'] = '$DC'
- env['DSHLINKFLAGS'] = SCons.Util.CLVar('$DLINKFLAGS -shared -shared-libphobos')
- env['SHDLINKCOM'] = '$DLINK -o $TARGET $DSHLINKFLAGS $__DSHLIBVERSIONFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS'
+ env['SHDLINK'] = '$DC'
+ env['SHDLINKFLAGS'] = SCons.Util.CLVar('$DLINKFLAGS -shared -shared-libphobos')
+ env['SHDLINKCOM'] = '$DLINK -o $TARGET $SHDLINKFLAGS $__SHDLIBVERSIONFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS'
env['DLIB'] = 'lib' if env['PLATFORM'] == 'win32' else 'ar cr'
env['DLIBCOM'] = '$DLIB $_DLIBFLAGS {0}$TARGET $SOURCES $_DLINKLIBFLAGS'.format('-c ' if env['PLATFORM'] == 'win32' else '')
@@ -118,15 +118,15 @@ def generate(env):
env['_RPATH'] = '${_concat(RPATHPREFIX, RPATH, RPATHSUFFIX, __env__)}'
# Support for versioned libraries
- env['_DSHLIBVERSIONFLAGS'] = '$DSHLIBVERSIONFLAGS -Wl,-soname=$_DSHLIBSONAME'
- env['_DSHLIBSONAME'] = '${DShLibSonameGenerator(__env__,TARGET)}'
+ env['_SHDLIBVERSIONFLAGS'] = '$SHDLIBVERSIONFLAGS -Wl,-soname=$_SHDLIBSONAME'
+ env['_SHDLIBSONAME'] = '${DShLibSonameGenerator(__env__,TARGET)}'
# NOTE: this is a quick hack, the soname will only work if there is
# c/c++ linker loaded which provides callback for the ShLibSonameGenerator
env['DShLibSonameGenerator'] = SCons.Tool.ShLibSonameGenerator
- # NOTE: this is only for further reference, currently $DSHLIBVERSION does
+ # NOTE: this is only for further reference, currently $SHDLIBVERSION does
# not work, the user must use $SHLIBVERSION
- env['DSHLIBVERSION'] = '$SHLIBVERSION'
- env['DSHLIBVERSIONFLAGS'] = '$SHLIBVERSIONFLAGS'
+ env['SHDLIBVERSION'] = '$SHLIBVERSION'
+ env['SHDLIBVERSIONFLAGS'] = '$SHLIBVERSIONFLAGS'
env['BUILDERS']['ProgramAllAtOnce'] = SCons.Builder.Builder(
action='$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -o $TARGET $DLINKFLAGS $__DRPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS',
diff --git a/src/engine/SCons/Tool/gdc.xml b/src/engine/SCons/Tool/gdc.xml
index 5ef1f9a..d44489e 100644
--- a/src/engine/SCons/Tool/gdc.xml
+++ b/src/engine/SCons/Tool/gdc.xml
@@ -63,8 +63,11 @@ Sets construction variables for the D language compiler GDC.
<item>DLIBFLAGSUFFIX</item>
<item>DLINKFLAGPREFIX</item>
<item>DLINKFLAGSUFFIX</item>
-<item>RPATHPREFIX</item>
-<item>RPATHSUFFIX</item>
+<item>DRPATHPREFIX</item>
+<item>DRPATHSUFFIX</item>
+<item>DShLibSonameGenerator</item>
+<item>SHDLIBVERSION</item>
+<item>SHDLIBVERSIONFLAGS</item>
</sets>
<uses>
</uses>
@@ -202,6 +205,143 @@ List of linker flags.
</summary>
</cvar>
+<cvar name="DVERSUFFIX">
+ <summary>
+ <para>
+ DVERSUFFIX.
+ </para>
+ </summary>
+</cvar>
+
+<cvar name="DVERPREFIX">
+ <summary>
+ <para>
+ DVERPREFIX.
+ </para>
+ </summary>
+</cvar>
+
+<cvar name="DLINKFLAGSUFFIX">
+ <summary>
+ <para>
+ DLINKFLAGSUFFIX.
+ </para>
+ </summary>
+</cvar>
+
+<cvar name="DLINKFLAGPREFIX">
+ <summary>
+ <para>
+ DLINKFLAGPREFIX.
+ </para>
+ </summary>
+</cvar>
+
+<cvar name="DLIBLINKSUFFIX">
+ <summary>
+ <para>
+ DLIBLINKSUFFIX.
+ </para>
+ </summary>
+</cvar>
+
+<cvar name="DLIBLINKPREFIX">
+ <summary>
+ <para>
+ DLIBLINKPREFIX.
+ </para>
+ </summary>
+</cvar>
+
+<cvar name="DLIBFLAGSUFFIX">
+ <summary>
+ <para>
+ DLIBFLAGSUFFIX.
+ </para>
+ </summary>
+</cvar>
+
+<cvar name="DLIBFLAGPREFIX">
+ <summary>
+ <para>
+ DLIBFLAGPREFIX.
+ </para>
+ </summary>
+</cvar>
+
+<cvar name="DLIBDIRSUFFIX">
+ <summary>
+ <para>
+ DLIBLINKSUFFIX.
+ </para>
+ </summary>
+</cvar>
+
+<cvar name="DLIBDIRPREFIX">
+ <summary>
+ <para>
+ DLIBLINKPREFIX.
+ </para>
+ </summary>
+</cvar>
+
+<cvar name="DINCSUFFIX">
+ <summary>
+ <para>
+ DLIBFLAGSUFFIX.
+ </para>
+ </summary>
+</cvar>
+
+
+<cvar name="DINCPREFIX">
+ <summary>
+ <para>
+ DINCPREFIX.
+ </para>
+ </summary>
+</cvar>
+
+<cvar name="DFLAGSUFFIX">
+ <summary>
+ <para>
+ DFLAGSUFFIX.
+ </para>
+ </summary>
+</cvar>
+
+<cvar name="DFLAGPREFIX">
+ <summary>
+ <para>
+ DFLAGPREFIX.
+ </para>
+ </summary>
+</cvar>
+
+<cvar name="DFILESUFFIX">
+ <summary>
+ <para>
+ DFILESUFFIX.
+ </para>
+ </summary>
+</cvar>
+
+<cvar name="DDEBUGPREFIX">
+ <summary>
+ <para>
+ DDEBUGPREFIX.
+ </para>
+ </summary>
+</cvar>
+
+<cvar name="DDEBUGSUFFIX">
+ <summary>
+ <para>
+ DDEBUGSUFFIX.
+ </para>
+ </summary>
+</cvar>
+
<builder name="ProgramAllAtOnce">
<summary>
<para>
diff --git a/src/engine/SCons/Tool/ldc.py b/src/engine/SCons/Tool/ldc.py
index b10bb75..3e12199 100644
--- a/src/engine/SCons/Tool/ldc.py
+++ b/src/engine/SCons/Tool/ldc.py
@@ -102,10 +102,10 @@ def generate(env):
env['DLINKFLAGS'] = SCons.Util.CLVar('')
env['DLINKCOM'] = '$DLINK -of=$TARGET $DLINKFLAGS $__DRPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS'
- env['DSHLINK'] = '$DC'
- env['DSHLINKFLAGS'] = SCons.Util.CLVar('$DLINKFLAGS -shared -defaultlib=phobos2-ldc')
+ env['SHDLINK'] = '$DC'
+ env['SHDLINKFLAGS'] = SCons.Util.CLVar('$DLINKFLAGS -shared -defaultlib=phobos2-ldc')
- env['SHDLINKCOM'] = '$DLINK -of=$TARGET $DSHLINKFLAGS $__DSHLIBVERSIONFLAGS $__DRPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS -L-ldruntime-ldc'
+ env['SHDLINKCOM'] = '$DLINK -of=$TARGET $SHDLINKFLAGS $__SHDLIBVERSIONFLAGS $__DRPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS -L-ldruntime-ldc'
env['DLIBLINKPREFIX'] = '' if env['PLATFORM'] == 'win32' else '-L-l'
env['DLIBLINKSUFFIX'] = '.lib' if env['PLATFORM'] == 'win32' else ''
@@ -131,15 +131,15 @@ def generate(env):
env['_DRPATH'] = '${_concat(DRPATHPREFIX, RPATH, DRPATHSUFFIX, __env__)}'
# Support for versioned libraries
- env['_DSHLIBVERSIONFLAGS'] = '$DSHLIBVERSIONFLAGS -L-soname=$_DSHLIBSONAME'
- env['_DSHLIBSONAME'] = '${DShLibSonameGenerator(__env__,TARGET)}'
+ env['_SHDLIBVERSIONFLAGS'] = '$SHDLIBVERSIONFLAGS -L-soname=$_SHDLIBSONAME'
+ env['_SHDLIBSONAME'] = '${DShLibSonameGenerator(__env__,TARGET)}'
# NOTE: this is a quick hack, the soname will only work if there is
# c/c++ linker loaded which provides callback for the ShLibSonameGenerator
env['DShLibSonameGenerator'] = SCons.Tool.ShLibSonameGenerator
- # NOTE: this is only for further reference, currently $DSHLIBVERSION does
+ # NOTE: this is only for further reference, currently $SHDLIBVERSION does
# not work, the user must use $SHLIBVERSION
- env['DSHLIBVERSION'] = '$SHLIBVERSION'
- env['DSHLIBVERSIONFLAGS'] = []
+ env['SHDLIBVERSION'] = '$SHLIBVERSION'
+ env['SHDLIBVERSIONFLAGS'] = []
env['BUILDERS']['ProgramAllAtOnce'] = SCons.Builder.Builder(
action='$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -of=$TARGET $DLINKFLAGS $__DRPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS',
diff --git a/src/engine/SCons/Tool/ldc.xml b/src/engine/SCons/Tool/ldc.xml
index 9593f41..495b8bc 100644
--- a/src/engine/SCons/Tool/ldc.xml
+++ b/src/engine/SCons/Tool/ldc.xml
@@ -63,8 +63,11 @@ Sets construction variables for the D language compiler LDC2.
<item>DLIBFLAGSUFFIX</item>
<item>DLINKFLAGPREFIX</item>
<item>DLINKFLAGSUFFIX</item>
-<item>RPATHPREFIX</item>
-<item>RPATHSUFFIX</item>
+<item>DRPATHPREFIX</item>
+<item>DRPATHSUFFIX</item>
+<item>DShLibSonameGenerator</item>
+<item>SHDLIBVERSION</item>
+<item>SHDLIBVERSIONFLAGS</item>
</sets>
<uses>
</uses>
@@ -202,6 +205,143 @@ List of linker flags.
</summary>
</cvar>
+<cvar name="DVERSUFFIX">
+ <summary>
+ <para>
+ DVERSUFFIX.
+ </para>
+ </summary>
+</cvar>
+
+<cvar name="DVERPREFIX">
+ <summary>
+ <para>
+ DVERPREFIX.
+ </para>
+ </summary>
+</cvar>
+
+<cvar name="DLINKFLAGSUFFIX">
+ <summary>
+ <para>
+ DLINKFLAGSUFFIX.
+ </para>
+ </summary>
+</cvar>
+
+<cvar name="DLINKFLAGPREFIX">
+ <summary>
+ <para>
+ DLINKFLAGPREFIX.
+ </para>
+ </summary>
+</cvar>
+
+<cvar name="DLIBLINKSUFFIX">
+ <summary>
+ <para>
+ DLIBLINKSUFFIX.
+ </para>
+ </summary>
+</cvar>
+
+<cvar name="DLIBLINKPREFIX">
+ <summary>
+ <para>
+ DLIBLINKPREFIX.
+ </para>
+ </summary>
+</cvar>
+
+<cvar name="DLIBFLAGSUFFIX">
+ <summary>
+ <para>
+ DLIBFLAGSUFFIX.
+ </para>
+ </summary>
+</cvar>
+
+<cvar name="DLIBFLAGPREFIX">
+ <summary>
+ <para>
+ DLIBFLAGPREFIX.
+ </para>
+ </summary>
+</cvar>
+
+<cvar name="DLIBDIRSUFFIX">
+ <summary>
+ <para>
+ DLIBLINKSUFFIX.
+ </para>
+ </summary>
+</cvar>
+
+<cvar name="DLIBDIRPREFIX">
+ <summary>
+ <para>
+ DLIBLINKPREFIX.
+ </para>
+ </summary>
+</cvar>
+
+<cvar name="DINCSUFFIX">
+ <summary>
+ <para>
+ DLIBFLAGSUFFIX.
+ </para>
+ </summary>
+</cvar>
+
+
+<cvar name="DINCPREFIX">
+ <summary>
+ <para>
+ DINCPREFIX.
+ </para>
+ </summary>
+</cvar>
+
+<cvar name="DFLAGSUFFIX">
+ <summary>
+ <para>
+ DFLAGSUFFIX.
+ </para>
+ </summary>
+</cvar>
+
+<cvar name="DFLAGPREFIX">
+ <summary>
+ <para>
+ DFLAGPREFIX.
+ </para>
+ </summary>
+</cvar>
+
+<cvar name="DFILESUFFIX">
+ <summary>
+ <para>
+ DFILESUFFIX.
+ </para>
+ </summary>
+</cvar>
+
+<cvar name="DDEBUGPREFIX">
+ <summary>
+ <para>
+ DDEBUGPREFIX.
+ </para>
+ </summary>
+</cvar>
+
+<cvar name="DDEBUGSUFFIX">
+ <summary>
+ <para>
+ DDEBUGSUFFIX.
+ </para>
+ </summary>
+</cvar>
+
<builder name="ProgramAllAtOnce">
<summary>
<para>
diff --git a/test/D/SharedObjects/Common/common.py b/test/D/SharedObjects/Common/common.py
index a46ea7e..bae376d 100644
--- a/test/D/SharedObjects/Common/common.py
+++ b/test/D/SharedObjects/Common/common.py
@@ -56,16 +56,22 @@ def testForTool(tool):
if tool == 'dmd' and Base()['DC'] == 'gdmd':
test.skip_test('gdmd does not recognize the -shared option so cannot support linking of shared objects.\n')
+ code_root = 'code'
+ library_root = 'answer'
+
platform = Base()['PLATFORM']
if platform == 'posix':
- filename = 'code.o'
- libraryname = 'libanswer.so'
+ code_name = code_root + '.o'
+ library_name = 'lib' + library_root + '.so'
elif platform == 'darwin':
- filename = 'code.o'
- libraryname = 'libanswer.dylib'
+ code_name = code_root + '.o'
+ library_name = 'lib' + library_root + '.dylib'
+ # As at 2017-08-22, DMD 2.075.1, LDC 1.2.0 (D 2.072.2), and GDC 7.2.0 (D 2.068.2)
+ # it is not clear if shared libraries are supported on macOS.
+ # test.skip_test('Dynamic libraries not yet supported on macOS.\n')
elif platform == 'win32':
- filename = 'code.obj'
- libraryname = 'answer.dll'
+ code_name = code_root + '.obj'
+ library_name = library_root + '.dll'
else:
test.fail_test()
@@ -79,8 +85,8 @@ def testForTool(tool):
else:
test.run()
- test.must_exist(test.workpath(filename))
- test.must_exist(test.workpath(libraryname))
+ test.must_exist(test.workpath(code_name))
+ test.must_exist(test.workpath(library_name))
test.pass_test()
diff --git a/test/D/SharedObjects/Image/SConstruct_template b/test/D/SharedObjects/Image/SConstruct_template
index d263e63..f731a33 100644
--- a/test/D/SharedObjects/Image/SConstruct_template
+++ b/test/D/SharedObjects/Image/SConstruct_template
@@ -1,5 +1,8 @@
# -*- mode:python; coding:utf-8; -*-
+# The core difference between this test and the one of SharedObjectSuffixIssue
+# is that here we explicitly use the relevant D tool and things work.
+
environment = Environment(
tools=['{0}', 'link']
)