summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2015-02-07 17:58:17 +1100
committerChris Johns <chrisj@rtems.org>2015-02-07 17:58:17 +1100
commitd4eb08f55a7e868ea0e61dee03c216cdf7a3502b (patch)
tree9f98bea8a291aeb38ab93b2efb2c9865db1defae
parentUpdate all 4.11 archs to newlib-2.2.0-1 and gdb-7.8.2 where possible. (diff)
downloadrtems-source-builder-d4eb08f55a7e868ea0e61dee03c216cdf7a3502b.tar.bz2
Windows native build fixes.
The testing of building on Windows is done using MSYS2.
-rw-r--r--source-builder/config/gcc-common-1.cfg9
-rw-r--r--source-builder/sb/build.py1
-rw-r--r--source-builder/sb/check.py2
-rw-r--r--source-builder/sb/download.py9
-rwxr-xr-xsource-builder/sb/ereport.py5
-rwxr-xr-xsource-builder/sb/log.py1
-rw-r--r--source-builder/sb/path.py9
-rw-r--r--source-builder/sb/windows.py17
8 files changed, 37 insertions, 16 deletions
diff --git a/source-builder/config/gcc-common-1.cfg b/source-builder/config/gcc-common-1.cfg
index 35e7efa..dd0cf4c 100644
--- a/source-builder/config/gcc-common-1.cfg
+++ b/source-builder/config/gcc-common-1.cfg
@@ -190,10 +190,11 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
%{__rmfile} $SB_BUILD_ROOT%{_mandir}/man3/*ffi*
# Clean the symlinks away incase the source is a repo
- %{__rmfile} ${source_dir_gcc}/newlib
- %{__rmfile} ${source_dir_gcc}/mpfr
- %{__rmfile} ${source_dir_gcc}/mpc
- %{__rmfile} ${source_dir_gcc}/gmp
+ # Note, delete as a directory because of MSYS2 support on Windows.
+ %{__rmdir} ${source_dir_gcc}/newlib
+ %{__rmdir} ${source_dir_gcc}/mpfr
+ %{__rmdir} ${source_dir_gcc}/mpc
+ %{__rmdir} ${source_dir_gcc}/gmp
%testing
# Add testing here.
diff --git a/source-builder/sb/build.py b/source-builder/sb/build.py
index 22e0f6a..630a1a0 100644
--- a/source-builder/sb/build.py
+++ b/source-builder/sb/build.py
@@ -227,7 +227,6 @@ class build:
raise error.general('setup source tag not found: %d' % (source_tag))
else:
name = opt_name
- name = self._name_(name)
self.script.append(self.config.expand('cd %{_builddir}'))
if not deleted_dir and delete_before_unpack:
self.script.append(self.config.expand('%{__rm} -rf ' + name))
diff --git a/source-builder/sb/check.py b/source-builder/sb/check.py
index f5d38a5..d2eba4f 100644
--- a/source-builder/sb/check.py
+++ b/source-builder/sb/check.py
@@ -104,7 +104,7 @@ def path_check(opts, silent = False):
if not silent:
log.notice('error: environment PATH contains an empty path')
return False
- elif p.strip() == '.' or p.strip() == '..':
+ elif not options.host_windows and (p.strip() == '.' or p.strip() == '..'):
if not silent:
log.notice('error: environment PATH invalid path: %s' % (p))
return False
diff --git a/source-builder/sb/download.py b/source-builder/sb/download.py
index dc1def6..9490aa0 100644
--- a/source-builder/sb/download.py
+++ b/source-builder/sb/download.py
@@ -69,7 +69,7 @@ def _hash_check(file_, absfile, macros, remove = True):
_in = None
try:
hasher = hashlib.new(hash[0])
- _in = open(absfile, 'rb')
+ _in = open(path.host(absfile), 'rb')
hasher.update(_in.read())
except IOError, err:
log.notice('hash: %s: read error: %s' % (file_, str(err)))
@@ -90,7 +90,12 @@ def _hash_check(file_, absfile, macros, remove = True):
if failed and remove:
log.warning('removing: %s' % (file_))
if path.exists(absfile):
- os.remove(path.host(absfile))
+ try:
+ os.remove(path.host(absfile))
+ except IOError, err:
+ raise error.general('hash: %s: remove: %s' % (absfile, str(err)))
+ except:
+ raise error.general('hash: %s: remove error' % (file_))
if hasher is not None:
del hasher
else:
diff --git a/source-builder/sb/ereport.py b/source-builder/sb/ereport.py
index 897b353..88aaa16 100755
--- a/source-builder/sb/ereport.py
+++ b/source-builder/sb/ereport.py
@@ -36,7 +36,10 @@ def generate(name, opts, header = None, footer = None):
opts.defaults.get_value('%{_sbgit_id}'))]
else:
r += [' RSB: not a valid repo']
- r += [' %s' % (' '.join(os.uname()))]
+ if os.name == 'nt':
+ r += [' Windows']
+ else:
+ r += [' %s' % (' '.join(os.uname()))]
r += []
r += ['Tail of the build log:']
r += log.tail()
diff --git a/source-builder/sb/log.py b/source-builder/sb/log.py
index 8e46023..410987c 100755
--- a/source-builder/sb/log.py
+++ b/source-builder/sb/log.py
@@ -74,6 +74,7 @@ def notice(text = os.linesep, log = None):
if not quiet and default is not None and not default.has_stdout():
for l in text.replace(chr(13), '').splitlines():
print l
+ sys.stdout.flush()
_output(text, log)
def trace(text = os.linesep, log = None):
diff --git a/source-builder/sb/path.py b/source-builder/sb/path.py
index 20ab73c..67aeacd 100644
--- a/source-builder/sb/path.py
+++ b/source-builder/sb/path.py
@@ -127,7 +127,14 @@ def mkdir(path):
def removeall(path):
def _onerror(function, path, excinfo):
- print 'removeall error: (%s) %s' % (excinfo, path)
+ import stat
+ if not os.access(path, os.W_OK):
+ # Is the error an access error ?
+ os.chmod(path, stat.S_IWUSR)
+ function(path)
+ else:
+ print 'removeall error: %s' % (path)
+ raise
path = host(path)
shutil.rmtree(path, onerror = _onerror)
diff --git a/source-builder/sb/windows.py b/source-builder/sb/windows.py
index 222876d..938abfc 100644
--- a/source-builder/sb/windows.py
+++ b/source-builder/sb/windows.py
@@ -30,13 +30,18 @@ import execute
def load():
# Default to the native Windows Python.
uname = 'win32'
- system = 'mingw32'
- if os.environ.has_key('HOSTTYPE'):
- hosttype = os.environ['HOSTTYPE']
+ if os.environ.has_key('PROCESSOR_ARCHITECTURE'):
+ if os.environ['PROCESSOR_ARCHITECTURE'] == 'AMD64':
+ hosttype = 'x86_64'
+ machsize = '64'
+ else:
+ hosttype = 'i686'
+ machsize = '32'
else:
- hosttype = 'i686'
- host_triple = hosttype + '-pc-' + system
- build_triple = hosttype + '-pc-' + system
+ hosttype = 'x86_64'
+ machsize = '32'
+ host_triple = '%s-w%s-mingw32' % (hosttype, machsize)
+ build_triple = '%s-w%s-mingw32' % (hosttype, machsize)
# See if this is actually Cygwin Python
if os.name == 'posix':