[rtems-tools commit] Fix Windows build issues.

Chris Johns chrisj at rtems.org
Sun Oct 18 22:15:29 UTC 2015


Module:    rtems-tools
Branch:    master
Commit:    0382b6863be01ad365d7ae272b61cfef4870f631
Changeset: http://git.rtems.org/rtems-tools/commit/?id=0382b6863be01ad365d7ae272b61cfef4870f631

Author:    Chris Johns <chrisj at rtems.org>
Date:      Sun Oct 18 19:19:08 2015 +1100

Fix Windows build issues.

Fix biulding the mmap Windows code.
Fix installing the files for Windows.

---

 linkers/wscript                               | 30 +++++++++++++++++++
 rtemstoolkit/elftoolchain/libelf/mmap_win32.c |  3 +-
 rtemstoolkit/wscript                          | 42 +++++++++++++++++++++------
 tester/rt/console.py                          | 28 +++++++++++++-----
 tester/rt/gdb.py                              |  1 -
 tester/rtems-test                             |  3 +-
 tester/wscript                                |  4 +--
 wscript                                       |  2 +-
 8 files changed, 90 insertions(+), 23 deletions(-)

diff --git a/linkers/wscript b/linkers/wscript
index e49358a..c1c4a61 100644
--- a/linkers/wscript
+++ b/linkers/wscript
@@ -1,4 +1,34 @@
 #
+# RTEMS Tools Project (http://www.rtems.org/)
+# Copyright 2014, 2015 Chris Johns (chrisj at rtems.org)
+# All rights reserved.
+#
+# This file is part of the RTEMS Tools package in 'rtems-tools'.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+#
 # RTEMS Linker build script.
 #
 import sys
diff --git a/rtemstoolkit/elftoolchain/libelf/mmap_win32.c b/rtemstoolkit/elftoolchain/libelf/mmap_win32.c
index 689fe87..ba91cba 100644
--- a/rtemstoolkit/elftoolchain/libelf/mmap_win32.c
+++ b/rtemstoolkit/elftoolchain/libelf/mmap_win32.c
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2011 Chris Johns <chrisj at rtems.org>
+ * Copyright (c) 2011, 2015 Chris Johns <chrisj at rtems.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -39,6 +39,7 @@
 
 #include <errno.h>
 #include <stdint.h>
+#include <io.h>
 #include <windows.h>
 
 /*
diff --git a/rtemstoolkit/wscript b/rtemstoolkit/wscript
index 229deeb..9e9f047 100644
--- a/rtemstoolkit/wscript
+++ b/rtemstoolkit/wscript
@@ -1,4 +1,34 @@
 #
+# RTEMS Tools Project (http://www.rtems.org/)
+# Copyright 2014, 2015 Chris Johns (chrisj at rtems.org)
+# All rights reserved.
+#
+# This file is part of the RTEMS Tools package in 'rtems-tools'.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+#
 # RTEMS Toolkit build script.
 #
 import sys
@@ -23,6 +53,8 @@ def configure(conf):
     conf_libiberty(conf)
     conf_libelf(conf)
 
+    conf.find_program('m4')
+
     conf.check(header_name='sys/wait.h',  features = 'c', mandatory = False)
     conf.check_cc(function_name='kill', header_name="signal.h",
                   features = 'c', mandatory = False)
@@ -138,15 +170,7 @@ def conf_libelf(conf):
 
 def bld_libelf(bld, conf):
     libelf = 'elftoolchain/libelf/'
-
-    #
-    # Work around the ${SRC} having Windows slashes which the MSYS m4 does not
-    # understand.
-    #
-    if sys.platform == 'win32':
-        m4_rule = 'type ${SRC} | m4 -D SRCDIR=../rtemstoolkit/' + libelf[:-1] + '> ${TGT}"'
-    else:
-        m4_rule = 'm4 -D SRCDIR=../rtemstoolkit/' + libelf[:-1] + ' ${SRC} > ${TGT}'
+    m4_rule = '${M4} -D SRCDIR=../rtemstoolkit/' + libelf[:-1] + ' ${SRC} > ${TGT}'
     if bld.env.DEST_OS == 'win32':
         includes = ['win32']
     else:
diff --git a/tester/rt/console.py b/tester/rt/console.py
index 74ec3bf..fa70541 100644
--- a/tester/rt/console.py
+++ b/tester/rt/console.py
@@ -33,18 +33,28 @@
 #
 
 import errno
-import fcntl
 import os
 import threading
 import time
 
-import stty
+#
+# Not available on Windows. Not sure what this means.
+#
+if os.name != 'nt':
+    import fcntl
+    import stty
+else:
+    fcntl = None
+    stty = None
 
 def save():
-    return stty.save()
+    if stty is not None:
+        return stty.save()
+    return None
 
 def restore(attributes):
-    stty.restore(attributes)
+    if attributes is not None and stty is not None:
+        stty.restore(attributes)
 
 class console(object):
     '''RTEMS Testing console base.'''
@@ -91,16 +101,18 @@ class tty(console):
         super(tty, self).__del__()
         if self._tracing():
             print ':: tty close', self.dev
-        fcntl.fcntl(me.tty.fd, fcntl.F_SETFL,
-                    fcntl.fcntl(me.tty.fd, fcntl.F_GETFL) & ~os.O_NONBLOCK)
+        if fcntl is not None:
+            fcntl.fcntl(me.tty.fd, fcntl.F_SETFL,
+                        fcntl.fcntl(me.tty.fd, fcntl.F_GETFL) & ~os.O_NONBLOCK)
         self.close()
 
     def open(self):
         def _readthread(me, x):
             if self._tracing():
                 print ':: tty runner started', self.dev
-            fcntl.fcntl(me.tty.fd, fcntl.F_SETFL,
-                        fcntl.fcntl(me.tty.fd, fcntl.F_GETFL) | os.O_NONBLOCK)
+            if fcntl is not None:
+                fcntl.fcntl(me.tty.fd, fcntl.F_SETFL,
+                            fcntl.fcntl(me.tty.fd, fcntl.F_GETFL) | os.O_NONBLOCK)
             line = ''
             while me.running:
                 time.sleep(0.05)
diff --git a/tester/rt/gdb.py b/tester/rt/gdb.py
index 956b395..2efd5c0 100644
--- a/tester/rt/gdb.py
+++ b/tester/rt/gdb.py
@@ -35,7 +35,6 @@
 import os
 import Queue
 import sys
-import termios
 import threading
 
 from rtemstoolkit import error
diff --git a/tester/rtems-test b/tester/rtems-test
index 1684abc..6f80df2 100755
--- a/tester/rtems-test
+++ b/tester/rtems-test
@@ -33,7 +33,8 @@ import sys, os
 base = os.path.dirname(os.path.abspath(sys.argv[0]))
 parent = os.path.dirname(base)
 rtems = os.path.join(parent, 'share', 'rtems')
-sys.path = [base, parent, rtems] + sys.path
+tester = os.path.join(parent, 'share', 'rtems', 'tester')
+sys.path = [parent, rtems, tester] + sys.path
 
 try:
     import rt.test
diff --git a/tester/wscript b/tester/wscript
index 8971529..794d25f 100644
--- a/tester/wscript
+++ b/tester/wscript
@@ -60,12 +60,12 @@ def build(bld):
                   'rt/stty.py',
                   'rt/test.py',
                   'rt/version.py'],
-        install_path = '${PREFIX}/share/rtems/rt')
+        install_path = '${PREFIX}/share/rtems/tester')
     bld(features = 'py',
         source = ['rt/pygdb/__init__.py',
                   'rt/pygdb/mi_parser.py',
                   'rt/pygdb/spark.py'],
-        install_path = '${PREFIX}/share/rtems/rt/pygdb')
+        install_path = '${PREFIX}/share/rtems/tester')
     bld.install_files('${PREFIX}/bin', ['rtems-test'], chmod = 0o755)
 
     #
diff --git a/wscript b/wscript
index e289858..674b640 100644
--- a/wscript
+++ b/wscript
@@ -1,6 +1,6 @@
 #
 # RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2014 Chris Johns (chrisj at rtems.org)
+# Copyright 2014, 2015 Chris Johns (chrisj at rtems.org)
 # All rights reserved.
 #
 # This file is part of the RTEMS Tools package in 'rtems-tools'.




More information about the vc mailing list