Bug 925605 - Allow to build with a special build of GNU make on windows. r=gps
☠☠ backed out by f6cd58cf99ff ☠ ☠
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 16 Oct 2013 08:34:18 +0900
changeset 150893 5f0bfb16fa4a5fd22e5828277e7e4ed0c9747f88
parent 150892 6d9022faecd0d3f3724605189aed828a6c65443d
child 150894 f5838290c7059fc279c1135e1a9f62690954548d
push id3066
push usercbook@mozilla.com
push dateWed, 16 Oct 2013 11:14:52 +0000
treeherderfx-team@762cd8723f8d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs925605
milestone27.0a1
Bug 925605 - Allow to build with a special build of GNU make on windows. r=gps
client.mk
config/baseconfig.mk
config/rules.mk
js/src/config/baseconfig.mk
js/src/config/rules.mk
js/src/configure.in
python/mozbuild/mozbuild/base.py
security/build/Makefile.in
--- a/client.mk
+++ b/client.mk
@@ -80,23 +80,16 @@ endif
 
 
 ####################################
 # Sanity checks
 
 # Windows checks.
 ifneq (,$(findstring mingw,$(CONFIG_GUESS)))
 
-# Require pymake (as opposed to GNU make).
-ifndef .PYMAKE
-$(error Pymake is required to build on Windows. Run |./mach build| to \
-automatically use pymake. Or, invoke pymake directly via \
-|python build/pymake/make.py|.)
-endif
-
 # check for CRLF line endings
 ifneq (0,$(shell $(PERL) -e 'binmode(STDIN); while (<STDIN>) { if (/\r/) { print "1"; exit } } print "0"' < $(TOPSRCDIR)/client.mk))
 $(error This source tree appears to have Windows-style line endings. To \
 convert it to Unix-style line endings, run \
 "python mozilla/build/win32/mozilla-dos2unix.py")
 endif
 endif
 
--- a/config/baseconfig.mk
+++ b/config/baseconfig.mk
@@ -4,26 +4,25 @@ installdir = $(libdir)/$(MOZ_APP_NAME)-$
 sdkdir = $(libdir)/$(MOZ_APP_NAME)-devel-$(MOZ_APP_VERSION)
 DIST = $(DEPTH)/dist
 
 # We do magic with OBJ_SUFFIX in config.mk, the following ensures we don't
 # manually use it before config.mk inclusion
 _OBJ_SUFFIX := $(OBJ_SUFFIX)
 OBJ_SUFFIX = $(error config/config.mk needs to be included before using OBJ_SUFFIX)
 
-# We only want to do the pymake sanity on Windows, other os's can cope
 ifeq ($(HOST_OS_ARCH),WINNT)
-# Ensure invariants between GNU Make and pymake
-# Checked here since we want the sane error in a file that
-# actually can be found regardless of path-style.
-ifeq (_:,$(.PYMAKE)_$(findstring :,$(srcdir)))
-$(error Windows-style srcdir being used with GNU make. Did you mean to run $(topsrcdir)/build/pymake/make.py instead? [see-also:     https://developer.mozilla.org/en/Gmake_vs._Pymake])
+# We only support building with pymake or a specially built gnu make.
+ifndef .PYMAKE
+ifeq (,$(filter mozmake%,$(notdir $(MAKE))))
+$(error Only building with pymake or mozmake is supported.)
 endif
-ifeq (1_a,$(.PYMAKE)_$(firstword a$(subst /, ,$(srcdir))))
-$(error MSYS-style srcdir being used with Pymake. Did you mean to run GNU Make instead? [see-also: https://developer.mozilla.org/    en/Gmake_vs._Pymake])
+endif
+ifeq (a,$(firstword a$(subst /, ,$(srcdir))))
+$(error MSYS-style srcdir are not supported for Windows builds.)
 endif
 endif # WINNT
 
 ifdef .PYMAKE
 include_deps = $(eval -includedeps $(1))
 else
 include_deps = $(eval -include $(1))
 endif
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -215,23 +215,23 @@ cppunittests-remote:
 	fi
 
 endif # CPP_UNIT_TESTS
 
 .PHONY: check
 
 ifdef PYTHON_UNIT_TESTS
 
-RUN_PYTHON_UNIT_TESTS := $(addprefix run-,$(PYTHON_UNIT_TESTS))
+RUN_PYTHON_UNIT_TESTS := $(addsuffix -run,$(PYTHON_UNIT_TESTS))
 
 .PHONY: $(RUN_PYTHON_UNIT_TESTS)
 
 check:: $(RUN_PYTHON_UNIT_TESTS)
 
-$(RUN_PYTHON_UNIT_TESTS): run-%: %
+$(RUN_PYTHON_UNIT_TESTS): %-run: %
 	@PYTHONDONTWRITEBYTECODE=1 $(PYTHON) $<
 
 endif # PYTHON_UNIT_TESTS
 
 endif # ENABLE_TESTS
 
 
 #
--- a/js/src/config/baseconfig.mk
+++ b/js/src/config/baseconfig.mk
@@ -11,26 +11,25 @@ DIST = $(DEPTH)/$(TOP_DIST)
 endif
 endif
 
 # We do magic with OBJ_SUFFIX in config.mk, the following ensures we don't
 # manually use it before config.mk inclusion
 _OBJ_SUFFIX := $(OBJ_SUFFIX)
 OBJ_SUFFIX = $(error config/config.mk needs to be included before using OBJ_SUFFIX)
 
-# We only want to do the pymake sanity on Windows, other os's can cope
 ifeq ($(HOST_OS_ARCH),WINNT)
-# Ensure invariants between GNU Make and pymake
-# Checked here since we want the sane error in a file that
-# actually can be found regardless of path-style.
-ifeq (_:,$(.PYMAKE)_$(findstring :,$(srcdir)))
-$(error Windows-style srcdir being used with GNU make. Did you mean to run $(topsrcdir)/build/pymake/make.py instead? [see-also:     https://developer.mozilla.org/en/Gmake_vs._Pymake])
+# We only support building with pymake or a specially built gnu make.
+ifndef .PYMAKE
+ifeq (,$(filter mozmake%,$(notdir $(MAKE))))
+$(error Only building with pymake or mozmake is supported.)
 endif
-ifeq (1_a,$(.PYMAKE)_$(firstword a$(subst /, ,$(srcdir))))
-$(error MSYS-style srcdir being used with Pymake. Did you mean to run GNU Make instead? [see-also: https://developer.mozilla.org/    en/Gmake_vs._Pymake])
+endif
+ifeq (a,$(firstword a$(subst /, ,$(srcdir))))
+$(error MSYS-style srcdir are not supported for Windows builds.)
 endif
 endif # WINNT
 
 ifdef .PYMAKE
 include_deps = $(eval -includedeps $(1))
 else
 include_deps = $(eval -include $(1))
 endif
--- a/js/src/config/rules.mk
+++ b/js/src/config/rules.mk
@@ -215,23 +215,23 @@ cppunittests-remote:
 	fi
 
 endif # CPP_UNIT_TESTS
 
 .PHONY: check
 
 ifdef PYTHON_UNIT_TESTS
 
-RUN_PYTHON_UNIT_TESTS := $(addprefix run-,$(PYTHON_UNIT_TESTS))
+RUN_PYTHON_UNIT_TESTS := $(addsuffix -run,$(PYTHON_UNIT_TESTS))
 
 .PHONY: $(RUN_PYTHON_UNIT_TESTS)
 
 check:: $(RUN_PYTHON_UNIT_TESTS)
 
-$(RUN_PYTHON_UNIT_TESTS): run-%: %
+$(RUN_PYTHON_UNIT_TESTS): %-run: %
 	@PYTHONDONTWRITEBYTECODE=1 $(PYTHON) $<
 
 endif # PYTHON_UNIT_TESTS
 
 endif # ENABLE_TESTS
 
 
 #
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -4192,26 +4192,28 @@ if test -n "$ENABLE_INTL_API" -a -z "$MO
     # don't include obsolete header files
     ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1"
     # remove chunks of the library that we don't need (yet)
     ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_LEGACY_CONVERSION"
     ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_TRANSLITERATION"
     ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_REGULAR_EXPRESSIONS"
     ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_BREAK_ITERATION"
 
+    ICU_SRCDIR=""
     # Set OS dependent options for ICU
     case "$OS_TARGET" in
         Darwin)
             ICU_TARGET=MacOSX
             ;;
         Linux)
             ICU_TARGET=Linux
             ;;
         WINNT)
             ICU_TARGET=MSYS/MSVC
+            ICU_SRCDIR="--srcdir=$(cd $srcdir/../../intl/icu/source; pwd -W)"
             ;;
         DragonFly|FreeBSD|NetBSD|OpenBSD)
             ICU_TARGET=BSD
             ;;
     esac
 
     # To reduce library size, use static linking
     ICU_LINK_OPTS="--enable-static --disable-shared"
@@ -4235,16 +4237,18 @@ if test -n "$ENABLE_INTL_API" -a -z "$MO
     (cd $_objdir/intl/icu
      MOZ_SUBCONFIGURE_WRAP([.],[
      CC="$CC" CXX="$CXX" \
      CFLAGS="$ICU_CFLAGS" CPPFLAGS="$ICU_CPPFLAGS" CXXFLAGS="$ICU_CXXFLAGS" \
             $SHELL $abs_srcdir/../../intl/icu/source/runConfigureICU \
             $ICU_BUILD_OPTS \
             $ICU_TARGET \
             $ICU_LINK_OPTS \
+dnl Shell quoting is fun.
+            ${ICU_SRCDIR+"$ICU_SRCDIR"} \
             --enable-extras=no --enable-icuio=no  --enable-layout=no \
             --enable-tests=no --enable-samples=no || exit 1
      ])
     ) || exit 1
 fi
 
 
 dnl ========================================================
--- a/python/mozbuild/mozbuild/base.py
+++ b/python/mozbuild/mozbuild/base.py
@@ -453,16 +453,23 @@ class MozbuildObject(ProcessExecutionMix
         }
 
         if log:
             params['log_name'] = 'make'
 
         return fn(**params)
 
     def _make_path(self, force_pymake=False):
+        if self._is_windows() and not force_pymake:
+            # Use mozmake if it's available.
+            try:
+                return [which.which('mozmake')]
+            except which.WhichError:
+                pass
+
         if self._is_windows() or force_pymake:
             make_py = os.path.join(self.topsrcdir, 'build', 'pymake',
                 'make.py').replace(os.sep, '/')
 
             # We might want to consider invoking with the virtualenv's Python
             # some day. But, there is a chicken-and-egg problem w.r.t. when the
             # virtualenv is created.
             return [sys.executable, make_py]
--- a/security/build/Makefile.in
+++ b/security/build/Makefile.in
@@ -124,42 +124,50 @@ DEFAULT_GMAKE_FLAGS += CC="$(CC)"
 DEFAULT_GMAKE_FLAGS += SOURCE_MD_DIR=$(ABS_DIST)
 DEFAULT_GMAKE_FLAGS += SOURCE_MDHEADERS_DIR=$(NSPR_INCLUDE_DIR)
 DEFAULT_GMAKE_FLAGS += DIST=$(ABS_DIST)
 DEFAULT_GMAKE_FLAGS += NSPR_INCLUDE_DIR=$(NSPR_INCLUDE_DIR)
 DEFAULT_GMAKE_FLAGS += NSPR_LIB_DIR=$(NSPR_LIB_DIR)
 DEFAULT_GMAKE_FLAGS += MOZILLA_CLIENT=1
 DEFAULT_GMAKE_FLAGS += NO_MDUPDATE=1
 DEFAULT_GMAKE_FLAGS += NSS_ENABLE_ECC=1
-DEFAULT_GMAKE_FLAGS += NSINSTALL="$(NSINSTALL)"
+ifeq ($(NSINSTALL_PY),$(NSINSTALL))
+DEFAULT_GMAKE_FLAGS += PYTHON='$(PYTHON)'
+DEFAULT_GMAKE_FLAGS += NSINSTALL_PY='$(call core_abspath,$(topsrcdir)/config/nsinstall.py)'
+DEFAULT_GMAKE_FLAGS += NSINSTALL='$$(PYTHON) $$(NSINSTALL_PY)'
+else
+DEFAULT_GMAKE_FLAGS += NSINSTALL='$(NSINSTALL)'
+endif
 ifeq ($(OS_ARCH),WINNT)
-DEFAULT_GMAKE_FLAGS += INSTALL="$(NSINSTALL) -t"
+DEFAULT_GMAKE_FLAGS += INSTALL='$$(NSINSTALL) -t'
 endif
 ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_1)
 DEFAULT_GMAKE_FLAGS += OS_DLLFLAGS="-static-libgcc"
 endif
 ifndef MOZ_NATIVE_SQLITE
 ifdef MOZ_FOLD_LIBS
 DEFAULT_GMAKE_FLAGS += SQLITE_LIB_NAME=nss3
 else
 DEFAULT_GMAKE_FLAGS += SQLITE_LIB_NAME=mozsqlite3
 endif # MOZ_FOLD_LIBS
 DEFAULT_GMAKE_FLAGS += SQLITE_INCLUDE_DIR=$(ABS_DIST)/include
 endif
 ifdef NSS_DISABLE_DBM 
 DEFAULT_GMAKE_FLAGS += NSS_DISABLE_DBM=1
 endif
+ifeq ($(HOST_OS_ARCH),WINNT)
+ABS_topsrcdir   := $(shell cd $(topsrcdir); pwd -W)
+else
 ABS_topsrcdir   := $(shell cd $(topsrcdir); pwd)
-ifeq ($(HOST_OS_ARCH),WINNT)
-ifdef .PYMAKE
-ABS_topsrcdir   := $(shell cd $(topsrcdir); pwd -W)
-endif
 endif
 # Hack to force NSS build system to use "normal" object directories
-DEFAULT_GMAKE_FLAGS += BUILD='$(MOZ_BUILD_ROOT)/security/$$(subst $(ABS_topsrcdir)/security/,,$$(CURDIR))'
+DEFAULT_GMAKE_FLAGS += ABS_topsrcdir='$(ABS_topsrcdir)'
+# ABS_topsrcdir can't be expanded here because msys path mangling likes to break
+# paths in that case.
+DEFAULT_GMAKE_FLAGS += BUILD='$(MOZ_BUILD_ROOT)/security/$$(subst $$(ABS_topsrcdir)/security/,,$$(CURDIR))'
 DEFAULT_GMAKE_FLAGS += BUILD_TREE='$$(BUILD)' OBJDIR='$$(BUILD)' DEPENDENCIES='$$(BUILD)/.deps' SINGLE_SHLIB_DIR='$$(BUILD)'
 DEFAULT_GMAKE_FLAGS += SOURCE_XP_DIR=$(ABS_DIST)
 ifndef MOZ_DEBUG
 DEFAULT_GMAKE_FLAGS += BUILD_OPT=1 OPT_CODE_SIZE=1
 endif
 ifdef GNU_CC
 DEFAULT_GMAKE_FLAGS += NS_USE_GCC=1
 else