summaryrefslogtreecommitdiff
path: root/engine/SCons/Tool/dmd.py
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2017-10-03 06:25:00 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2017-10-03 06:25:00 +0200
commitd4ed069896a9d49eb33966a0f871e39b5c24da8a (patch)
tree1c923e288e1641b8a08a71891e3ee5ea1e4dfde5 /engine/SCons/Tool/dmd.py
parent3765e33b76c51c81dd7bbbfacab0c4e76a1713cb (diff)
parent13e92f02338ad8d28d58fcd7c9f46d0d5e970e54 (diff)
Merge branch 'release/3.0.0-1'3.0.0-1
Diffstat (limited to 'engine/SCons/Tool/dmd.py')
-rw-r--r--engine/SCons/Tool/dmd.py48
1 files changed, 23 insertions, 25 deletions
diff --git a/engine/SCons/Tool/dmd.py b/engine/SCons/Tool/dmd.py
index aaacd47..1dfb5d7 100644
--- a/engine/SCons/Tool/dmd.py
+++ b/engine/SCons/Tool/dmd.py
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
"""SCons.Tool.dmd
Tool-specific initialization for the Digital Mars D compiler.
@@ -9,13 +11,6 @@ Originally coded by Andy Friesen (andy@ikagames.com)
Evolved by Russel Winder (russel@winder.org.uk)
2010-02-07 onwards
-There are a number of problems with this script at this point in time.
-The one that irritates the most is the Windows linker setup. The D
-linker doesn't have a way to add lib paths on the commandline, as far
-as I can see. You have to specify paths relative to the SConscript or
-use absolute paths. To hack around it, add '#/blah'. This will link
-blah.lib from the directory where SConstruct resides.
-
Compiler variables:
DC - The name of the D compiler to use. Defaults to dmd or gdmd,
whichever is found.
@@ -36,7 +31,7 @@ Lib tool variables:
"""
#
-# Copyright (c) 2001 - 2016 The SCons Foundation
+# Copyright (c) 2001 - 2017 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -58,7 +53,7 @@ Lib tool variables:
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/dmd.py rel_2.5.1:3735:9dc6cee5c168 2016/11/03 14:02:02 bdbaddog"
+__revision__ = "src/engine/SCons/Tool/dmd.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
import os
import subprocess
@@ -69,7 +64,7 @@ import SCons.Defaults
import SCons.Scanner.D
import SCons.Tool
-import SCons.Tool.DCommon
+import SCons.Tool.DCommon as DCommon
def generate(env):
@@ -80,7 +75,7 @@ def generate(env):
static_obj.add_emitter('.d', SCons.Defaults.StaticObjectEmitter)
shared_obj.add_emitter('.d', SCons.Defaults.SharedObjectEmitter)
- env['DC'] = env.Detect(['dmd', 'gdmd'])
+ env['DC'] = env.Detect(['dmd', 'ldmd2', 'gdmd']) or 'dmd'
env['DCOM'] = '$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -c -of$TARGET $SOURCES'
env['_DINCFLAGS'] = '${_concat(DINCPREFIX, DPATH, DINCSUFFIX, __env__, RDirs, TARGET, SOURCE)}'
env['_DVERFLAGS'] = '${_concat(DVERPREFIX, DVERSIONS, DVERSUFFIX, __env__)}'
@@ -96,7 +91,7 @@ def generate(env):
env['DDEBUG'] = []
if env['DC']:
- SCons.Tool.DCommon.addDPATHToEnv(env, env['DC'])
+ DCommon.addDPATHToEnv(env, env['DC'])
env['DINCPREFIX'] = '-I'
env['DINCSUFFIX'] = ''
@@ -112,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 ''
@@ -124,37 +119,40 @@ def generate(env):
env['DLIBDIRSUFFIX'] = ''
env['_DLIBDIRFLAGS'] = '${_concat(DLIBDIRPREFIX, LIBPATH, DLIBDIRSUFFIX, __env__, RDirs, TARGET, SOURCE)}'
-
env['DLIB'] = 'lib' if env['PLATFORM'] == 'win32' else 'ar cr'
env['DLIBCOM'] = '$DLIB $_DLIBFLAGS {0}$TARGET $SOURCES $_DLIBFLAGS'.format('-c ' if env['PLATFORM'] == 'win32' else '')
- #env['_DLIBFLAGS'] = '${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)}'
+ # env['_DLIBFLAGS'] = '${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)}'
env['DLIBFLAGPREFIX'] = '-'
env['DLIBFLAGSUFFIX'] = ''
# __RPATH is set to $_RPATH in the platform specification if that
# platform supports it.
- env['DRPATHPREFIX'] = '-L-rpath='
+ env['DRPATHPREFIX'] = '-L-rpath,' if env['PLATFORM'] == 'darwin' else '-L-rpath='
env['DRPATHSUFFIX'] = ''
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'] = []
- SCons.Tool.createStaticLibBuilder(env)
+ env['BUILDERS']['ProgramAllAtOnce'] = SCons.Builder.Builder(
+ action='$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -of$TARGET $DLINKFLAGS $__DRPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS',
+ emitter=DCommon.allAtOnceEmitter,
+ )
def exists(env):
- return env.Detect(['dmd', 'gdmd'])
+ return env.Detect(['dmd', 'ldmd2', 'gdmd'])
+
# Local Variables:
# tab-width:4