summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2010-07-23 05:13:23 (GMT)
committerSteven Knight <knight@baldmt.com>2010-07-23 05:13:23 (GMT)
commit6edc938ac25bfbb9c6a0ae0cd539121ffb40f67f (patch)
tree9232be5dd8a10564b09ca4f12f769ba3814fb3e7
parent68ac24295c5783711065c0981408628d11813761 (diff)
downloadSCons-6edc938ac25bfbb9c6a0ae0cd539121ffb40f67f.zip
SCons-6edc938ac25bfbb9c6a0ae0cd539121ffb40f67f.tar.gz
SCons-6edc938ac25bfbb9c6a0ae0cd539121ffb40f67f.tar.bz2
Issue 2549: Add support for DMD version 2. (Russel Winder)
-rw-r--r--src/CHANGES.txt4
-rw-r--r--src/engine/SCons/Tool/dmd.py27
-rw-r--r--test/D/DMD.py3
3 files changed, 29 insertions, 5 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 1435756..a6e8848 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -74,6 +74,10 @@ RELEASE 2.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE
- Fixed the LaTeX scanner so dependencies are found in commands that
are broken across lines with a comment or have embedded spaces.
+ From Russel Winder:
+
+ - Add support for DMD version 2 (the phobos2 library).
+
RELEASE 2.0.0.beta.20100605 - Sat, 05 Jun 2010 21:02:48 -0700
From Dirk Baechle:
diff --git a/src/engine/SCons/Tool/dmd.py b/src/engine/SCons/Tool/dmd.py
index d7156dd..a8faf5d 100644
--- a/src/engine/SCons/Tool/dmd.py
+++ b/src/engine/SCons/Tool/dmd.py
@@ -6,6 +6,9 @@ Tool-specific initialization for the Digital Mars D compiler.
Coded by Andy Friesen (andy@ikagames.com)
15 November 2003
+Amended by Russel Winder (russel@russel.org.uk)
+2010-02-07
+
There are a number of problems with this script at this point in time.
The one that irritates me the most is the Windows linker setup. The D
linker doesn't have a way to add lib paths on the commandline, as far
@@ -199,11 +202,25 @@ def generate(env):
libs = env['LIBS']
except KeyError:
libs = []
- if 'phobos' not in libs and 'gphobos' not in libs:
- if dc is 'dmd':
- env.Append(LIBS = ['phobos'])
- elif dc is 'gdmd':
- env.Append(LIBS = ['gphobos'])
+ if dc == 'dmd':
+ # TODO: This assumes that the dmd executable is in the
+ # bin directory and that the libraries are in a peer
+ # directory lib. This true of the Digital Mars
+ # distribution but . . .
+ import glob
+ dHome = env.WhereIs(dc).replace('/dmd' , '/..')
+ if glob.glob(dHome + '/lib/*phobos2*'):
+ if 'phobos2' not in libs:
+ env.Append(LIBPATH = [dHome + '/lib'])
+ env.Append(LIBS = ['phobos2'])
+ # TODO: Find out when there will be a
+ # 64-bit version of D.
+ env.Append(LINKFLAGS = ['-m32'])
+ else:
+ if 'phobos' not in libs:
+ env.Append(LIBS = ['phobos'])
+ elif dc is 'gdmd':
+ env.Append(LIBS = ['gphobos'])
if 'pthread' not in libs:
env.Append(LIBS = ['pthread'])
if 'm' not in libs:
diff --git a/test/D/DMD.py b/test/D/DMD.py
index 497b6c5..1bde380 100644
--- a/test/D/DMD.py
+++ b/test/D/DMD.py
@@ -22,6 +22,8 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
+# Amended by Russel Winder <russel@russel.org.uk> 2010-05-05
+
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import TestSCons
@@ -41,6 +43,7 @@ env.Program('foo', 'foo.d')
""")
test.write('foo.d', """\
+import std.stdio;
int main(char[][] args) {
printf("Hello!\n");
return 0;