Bug 925605 - Allow to build with a special build of GNU make on windows. r=gps

This commit is contained in:
Mike Hommey 2013-10-16 08:34:18 +09:00
parent 08b001d8f0
commit 0547bcf728
8 changed files with 45 additions and 35 deletions

View File

@ -85,13 +85,6 @@ endif
# 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 \

View File

@ -9,16 +9,15 @@ DIST = $(DEPTH)/dist
_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

View File

@ -220,13 +220,13 @@ endif # CPP_UNIT_TESTS
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

View File

@ -16,16 +16,15 @@ endif
_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

View File

@ -220,13 +220,13 @@ endif # CPP_UNIT_TESTS
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

View File

@ -4197,6 +4197,7 @@ if test -n "$ENABLE_INTL_API" -a -z "$MOZ_NATIVE_ICU"; then
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)
@ -4207,6 +4208,7 @@ if test -n "$ENABLE_INTL_API" -a -z "$MOZ_NATIVE_ICU"; then
;;
WINNT)
ICU_TARGET=MSYS/MSVC
ICU_SRCDIR="--srcdir=$(cd $srcdir/../../intl/icu/source; pwd -W)"
;;
DragonFly|FreeBSD|NetBSD|OpenBSD)
ICU_TARGET=BSD
@ -4240,6 +4242,8 @@ if test -n "$ENABLE_INTL_API" -a -z "$MOZ_NATIVE_ICU"; then
$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
])

View File

@ -458,6 +458,13 @@ class MozbuildObject(ProcessExecutionMixin):
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, '/')

View File

@ -129,10 +129,6 @@ 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 ($(OS_ARCH),WINNT)
DEFAULT_GMAKE_FLAGS += INSTALL="$(NSINSTALL) -t"
endif
ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_1)
DEFAULT_GMAKE_FLAGS += OS_DLLFLAGS="-static-libgcc"
endif
@ -147,14 +143,16 @@ endif
ifdef NSS_DISABLE_DBM
DEFAULT_GMAKE_FLAGS += NSS_DISABLE_DBM=1
endif
ABS_topsrcdir := $(shell cd $(topsrcdir); pwd)
ifeq ($(HOST_OS_ARCH),WINNT)
ifdef .PYMAKE
ABS_topsrcdir := $(shell cd $(topsrcdir); pwd -W)
endif
else
ABS_topsrcdir := $(shell cd $(topsrcdir); pwd)
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
@ -450,6 +448,16 @@ libs-nss/lib/freebl: $(DIST)/lib/$(IMPORT_PREFIX)nssutil3$(IMPORT_SUFFIX) $(NSPR
$(addprefix libs-,$(NSS_STATIC_DIRS)): DEFAULT_GMAKE_FLAGS += SHARED_LIBRARY= IMPORT_LIBRARY=
endif # MOZ_FOLD_LIBS
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'
endif
DEFAULT_GMAKE_FLAGS += $(EXTRA_GMAKE_FLAGS)
$(addprefix libs-,$(NSS_DIRS)): libs-%: