Bug 842341 - Fix Windows builds with GNU make; r=ted
authorGregory Szorc <gps@mozilla.com>
Wed, 06 Mar 2013 12:08:47 -0800
changeset 134414 0887088eee1a3f8303f1afa26a15074cc081e554
parent 134413 99370053542ac56b8916585847f8b4c40e5aeba7
child 134415 bdeb0fd118baed927364b9f0cace7d9d45f96553
push id2452
push userlsblakk@mozilla.com
push dateMon, 13 May 2013 16:59:38 +0000
treeherdermozilla-beta@d4b152d29d8d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs842341
milestone22.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 842341 - Fix Windows builds with GNU make; r=ted
addon-sdk/Makefile.in
addon-sdk/copy_source.py
--- a/addon-sdk/Makefile.in
+++ b/addon-sdk/Makefile.in
@@ -4,16 +4,18 @@
 
 DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(topsrcdir)/config/config.mk
 
+export PYMAKE = $(.PYMAKE)
+
 libs::
 	$(PYTHON) $(srcdir)/copy_source.py $(topsrcdir) $(srcdir)/source/lib $(FINAL_TARGET)/modules/commonjs >copy_source.mk
 	$(MAKE) -f copy_source.mk libs
 
 include $(topsrcdir)/config/rules.mk
 
 TEST_FILES = \
   source/app-extension \
--- a/addon-sdk/copy_source.py
+++ b/addon-sdk/copy_source.py
@@ -1,21 +1,38 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 import os
+import posixpath
 import sys
 
+
+def normpath(path):
+    """Ensure UNIX style paths are used with GNU make on Windows.
+
+    This can be removed once we no longer support GNU make on Windows (bug
+    828317).
+    """
+    if os.environ.get('PYMAKE') or os.name not in ('nt', 'ce'):
+        return path
+
+    if len(path) > 2 and path[1] == ':':
+        path = '/' + path[0] + path[2:]
+
+    return posixpath.normpath(path)
+
+
 if len(sys.argv) != 4:
     print >> sys.stderr, "Usage: copy_source.py " \
                          "<topsrcdir> <source directory> <target directory>"
     sys.exit(1)
 
-topsrcdir = sys.argv[1]
+topsrcdir = normpath(sys.argv[1])
 source_dir = sys.argv[2]
 target_dir = sys.argv[3]
 
 print """
 DEPTH     = ..
 topsrcdir = %(topsrcdir)s
 srcdir    = %(topsrcdir)s/addon-sdk
 VPATH     = %(topsrcdir)s/addon-sdk