mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 950298 - Make the js build system use top-level as its root objdir. r=gps
This commit is contained in:
parent
ead63b959e
commit
64fdc4d9ca
2
CLOBBER
2
CLOBBER
@ -22,4 +22,4 @@
|
||||
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
|
||||
# don't change CLOBBER for WebIDL changes any more.
|
||||
|
||||
Bug 958185 requires clobber on Android to force a Proguard refresh
|
||||
Bug 950298 requires clobber because it changes where nsinstall is picked and it was previously installed there with wrong permissions. Also, the directory where js is built changed.
|
||||
|
55
Makefile.in
55
Makefile.in
@ -17,15 +17,19 @@ export TOPLEVEL_BUILD := 1
|
||||
|
||||
default::
|
||||
|
||||
ifdef MOZ_BUILD_APP
|
||||
include $(topsrcdir)/$(MOZ_BUILD_APP)/build.mk
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
ifndef LIBXUL_SDK
|
||||
ifdef COMPILE_ENVIRONMENT
|
||||
ifndef BUILDING_JS
|
||||
BUILD_JS = 1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
GARBAGE_DIRS += dist _javagen _profile staticlib
|
||||
DIST_GARBAGE = config.cache config.log config.status* config-defs.h \
|
||||
@ -34,29 +38,40 @@ DIST_GARBAGE = config.cache config.log config.status* config-defs.h \
|
||||
netwerk/necko-config.h xpcom/xpcom-config.h xpcom/xpcom-private.h \
|
||||
.mozconfig.mk
|
||||
|
||||
ifdef BUILDING_JS
|
||||
configure_dir = $(topsrcdir)/js/src
|
||||
else
|
||||
configure_dir = $(topsrcdir)
|
||||
endif
|
||||
|
||||
ifndef MOZ_PROFILE_USE
|
||||
# We need to explicitly put backend.RecursiveMakeBackend here
|
||||
# otherwise the rule in rules.mk doesn't run early enough.
|
||||
libs binaries export tools:: CLOBBER $(topsrcdir)/configure config.status backend.RecursiveMakeBackend
|
||||
libs binaries export tools:: CLOBBER $(configure_dir)/configure config.status backend.RecursiveMakeBackend
|
||||
ifdef BUILD_JS
|
||||
libs binaries export tools:: js-config-status
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef BUILDING_JS
|
||||
.PHONY: CLOBBER
|
||||
CLOBBER:
|
||||
else
|
||||
CLOBBER: $(topsrcdir)/CLOBBER
|
||||
@echo 'STOP! The CLOBBER file has changed.'
|
||||
@echo 'Please run the build through a sanctioned build wrapper, such as'
|
||||
@echo '"mach build" or client.mk.'
|
||||
@exit 1
|
||||
endif
|
||||
|
||||
$(topsrcdir)/configure: $(topsrcdir)/configure.in
|
||||
$(configure_dir)/configure: $(configure_dir)/configure.in
|
||||
@echo 'STOP! configure.in has changed, and your configure is out of date.'
|
||||
@echo 'Please rerun autoconf and re-configure your build directory.'
|
||||
@echo 'To ignore this message, touch "configure" in the source directory,'
|
||||
@echo 'but your build might not succeed.'
|
||||
@exit 1
|
||||
|
||||
config.status: $(topsrcdir)/configure
|
||||
config.status: $(configure_dir)/configure
|
||||
@echo 'STOP! configure has changed and needs to be run in this build directory.'
|
||||
@echo 'Please rerun configure.'
|
||||
@echo 'To ignore this message, touch "config.status" in the build directory,'
|
||||
@ -90,7 +105,7 @@ endif
|
||||
install_manifests := bin idl include public private sdk
|
||||
install_manifest_depends = \
|
||||
CLOBBER \
|
||||
$(topsrcdir)/configure \
|
||||
$(configure_dir)/configure \
|
||||
config.status \
|
||||
backend.RecursiveMakeBackend \
|
||||
$(NULL)
|
||||
@ -102,6 +117,18 @@ endif
|
||||
.PHONY: install-manifests
|
||||
install-manifests: $(addprefix install-dist-,$(install_manifests))
|
||||
|
||||
# process_install_manifest needs to be invoked with --no-remove when building
|
||||
# js as standalone because automated builds are building nspr separately and
|
||||
# that would remove the resulting files. It is also necessary when building
|
||||
# js as part of gecko because that would remove the files exported from gecko.
|
||||
# Eventually, a standalone js build would just be able to build nspr itself,
|
||||
# removing the need for the former. But that won't likely happen before
|
||||
# finishing to merge gecko and js build systems, removing the need for the
|
||||
# latter.
|
||||
ifdef BUILDING_JS
|
||||
NO_REMOVE=1
|
||||
endif
|
||||
|
||||
.PHONY: $(addprefix install-dist-,$(install_manifests))
|
||||
$(addprefix install-dist-,$(install_manifests)): install-dist-%: $(install_manifest_depends)
|
||||
$(call py_action,process_install_manifest,$(if $(NO_REMOVE),--no-remove )$(DIST)/$* _build_manifests/install/dist_$* $(if $(BUILD_JS),js/src/_build_manifests/install/dist_$*))
|
||||
@ -139,10 +166,12 @@ endif
|
||||
# with no regard for PGO passes. This decision could probably be revisited.
|
||||
export:: install-dist-sdk
|
||||
|
||||
ifndef BUILDING_JS
|
||||
ifdef ENABLE_TESTS
|
||||
# Additional makefile targets to call automated test suites
|
||||
include $(topsrcdir)/testing/testsuite-targets.mk
|
||||
endif
|
||||
endif
|
||||
|
||||
default all::
|
||||
$(call BUILDSTATUS,TIERS export $(if $(COMPILE_ENVIRONMENT),$(if $(MOZ_PSEUDO_DERECURSE),compile ))libs tools)
|
||||
@ -181,6 +210,7 @@ endif
|
||||
|
||||
SYM_STORE_SOURCE_DIRS := $(topsrcdir)
|
||||
|
||||
ifndef BUILDING_JS
|
||||
include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
|
||||
|
||||
ifdef MOZ_SYMBOLS_EXTRA_BUILDID
|
||||
@ -225,6 +255,7 @@ endif
|
||||
# so transform it to an immediate assignment.
|
||||
MOZ_SOURCE_STAMP := $(MOZ_SOURCE_STAMP)
|
||||
export MOZ_SOURCE_STAMP
|
||||
endif
|
||||
|
||||
#XXX: this is a hack, since we don't want to clobber for MSVC
|
||||
# PGO support, but we can't do this test in client.mk
|
||||
@ -250,6 +281,21 @@ check::
|
||||
@relcount=`find $(DIST)/bin -name '*.so' | xargs objdump -R | grep R_386_PC32 | wc -l` && if test $$relcount -gt 0; then echo 'FAILED: R_386_PC32 relocations detected in a shared library. Did you use a system header without adding it to config/system-headers?'; exit 1; else echo 'PASSED'; fi
|
||||
endif
|
||||
|
||||
ifdef BUILDING_JS
|
||||
# Delegate js-specific rules to js
|
||||
check-%:
|
||||
$(MAKE) -C js/src $@
|
||||
|
||||
source-package install:
|
||||
$(MAKE) -C js/src $@
|
||||
|
||||
# Every export rule depends on config/export, but the rule for config/export
|
||||
# doesn't exist when building js non-standalone.
|
||||
.PHONY: config/export
|
||||
config/export:
|
||||
|
||||
else
|
||||
|
||||
ifdef BUILD_JS
|
||||
js/src/Makefile: subsrcdir := js/src
|
||||
|
||||
@ -263,3 +309,4 @@ js/src/export config/export: build/clang-plugin/export
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
23
client.mk
23
client.mk
@ -312,7 +312,6 @@ EXTRA_CONFIG_DEPS := \
|
||||
$(NULL)
|
||||
|
||||
$(CONFIGURES): %: %.in $(EXTRA_CONFIG_DEPS)
|
||||
@$(PYTHON) $(TOPSRCDIR)/js/src/config/check-sync-dirs.py $(TOPSRCDIR)/js/src/build $(TOPSRCDIR)/build
|
||||
@echo Generating $@ using autoconf
|
||||
cd $(@D); $(AUTOCONF)
|
||||
|
||||
@ -322,7 +321,6 @@ CONFIG_STATUS_DEPS := \
|
||||
$(TOPSRCDIR)/CLOBBER \
|
||||
$(TOPSRCDIR)/nsprpub/configure \
|
||||
$(TOPSRCDIR)/config/milestone.txt \
|
||||
$(TOPSRCDIR)/js/src/config/milestone.txt \
|
||||
$(TOPSRCDIR)/browser/config/version.txt \
|
||||
$(TOPSRCDIR)/build/virtualenv_packages.txt \
|
||||
$(TOPSRCDIR)/python/mozbuild/mozbuild/virtualenv.py \
|
||||
@ -396,7 +394,7 @@ endif
|
||||
####################################
|
||||
# Build it
|
||||
|
||||
realbuild:: $(OBJDIR)/Makefile $(OBJDIR)/config.status check-sync-dirs-config
|
||||
realbuild:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
|
||||
$(MOZ_MAKE)
|
||||
|
||||
####################################
|
||||
@ -454,25 +452,6 @@ cleansrcdir:
|
||||
build/autoconf/clean-config.sh; \
|
||||
fi;
|
||||
|
||||
# Because SpiderMonkey can be distributed and built independently
|
||||
# of the Mozilla source tree, it contains its own copies of many of
|
||||
# the files used by the top-level Mozilla build process, from the
|
||||
# 'config' and 'build' subtrees.
|
||||
#
|
||||
# To make it simpler to keep the copies in sync, we follow the policy
|
||||
# that the SpiderMonkey copies must always be exact copies of those in
|
||||
# the containing Mozilla tree. If you've made a change in one, it
|
||||
# belongs in the other as well. If the change isn't right for both
|
||||
# places, then that's something to bring up with the other developers.
|
||||
#
|
||||
# Some files are reasonable to diverge; for example,
|
||||
# js/src/config/autoconf.mk.in doesn't need most of the stuff in
|
||||
# config/autoconf.mk.in.
|
||||
.PHONY: check-sync-dirs
|
||||
check-sync-dirs: check-sync-dirs-build check-sync-dirs-config
|
||||
check-sync-dirs-%:
|
||||
@$(PYTHON) $(TOPSRCDIR)/js/src/config/check-sync-dirs.py $(TOPSRCDIR)/js/src/$* $(TOPSRCDIR)/$*
|
||||
|
||||
echo-variable-%:
|
||||
@echo $($*)
|
||||
|
||||
|
@ -27,19 +27,21 @@ nsinstall$(HOST_BIN_SUFFIX): $(HOST_PROGRAM)
|
||||
cp $^ $@.tmp
|
||||
mv $@.tmp $@
|
||||
|
||||
NSINSTALL_FILES := nsinstall$(HOST_BIN_SUFFIX)
|
||||
NSINSTALL_EXECUTABLES := nsinstall$(HOST_BIN_SUFFIX)
|
||||
NSINSTALL_DEST := $(DIST)/bin
|
||||
NSINSTALL_TARGET := export
|
||||
INSTALL_TARGETS += NSINSTALL
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef BUILDING_JS
|
||||
HEADERS_FILES = \
|
||||
$(DEPTH)/mozilla-config.h \
|
||||
$(NULL)
|
||||
HEADERS_DEST := $(DIST)/include
|
||||
HEADERS_TARGET := export
|
||||
INSTALL_TARGETS += HEADERS
|
||||
endif
|
||||
|
||||
PYTHON_UNIT_TESTS := $(wildcard $(srcdir)/tests/unit-*.py)
|
||||
|
||||
@ -47,6 +49,7 @@ include $(topsrcdir)/config/rules.mk
|
||||
|
||||
HOST_CFLAGS += -DUNICODE -D_UNICODE
|
||||
|
||||
ifndef BUILDING_JS
|
||||
# Generate a new buildid every time we "export" in config... that's only
|
||||
# supposed to be once per-build!
|
||||
export::
|
||||
@ -55,6 +58,7 @@ ifdef MOZ_BUILD_DATE
|
||||
else
|
||||
$(PYTHON) $(topsrcdir)/toolkit/xre/make-platformini.py --print-buildid > buildid
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef WRAP_SYSTEM_INCLUDES
|
||||
export-preqs = \
|
||||
@ -108,10 +112,10 @@ GARBAGE += \
|
||||
|
||||
FORCE:
|
||||
|
||||
check-preqs = \
|
||||
check-jar-mn \
|
||||
check-makefiles \
|
||||
$(NULL)
|
||||
ifndef BUILDING_JS
|
||||
check-preqs += check-jar-mn
|
||||
endif
|
||||
check-preqs += check-makefiles
|
||||
|
||||
check:: $(check-preqs)
|
||||
|
||||
|
@ -2,7 +2,18 @@ includedir := $(includedir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
|
||||
idldir = $(datadir)/idl/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
|
||||
installdir = $(libdir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
|
||||
sdkdir = $(libdir)/$(MOZ_APP_NAME)-devel-$(MOZ_APP_VERSION)
|
||||
DIST = $(DEPTH)/dist
|
||||
ifndef TOP_DIST
|
||||
TOP_DIST = dist
|
||||
endif
|
||||
ifneq (,$(filter /%,$(TOP_DIST)))
|
||||
DIST = $(TOP_DIST)
|
||||
else
|
||||
ifeq (.,$(DEPTH))
|
||||
DIST = $(TOP_DIST)
|
||||
else
|
||||
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
|
||||
|
@ -717,7 +717,7 @@ else
|
||||
ifeq ($(HOST_OS_ARCH),WINNT)
|
||||
NSINSTALL = $(NSINSTALL_PY)
|
||||
else
|
||||
NSINSTALL = $(CONFIG_TOOLS)/nsinstall$(HOST_BIN_SUFFIX)
|
||||
NSINSTALL = $(DIST)/bin/nsinstall$(HOST_BIN_SUFFIX)
|
||||
endif # WINNT
|
||||
endif # OS2
|
||||
endif # NSINSTALL_BIN
|
||||
|
@ -10,9 +10,7 @@ NO_DIST_INSTALL = True
|
||||
NO_VISIBILITY_FLAGS = True
|
||||
|
||||
CONFIGURE_SUBST_FILES += [
|
||||
'autoconf.mk',
|
||||
'doxygen.cfg',
|
||||
'emptyvars.mk',
|
||||
'makefiles/test/Makefile',
|
||||
'tests/makefiles/autodeps/Makefile',
|
||||
'tests/src-simple/Makefile',
|
||||
|
@ -364,6 +364,10 @@ ifdef MOZ_UPDATE_XTERM
|
||||
UPDATE_TITLE = printf '\033]0;%s in %s\007' $(1) $(relativesrcdir)/$(2) ;
|
||||
endif
|
||||
|
||||
ifdef BUILDING_JS
|
||||
NO_BUILDSTATUS_MESSAGES=1
|
||||
endif
|
||||
|
||||
ifdef MACH
|
||||
ifndef NO_BUILDSTATUS_MESSAGES
|
||||
define BUILDSTATUS
|
||||
@ -1453,9 +1457,9 @@ endif
|
||||
# file would be $(DIST)/include/bar/baz/qux.h instead of $(DIST)/include/qux.h
|
||||
|
||||
# If we're using binary nsinstall and it's not built yet, fallback to python nsinstall.
|
||||
ifneq (,$(filter $(CONFIG_TOOLS)/nsinstall$(HOST_BIN_SUFFIX),$(install_cmd)))
|
||||
ifeq (,$(wildcard $(CONFIG_TOOLS)/nsinstall$(HOST_BIN_SUFFIX)))
|
||||
nsinstall_is_usable = $(if $(wildcard $(CONFIG_TOOLS)/nsinstall$(HOST_BIN_SUFFIX)),yes)
|
||||
ifneq (,$(filter $(DIST)/bin/nsinstall$(HOST_BIN_SUFFIX),$(install_cmd)))
|
||||
ifeq (,$(wildcard $(DIST)/bin/nsinstall$(HOST_BIN_SUFFIX)))
|
||||
nsinstall_is_usable = $(if $(wildcard $(DIST)/bin/nsinstall$(HOST_BIN_SUFFIX)),yes)
|
||||
|
||||
define install_cmd_override
|
||||
$(1): install_cmd = $$(if $$(nsinstall_is_usable),$$(INSTALL),$$(NSINSTALL_PY)) $$(1)
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
DEHYDRA_SCRIPT = $(topsrcdir)/config/static-checking.js
|
||||
|
||||
ifndef BUILDING_JS
|
||||
DEHYDRA_MODULES = \
|
||||
$(topsrcdir)/xpcom/analysis/final.js \
|
||||
$(topsrcdir)/xpcom/analysis/must-override.js \
|
||||
@ -17,9 +18,13 @@ TREEHYDRA_MODULES = \
|
||||
$(topsrcdir)/xpcom/analysis/stack.js \
|
||||
$(topsrcdir)/xpcom/analysis/flow.js \
|
||||
$(topsrcdir)/xpcom/analysis/static-init.js \
|
||||
$(topsrcdir)/js/src/jsstack.js \
|
||||
$(topsrcdir)/layout/generic/frame-verify.js \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
TREEHYDRA_MODULES += \
|
||||
$(topsrcdir)/js/src/jsstack.js \
|
||||
$(NULL)
|
||||
|
||||
DEHYDRA_ARG_PREFIX=-fplugin-arg-gcc_treehydra-
|
||||
|
||||
@ -38,7 +43,11 @@ OS_CXXFLAGS += $(DEHYDRA_FLAGS)
|
||||
endif
|
||||
|
||||
ifdef ENABLE_CLANG_PLUGIN
|
||||
ifndef BUILDING_JS
|
||||
CLANG_PLUGIN := $(DEPTH)/build/clang-plugin/$(DLL_PREFIX)clang-plugin$(DLL_SUFFIX)
|
||||
else
|
||||
CLANG_PLUGIN := $(DEPTH)/../../build/clang-plugin/$(DLL_PREFIX)clang-plugin$(DLL_SUFFIX)
|
||||
endif
|
||||
OS_CXXFLAGS += -Xclang -load -Xclang $(CLANG_PLUGIN) -Xclang -add-plugin -Xclang moz-check
|
||||
OS_CFLAGS += -Xclang -load -Xclang $(CLANG_PLUGIN) -Xclang -add-plugin -Xclang moz-check
|
||||
endif
|
||||
|
@ -72,31 +72,6 @@ endif
|
||||
MOZILLA_DTRACE_SRC = $(srcdir)/devtools/javascript-trace.d
|
||||
endif
|
||||
|
||||
backend.RecursiveMakeBackend:
|
||||
@echo 'Build configuration changed. Regenerating backend.'
|
||||
$(PYTHON) config.status
|
||||
|
||||
Makefile: backend.RecursiveMakeBackend
|
||||
@$(TOUCH) $@
|
||||
|
||||
include backend.RecursiveMakeBackend.pp
|
||||
|
||||
default:: backend.RecursiveMakeBackend
|
||||
|
||||
default::
|
||||
$(call py_action,process_install_manifest,--no-remove $(DIST)/include _build_manifests/install/dist_include)
|
||||
|
||||
ifneq (,$(CROSS_COMPILE)$(filter-out WINNT OS2,$(OS_ARCH)))
|
||||
# nsinstall doesn't get built until we enter config/ in the exports phase,
|
||||
# so we'll have to manually ensure it gets built here if we want to use
|
||||
# $(EXPORTS)
|
||||
export:: config/nsinstall$(HOST_BIN_SUFFIX)
|
||||
$(PUBLIC) $(SDK_PUBLIC): config/nsinstall$(HOST_BIN_SUFFIX)
|
||||
|
||||
config/nsinstall$(HOST_BIN_SUFFIX): $(srcdir)/config/nsinstall.c $(srcdir)/config/pathsub.c
|
||||
$(MAKE) -C config/ nsinstall$(HOST_BIN_SUFFIX)
|
||||
endif
|
||||
|
||||
# Ensure symbol versions of shared library on Linux do not conflict
|
||||
# with those in libxul.
|
||||
ifeq (Linux,$(OS_TARGET))
|
||||
@ -135,16 +110,16 @@ ifdef ENABLE_INTL_API
|
||||
ifdef MOZ_SHARED_ICU
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
ifdef JS_SHARED_LIBRARY
|
||||
ICU_FILES := $(foreach libname,$(ICU_LIB_NAMES),intl/icu/target/lib/$(libname)$(ICU_LIB_SUFFIX)$(MOZ_ICU_VERSION).dll)
|
||||
ICU_FILES := $(foreach libname,$(ICU_LIB_NAMES),$(DEPTH)/intl/icu/target/lib/$(libname)$(ICU_LIB_SUFFIX)$(MOZ_ICU_VERSION).dll)
|
||||
endif
|
||||
else # ! WINNT
|
||||
ifeq ($(OS_ARCH),Darwin)
|
||||
ifdef JS_SHARED_LIBRARY
|
||||
ICU_FILES := $(foreach libname,$(ICU_LIB_NAMES),intl/icu/target/lib/$(DLL_PREFIX)$(libname).$(MOZ_ICU_VERSION)$(DLL_SUFFIX))
|
||||
ICU_FILES := $(foreach libname,$(ICU_LIB_NAMES),$(DEPTH)/intl/icu/target/lib/$(DLL_PREFIX)$(libname).$(MOZ_ICU_VERSION)$(DLL_SUFFIX))
|
||||
endif
|
||||
else # ! Darwin
|
||||
ifdef JS_SHARED_LIBRARY
|
||||
ICU_FILES := $(foreach libname,$(ICU_LIB_NAMES),intl/icu/target/lib/$(DLL_PREFIX)$(libname)$(DLL_SUFFIX).$(MOZ_ICU_VERSION))
|
||||
ICU_FILES := $(foreach libname,$(ICU_LIB_NAMES),$(DEPTH)/intl/icu/target/lib/$(DLL_PREFIX)$(libname)$(DLL_SUFFIX).$(MOZ_ICU_VERSION))
|
||||
endif
|
||||
endif
|
||||
endif # WINNT
|
||||
@ -157,7 +132,7 @@ ifdef ENABLE_INTL_API
|
||||
else # !MOZ_SHARED_ICU
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
ICU_LIB_RENAME = $(foreach libname,$(ICU_LIB_NAMES),\
|
||||
cp -p intl/icu/target/lib/s$(libname)$(ICU_LIB_SUFFIX).lib intl/icu/target/lib/$(libname).lib;)
|
||||
cp -p $(DEPTH)/intl/icu/target/lib/s$(libname)$(ICU_LIB_SUFFIX).lib $(DEPTH)/intl/icu/target/lib/$(libname).lib;)
|
||||
endif
|
||||
endif # MOZ_SHARED_ICU
|
||||
endif # !MOZ_NATIVE_ICU
|
||||
@ -191,8 +166,8 @@ ifdef MOZ_NATIVE_ICU
|
||||
LOCAL_INCLUDES += $(MOZ_ICU_CFLAGS)
|
||||
else
|
||||
LOCAL_INCLUDES += \
|
||||
-I$(topsrcdir)/../../intl/icu/source/common \
|
||||
-I$(topsrcdir)/../../intl/icu/source/i18n \
|
||||
-I$(topsrcdir)/intl/icu/source/common \
|
||||
-I$(topsrcdir)/intl/icu/source/i18n \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
@ -232,16 +207,16 @@ endif
|
||||
buildicu:
|
||||
# ICU's build system is full of races, so force non-parallel build.
|
||||
ifdef CROSS_COMPILE
|
||||
+$(ICU_MAKE) -j1 -C intl/icu/host STATIC_O=$(OBJ_SUFFIX) GENRBOPTS='-k -R -C'
|
||||
+$(ICU_MAKE) -j1 -C $(DEPTH)/intl/icu/host STATIC_O=$(OBJ_SUFFIX) GENRBOPTS='-k -R -C'
|
||||
endif
|
||||
+$(ICU_MAKE) -j1 -C intl/icu/target STATIC_O=$(OBJ_SUFFIX) GENRBOPTS='-k -R'
|
||||
+$(ICU_MAKE) -j1 -C $(DEPTH)/intl/icu/target STATIC_O=$(OBJ_SUFFIX) GENRBOPTS='-k -R'
|
||||
$(ICU_LIB_RENAME)
|
||||
|
||||
distclean clean::
|
||||
ifdef CROSS_COMPILE
|
||||
$(call SUBMAKE,$@,intl/icu/host)
|
||||
$(call SUBMAKE,$@,$(DEPTH)/intl/icu/host)
|
||||
endif
|
||||
$(call SUBMAKE,$@,intl/icu/target)
|
||||
$(call SUBMAKE,$@,$(DEPTH)/intl/icu/target)
|
||||
|
||||
endif
|
||||
endif
|
||||
@ -254,12 +229,12 @@ endif
|
||||
# check_vanilla_allocations.py is tailored to Linux, so only run it there.
|
||||
# That should be enough to catch any problems.
|
||||
check-vanilla-allocations:
|
||||
$(PYTHON) $(srcdir)/config/check_vanilla_allocations.py $(REAL_LIBRARY)
|
||||
$(PYTHON) $(topsrcdir)/config/check_vanilla_allocations.py $(REAL_LIBRARY)
|
||||
|
||||
# The "aggressive" variant will likely fail on some compiler/platform
|
||||
# combinations, but is worth running by hand every once in a while.
|
||||
check-vanilla-allocations-aggressive:
|
||||
$(PYTHON) $(srcdir)/config/check_vanilla_allocations.py --aggressive $(REAL_LIBRARY)
|
||||
$(PYTHON) $(topsrcdir)/config/check_vanilla_allocations.py --aggressive $(REAL_LIBRARY)
|
||||
|
||||
ifeq ($(OS_ARCH),Linux)
|
||||
check:: check-vanilla-allocations
|
||||
@ -269,7 +244,7 @@ endif
|
||||
# If the number of OOM errors changes, update the number below. We intend this
|
||||
# number to go down over time, by fixing OOMs.
|
||||
check-ooms:
|
||||
$(wildcard $(RUN_TEST_PROGRAM)) $(PYTHON) -u $(srcdir)/config/find_OOM_errors.py --regression 125
|
||||
$(wildcard $(RUN_TEST_PROGRAM)) $(PYTHON) -u $(topsrcdir)/config/find_OOM_errors.py --regression 125
|
||||
|
||||
ifeq ($(MOZ_DEBUG),1)
|
||||
#check:: check-ooms
|
||||
@ -289,7 +264,7 @@ endif
|
||||
endif
|
||||
|
||||
check-style::
|
||||
(cd $(srcdir) && $(PYTHON) config/check_spidermonkey_style.py);
|
||||
(cd $(srcdir) && $(PYTHON) $(topsrcdir)/config/check_spidermonkey_style.py);
|
||||
|
||||
check-jit-test::
|
||||
$(JITTEST_ASAN_ENV) $(wildcard $(RUN_TEST_PROGRAM)) $(PYTHON) -u $(srcdir)/jit-test/jit_test.py \
|
||||
|
9
js/src/aclocal.m4
vendored
9
js/src/aclocal.m4
vendored
@ -31,4 +31,13 @@ builtin(include, ../../build/autoconf/python-virtualenv.m4)dnl
|
||||
builtin(include, ../../build/autoconf/winsdk.m4)dnl
|
||||
builtin(include, ../../build/autoconf/icu.m4)dnl
|
||||
|
||||
define([__MOZ_AC_INIT_PREPARE], defn([AC_INIT_PREPARE]))
|
||||
define([AC_INIT_PREPARE],
|
||||
[if test -z "$srcdir"; then
|
||||
srcdir=`dirname "[$]0"`
|
||||
fi
|
||||
srcdir="$srcdir/../.."
|
||||
__MOZ_AC_INIT_PREPARE($1)
|
||||
])
|
||||
|
||||
MOZ_PROG_CHECKMSYS()
|
||||
|
@ -1 +0,0 @@
|
||||
*.pyc
|
@ -1,20 +0,0 @@
|
||||
#!/bin/sh
|
||||
# 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/.
|
||||
|
||||
|
||||
args=""
|
||||
|
||||
for i in "${@}"
|
||||
do
|
||||
case "$i" in
|
||||
-I?:/*)
|
||||
i="$(echo "${i}" | sed -e 's|^-I\(.\):/|-I/\1/|')"
|
||||
;;
|
||||
esac
|
||||
|
||||
args="${args} '${i}'"
|
||||
done
|
||||
|
||||
eval "exec perl $args"
|
@ -1,24 +0,0 @@
|
||||
#!/bin/bash
|
||||
# this script creates a wrapper shell script for an executable. The idea is the actual executable cannot be
|
||||
# executed natively (it was cross compiled), but we want to run tests natively. Running this script
|
||||
# as part of the compilation process will move the non-native executable to a new location, and replace it
|
||||
# with a script that will run it under qemu.
|
||||
while [[ -n $1 ]]; do
|
||||
case $1 in
|
||||
--qemu) QEMU="$2"; shift 2;;
|
||||
--libdir) LIBDIR="$2"; shift 2;;
|
||||
--ld) LD="$2"; shift 2;;
|
||||
*) exe="$1"; shift;;
|
||||
esac
|
||||
done
|
||||
if [[ -z $LIBDIR ]]; then
|
||||
echo "You need to specify a directory for the cross libraries when you configure the shell"
|
||||
echo "You can do this with --with-cross-lib="
|
||||
exit 1
|
||||
fi
|
||||
LD=${LD:-$LIBDIR/ld-linux.so.3}
|
||||
mv $exe $exe.target
|
||||
# Just hardcode the path to the executable. It'll be pretty obvious if it is doing the wrong thing.
|
||||
|
||||
echo $'#!/bin/bash\n' $QEMU -E LD_LIBRARY_PATH="${LIBDIR}" "$LD" "$(readlink -f "$exe.target")" '"$@"' >"$exe"
|
||||
chmod +x $exe
|
@ -1,124 +0,0 @@
|
||||
# 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/.
|
||||
|
||||
# This script is used to capture the content of config.status-generated
|
||||
# files and subsequently restore their timestamp if they haven't changed.
|
||||
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import pickle
|
||||
|
||||
class File(object):
|
||||
def __init__(self, path):
|
||||
self._path = path
|
||||
self._content = open(path, 'rb').read()
|
||||
stat = os.stat(path)
|
||||
self._times = (stat.st_atime, stat.st_mtime)
|
||||
|
||||
def update_time(self):
|
||||
'''If the file hasn't changed since the instance was created,
|
||||
restore its old modification time.'''
|
||||
if not os.path.exists(self._path):
|
||||
return
|
||||
if open(self._path, 'rb').read() == self._content:
|
||||
os.utime(self._path, self._times)
|
||||
|
||||
|
||||
# As defined in the various sub-configures in the tree
|
||||
PRECIOUS_VARS = set([
|
||||
'build_alias',
|
||||
'host_alias',
|
||||
'target_alias',
|
||||
'CC',
|
||||
'CFLAGS',
|
||||
'LDFLAGS',
|
||||
'LIBS',
|
||||
'CPPFLAGS',
|
||||
'CPP',
|
||||
'CCC',
|
||||
'CXXFLAGS',
|
||||
'CXX',
|
||||
'CCASFLAGS',
|
||||
'CCAS',
|
||||
])
|
||||
|
||||
|
||||
# Autoconf, in some of the sub-configures used in the tree, likes to error
|
||||
# out when "precious" variables change in value. The solution it gives to
|
||||
# straighten things is to either run make distclean or remove config.cache.
|
||||
# There's no reason not to do the latter automatically instead of failing,
|
||||
# doing the cleanup (which, on buildbots means a full clobber), and
|
||||
# restarting from scratch.
|
||||
def maybe_clear_cache():
|
||||
comment = re.compile(r'^\s+#')
|
||||
cache = {}
|
||||
with open('config.cache') as f:
|
||||
for line in f.readlines():
|
||||
if not comment.match(line) and '=' in line:
|
||||
key, value = line.split('=', 1)
|
||||
cache[key] = value
|
||||
for precious in PRECIOUS_VARS:
|
||||
entry = 'ac_cv_env_%s_value' % precious
|
||||
if entry in cache and (not precious in os.environ or os.environ[precious] != cache[entry]):
|
||||
os.remove('config.cache')
|
||||
return
|
||||
|
||||
|
||||
def dump(dump_file, shell):
|
||||
if os.path.exists('config.cache'):
|
||||
maybe_clear_cache()
|
||||
if not os.path.exists('config.status'):
|
||||
if os.path.exists(dump_file):
|
||||
os.remove(dump_file)
|
||||
return
|
||||
|
||||
config_files = [File('config.status')]
|
||||
|
||||
# Scan the config.status output for information about configuration files
|
||||
# it generates.
|
||||
config_status_output = subprocess.check_output(
|
||||
[shell, '-c', './config.status --help'],
|
||||
stderr=subprocess.STDOUT).splitlines()
|
||||
state = None
|
||||
for line in config_status_output:
|
||||
if line.startswith('Configuration') and line.endswith(':'):
|
||||
state = 'config'
|
||||
elif not line.startswith(' '):
|
||||
state = None
|
||||
elif state == 'config':
|
||||
for f in (couple.split(':')[0] for couple in line.split()):
|
||||
if os.path.isfile(f):
|
||||
config_files.append(File(f))
|
||||
|
||||
with open(dump_file, 'wb') as f:
|
||||
pickle.dump(config_files, f)
|
||||
|
||||
|
||||
def adjust(dump_file):
|
||||
if not os.path.exists(dump_file):
|
||||
return
|
||||
|
||||
config_files = []
|
||||
|
||||
try:
|
||||
with open(dump_file, 'rb') as f:
|
||||
config_files = pickle.load(f)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
for f in config_files:
|
||||
f.update_time()
|
||||
|
||||
os.remove(dump_file)
|
||||
|
||||
|
||||
CONFIG_DUMP = 'config_files.pkl'
|
||||
|
||||
if __name__ == '__main__':
|
||||
if sys.argv[1] == 'dump':
|
||||
dump(CONFIG_DUMP, sys.argv[2])
|
||||
elif sys.argv[1] == 'adjust':
|
||||
adjust(CONFIG_DUMP)
|
@ -1,33 +0,0 @@
|
||||
import pymake.data
|
||||
import pymake.parser
|
||||
import pymake.parserdata
|
||||
import sys
|
||||
|
||||
'''
|
||||
Modifies the output of Sun Studio's -xM to look more like the output
|
||||
of gcc's -MD -MP, adding phony targets for dependencies.
|
||||
'''
|
||||
|
||||
|
||||
def add_phony_targets(path):
|
||||
print path
|
||||
deps = set()
|
||||
targets = set()
|
||||
for stmt in pymake.parser.parsefile(path):
|
||||
if isinstance(stmt, pymake.parserdata.Rule):
|
||||
assert isinstance(stmt.depexp, pymake.data.StringExpansion)
|
||||
assert isinstance(stmt.targetexp, pymake.data.StringExpansion)
|
||||
for d in stmt.depexp.s.split():
|
||||
deps.add(d)
|
||||
for t in stmt.targetexp.s.split():
|
||||
targets.add(t)
|
||||
phony_targets = deps - targets
|
||||
if not phony_targets:
|
||||
return
|
||||
with open(path, 'a') as f:
|
||||
f.writelines('%s:\n' % d for d in phony_targets)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
for f in sys.argv[1:]:
|
||||
add_phony_targets(f)
|
@ -1,2 +0,0 @@
|
||||
#include_next <bits/c++config.h>
|
||||
#undef _GLIBCXX_USE_FLOAT128
|
@ -1,25 +0,0 @@
|
||||
#!/bin/sh
|
||||
# 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/.
|
||||
|
||||
#
|
||||
# Usage from makefile:
|
||||
# ELOG = . $(topdir)/build/autoconf/print-failed-commands.sh
|
||||
# $(ELOG) $(CC) $CFLAGS -o $@ $<
|
||||
#
|
||||
# This shell script is used by the build system to print out commands that fail
|
||||
# to execute properly. It is designed to make the "make -s" command more
|
||||
# useful.
|
||||
#
|
||||
# Note that in the example we are sourcing rather than execing the script.
|
||||
# Since make already started a shell for us, we might as well use it rather
|
||||
# than starting a new one.
|
||||
|
||||
( exec "$@" ) || {
|
||||
echo
|
||||
echo "In the directory " `pwd`
|
||||
echo "The following command failed to execute properly:"
|
||||
echo "$@"
|
||||
exit 1;
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
# 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/.
|
||||
|
||||
##----------------------------##
|
||||
##---] CORE/CPAN INCLUDES [---##
|
||||
##----------------------------##
|
||||
use strict;
|
||||
use warnings;
|
||||
use Getopt::Long;
|
||||
|
||||
##-------------------##
|
||||
##---] EXPORTS [---##
|
||||
##-------------------##
|
||||
our $VERSION = qw(1.1);
|
||||
|
||||
##-------------------##
|
||||
##---] GLOBALS [---##
|
||||
##-------------------##
|
||||
my %argv;
|
||||
my $modver = $Getopt::Long::VERSION || 0;
|
||||
my $isOldGetopt = ($modver eq '2.25') ? 1 : 0;
|
||||
|
||||
###########################################################################
|
||||
## Intent: Script init function
|
||||
###########################################################################
|
||||
sub init
|
||||
{
|
||||
if ($isOldGetopt)
|
||||
{
|
||||
# mozilla.build/mingw perl in need of an upgrade
|
||||
# emulate Getopt::Long switch|short:init
|
||||
foreach (qw(debug regex sort))
|
||||
{
|
||||
if (defined($argv{$_}))
|
||||
{
|
||||
$argv{$_} ||= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} # init
|
||||
|
||||
##----------------##
|
||||
##---] MAIN [---##
|
||||
##----------------##
|
||||
my @args = ($isOldGetopt)
|
||||
? qw(debug|d regex|r sort|s)
|
||||
: qw(debug|d:1 regex|r:1 sort|s:1)
|
||||
;
|
||||
|
||||
unless(GetOptions(\%argv, @args))
|
||||
{
|
||||
print "Usage: $0\n";
|
||||
print " --sort Sort list elements early\n";
|
||||
print " --regex Exclude subdirs by pattern\n";
|
||||
}
|
||||
|
||||
init();
|
||||
my $debug = $argv{debug} || 0;
|
||||
|
||||
my %seen;
|
||||
my @out;
|
||||
my @in = ($argv{sort}) ? sort @ARGV : @ARGV;
|
||||
|
||||
foreach my $d (@in)
|
||||
{
|
||||
next if ($seen{$d}++);
|
||||
|
||||
print " arg is $d\n" if ($debug);
|
||||
|
||||
if ($argv{regex})
|
||||
{
|
||||
my $found = 0;
|
||||
foreach my $dir (@out)
|
||||
{
|
||||
my $dirM = quotemeta($dir);
|
||||
$found++, last if ($d eq $dir || $d =~ m!^${dirM}\/!);
|
||||
}
|
||||
print "Adding $d\n" if ($debug && !$found);
|
||||
push @out, $d if (!$found);
|
||||
} else {
|
||||
print "Adding: $d\n" if ($debug);
|
||||
push(@out, $d);
|
||||
}
|
||||
}
|
||||
|
||||
print "@out\n"
|
||||
|
||||
# EOF
|
@ -1,44 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
# 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/.
|
||||
|
||||
# Usage: pgomerge.py <binary basename> <dist/bin>
|
||||
# Gathers .pgc files from dist/bin and merges them into
|
||||
# $PWD/$basename.pgd using pgomgr, then deletes them.
|
||||
# No errors if any of these files don't exist.
|
||||
|
||||
import sys, os, os.path, subprocess
|
||||
if not sys.platform == "win32":
|
||||
raise Exception("This script was only meant for Windows.")
|
||||
|
||||
def MergePGOFiles(basename, pgddir, pgcdir):
|
||||
"""Merge pgc files produced from an instrumented binary
|
||||
into the pgd file for the second pass of profile-guided optimization
|
||||
with MSVC. |basename| is the name of the DLL or EXE without the
|
||||
extension. |pgddir| is the path that contains <basename>.pgd
|
||||
(should be the objdir it was built in). |pgcdir| is the path
|
||||
containing basename!N.pgc files, which is probably dist/bin.
|
||||
Calls pgomgr to merge each pgc file into the pgd, then deletes
|
||||
the pgc files."""
|
||||
if not os.path.isdir(pgddir) or not os.path.isdir(pgcdir):
|
||||
return
|
||||
pgdfile = os.path.abspath(os.path.join(pgddir, basename + ".pgd"))
|
||||
if not os.path.isfile(pgdfile):
|
||||
return
|
||||
for file in os.listdir(pgcdir):
|
||||
if file.startswith(basename+"!") and file.endswith(".pgc"):
|
||||
try:
|
||||
pgcfile = os.path.normpath(os.path.join(pgcdir, file))
|
||||
subprocess.call(['pgomgr', '-merge',
|
||||
pgcfile,
|
||||
pgdfile])
|
||||
os.remove(pgcfile)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) != 3:
|
||||
print >>sys.stderr, "Usage: pgomerge.py <binary basename> <dist/bin>"
|
||||
sys.exit(1)
|
||||
MergePGOFiles(sys.argv[1], os.getcwd(), sys.argv[2])
|
@ -1,47 +0,0 @@
|
||||
#
|
||||
# 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/.
|
||||
|
||||
# IMPORTANT: Disable NSBUILDROOT for this directory only, otherwise we have
|
||||
# a recursive rule for finding nsinstall and the Perl scripts.
|
||||
ifdef NSBUILDROOT
|
||||
override NSBUILDROOT :=
|
||||
endif
|
||||
|
||||
ifdef GNU_CC
|
||||
MODULE_OPTIMIZE_FLAGS = -O3
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
ifneq (WINNT,$(HOST_OS_ARCH))
|
||||
# Ensure nsinstall is atomically created
|
||||
nsinstall$(HOST_BIN_SUFFIX): $(HOST_PROGRAM)
|
||||
cp $^ $@.tmp
|
||||
mv $@.tmp $@
|
||||
|
||||
NSINSTALL_FILES := nsinstall$(HOST_BIN_SUFFIX)
|
||||
NSINSTALL_DEST := $(DIST)/bin
|
||||
NSINSTALL_TARGET := export
|
||||
INSTALL_TARGETS += NSINSTALL
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
HOST_CFLAGS += -DUNICODE -D_UNICODE
|
||||
|
||||
ifdef WRAP_SYSTEM_INCLUDES
|
||||
export:: \
|
||||
$(call mkdir_deps,system_wrappers_js) \
|
||||
$(NULL)
|
||||
$(PYTHON) -m mozbuild.action.preprocessor $(DEFINES) $(ACDEFINES) \
|
||||
$(srcdir)/system-headers | $(PERL) $(srcdir)/make-system-wrappers.pl system_wrappers_js
|
||||
$(INSTALL) system_wrappers_js $(DIST)
|
||||
|
||||
GARBAGE_DIRS += system_wrappers_js
|
||||
endif
|
||||
|
||||
GARBAGE += $(srcdir)/*.pyc *.pyc
|
||||
|
||||
FORCE:
|
@ -1,220 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
# 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/.
|
||||
|
||||
package Moz::Milestone;
|
||||
use strict;
|
||||
|
||||
use vars qw($officialMilestone
|
||||
$milestone);
|
||||
|
||||
local $Moz::Milestone::milestone;
|
||||
local $Moz::Milestone::officialMilestone;
|
||||
|
||||
#
|
||||
# Usage: getOfficialMilestone($milestoneFile)
|
||||
# Returns full milestone (x.x.x.x[ab12pre+])
|
||||
#
|
||||
sub getOfficialMilestone($) {
|
||||
my $mfile = $_[0];
|
||||
open(FILE,"$mfile") ||
|
||||
die ("Can't open $mfile for reading!");
|
||||
|
||||
my $num = <FILE>;
|
||||
while($num =~ /^\s*#/ || $num !~ /^\d/) {
|
||||
$num = <FILE>;
|
||||
}
|
||||
|
||||
close(FILE);
|
||||
if ($num !~ /^\d/) { return; }
|
||||
chomp($num);
|
||||
# Remove extra ^M caused by using dos-mode line-endings
|
||||
chop $num if (substr($num, -1, 1) eq "\r");
|
||||
$Moz::Milestone::officialMilestone = $num;
|
||||
$Moz::Milestone::milestone = &getMilestoneNum;
|
||||
return $num;
|
||||
}
|
||||
|
||||
#
|
||||
# Usage: getMilestoneNum($num)
|
||||
# Returns: milestone without a + if it exists.
|
||||
#
|
||||
sub getMilestoneNum {
|
||||
if (defined($Moz::Milestone::milestone)) {
|
||||
return $Moz::Milestone::milestone;
|
||||
}
|
||||
|
||||
if (defined($Moz::Milestone::officialMilestone)) {
|
||||
$Moz::Milestone::milestone = $Moz::Milestone::officialMilestone;
|
||||
} else {
|
||||
$Moz::Milestone::milestone = $_[0];
|
||||
}
|
||||
|
||||
if ($Moz::Milestone::milestone =~ /\+$/) { # for x.x.x+, strip off the +
|
||||
$Moz::Milestone::milestone =~ s/\+$//;
|
||||
}
|
||||
|
||||
return $Moz::Milestone::milestone;
|
||||
}
|
||||
|
||||
#
|
||||
# Usage: getMilestoneQualifier($num)
|
||||
# Returns: + if it exists.
|
||||
#
|
||||
sub getMilestoneQualifier {
|
||||
my $milestoneQualifier;
|
||||
if (defined($Moz::Milestone::officialMilestone)) {
|
||||
$milestoneQualifier = $Moz::Milestone::officialMilestone;
|
||||
} else {
|
||||
$milestoneQualifier = $_[0];
|
||||
}
|
||||
|
||||
if ($milestoneQualifier =~ /\+$/) {
|
||||
return "+";
|
||||
}
|
||||
}
|
||||
|
||||
sub getMilestoneMajor {
|
||||
my $milestoneMajor;
|
||||
if (defined($Moz::Milestone::milestone)) {
|
||||
$milestoneMajor = $Moz::Milestone::milestone;
|
||||
} else {
|
||||
$milestoneMajor = $_[0];
|
||||
}
|
||||
my @parts = split(/\./,$milestoneMajor);
|
||||
return $parts[0];
|
||||
}
|
||||
|
||||
sub getMilestoneMinor {
|
||||
my $milestoneMinor;
|
||||
if (defined($Moz::Milestone::milestone)) {
|
||||
$milestoneMinor = $Moz::Milestone::milestone;
|
||||
} else {
|
||||
$milestoneMinor = $_[0];
|
||||
}
|
||||
my @parts = split(/\./,$milestoneMinor);
|
||||
|
||||
if ($#parts < 1 ) { return 0; }
|
||||
return $parts[1];
|
||||
}
|
||||
|
||||
sub getMilestoneMini {
|
||||
my $milestoneMini;
|
||||
if (defined($Moz::Milestone::milestone)) {
|
||||
$milestoneMini = $Moz::Milestone::milestone;
|
||||
} else {
|
||||
$milestoneMini = $_[0];
|
||||
}
|
||||
my @parts = split(/\./,$milestoneMini);
|
||||
|
||||
if ($#parts < 2 ) { return 0; }
|
||||
return $parts[2];
|
||||
}
|
||||
|
||||
sub getMilestoneMicro {
|
||||
my $milestoneMicro;
|
||||
if (defined($Moz::Milestone::milestone)) {
|
||||
$milestoneMicro = $Moz::Milestone::milestone;
|
||||
} else {
|
||||
$milestoneMicro = $_[0];
|
||||
}
|
||||
my @parts = split(/\./,$milestoneMicro);
|
||||
|
||||
if ($#parts < 3 ) { return 0; }
|
||||
return $parts[3];
|
||||
}
|
||||
|
||||
sub getMilestoneAB {
|
||||
my $milestoneAB;
|
||||
if (defined($Moz::Milestone::milestone)) {
|
||||
$milestoneAB = $Moz::Milestone::milestone;
|
||||
} else {
|
||||
$milestoneAB = $_[0];
|
||||
}
|
||||
|
||||
if ($milestoneAB =~ /a/) { return "alpha"; }
|
||||
if ($milestoneAB =~ /b/) { return "beta"; }
|
||||
return "final";
|
||||
}
|
||||
|
||||
#
|
||||
# Usage: getMilestoneABWithNum($milestoneFile)
|
||||
# Returns the alpha and beta tag with its number (a1, a2, b3, ...)
|
||||
#
|
||||
sub getMilestoneABWithNum {
|
||||
my $milestoneABNum;
|
||||
if (defined($Moz::Milestone::milestone)) {
|
||||
$milestoneABNum = $Moz::Milestone::milestone;
|
||||
} else {
|
||||
$milestoneABNum = $_[0];
|
||||
}
|
||||
|
||||
if ($milestoneABNum =~ /([ab]\d+)/) {
|
||||
return $1;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# build_file($template_file,$output_file)
|
||||
#
|
||||
sub build_file($$) {
|
||||
my @FILE;
|
||||
my @MILESTONE_PARTS;
|
||||
my $MINI_VERSION = 0;
|
||||
my $MICRO_VERSION = 0;
|
||||
my $OFFICIAL = 0;
|
||||
my $QUALIFIER = "";
|
||||
|
||||
if (!defined($Moz::Milestone::milestone)) { die("$0: no milestone file set!\n"); }
|
||||
@MILESTONE_PARTS = split(/\./, &getMilestoneNum);
|
||||
if ($#MILESTONE_PARTS >= 2) {
|
||||
$MINI_VERSION = 1;
|
||||
} else {
|
||||
$MILESTONE_PARTS[2] = 0;
|
||||
}
|
||||
if ($#MILESTONE_PARTS >= 3) {
|
||||
$MICRO_VERSION = 1;
|
||||
} else {
|
||||
$MILESTONE_PARTS[3] = 0;
|
||||
}
|
||||
if (! &getMilestoneQualifier) {
|
||||
$OFFICIAL = 1;
|
||||
} else {
|
||||
$QUALIFIER = "+";
|
||||
}
|
||||
|
||||
if (-e $_[0]) {
|
||||
open(FILE, "$_[0]") || die("$0: Can't open $_[0] for reading!\n");
|
||||
@FILE = <FILE>;
|
||||
close(FILE);
|
||||
|
||||
open(FILE, ">$_[1]") || die("$0: Can't open $_[1] for writing!\n");
|
||||
|
||||
#
|
||||
# There will be more of these based on what we need for files.
|
||||
#
|
||||
foreach(@FILE) {
|
||||
s/__MOZ_MAJOR_VERSION__/$MILESTONE_PARTS[0]/g;
|
||||
s/__MOZ_MINOR_VERSION__/$MILESTONE_PARTS[1]/g;
|
||||
s/__MOZ_MINI_VERSION__/$MILESTONE_PARTS[2]/g;
|
||||
s/__MOZ_MICRO_VERSION__/$MILESTONE_PARTS[3]/g;
|
||||
if ($MINI_VERSION) {
|
||||
s/__MOZ_OPTIONAL_MINI_VERSION__/.$MILESTONE_PARTS[2]/g;
|
||||
}
|
||||
if ($MICRO_VERSION) {
|
||||
s/__MOZ_OPTIONAL_MICRO_VERSION__/.$MILESTONE_PARTS[3]/g;
|
||||
}
|
||||
|
||||
print FILE $_;
|
||||
}
|
||||
close(FILE);
|
||||
} else {
|
||||
die("$0: $_[0] doesn't exist for autoversioning!\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
1;
|
@ -1,6 +0,0 @@
|
||||
ifndef INCLUDED_AUTOCONF_MK
|
||||
INCLUDED_AUTOCONF_MK = 1
|
||||
include $(DEPTH)/config/emptyvars.mk
|
||||
@ALLSUBSTS@
|
||||
include $(topsrcdir)/config/baseconfig.mk
|
||||
endif
|
@ -1,42 +0,0 @@
|
||||
installdir = $(libdir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
|
||||
sdkdir = $(libdir)/$(MOZ_APP_NAME)-devel-$(MOZ_APP_VERSION)
|
||||
|
||||
ifneq (,$(filter /%,$(TOP_DIST)))
|
||||
DIST = $(TOP_DIST)
|
||||
else
|
||||
ifeq (.,$(DEPTH))
|
||||
DIST = $(TOP_DIST)
|
||||
else
|
||||
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)
|
||||
|
||||
ifeq ($(HOST_OS_ARCH),WINNT)
|
||||
# We only support building with pymake or a non-msys gnu make version
|
||||
# strictly above 4.0.
|
||||
ifndef .PYMAKE
|
||||
ifeq (a,$(firstword a$(subst /, ,$(abspath .))))
|
||||
$(error MSYS make is not supported)
|
||||
endif
|
||||
# 4.0- happens to be greater than 4.0, lower than the mozmake version,
|
||||
# and lower than 4.0.1 or 4.1, whatever next version of gnu make will
|
||||
# be released.
|
||||
ifneq (4.0-,$(firstword $(sort 4.0- $(MAKE_VERSION))))
|
||||
$(error Make version too old. Only versions strictly greater than 4.0 are supported.)
|
||||
endif
|
||||
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
|
@ -1,108 +0,0 @@
|
||||
# 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/.
|
||||
|
||||
# check-sync-dirs.py --- check that one directory is an exact subset of another
|
||||
#
|
||||
# Usage: python check-sync-dirs.py COPY ORIGINAL
|
||||
#
|
||||
# Check that the files present in the directory tree COPY are exact
|
||||
# copies of their counterparts in the directory tree ORIGINAL. COPY
|
||||
# need not have all the files in ORIGINAL, but COPY may not have files
|
||||
# absent from ORIGINAL.
|
||||
#
|
||||
# Each directory in COPY may have a file named
|
||||
# 'check-sync-exceptions', which lists files in COPY that need not be
|
||||
# the same as the corresponding file in ORIGINAL, or exist at all in
|
||||
# ORIGINAL. (The 'check-sync-exceptions' file itself is always
|
||||
# treated as exceptional.) Blank lines and '#' comments in the file
|
||||
# are ignored.
|
||||
|
||||
import sys
|
||||
import os
|
||||
from os.path import join
|
||||
import filecmp
|
||||
import textwrap
|
||||
import fnmatch
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
print >> sys.stderr, 'TEST-UNEXPECTED-FAIL | check-sync-dirs.py | Usage: %s COPY ORIGINAL' % sys.argv[0]
|
||||
sys.exit(1)
|
||||
|
||||
copy = os.path.abspath(sys.argv[1])
|
||||
original = os.path.abspath(sys.argv[2])
|
||||
|
||||
# Return the contents of FILENAME, a 'check-sync-exceptions' file, as
|
||||
# a dictionary whose keys are exactly the list of filenames, along
|
||||
# with the basename of FILENAME itself. If FILENAME does not exist,
|
||||
# return the empty dictionary.
|
||||
def read_exceptions(filename):
|
||||
if (os.path.exists(filename)):
|
||||
f = file(filename)
|
||||
exceptions = {}
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
if line != '' and line[0] != '#':
|
||||
exceptions[line] = None
|
||||
exceptions[os.path.basename (filename)] = None
|
||||
f.close()
|
||||
return exceptions
|
||||
else:
|
||||
return {}
|
||||
|
||||
# Return true if FILENAME matches any pattern in the list of filename
|
||||
# patterns PATTERNS.
|
||||
def fnmatch_any(filename, patterns):
|
||||
for pattern in patterns:
|
||||
if fnmatch.fnmatch(filename, pattern):
|
||||
return True
|
||||
return False
|
||||
|
||||
# Check the contents of the directory tree COPY against ORIGINAL. For each
|
||||
# file that differs, apply REPORT to COPY, ORIGINAL, and the file's
|
||||
# relative path. COPY and ORIGINAL should be absolute. Ignore files
|
||||
# that match patterns given in the list IGNORE.
|
||||
def check(copy, original):
|
||||
os.chdir(copy)
|
||||
for (dirpath, dirnames, filenames) in os.walk('.'):
|
||||
exceptions = read_exceptions(join(dirpath, 'check-sync-exceptions'))
|
||||
for dirname in dirnames:
|
||||
if fnmatch_any(dirname, exceptions):
|
||||
dirnames.remove(dirname)
|
||||
break
|
||||
for filename in filenames:
|
||||
if fnmatch_any(filename, exceptions):
|
||||
continue
|
||||
relative_name = join(dirpath, filename)
|
||||
original_name = join(original, relative_name)
|
||||
if (os.path.exists(original_name)
|
||||
and filecmp.cmp(relative_name, original_name, False)):
|
||||
continue
|
||||
report(copy, original, relative_name)
|
||||
|
||||
differences_found = False
|
||||
|
||||
# Print an error message for DIFFERING, which was found to differ
|
||||
# between COPY and ORIGINAL. Set the global variable differences_found.
|
||||
def report(copy, original, differing):
|
||||
global differences_found
|
||||
if not differences_found:
|
||||
print >> sys.stderr, 'TEST-UNEXPECTED-FAIL | check-sync-dirs.py | build file copies are not in sync\n' \
|
||||
'TEST-INFO | check-sync-dirs.py | file(s) found in: %s\n' \
|
||||
'TEST-INFO | check-sync-dirs.py | differ from their originals in: %s' \
|
||||
% (copy, original)
|
||||
print >> sys.stderr, 'TEST-INFO | check-sync-dirs.py | differing file: %s' % differing
|
||||
differences_found = True
|
||||
|
||||
check(copy, original)
|
||||
|
||||
if differences_found:
|
||||
msg = '''In general, the files in '%s' should always be exact copies of
|
||||
originals in '%s'. A change made to one should also be made to the
|
||||
other. See 'check-sync-dirs.py' for more details.''' \
|
||||
% (copy, original)
|
||||
print >> sys.stderr, textwrap.fill(msg, 75)
|
||||
sys.exit(1)
|
||||
|
||||
print >> sys.stderr, 'TEST-PASS | check-sync-dirs.py | %s <= %s' % (copy, original)
|
||||
sys.exit(0)
|
@ -1,27 +0,0 @@
|
||||
Makefile.in
|
||||
Makefile
|
||||
autoconf.mk.in
|
||||
autoconf.mk
|
||||
baseconfig.mk
|
||||
check-sync-dirs.py
|
||||
static-checking-config.mk
|
||||
nsinstall
|
||||
nsinstall.exe
|
||||
host_nsinstall.o
|
||||
host_pathsub.o
|
||||
moz.build
|
||||
|
||||
# This is a copy of nspr's config/make-system-wrappers.pl.
|
||||
make-system-wrappers.pl
|
||||
system_wrappers_js
|
||||
|
||||
# Ignore detritus left lying around by editing tools.
|
||||
*~
|
||||
.#*
|
||||
#*#
|
||||
*.orig
|
||||
*.rej
|
||||
|
||||
# Ignore "compiled" python files
|
||||
*.pyc
|
||||
*.pyo
|
@ -1,57 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# 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/.
|
||||
|
||||
|
||||
# Usage: check_source_count.py SEARCH_TERM COUNT ERROR_LOCATION REPLACEMENT [FILES...]
|
||||
# Checks that FILES contains exactly COUNT matches of SEARCH_TERM. If it does
|
||||
# not, an error message is printed, quoting ERROR_LOCATION, which should
|
||||
# probably be the filename and line number of the erroneous call to
|
||||
# check_source_count.py.
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
|
||||
search_string = sys.argv[1]
|
||||
expected_count = int(sys.argv[2])
|
||||
error_location = sys.argv[3]
|
||||
replacement = sys.argv[4]
|
||||
files = sys.argv[5:]
|
||||
|
||||
details = {}
|
||||
|
||||
count = 0
|
||||
for f in files:
|
||||
text = file(f).read()
|
||||
match = re.findall(search_string, text)
|
||||
if match:
|
||||
num = len(match)
|
||||
count += num
|
||||
details[f] = num
|
||||
|
||||
if count == expected_count:
|
||||
print("TEST-PASS | check_source_count.py {0} | {1}"
|
||||
.format(search_string, expected_count))
|
||||
|
||||
else:
|
||||
print("TEST-UNEXPECTED-FAIL | check_source_count.py {0} | "
|
||||
.format(search_string),
|
||||
end='')
|
||||
if count < expected_count:
|
||||
print("There are fewer occurrences of /{0}/ than expected. "
|
||||
"This may mean that you have removed some, but forgotten to "
|
||||
"account for it {1}.".format(search_string, error_location))
|
||||
else:
|
||||
print("There are more occurrences of /{0}/ than expected. We're trying "
|
||||
"to prevent an increase in the number of {1}'s, using {2} if "
|
||||
"possible. If it is unavoidable, you should update the expected "
|
||||
"count {3}.".format(search_string, search_string, replacement,
|
||||
error_location))
|
||||
|
||||
print("Expected: {0}; found: {1}".format(expected_count, count))
|
||||
for k in sorted(details):
|
||||
print("Found {0} occurences in {1}".format(details[k],k))
|
||||
sys.exit(-1)
|
||||
|
@ -1,588 +0,0 @@
|
||||
# vim: set ts=8 sts=4 et sw=4 tw=99:
|
||||
# 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/.
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# This script checks various aspects of SpiderMonkey code style. The current checks are as
|
||||
# follows.
|
||||
#
|
||||
# We check the following things in headers.
|
||||
#
|
||||
# - No cyclic dependencies.
|
||||
#
|
||||
# - No normal header should #include a inlines.h/-inl.h file.
|
||||
#
|
||||
# - #ifndef wrappers should have the right form. (XXX: not yet implemented)
|
||||
# - Every header file should have one.
|
||||
# - The guard name used should be appropriate for the filename.
|
||||
#
|
||||
# We check the following things in all files.
|
||||
#
|
||||
# - #includes should have full paths, e.g. "jit/Ion.h", not "Ion.h".
|
||||
#
|
||||
# - #includes should use the appropriate form for system headers (<...>) and
|
||||
# local headers ("...").
|
||||
#
|
||||
# - #includes should be ordered correctly.
|
||||
# - Each one should be in the correct section.
|
||||
# - Alphabetical order should be used within sections.
|
||||
# - Sections should be in the right order.
|
||||
# Note that the presence of #if/#endif blocks complicates things, to the
|
||||
# point that it's not always clear where a conditionally-compiled #include
|
||||
# statement should go, even to a human. Therefore, we check the #include
|
||||
# statements within each #if/#endif block (including nested ones) in
|
||||
# isolation, but don't try to do any order checking between such blocks.
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import difflib
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
# We don't bother checking files in these directories, because they're (a) auxiliary or (b)
|
||||
# imported code that doesn't follow our coding style.
|
||||
ignored_js_src_dirs = [
|
||||
'js/src/config/', # auxiliary stuff
|
||||
'js/src/ctypes/libffi/', # imported code
|
||||
'js/src/devtools/', # auxiliary stuff
|
||||
'js/src/editline/', # imported code
|
||||
'js/src/gdb/', # auxiliary stuff
|
||||
'js/src/vtune/' # imported code
|
||||
]
|
||||
|
||||
# We ignore #includes of these files, because they don't follow the usual rules.
|
||||
included_inclnames_to_ignore = set([
|
||||
'ffi.h', # generated in ctypes/libffi/
|
||||
'devtools/sharkctl.h', # we ignore devtools/ in general
|
||||
'devtools/Instruments.h', # we ignore devtools/ in general
|
||||
'double-conversion.h', # strange MFBT case
|
||||
'javascript-trace.h', # generated in $OBJDIR if HAVE_DTRACE is defined
|
||||
'jsautokw.h', # generated in $OBJDIR
|
||||
'jsautooplen.h', # generated in $OBJDIR
|
||||
'jscustomallocator.h', # provided by embedders; allowed to be missing
|
||||
'js-config.h', # generated in $OBJDIR
|
||||
'pratom.h', # NSPR
|
||||
'prcvar.h', # NSPR
|
||||
'prinit.h', # NSPR
|
||||
'prlink.h', # NSPR
|
||||
'prlock.h', # NSPR
|
||||
'prprf.h', # NSPR
|
||||
'prthread.h', # NSPR
|
||||
'prtypes.h', # NSPR
|
||||
'selfhosted.out.h', # generated in $OBJDIR
|
||||
'unicode/locid.h', # ICU
|
||||
'unicode/numsys.h', # ICU
|
||||
'unicode/ucal.h', # ICU
|
||||
'unicode/uclean.h', # ICU
|
||||
'unicode/ucol.h', # ICU
|
||||
'unicode/udat.h', # ICU
|
||||
'unicode/udatpg.h', # ICU
|
||||
'unicode/uenum.h', # ICU
|
||||
'unicode/unum.h', # ICU
|
||||
'unicode/ustring.h', # ICU
|
||||
'unicode/utypes.h', # ICU
|
||||
'vtune/VTuneWrapper.h' # VTune
|
||||
])
|
||||
|
||||
# These files have additional constraints on where they are #included, so we
|
||||
# ignore #includes of them when checking #include ordering.
|
||||
oddly_ordered_inclnames = set([
|
||||
'ctypes/typedefs.h', # Included multiple times in the body of ctypes/CTypes.h
|
||||
'jsautokw.h', # Included in the body of frontend/TokenStream.h
|
||||
'jswin.h', # Must be #included before <psapi.h>
|
||||
'machine/endian.h', # Must be included after <sys/types.h> on BSD
|
||||
'winbase.h', # Must precede other system headers(?)
|
||||
'windef.h' # Must precede other system headers(?)
|
||||
])
|
||||
|
||||
# The files in tests/style/ contain code that fails this checking in various
|
||||
# ways. Here is the output we expect. If the actual output differs from
|
||||
# this, one of the following must have happened.
|
||||
# - New SpiderMonkey code violates one of the checked rules.
|
||||
# - The tests/style/ files have changed without expected_output being changed
|
||||
# accordingly.
|
||||
# - This script has been broken somehow.
|
||||
#
|
||||
expected_output = '''\
|
||||
js/src/tests/style/BadIncludes2.h:1: error:
|
||||
vanilla header includes an inline-header file "tests/style/BadIncludes2-inl.h"
|
||||
|
||||
js/src/tests/style/BadIncludes.h:3: error:
|
||||
the file includes itself
|
||||
|
||||
js/src/tests/style/BadIncludes.h:6: error:
|
||||
"BadIncludes2.h" is included using the wrong path;
|
||||
did you forget a prefix, or is the file not yet committed?
|
||||
|
||||
js/src/tests/style/BadIncludes.h:8: error:
|
||||
<tests/style/BadIncludes2.h> should be included using
|
||||
the #include "..." form
|
||||
|
||||
js/src/tests/style/BadIncludes.h:10: error:
|
||||
"stdio.h" is included using the wrong path;
|
||||
did you forget a prefix, or is the file not yet committed?
|
||||
|
||||
js/src/tests/style/BadIncludesOrder-inl.h:5:6: error:
|
||||
"vm/Interpreter-inl.h" should be included after "jsscriptinlines.h"
|
||||
|
||||
js/src/tests/style/BadIncludesOrder-inl.h:6:7: error:
|
||||
"jsscriptinlines.h" should be included after "js/Value.h"
|
||||
|
||||
js/src/tests/style/BadIncludesOrder-inl.h:7:8: error:
|
||||
"js/Value.h" should be included after "ds/LifoAlloc.h"
|
||||
|
||||
js/src/tests/style/BadIncludesOrder-inl.h:8:9: error:
|
||||
"ds/LifoAlloc.h" should be included after "jsapi.h"
|
||||
|
||||
js/src/tests/style/BadIncludesOrder-inl.h:9:10: error:
|
||||
"jsapi.h" should be included after <stdio.h>
|
||||
|
||||
js/src/tests/style/BadIncludesOrder-inl.h:10:11: error:
|
||||
<stdio.h> should be included after "mozilla/HashFunctions.h"
|
||||
|
||||
js/src/tests/style/BadIncludesOrder-inl.h:27:28: error:
|
||||
"jsobj.h" should be included after "jsfun.h"
|
||||
|
||||
(multiple files): error:
|
||||
header files form one or more cycles
|
||||
|
||||
tests/style/HeaderCycleA1.h
|
||||
-> tests/style/HeaderCycleA2.h
|
||||
-> tests/style/HeaderCycleA3.h
|
||||
-> tests/style/HeaderCycleA1.h
|
||||
|
||||
tests/style/HeaderCycleB1-inl.h
|
||||
-> tests/style/HeaderCycleB2-inl.h
|
||||
-> tests/style/HeaderCycleB3-inl.h
|
||||
-> tests/style/HeaderCycleB4-inl.h
|
||||
-> tests/style/HeaderCycleB1-inl.h
|
||||
-> tests/style/jsheadercycleB5inlines.h
|
||||
-> tests/style/HeaderCycleB1-inl.h
|
||||
-> tests/style/HeaderCycleB4-inl.h
|
||||
|
||||
'''.splitlines(True)
|
||||
|
||||
actual_output = []
|
||||
|
||||
|
||||
def out(*lines):
|
||||
for line in lines:
|
||||
actual_output.append(line + '\n')
|
||||
|
||||
|
||||
def error(filename, linenum, *lines):
|
||||
location = filename
|
||||
if linenum is not None:
|
||||
location += ':' + str(linenum)
|
||||
out(location + ': error:')
|
||||
for line in (lines):
|
||||
out(' ' + line)
|
||||
out('')
|
||||
|
||||
|
||||
class FileKind(object):
|
||||
C = 1
|
||||
CPP = 2
|
||||
INL_H = 3
|
||||
H = 4
|
||||
TBL = 5
|
||||
MSG = 6
|
||||
|
||||
@staticmethod
|
||||
def get(filename):
|
||||
if filename.endswith('.c'):
|
||||
return FileKind.C
|
||||
|
||||
if filename.endswith('.cpp'):
|
||||
return FileKind.CPP
|
||||
|
||||
if filename.endswith(('inlines.h', '-inl.h', 'Inlines.h')):
|
||||
return FileKind.INL_H
|
||||
|
||||
if filename.endswith('.h'):
|
||||
return FileKind.H
|
||||
|
||||
if filename.endswith('.tbl'):
|
||||
return FileKind.TBL
|
||||
|
||||
if filename.endswith('.msg'):
|
||||
return FileKind.MSG
|
||||
|
||||
error(filename, None, 'unknown file kind')
|
||||
|
||||
|
||||
def get_all_filenames():
|
||||
'''Get a list of all the files in the (Mercurial or Git) repository.'''
|
||||
cmds = [['hg', 'manifest', '-q'], ['git', 'ls-files', '--full-name', '../..']]
|
||||
for cmd in cmds:
|
||||
try:
|
||||
all_filenames = subprocess.check_output(cmd, universal_newlines=True,
|
||||
stderr=subprocess.PIPE).split('\n')
|
||||
return all_filenames
|
||||
except:
|
||||
continue
|
||||
else:
|
||||
raise Exception('failed to run any of the repo manifest commands', cmds)
|
||||
|
||||
|
||||
def check_style():
|
||||
# We deal with two kinds of name.
|
||||
# - A "filename" is a full path to a file from the repository root.
|
||||
# - An "inclname" is how a file is referred to in a #include statement.
|
||||
#
|
||||
# Examples (filename -> inclname)
|
||||
# - "mfbt/Attributes.h" -> "mozilla/Attributes.h"
|
||||
# - "js/public/Vector.h" -> "js/Vector.h"
|
||||
# - "js/src/vm/String.h" -> "vm/String.h"
|
||||
|
||||
mfbt_inclnames = set() # type: set(inclname)
|
||||
js_names = dict() # type: dict(filename, inclname)
|
||||
|
||||
# Select the appropriate files.
|
||||
for filename in get_all_filenames():
|
||||
if filename.startswith('mfbt/') and filename.endswith('.h'):
|
||||
inclname = 'mozilla/' + filename[len('mfbt/'):]
|
||||
mfbt_inclnames.add(inclname)
|
||||
|
||||
if filename.startswith('js/public/') and filename.endswith('.h'):
|
||||
inclname = 'js/' + filename[len('js/public/'):]
|
||||
js_names[filename] = inclname
|
||||
|
||||
if filename.startswith('js/src/') and \
|
||||
not filename.startswith(tuple(ignored_js_src_dirs)) and \
|
||||
filename.endswith(('.c', '.cpp', '.h', '.tbl', '.msg')):
|
||||
inclname = filename[len('js/src/'):]
|
||||
js_names[filename] = inclname
|
||||
|
||||
all_inclnames = mfbt_inclnames | set(js_names.values())
|
||||
|
||||
edges = dict() # type: dict(inclname, set(inclname))
|
||||
|
||||
# We don't care what's inside the MFBT files, but because they are
|
||||
# #included from JS files we have to add them to the inclusion graph.
|
||||
for inclname in mfbt_inclnames:
|
||||
edges[inclname] = set()
|
||||
|
||||
# Process all the JS files.
|
||||
for filename in js_names.keys():
|
||||
inclname = js_names[filename]
|
||||
file_kind = FileKind.get(filename)
|
||||
if file_kind == FileKind.C or file_kind == FileKind.CPP or \
|
||||
file_kind == FileKind.H or file_kind == FileKind.INL_H:
|
||||
included_h_inclnames = set() # type: set(inclname)
|
||||
|
||||
# This script is run in js/src/, so prepend '../../' to get to the root of the Mozilla
|
||||
# source tree.
|
||||
with open(os.path.join('../..', filename)) as f:
|
||||
do_file(filename, inclname, file_kind, f, all_inclnames, included_h_inclnames)
|
||||
|
||||
edges[inclname] = included_h_inclnames
|
||||
|
||||
find_cycles(all_inclnames, edges)
|
||||
|
||||
# Compare expected and actual output.
|
||||
difflines = difflib.unified_diff(expected_output, actual_output,
|
||||
fromfile='check_spider_monkey_style.py expected output',
|
||||
tofile='check_spider_monkey_style.py actual output')
|
||||
ok = True
|
||||
for diffline in difflines:
|
||||
ok = False
|
||||
print(diffline, end='')
|
||||
|
||||
return ok
|
||||
|
||||
|
||||
def module_name(name):
|
||||
'''Strip the trailing .cpp, .h, inlines.h or -inl.h from a filename.'''
|
||||
|
||||
return name.replace('inlines.h', '').replace('-inl.h', '').replace('.h', '').replace('.cpp', '')
|
||||
|
||||
|
||||
def is_module_header(enclosing_inclname, header_inclname):
|
||||
'''Determine if an included name is the "module header", i.e. should be
|
||||
first in the file.'''
|
||||
|
||||
module = module_name(enclosing_inclname)
|
||||
|
||||
# Normal case, e.g. module == "foo/Bar", header_inclname == "foo/Bar.h".
|
||||
if module == module_name(header_inclname):
|
||||
return True
|
||||
|
||||
# A public header, e.g. module == "foo/Bar", header_inclname == "js/Bar.h".
|
||||
m = re.match(r'js\/(.*)\.h', header_inclname)
|
||||
if m is not None and module.endswith('/' + m.group(1)):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
class Include(object):
|
||||
'''Important information for a single #include statement.'''
|
||||
|
||||
def __init__(self, inclname, linenum, is_system):
|
||||
self.inclname = inclname
|
||||
self.linenum = linenum
|
||||
self.is_system = is_system
|
||||
|
||||
def isLeaf(self):
|
||||
return True
|
||||
|
||||
def section(self, enclosing_inclname):
|
||||
'''Identify which section inclname belongs to.
|
||||
|
||||
The section numbers are as follows.
|
||||
0. Module header (e.g. jsfoo.h or jsfooinlines.h within jsfoo.cpp)
|
||||
1. mozilla/Foo.h
|
||||
2. <foo.h> or <foo>
|
||||
3. jsfoo.h, prmjtime.h, etc
|
||||
4. foo/Bar.h
|
||||
5. jsfooinlines.h
|
||||
6. foo/Bar-inl.h
|
||||
7. non-.h, e.g. *.tbl, *.msg
|
||||
'''
|
||||
|
||||
if self.is_system:
|
||||
return 2
|
||||
|
||||
if not self.inclname.endswith('.h'):
|
||||
return 7
|
||||
|
||||
# A couple of modules have the .h file in js/ and the .cpp file elsewhere and so need
|
||||
# special handling.
|
||||
if is_module_header(enclosing_inclname, self.inclname):
|
||||
return 0
|
||||
|
||||
if '/' in self.inclname:
|
||||
if self.inclname.startswith('mozilla/'):
|
||||
return 1
|
||||
|
||||
if self.inclname.endswith('-inl.h'):
|
||||
return 6
|
||||
|
||||
return 4
|
||||
|
||||
if self.inclname.endswith('inlines.h'):
|
||||
return 5
|
||||
|
||||
return 3
|
||||
|
||||
def quote(self):
|
||||
if self.is_system:
|
||||
return '<' + self.inclname + '>'
|
||||
else:
|
||||
return '"' + self.inclname + '"'
|
||||
|
||||
|
||||
class HashIfBlock(object):
|
||||
'''Important information about a #if/#endif block.
|
||||
|
||||
A #if/#endif block is the contents of a #if/#endif (or similar) section.
|
||||
The top-level block, which is not within a #if/#endif pair, is also
|
||||
considered a block.
|
||||
|
||||
Each leaf is either an Include (representing a #include), or another
|
||||
nested HashIfBlock.'''
|
||||
def __init__(self):
|
||||
self.kids = []
|
||||
|
||||
def isLeaf(self):
|
||||
return False
|
||||
|
||||
|
||||
def do_file(filename, inclname, file_kind, f, all_inclnames, included_h_inclnames):
|
||||
block_stack = [HashIfBlock()]
|
||||
|
||||
# Extract the #include statements as a tree of IBlocks and IIncludes.
|
||||
for linenum, line in enumerate(f, start=1):
|
||||
# Look for a |#include "..."| line.
|
||||
m = re.match(r'\s*#\s*include\s+"([^"]*)"', line)
|
||||
if m is not None:
|
||||
block_stack[-1].kids.append(Include(m.group(1), linenum, False))
|
||||
|
||||
# Look for a |#include <...>| line.
|
||||
m = re.match(r'\s*#\s*include\s+<([^>]*)>', line)
|
||||
if m is not None:
|
||||
block_stack[-1].kids.append(Include(m.group(1), linenum, True))
|
||||
|
||||
# Look for a |#{if,ifdef,ifndef}| line.
|
||||
m = re.match(r'\s*#\s*(if|ifdef|ifndef)\b', line)
|
||||
if m is not None:
|
||||
# Open a new block.
|
||||
new_block = HashIfBlock()
|
||||
block_stack[-1].kids.append(new_block)
|
||||
block_stack.append(new_block)
|
||||
|
||||
# Look for a |#{elif,else}| line.
|
||||
m = re.match(r'\s*#\s*(elif|else)\b', line)
|
||||
if m is not None:
|
||||
# Close the current block, and open an adjacent one.
|
||||
block_stack.pop()
|
||||
new_block = HashIfBlock()
|
||||
block_stack[-1].kids.append(new_block)
|
||||
block_stack.append(new_block)
|
||||
|
||||
# Look for a |#endif| line.
|
||||
m = re.match(r'\s*#\s*endif\b', line)
|
||||
if m is not None:
|
||||
# Close the current block.
|
||||
block_stack.pop()
|
||||
|
||||
def check_include_statement(include):
|
||||
'''Check the style of a single #include statement.'''
|
||||
|
||||
if include.is_system:
|
||||
# Check it is not a known local file (in which case it's probably a system header).
|
||||
if include.inclname in included_inclnames_to_ignore or \
|
||||
include.inclname in all_inclnames:
|
||||
error(filename, include.linenum,
|
||||
include.quote() + ' should be included using',
|
||||
'the #include "..." form')
|
||||
|
||||
else:
|
||||
if include.inclname not in included_inclnames_to_ignore:
|
||||
included_kind = FileKind.get(include.inclname)
|
||||
|
||||
# Check the #include path has the correct form.
|
||||
if include.inclname not in all_inclnames:
|
||||
error(filename, include.linenum,
|
||||
include.quote() + ' is included ' + 'using the wrong path;',
|
||||
'did you forget a prefix, or is the file not yet committed?')
|
||||
|
||||
# Record inclusions of .h files for cycle detection later.
|
||||
# (Exclude .tbl and .msg files.)
|
||||
elif included_kind == FileKind.H or included_kind == FileKind.INL_H:
|
||||
included_h_inclnames.add(include.inclname)
|
||||
|
||||
# Check a H file doesn't #include an INL_H file.
|
||||
if file_kind == FileKind.H and included_kind == FileKind.INL_H:
|
||||
error(filename, include.linenum,
|
||||
'vanilla header includes an inline-header file ' + include.quote())
|
||||
|
||||
# Check a file doesn't #include itself. (We do this here because the cycle
|
||||
# detection below doesn't detect this case.)
|
||||
if inclname == include.inclname:
|
||||
error(filename, include.linenum, 'the file includes itself')
|
||||
|
||||
def check_includes_order(include1, include2):
|
||||
'''Check the ordering of two #include statements.'''
|
||||
|
||||
if include1.inclname in oddly_ordered_inclnames or \
|
||||
include2.inclname in oddly_ordered_inclnames:
|
||||
return
|
||||
|
||||
section1 = include1.section(inclname)
|
||||
section2 = include2.section(inclname)
|
||||
if (section1 > section2) or \
|
||||
((section1 == section2) and (include1.inclname.lower() > include2.inclname.lower())):
|
||||
error(filename, str(include1.linenum) + ':' + str(include2.linenum),
|
||||
include1.quote() + ' should be included after ' + include2.quote())
|
||||
|
||||
# The #include statements in the files in assembler/ and yarr/ have all manner of implicit
|
||||
# ordering requirements. Boo. Ignore them.
|
||||
skip_order_checking = inclname.startswith(('assembler/', 'yarr/'))
|
||||
|
||||
# Check the extracted #include statements, both individually, and the ordering of
|
||||
# adjacent pairs that live in the same block.
|
||||
def pair_traverse(prev, this):
|
||||
if this.isLeaf():
|
||||
check_include_statement(this)
|
||||
if prev is not None and prev.isLeaf() and not skip_order_checking:
|
||||
check_includes_order(prev, this)
|
||||
else:
|
||||
for prev2, this2 in zip([None] + this.kids[0:-1], this.kids):
|
||||
pair_traverse(prev2, this2)
|
||||
|
||||
pair_traverse(None, block_stack[-1])
|
||||
|
||||
|
||||
def find_cycles(all_inclnames, edges):
|
||||
'''Find and draw any cycles.'''
|
||||
|
||||
SCCs = tarjan(all_inclnames, edges)
|
||||
|
||||
# The various sorted() calls below ensure the output is deterministic.
|
||||
|
||||
def draw_SCC(c):
|
||||
cset = set(c)
|
||||
drawn = set()
|
||||
def draw(v, indent):
|
||||
out(' ' * indent + ('-> ' if indent else ' ') + v)
|
||||
if v in drawn:
|
||||
return
|
||||
drawn.add(v)
|
||||
for succ in sorted(edges[v]):
|
||||
if succ in cset:
|
||||
draw(succ, indent + 1)
|
||||
draw(sorted(c)[0], 0)
|
||||
out('')
|
||||
|
||||
have_drawn_an_SCC = False
|
||||
for scc in sorted(SCCs):
|
||||
if len(scc) != 1:
|
||||
if not have_drawn_an_SCC:
|
||||
error('(multiple files)', None, 'header files form one or more cycles')
|
||||
have_drawn_an_SCC = True
|
||||
|
||||
draw_SCC(scc)
|
||||
|
||||
|
||||
# Tarjan's algorithm for finding the strongly connected components (SCCs) of a graph.
|
||||
# https://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm
|
||||
def tarjan(V, E):
|
||||
vertex_index = {}
|
||||
vertex_lowlink = {}
|
||||
index = 0
|
||||
S = []
|
||||
all_SCCs = []
|
||||
|
||||
def strongconnect(v, index):
|
||||
# Set the depth index for v to the smallest unused index
|
||||
vertex_index[v] = index
|
||||
vertex_lowlink[v] = index
|
||||
index += 1
|
||||
S.append(v)
|
||||
|
||||
# Consider successors of v
|
||||
for w in E[v]:
|
||||
if w not in vertex_index:
|
||||
# Successor w has not yet been visited; recurse on it
|
||||
index = strongconnect(w, index)
|
||||
vertex_lowlink[v] = min(vertex_lowlink[v], vertex_lowlink[w])
|
||||
elif w in S:
|
||||
# Successor w is in stack S and hence in the current SCC
|
||||
vertex_lowlink[v] = min(vertex_lowlink[v], vertex_index[w])
|
||||
|
||||
# If v is a root node, pop the stack and generate an SCC
|
||||
if vertex_lowlink[v] == vertex_index[v]:
|
||||
i = S.index(v)
|
||||
scc = S[i:]
|
||||
del S[i:]
|
||||
all_SCCs.append(scc)
|
||||
|
||||
return index
|
||||
|
||||
for v in V:
|
||||
if v not in vertex_index:
|
||||
index = strongconnect(v, index)
|
||||
|
||||
return all_SCCs
|
||||
|
||||
|
||||
def main():
|
||||
ok = check_style()
|
||||
|
||||
if ok:
|
||||
print('TEST-PASS | check_spidermonkey_style.py | ok')
|
||||
else:
|
||||
print('TEST-UNEXPECTED-FAIL | check_spidermonkey_style.py | actual output does not match expected output; diff is above')
|
||||
|
||||
sys.exit(0 if ok else 1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
@ -1,159 +0,0 @@
|
||||
# vim: set ts=8 sts=4 et sw=4 tw=79:
|
||||
# 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/.
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# All heap allocations in SpiderMonkey must go through js_malloc, js_calloc,
|
||||
# js_realloc, and js_free. This is so that any embedder who uses a custom
|
||||
# allocator (by defining JS_USE_CUSTOM_ALLOCATOR) will see all heap allocation
|
||||
# go through that custom allocator.
|
||||
#
|
||||
# Therefore, the presence of any calls to "vanilla" allocation/free functions
|
||||
# (e.g. malloc(), free()) is a bug.
|
||||
#
|
||||
# This script checks for the presence of such disallowed vanilla
|
||||
# allocation/free function in SpiderMonkey when it's built as a library. It
|
||||
# relies on |nm| from the GNU binutils, and so only works on Linux, but one
|
||||
# platform is good enough to catch almost all violations.
|
||||
#
|
||||
# This checking is only 100% reliable in a JS_USE_CUSTOM_ALLOCATOR build in
|
||||
# which the default definitions of js_malloc et al (in Utility.h) -- which call
|
||||
# malloc et al -- are replaced with empty definitions. This is because the
|
||||
# presence and possible inlining of the default js_malloc et al can cause
|
||||
# malloc/calloc/realloc/free calls show up in unpredictable places.
|
||||
#
|
||||
# Unfortunately, that configuration cannot be tested on Mozilla's standard
|
||||
# testing infrastructure. Instead, by default this script only tests that none
|
||||
# of the other vanilla allocation/free functions (operator new, memalign, etc)
|
||||
# are present. If given the --aggressive flag, it will also check for
|
||||
# malloc/calloc/realloc/free.
|
||||
#
|
||||
# Note: We don't check for |operator delete| and |operator delete[]|. These
|
||||
# can be present somehow due to virtual destructors, but this is not too
|
||||
# because vanilla delete/delete[] calls don't make sense without corresponding
|
||||
# vanilla new/new[] calls, and any explicit calls will be caught by Valgrind's
|
||||
# mismatched alloc/free checking.
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
# The obvious way to implement this script is to search for occurrences of
|
||||
# malloc et al, succeed if none are found, and fail is some are found.
|
||||
# However, "none are found" does not necessarily mean "none are present" --
|
||||
# this script could be buggy. (Or the output format of |nm| might change in
|
||||
# the future.)
|
||||
#
|
||||
# So jsutil.cpp deliberately contains a (never-called) function that contains a
|
||||
# single use of all the vanilla allocation/free functions. And this script
|
||||
# fails if it (a) finds uses of those functions in files other than jsutil.cpp,
|
||||
# *or* (b) fails to find them in jsutil.cpp.
|
||||
|
||||
# Tracks overall success of the test.
|
||||
has_failed = False
|
||||
|
||||
|
||||
def fail(msg):
|
||||
print('TEST-UNEXPECTED-FAIL | check_vanilla_allocations.py |', msg)
|
||||
global has_failed
|
||||
has_failed = True
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--aggressive', action='store_true',
|
||||
help='also check for malloc, calloc, realloc and free')
|
||||
parser.add_argument('file', type=str,
|
||||
help='name of the file to check')
|
||||
args = parser.parse_args()
|
||||
|
||||
# Run |nm|. Options:
|
||||
# -u: show only undefined symbols
|
||||
# -C: demangle symbol names
|
||||
# -l: show a filename and line number for each undefined symbol
|
||||
cmd = ['nm', '-u', '-C', '-l', args.file]
|
||||
lines = subprocess.check_output(cmd, universal_newlines=True,
|
||||
stderr=subprocess.PIPE).split('\n')
|
||||
|
||||
# alloc_fns contains all the vanilla allocation/free functions that we look
|
||||
# for. Regexp chars are escaped appropriately.
|
||||
|
||||
alloc_fns = [
|
||||
# Matches |operator new(unsigned T)|, where |T| is |int| or |long|.
|
||||
r'operator new\(unsigned',
|
||||
|
||||
# Matches |operator new[](unsigned T)|, where |T| is |int| or |long|.
|
||||
r'operator new\[\]\(unsigned',
|
||||
|
||||
r'memalign',
|
||||
# These two aren't available on all Linux configurations.
|
||||
#r'posix_memalign',
|
||||
#r'aligned_alloc',
|
||||
r'valloc',
|
||||
r'strdup'
|
||||
]
|
||||
|
||||
if args.aggressive:
|
||||
alloc_fns += [
|
||||
r'malloc',
|
||||
r'calloc',
|
||||
r'realloc',
|
||||
r'free'
|
||||
]
|
||||
|
||||
# This is like alloc_fns, but regexp chars are not escaped.
|
||||
alloc_fns_unescaped = [fn.translate(None, r'\\') for fn in alloc_fns]
|
||||
|
||||
# This regexp matches the relevant lines in the output of |nm|, which look
|
||||
# like the following.
|
||||
#
|
||||
# U malloc /path/to/objdir/dist/include/js/Utility.h:142
|
||||
#
|
||||
alloc_fns_re = r'U (' + r'|'.join(alloc_fns) + r').*\/([\w\.]+):(\d+)$'
|
||||
|
||||
# This tracks which allocation/free functions have been seen in jsutil.cpp.
|
||||
jsutil_cpp = set([])
|
||||
|
||||
for line in lines:
|
||||
m = re.search(alloc_fns_re, line)
|
||||
if m is None:
|
||||
continue
|
||||
|
||||
fn = m.group(1)
|
||||
filename = m.group(2)
|
||||
linenum = m.group(3)
|
||||
if filename == 'jsutil.cpp':
|
||||
jsutil_cpp.add(fn)
|
||||
else:
|
||||
# An allocation is present in a non-special file. Fail!
|
||||
fail("'" + fn + "' present at " + filename + ':' + linenum)
|
||||
|
||||
|
||||
# Check that all functions we expect are used in jsutil.cpp. (This will
|
||||
# fail if the function-detection code breaks at any point.)
|
||||
for fn in alloc_fns_unescaped:
|
||||
if fn not in jsutil_cpp:
|
||||
fail("'" + fn + "' isn't used as expected in jsutil.cpp")
|
||||
else:
|
||||
jsutil_cpp.remove(fn)
|
||||
|
||||
# This should never happen, but check just in case.
|
||||
if jsutil_cpp:
|
||||
fail('unexpected allocation fns used in jsutil.cpp: ' +
|
||||
', '.join(jsutil_cpp))
|
||||
|
||||
if has_failed:
|
||||
sys.exit(1)
|
||||
|
||||
print('TEST-PASS | check_vanilla_allocations.py | ok')
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
@ -1,910 +0,0 @@
|
||||
#
|
||||
# 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/.
|
||||
|
||||
#
|
||||
# config.mk
|
||||
#
|
||||
# Determines the platform and builds the macros needed to load the
|
||||
# appropriate platform-specific .mk file, then defines all (most?)
|
||||
# of the generic macros.
|
||||
#
|
||||
|
||||
# Define an include-at-most-once flag
|
||||
ifdef INCLUDED_CONFIG_MK
|
||||
$(error Do not include config.mk twice!)
|
||||
endif
|
||||
INCLUDED_CONFIG_MK = 1
|
||||
|
||||
EXIT_ON_ERROR = set -e; # Shell loops continue past errors without this.
|
||||
|
||||
ifndef topsrcdir
|
||||
topsrcdir = $(DEPTH)
|
||||
endif
|
||||
|
||||
ifndef INCLUDED_AUTOCONF_MK
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
endif
|
||||
|
||||
-include $(DEPTH)/.mozconfig.mk
|
||||
|
||||
# Integrate with mozbuild-generated make files. We first verify that no
|
||||
# variables provided by the automatically generated .mk files are
|
||||
# present. If they are, this is a violation of the separation of
|
||||
# responsibility between Makefile.in and mozbuild files.
|
||||
_MOZBUILD_EXTERNAL_VARIABLES := \
|
||||
ANDROID_GENERATED_RESFILES \
|
||||
ANDROID_RES_DIRS \
|
||||
CMSRCS \
|
||||
CMMSRCS \
|
||||
CPP_UNIT_TESTS \
|
||||
DIRS \
|
||||
EXTRA_PP_COMPONENTS \
|
||||
EXTRA_PP_JS_MODULES \
|
||||
FORCE_SHARED_LIB \
|
||||
FORCE_STATIC_LIB \
|
||||
FINAL_LIBRARY \
|
||||
HOST_CSRCS \
|
||||
HOST_CMMSRCS \
|
||||
HOST_LIBRARY_NAME \
|
||||
HOST_PROGRAM \
|
||||
HOST_SIMPLE_PROGRAMS \
|
||||
IS_COMPONENT \
|
||||
JAR_MANIFEST \
|
||||
JAVA_JAR_TARGETS \
|
||||
JS_MODULES_PATH \
|
||||
LIBRARY_NAME \
|
||||
LIBXUL_LIBRARY \
|
||||
MODULE \
|
||||
MSVC_ENABLE_PGO \
|
||||
NO_DIST_INSTALL \
|
||||
PARALLEL_DIRS \
|
||||
PROGRAM \
|
||||
SDK_HEADERS \
|
||||
SIMPLE_PROGRAMS \
|
||||
TEST_DIRS \
|
||||
TIERS \
|
||||
TOOL_DIRS \
|
||||
XPCSHELL_TESTS \
|
||||
XPIDL_MODULE \
|
||||
$(NULL)
|
||||
|
||||
_DEPRECATED_VARIABLES := \
|
||||
ANDROID_RESFILES \
|
||||
MOCHITEST_FILES_PARTS \
|
||||
MOCHITEST_BROWSER_FILES_PARTS \
|
||||
SHORT_LIBNAME \
|
||||
$(NULL)
|
||||
|
||||
ifndef EXTERNALLY_MANAGED_MAKE_FILE
|
||||
# Using $(firstword) may not be perfect. But it should be good enough for most
|
||||
# scenarios.
|
||||
_current_makefile = $(CURDIR)/$(firstword $(MAKEFILE_LIST))
|
||||
|
||||
$(foreach var,$(_MOZBUILD_EXTERNAL_VARIABLES),$(if $(filter file override,$(subst $(NULL) ,_,$(origin $(var)))),\
|
||||
$(error Variable $(var) is defined in $(_current_makefile). It should only be defined in moz.build files),\
|
||||
))
|
||||
|
||||
$(foreach var,$(_DEPRECATED_VARIABLES),$(if $(filter file override,$(subst $(NULL) ,_,$(origin $(var)))),\
|
||||
$(error Variable $(var) is defined in $(_current_makefile). This variable has been deprecated. It does nothing. It must be removed in order to build)\
|
||||
))
|
||||
|
||||
# Import the automatically generated backend file. If this file doesn't exist,
|
||||
# the backend hasn't been properly configured. We want this to be a fatal
|
||||
# error, hence not using "-include".
|
||||
ifndef STANDALONE_MAKEFILE
|
||||
GLOBAL_DEPS += backend.mk
|
||||
include backend.mk
|
||||
endif
|
||||
|
||||
# Freeze the values specified by moz.build to catch them if they fail.
|
||||
|
||||
$(foreach var,$(_MOZBUILD_EXTERNAL_VARIABLES),$(eval $(var)_FROZEN := '$($(var))'))
|
||||
$(foreach var,$(_DEPRECATED_VARIABLES),$(eval $(var)_FROZEN := '$($(var))'))
|
||||
|
||||
CHECK_MOZBUILD_VARIABLES = $(foreach var,$(_MOZBUILD_EXTERNAL_VARIABLES), \
|
||||
$(if $(subst $($(var)_FROZEN),,'$($(var))'), \
|
||||
$(error Variable $(var) is defined in $(_current_makefile). It should only be defined in moz.build files),\
|
||||
)) $(foreach var,$(_DEPRECATED_VARIABLES), \
|
||||
$(if $(subst $($(var)_FROZEN),,'$($(var))'), \
|
||||
$(error Variable $(var) is defined in $(_current_makefile). This variable has been deprecated. It does nothing. It must be removed in order to build),\
|
||||
))
|
||||
|
||||
endif
|
||||
|
||||
space = $(NULL) $(NULL)
|
||||
|
||||
# Include defs.mk files that can be found in $(srcdir)/$(DEPTH),
|
||||
# $(srcdir)/$(DEPTH-1), $(srcdir)/$(DEPTH-2), etc., and $(srcdir)
|
||||
# where $(DEPTH-1) is one level less of depth, $(DEPTH-2), two, etc.
|
||||
# i.e. for DEPTH=../../.., DEPTH-1 is ../.. and DEPTH-2 is ..
|
||||
# These defs.mk files are used to define variables in a directory
|
||||
# and all its subdirectories, recursively.
|
||||
__depth := $(subst /, ,$(DEPTH))
|
||||
ifeq (.,$(__depth))
|
||||
__depth :=
|
||||
endif
|
||||
$(foreach __d,$(__depth) .,$(eval __depth = $(wordlist 2,$(words $(__depth)),$(__depth))$(eval -include $(subst $(space),/,$(strip $(srcdir) $(__depth) defs.mk)))))
|
||||
|
||||
COMMA = ,
|
||||
|
||||
# Sanity check some variables
|
||||
CHECK_VARS := \
|
||||
XPI_NAME \
|
||||
LIBRARY_NAME \
|
||||
MODULE \
|
||||
DEPTH \
|
||||
XPI_PKGNAME \
|
||||
INSTALL_EXTENSION_ID \
|
||||
SHARED_LIBRARY_NAME \
|
||||
STATIC_LIBRARY_NAME \
|
||||
$(NULL)
|
||||
|
||||
# checks for internal spaces or trailing spaces in the variable
|
||||
# named by $x
|
||||
check-variable = $(if $(filter-out 0 1,$(words $($(x))z)),$(error Spaces are not allowed in $(x)))
|
||||
|
||||
$(foreach x,$(CHECK_VARS),$(check-variable))
|
||||
|
||||
ifndef INCLUDED_FUNCTIONS_MK
|
||||
include $(topsrcdir)/config/makefiles/functions.mk
|
||||
endif
|
||||
|
||||
RM = rm -f
|
||||
|
||||
# LIBXUL_DIST is not defined under js/src, thus we make it mean DIST there.
|
||||
LIBXUL_DIST ?= $(DIST)
|
||||
|
||||
# FINAL_TARGET specifies the location into which we copy end-user-shipped
|
||||
# build products (typelibs, components, chrome). It may already be specified by
|
||||
# a moz.build file.
|
||||
#
|
||||
# If XPI_NAME is set, the files will be shipped to $(DIST)/xpi-stage/$(XPI_NAME)
|
||||
# instead of $(DIST)/bin. In both cases, if DIST_SUBDIR is set, the files will be
|
||||
# shipped to a $(DIST_SUBDIR) subdirectory.
|
||||
FINAL_TARGET ?= $(if $(XPI_NAME),$(DIST)/xpi-stage/$(XPI_NAME),$(DIST)/bin)$(DIST_SUBDIR:%=/%)
|
||||
# Override the stored value for the check to make sure that the variable is not
|
||||
# redefined in the Makefile.in value.
|
||||
FINAL_TARGET_FROZEN := '$(FINAL_TARGET)'
|
||||
|
||||
ifdef XPI_NAME
|
||||
DEFINES += -DXPI_NAME=$(XPI_NAME)
|
||||
endif
|
||||
|
||||
# The VERSION_NUMBER is suffixed onto the end of the DLLs we ship.
|
||||
VERSION_NUMBER = 50
|
||||
|
||||
ifeq ($(HOST_OS_ARCH),WINNT)
|
||||
win_srcdir := $(subst $(topsrcdir),$(WIN_TOP_SRC),$(srcdir))
|
||||
BUILD_TOOLS = $(WIN_TOP_SRC)/build/unix
|
||||
else
|
||||
win_srcdir := $(srcdir)
|
||||
BUILD_TOOLS = $(topsrcdir)/build/unix
|
||||
endif
|
||||
|
||||
CONFIG_TOOLS = $(MOZ_BUILD_ROOT)/config
|
||||
AUTOCONF_TOOLS = $(topsrcdir)/build/autoconf
|
||||
|
||||
# Disable MOZ_PSEUDO_DERECURSE when it contains no-pymake and we're running
|
||||
# pymake. This can be removed when no-pymake is removed from the default in
|
||||
# build/autoconf/compiler-opts.m4.
|
||||
ifdef .PYMAKE
|
||||
comma = ,
|
||||
ifneq (,$(filter no-pymake,$(subst $(comma), ,$(MOZ_PSEUDO_DERECURSE))))
|
||||
MOZ_PSEUDO_DERECURSE :=
|
||||
endif
|
||||
endif
|
||||
|
||||
# Disable MOZ_PSEUDO_DERECURSE on PGO builds until it's fixed.
|
||||
ifneq (,$(MOZ_PROFILE_USE)$(MOZ_PROFILE_GENERATE))
|
||||
MOZ_PSEUDO_DERECURSE :=
|
||||
endif
|
||||
|
||||
#
|
||||
# Strip off the excessively long version numbers on these platforms,
|
||||
# but save the version to allow multiple versions of the same base
|
||||
# platform to be built in the same tree.
|
||||
#
|
||||
ifneq (,$(filter FreeBSD HP-UX Linux NetBSD OpenBSD SunOS,$(OS_ARCH)))
|
||||
OS_RELEASE := $(basename $(OS_RELEASE))
|
||||
|
||||
# Allow the user to ignore the OS_VERSION, which is usually irrelevant.
|
||||
ifdef WANT_MOZILLA_CONFIG_OS_VERSION
|
||||
OS_VERS := $(suffix $(OS_RELEASE))
|
||||
OS_VERSION := $(shell echo $(OS_VERS) | sed 's/-.*//')
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
OS_CONFIG := $(OS_ARCH)$(OS_RELEASE)
|
||||
|
||||
ifdef _MSC_VER
|
||||
CC_WRAPPER ?= $(call py_action,cl)
|
||||
CXX_WRAPPER ?= $(call py_action,cl)
|
||||
endif # _MSC_VER
|
||||
|
||||
CC := $(CC_WRAPPER) $(CC)
|
||||
CXX := $(CXX_WRAPPER) $(CXX)
|
||||
MKDIR ?= mkdir
|
||||
SLEEP ?= sleep
|
||||
TOUCH ?= touch
|
||||
|
||||
ifdef .PYMAKE
|
||||
PYCOMMANDPATH += $(PYTHON_SITE_PACKAGES)
|
||||
endif
|
||||
|
||||
PYTHON_PATH = $(PYTHON) $(topsrcdir)/config/pythonpath.py
|
||||
|
||||
# determine debug-related options
|
||||
_DEBUG_ASFLAGS :=
|
||||
_DEBUG_CFLAGS :=
|
||||
_DEBUG_LDFLAGS :=
|
||||
|
||||
ifdef MOZ_DEBUG
|
||||
_DEBUG_CFLAGS += $(MOZ_DEBUG_ENABLE_DEFS)
|
||||
XULPPFLAGS += $(MOZ_DEBUG_ENABLE_DEFS)
|
||||
else
|
||||
_DEBUG_CFLAGS += $(MOZ_DEBUG_DISABLE_DEFS)
|
||||
XULPPFLAGS += $(MOZ_DEBUG_DISABLE_DEFS)
|
||||
endif
|
||||
|
||||
ifneq (,$(MOZ_DEBUG)$(MOZ_DEBUG_SYMBOLS))
|
||||
ifeq ($(AS),yasm)
|
||||
ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_)
|
||||
_DEBUG_ASFLAGS += -g cv8
|
||||
else
|
||||
ifneq ($(OS_ARCH),Darwin)
|
||||
_DEBUG_ASFLAGS += -g dwarf2
|
||||
endif
|
||||
endif
|
||||
else
|
||||
_DEBUG_ASFLAGS += $(MOZ_DEBUG_FLAGS)
|
||||
endif
|
||||
_DEBUG_CFLAGS += $(MOZ_DEBUG_FLAGS)
|
||||
_DEBUG_LDFLAGS += $(MOZ_DEBUG_LDFLAGS)
|
||||
endif
|
||||
|
||||
MOZALLOC_LIB = $(call EXPAND_LIBNAME_PATH,mozalloc,$(DIST)/lib)
|
||||
|
||||
ASFLAGS += $(_DEBUG_ASFLAGS)
|
||||
OS_CFLAGS += $(_DEBUG_CFLAGS)
|
||||
OS_CXXFLAGS += $(_DEBUG_CFLAGS)
|
||||
OS_LDFLAGS += $(_DEBUG_LDFLAGS)
|
||||
|
||||
# XXX: What does this? Bug 482434 filed for better explanation.
|
||||
ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_)
|
||||
ifdef MOZ_DEBUG
|
||||
ifneq (,$(MOZ_BROWSE_INFO)$(MOZ_BSCFILE))
|
||||
OS_CFLAGS += -FR
|
||||
OS_CXXFLAGS += -FR
|
||||
endif
|
||||
else # ! MOZ_DEBUG
|
||||
|
||||
# MOZ_DEBUG_SYMBOLS generates debug symbols in separate PDB files.
|
||||
# Used for generating an optimized build with debugging symbols.
|
||||
# Used in the Windows nightlies to generate symbols for crash reporting.
|
||||
ifdef MOZ_DEBUG_SYMBOLS
|
||||
OS_CXXFLAGS += -UDEBUG -DNDEBUG
|
||||
OS_CFLAGS += -UDEBUG -DNDEBUG
|
||||
ifdef HAVE_64BIT_OS
|
||||
OS_LDFLAGS += -DEBUG -OPT:REF,ICF
|
||||
else
|
||||
OS_LDFLAGS += -DEBUG -OPT:REF
|
||||
endif
|
||||
endif
|
||||
|
||||
#
|
||||
# Handle trace-malloc and DMD in optimized builds.
|
||||
# No opt to give sane callstacks.
|
||||
#
|
||||
ifneq (,$(NS_TRACE_MALLOC)$(MOZ_DMD))
|
||||
MOZ_OPTIMIZE_FLAGS=-Zi -Od -UDEBUG -DNDEBUG
|
||||
ifdef HAVE_64BIT_OS
|
||||
OS_LDFLAGS = -DEBUG -OPT:REF,ICF
|
||||
else
|
||||
OS_LDFLAGS = -DEBUG -OPT:REF
|
||||
endif
|
||||
endif # NS_TRACE_MALLOC || MOZ_DMD
|
||||
|
||||
endif # MOZ_DEBUG
|
||||
|
||||
# We don't build a static CRT when building a custom CRT,
|
||||
# it appears to be broken. So don't link to jemalloc if
|
||||
# the Makefile wants static CRT linking.
|
||||
ifeq ($(MOZ_MEMORY)_$(USE_STATIC_LIBS),1_1)
|
||||
# Disable default CRT libs and add the right lib path for the linker
|
||||
MOZ_GLUE_LDFLAGS=
|
||||
endif
|
||||
|
||||
endif # WINNT && !GNU_CC
|
||||
|
||||
ifdef MOZ_GLUE_PROGRAM_LDFLAGS
|
||||
DEFINES += -DMOZ_GLUE_IN_PROGRAM
|
||||
else
|
||||
MOZ_GLUE_PROGRAM_LDFLAGS=$(MOZ_GLUE_LDFLAGS)
|
||||
endif
|
||||
|
||||
#
|
||||
# Build using PIC by default
|
||||
#
|
||||
_ENABLE_PIC=1
|
||||
|
||||
# Determine if module being compiled is destined
|
||||
# to be merged into libxul
|
||||
|
||||
ifeq ($(FINAL_LIBRARY),xul)
|
||||
ifdef LIBXUL_LIBRARY
|
||||
$(error FINAL_LIBRARY is "xul", LIBXUL_LIBRARY is implied)
|
||||
endif
|
||||
LIBXUL_LIBRARY := 1
|
||||
endif
|
||||
|
||||
ifdef LIBXUL_LIBRARY
|
||||
ifdef IS_COMPONENT
|
||||
$(error IS_COMPONENT is set, but is not compatible with LIBXUL_LIBRARY)
|
||||
endif
|
||||
FORCE_STATIC_LIB=1
|
||||
endif
|
||||
|
||||
# If we are building this component into an extension/xulapp, it cannot be
|
||||
# statically linked. In the future we may want to add a xulapp meta-component
|
||||
# build option.
|
||||
|
||||
ifdef XPI_NAME
|
||||
ifdef IS_COMPONENT
|
||||
EXPORT_LIBRARY=
|
||||
FORCE_STATIC_LIB=
|
||||
FORCE_SHARED_LIB=1
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef SHARED_LIBRARY_NAME
|
||||
ifdef LIBRARY_NAME
|
||||
SHARED_LIBRARY_NAME=$(LIBRARY_NAME)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef STATIC_LIBRARY_NAME
|
||||
ifdef LIBRARY_NAME
|
||||
STATIC_LIBRARY_NAME=$(LIBRARY_NAME)
|
||||
endif
|
||||
endif
|
||||
|
||||
# PGO on MSVC is opt-in
|
||||
ifdef _MSC_VER
|
||||
ifndef MSVC_ENABLE_PGO
|
||||
NO_PROFILE_GUIDED_OPTIMIZE = 1
|
||||
endif
|
||||
endif
|
||||
|
||||
# No sense in profiling tools
|
||||
ifdef INTERNAL_TOOLS
|
||||
NO_PROFILE_GUIDED_OPTIMIZE = 1
|
||||
endif
|
||||
|
||||
# Don't build SIMPLE_PROGRAMS with PGO, since they don't need it anyway,
|
||||
# and we don't have the same build logic to re-link them in the second pass.
|
||||
ifdef SIMPLE_PROGRAMS
|
||||
NO_PROFILE_GUIDED_OPTIMIZE = 1
|
||||
endif
|
||||
|
||||
# No sense in profiling unit tests
|
||||
ifdef CPP_UNIT_TESTS
|
||||
NO_PROFILE_GUIDED_OPTIMIZE = 1
|
||||
endif
|
||||
|
||||
# Enable profile-based feedback
|
||||
ifneq (1,$(NO_PROFILE_GUIDED_OPTIMIZE))
|
||||
ifdef MOZ_PROFILE_GENERATE
|
||||
OS_CFLAGS += $(if $(filter $(notdir $<),$(notdir $(NO_PROFILE_GUIDED_OPTIMIZE))),,$(PROFILE_GEN_CFLAGS))
|
||||
OS_CXXFLAGS += $(if $(filter $(notdir $<),$(notdir $(NO_PROFILE_GUIDED_OPTIMIZE))),,$(PROFILE_GEN_CFLAGS))
|
||||
OS_LDFLAGS += $(PROFILE_GEN_LDFLAGS)
|
||||
ifeq (WINNT,$(OS_ARCH))
|
||||
AR_FLAGS += -LTCG
|
||||
endif
|
||||
endif # MOZ_PROFILE_GENERATE
|
||||
|
||||
ifdef MOZ_PROFILE_USE
|
||||
OS_CFLAGS += $(if $(filter $(notdir $<),$(notdir $(NO_PROFILE_GUIDED_OPTIMIZE))),,$(PROFILE_USE_CFLAGS))
|
||||
OS_CXXFLAGS += $(if $(filter $(notdir $<),$(notdir $(NO_PROFILE_GUIDED_OPTIMIZE))),,$(PROFILE_USE_CFLAGS))
|
||||
OS_LDFLAGS += $(PROFILE_USE_LDFLAGS)
|
||||
ifeq (WINNT,$(OS_ARCH))
|
||||
AR_FLAGS += -LTCG
|
||||
endif
|
||||
endif # MOZ_PROFILE_USE
|
||||
endif # NO_PROFILE_GUIDED_OPTIMIZE
|
||||
|
||||
|
||||
# Does the makefile specifies the internal XPCOM API linkage?
|
||||
ifneq (,$(MOZILLA_INTERNAL_API)$(LIBXUL_LIBRARY))
|
||||
DEFINES += -DMOZILLA_INTERNAL_API
|
||||
endif
|
||||
|
||||
# Force XPCOM/widget/gfx methods to be _declspec(dllexport) when we're
|
||||
# building libxul libraries
|
||||
ifdef LIBXUL_LIBRARY
|
||||
DEFINES += \
|
||||
-DIMPL_LIBXUL \
|
||||
$(NULL)
|
||||
|
||||
ifndef JS_SHARED_LIBRARY
|
||||
DEFINES += -DSTATIC_EXPORTABLE_JS_API
|
||||
endif
|
||||
endif
|
||||
|
||||
MAKE_JARS_FLAGS = \
|
||||
-t $(topsrcdir) \
|
||||
-f $(MOZ_CHROME_FILE_FORMAT) \
|
||||
$(NULL)
|
||||
|
||||
ifdef USE_EXTENSION_MANIFEST
|
||||
MAKE_JARS_FLAGS += -e
|
||||
endif
|
||||
|
||||
TAR_CREATE_FLAGS = -chf
|
||||
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
TAR_CREATE_FLAGS = -cf
|
||||
endif
|
||||
|
||||
#
|
||||
# Personal makefile customizations go in these optional make include files.
|
||||
#
|
||||
MY_CONFIG := $(DEPTH)/config/myconfig.mk
|
||||
MY_RULES := $(DEPTH)/config/myrules.mk
|
||||
|
||||
#
|
||||
# Default command macros; can be overridden in <arch>.mk.
|
||||
#
|
||||
CCC = $(CXX)
|
||||
|
||||
# Java macros
|
||||
JAVA_GEN_DIR = _javagen
|
||||
JAVA_DIST_DIR = $(DEPTH)/$(JAVA_GEN_DIR)
|
||||
JAVA_IFACES_PKG_NAME = org/mozilla/interfaces
|
||||
|
||||
OS_INCLUDES += $(MOZ_JPEG_CFLAGS) $(MOZ_PNG_CFLAGS) $(MOZ_ZLIB_CFLAGS) $(MOZ_PIXMAN_CFLAGS)
|
||||
|
||||
# NSPR_CFLAGS and NSS_CFLAGS must appear ahead of OS_INCLUDES to avoid Linux
|
||||
# builds wrongly picking up system NSPR/NSS header files.
|
||||
INCLUDES = \
|
||||
-I$(srcdir) \
|
||||
-I. \
|
||||
$(LOCAL_INCLUDES) \
|
||||
-I$(DIST)/include \
|
||||
$(if $(LIBXUL_SDK),-I$(LIBXUL_SDK)/include) \
|
||||
$(NSPR_CFLAGS) $(NSS_CFLAGS) \
|
||||
$(OS_INCLUDES) \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/static-checking-config.mk
|
||||
|
||||
CFLAGS = $(OS_CPPFLAGS) $(OS_CFLAGS)
|
||||
CXXFLAGS = $(OS_CPPFLAGS) $(OS_CXXFLAGS)
|
||||
LDFLAGS = $(OS_LDFLAGS) $(MOZ_FIX_LINK_PATHS)
|
||||
|
||||
# Allow each module to override the *default* optimization settings
|
||||
# by setting MODULE_OPTIMIZE_FLAGS if the developer has not given
|
||||
# arguments to --enable-optimize
|
||||
ifdef MOZ_OPTIMIZE
|
||||
ifeq (1,$(MOZ_OPTIMIZE))
|
||||
ifdef MODULE_OPTIMIZE_FLAGS
|
||||
CFLAGS += $(MODULE_OPTIMIZE_FLAGS)
|
||||
CXXFLAGS += $(MODULE_OPTIMIZE_FLAGS)
|
||||
else
|
||||
ifneq (,$(if $(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE),$(MOZ_PGO_OPTIMIZE_FLAGS)))
|
||||
CFLAGS += $(MOZ_PGO_OPTIMIZE_FLAGS)
|
||||
CXXFLAGS += $(MOZ_PGO_OPTIMIZE_FLAGS)
|
||||
else
|
||||
CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
|
||||
CXXFLAGS += $(MOZ_OPTIMIZE_FLAGS)
|
||||
endif # neq (,$(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE))
|
||||
endif # MODULE_OPTIMIZE_FLAGS
|
||||
else
|
||||
CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
|
||||
CXXFLAGS += $(MOZ_OPTIMIZE_FLAGS)
|
||||
endif # MOZ_OPTIMIZE == 1
|
||||
LDFLAGS += $(MOZ_OPTIMIZE_LDFLAGS)
|
||||
endif # MOZ_OPTIMIZE
|
||||
|
||||
ifdef CROSS_COMPILE
|
||||
HOST_CFLAGS += $(HOST_OPTIMIZE_FLAGS)
|
||||
else
|
||||
ifdef MOZ_OPTIMIZE
|
||||
ifeq (1,$(MOZ_OPTIMIZE))
|
||||
ifdef MODULE_OPTIMIZE_FLAGS
|
||||
HOST_CFLAGS += $(MODULE_OPTIMIZE_FLAGS)
|
||||
else
|
||||
HOST_CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
|
||||
endif # MODULE_OPTIMIZE_FLAGS
|
||||
else
|
||||
HOST_CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
|
||||
endif # MOZ_OPTIMIZE == 1
|
||||
endif # MOZ_OPTIMIZE
|
||||
endif # CROSS_COMPILE
|
||||
|
||||
CFLAGS += $(MOZ_FRAMEPTR_FLAGS)
|
||||
CXXFLAGS += $(MOZ_FRAMEPTR_FLAGS)
|
||||
|
||||
# Check for FAIL_ON_WARNINGS & FAIL_ON_WARNINGS_DEBUG (Shorthand for Makefiles
|
||||
# to request that we use the 'warnings as errors' compile flags)
|
||||
|
||||
# NOTE: First, we clear FAIL_ON_WARNINGS[_DEBUG] if we're doing a Windows PGO
|
||||
# build, since WARNINGS_AS_ERRORS has been suspected of causing isuses in that
|
||||
# situation. (See bug 437002.)
|
||||
ifeq (WINNT_1,$(OS_ARCH)_$(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE))
|
||||
FAIL_ON_WARNINGS_DEBUG=
|
||||
FAIL_ON_WARNINGS=
|
||||
endif # WINNT && (MOS_PROFILE_GENERATE ^ MOZ_PROFILE_USE)
|
||||
|
||||
# Now, check for debug version of flag; it turns on normal flag in debug builds.
|
||||
ifdef FAIL_ON_WARNINGS_DEBUG
|
||||
ifdef MOZ_DEBUG
|
||||
FAIL_ON_WARNINGS = 1
|
||||
endif # MOZ_DEBUG
|
||||
endif # FAIL_ON_WARNINGS_DEBUG
|
||||
|
||||
# Check for normal version of flag, and add WARNINGS_AS_ERRORS if it's set to 1.
|
||||
ifdef FAIL_ON_WARNINGS
|
||||
CXXFLAGS += $(WARNINGS_AS_ERRORS)
|
||||
CFLAGS += $(WARNINGS_AS_ERRORS)
|
||||
endif # FAIL_ON_WARNINGS
|
||||
|
||||
ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_)
|
||||
#// Currently, unless USE_STATIC_LIBS is defined, the multithreaded
|
||||
#// DLL version of the RTL is used...
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
ifdef USE_STATIC_LIBS
|
||||
RTL_FLAGS=-MT # Statically linked multithreaded RTL
|
||||
ifneq (,$(MOZ_DEBUG)$(NS_TRACE_MALLOC))
|
||||
ifndef MOZ_NO_DEBUG_RTL
|
||||
RTL_FLAGS=-MTd # Statically linked multithreaded MSVC4.0 debug RTL
|
||||
endif
|
||||
endif # MOZ_DEBUG || NS_TRACE_MALLOC
|
||||
|
||||
else # !USE_STATIC_LIBS
|
||||
|
||||
RTL_FLAGS=-MD # Dynamically linked, multithreaded RTL
|
||||
ifneq (,$(MOZ_DEBUG)$(NS_TRACE_MALLOC))
|
||||
ifndef MOZ_NO_DEBUG_RTL
|
||||
RTL_FLAGS=-MDd # Dynamically linked, multithreaded MSVC4.0 debug RTL
|
||||
endif
|
||||
endif # MOZ_DEBUG || NS_TRACE_MALLOC
|
||||
endif # USE_STATIC_LIBS
|
||||
endif # WINNT && !GNU_CC
|
||||
|
||||
ifeq ($(OS_ARCH),Darwin)
|
||||
# Compiling ObjC requires an Apple compiler anyway, so it's ok to set
|
||||
# host CMFLAGS here.
|
||||
HOST_CMFLAGS += -fobjc-exceptions
|
||||
HOST_CMMFLAGS += -fobjc-exceptions
|
||||
OS_COMPILE_CMFLAGS += -fobjc-exceptions
|
||||
OS_COMPILE_CMMFLAGS += -fobjc-exceptions
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),uikit)
|
||||
OS_COMPILE_CMFLAGS += -fobjc-abi-version=2 -fobjc-legacy-dispatch
|
||||
OS_COMPILE_CMMFLAGS += -fobjc-abi-version=2 -fobjc-legacy-dispatch
|
||||
endif
|
||||
endif
|
||||
|
||||
COMPILE_CFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(RTL_FLAGS) $(OS_CPPFLAGS) $(OS_COMPILE_CFLAGS) $(CFLAGS) $(EXTRA_COMPILE_FLAGS)
|
||||
COMPILE_CXXFLAGS = $(STL_FLAGS) $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(RTL_FLAGS) $(OS_CPPFLAGS) $(OS_COMPILE_CXXFLAGS) $(CXXFLAGS) $(EXTRA_COMPILE_FLAGS)
|
||||
COMPILE_CMFLAGS = $(OS_COMPILE_CMFLAGS) $(EXTRA_COMPILE_FLAGS)
|
||||
COMPILE_CMMFLAGS = $(OS_COMPILE_CMMFLAGS) $(EXTRA_COMPILE_FLAGS)
|
||||
ASFLAGS += $(EXTRA_ASSEMBLER_FLAGS)
|
||||
|
||||
ifndef CROSS_COMPILE
|
||||
HOST_CFLAGS += $(RTL_FLAGS)
|
||||
endif
|
||||
|
||||
#
|
||||
# Name of the binary code directories
|
||||
#
|
||||
# Override defaults
|
||||
|
||||
# We need to know where to find the libraries we
|
||||
# put on the link line for binaries, and should
|
||||
# we link statically or dynamic? Assuming dynamic for now.
|
||||
|
||||
ifneq (WINNT_,$(OS_ARCH)_$(GNU_CC))
|
||||
LIBS_DIR = -L$(DIST)/bin -L$(DIST)/lib
|
||||
ifdef LIBXUL_SDK
|
||||
LIBS_DIR += -L$(LIBXUL_SDK)/bin -L$(LIBXUL_SDK)/lib
|
||||
endif
|
||||
endif
|
||||
|
||||
# Default location of include files
|
||||
ifndef LIBXUL_SDK
|
||||
IDL_PARSER_DIR = $(topsrcdir)/xpcom/idl-parser
|
||||
IDL_PARSER_CACHE_DIR = $(DEPTH)/xpcom/idl-parser
|
||||
else
|
||||
IDL_PARSER_DIR = $(LIBXUL_SDK)/sdk/bin
|
||||
IDL_PARSER_CACHE_DIR = $(LIBXUL_SDK)/sdk/bin
|
||||
endif
|
||||
|
||||
SDK_LIB_DIR = $(DIST)/sdk/lib
|
||||
SDK_BIN_DIR = $(DIST)/sdk/bin
|
||||
|
||||
DEPENDENCIES = .md
|
||||
|
||||
MOZ_COMPONENT_LIBS=$(XPCOM_LIBS) $(MOZ_COMPONENT_NSPR_LIBS)
|
||||
|
||||
ifdef MACOSX_DEPLOYMENT_TARGET
|
||||
export MACOSX_DEPLOYMENT_TARGET
|
||||
endif # MACOSX_DEPLOYMENT_TARGET
|
||||
|
||||
ifdef MOZ_USING_CCACHE
|
||||
ifdef CLANG_CXX
|
||||
export CCACHE_CPP2=1
|
||||
endif
|
||||
endif
|
||||
|
||||
# Set link flags according to whether we want a console.
|
||||
ifdef MOZ_WINCONSOLE
|
||||
ifeq ($(MOZ_WINCONSOLE),1)
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
BIN_FLAGS += -Zlinker -PM:VIO
|
||||
endif
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
ifdef GNU_CC
|
||||
WIN32_EXE_LDFLAGS += -mconsole
|
||||
else
|
||||
WIN32_EXE_LDFLAGS += -SUBSYSTEM:CONSOLE
|
||||
endif
|
||||
endif
|
||||
else # MOZ_WINCONSOLE
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
BIN_FLAGS += -Zlinker -PM:PM
|
||||
endif
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
ifdef GNU_CC
|
||||
WIN32_EXE_LDFLAGS += -mwindows
|
||||
else
|
||||
WIN32_EXE_LDFLAGS += -SUBSYSTEM:WINDOWS
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef _MSC_VER
|
||||
ifeq ($(CPU_ARCH),x86_64)
|
||||
# set stack to 2MB on x64 build. See bug 582910
|
||||
WIN32_EXE_LDFLAGS += -STACK:2097152
|
||||
endif
|
||||
endif
|
||||
|
||||
# If we're building a component on MSVC, we don't want to generate an
|
||||
# import lib, because that import lib will collide with the name of a
|
||||
# static version of the same library.
|
||||
ifeq ($(GNU_LD)$(OS_ARCH),WINNT)
|
||||
ifdef IS_COMPONENT
|
||||
LDFLAGS += -IMPLIB:fake.lib
|
||||
DELETE_AFTER_LINK = fake.lib fake.exp
|
||||
endif
|
||||
endif
|
||||
|
||||
#
|
||||
# Include any personal overrides the user might think are needed.
|
||||
#
|
||||
-include $(topsrcdir)/$(MOZ_BUILD_APP)/app-config.mk
|
||||
-include $(MY_CONFIG)
|
||||
|
||||
######################################################################
|
||||
|
||||
GARBAGE += $(DEPENDENCIES) core $(wildcard core.[0-9]*) $(wildcard *.err) $(wildcard *.pure) $(wildcard *_pure_*.o) Templates.DB
|
||||
|
||||
ifeq ($(OS_ARCH),Darwin)
|
||||
ifndef NSDISTMODE
|
||||
NSDISTMODE=absolute_symlink
|
||||
endif
|
||||
PWD := $(CURDIR)
|
||||
endif
|
||||
|
||||
NSINSTALL_PY := $(PYTHON) $(abspath $(topsrcdir)/config/nsinstall.py)
|
||||
# For Pymake, wherever we use nsinstall.py we're also going to try to make it
|
||||
# a native command where possible. Since native commands can't be used outside
|
||||
# of single-line commands, we continue to provide INSTALL for general use.
|
||||
# Single-line commands should be switched over to install_cmd.
|
||||
NSINSTALL_NATIVECMD := %nsinstall nsinstall
|
||||
|
||||
ifdef NSINSTALL_BIN
|
||||
NSINSTALL = $(NSINSTALL_BIN)
|
||||
else
|
||||
ifeq (OS2,$(CROSS_COMPILE)$(OS_ARCH))
|
||||
NSINSTALL = $(MOZ_TOOLS_DIR)/nsinstall
|
||||
else
|
||||
ifeq ($(HOST_OS_ARCH),WINNT)
|
||||
NSINSTALL = $(NSINSTALL_PY)
|
||||
else
|
||||
NSINSTALL = $(CONFIG_TOOLS)/nsinstall$(HOST_BIN_SUFFIX)
|
||||
endif # WINNT
|
||||
endif # OS2
|
||||
endif # NSINSTALL_BIN
|
||||
|
||||
|
||||
ifeq (,$(CROSS_COMPILE)$(filter-out WINNT OS2, $(OS_ARCH)))
|
||||
INSTALL = $(NSINSTALL) -t
|
||||
ifdef .PYMAKE
|
||||
install_cmd = $(NSINSTALL_NATIVECMD) -t $(1)
|
||||
endif # .PYMAKE
|
||||
|
||||
else
|
||||
|
||||
# This isn't laid out as conditional directives so that NSDISTMODE can be
|
||||
# target-specific.
|
||||
INSTALL = $(if $(filter copy, $(NSDISTMODE)), $(NSINSTALL) -t, $(if $(filter absolute_symlink, $(NSDISTMODE)), $(NSINSTALL) -L $(PWD), $(NSINSTALL) -R))
|
||||
|
||||
endif # WINNT/OS2
|
||||
|
||||
# The default for install_cmd is simply INSTALL
|
||||
install_cmd ?= $(INSTALL) $(1)
|
||||
|
||||
# Use nsinstall in copy mode to install files on the system
|
||||
SYSINSTALL = $(NSINSTALL) -t
|
||||
# This isn't necessarily true, just here
|
||||
sysinstall_cmd = install_cmd
|
||||
|
||||
#
|
||||
# Localization build automation
|
||||
#
|
||||
|
||||
# Because you might wish to "make locales AB_CD=ab-CD", we don't hardcode
|
||||
# MOZ_UI_LOCALE directly, but use an intermediate variable that can be
|
||||
# overridden by the command line. (Besides, AB_CD is prettier).
|
||||
AB_CD = $(MOZ_UI_LOCALE)
|
||||
|
||||
ifndef L10NBASEDIR
|
||||
L10NBASEDIR = $(error L10NBASEDIR not defined by configure)
|
||||
else
|
||||
IS_LANGUAGE_REPACK = 1
|
||||
endif
|
||||
|
||||
EXPAND_LOCALE_SRCDIR = $(if $(filter en-US,$(AB_CD)),$(topsrcdir)/$(1)/en-US,$(or $(realpath $(L10NBASEDIR)),$(abspath $(L10NBASEDIR)))/$(AB_CD)/$(subst /locales,,$(1)))
|
||||
|
||||
ifdef relativesrcdir
|
||||
LOCALE_SRCDIR ?= $(call EXPAND_LOCALE_SRCDIR,$(relativesrcdir))
|
||||
endif
|
||||
|
||||
ifdef relativesrcdir
|
||||
MAKE_JARS_FLAGS += --relativesrcdir=$(relativesrcdir)
|
||||
ifneq (en-US,$(AB_CD))
|
||||
ifdef LOCALE_MERGEDIR
|
||||
MAKE_JARS_FLAGS += --locale-mergedir=$(LOCALE_MERGEDIR)
|
||||
endif
|
||||
ifdef IS_LANGUAGE_REPACK
|
||||
MAKE_JARS_FLAGS += --l10n-base=$(L10NBASEDIR)/$(AB_CD)
|
||||
endif
|
||||
else
|
||||
MAKE_JARS_FLAGS += -c $(LOCALE_SRCDIR)
|
||||
endif # en-US
|
||||
else
|
||||
MAKE_JARS_FLAGS += -c $(LOCALE_SRCDIR)
|
||||
endif # ! relativesrcdir
|
||||
|
||||
ifdef LOCALE_MERGEDIR
|
||||
MERGE_FILE = $(firstword \
|
||||
$(wildcard $(LOCALE_MERGEDIR)/$(subst /locales,,$(relativesrcdir))/$(1)) \
|
||||
$(wildcard $(LOCALE_SRCDIR)/$(1)) \
|
||||
$(srcdir)/en-US/$(1) )
|
||||
else
|
||||
MERGE_FILE = $(LOCALE_SRCDIR)/$(1)
|
||||
endif
|
||||
MERGE_FILES = $(foreach f,$(1),$(call MERGE_FILE,$(f)))
|
||||
|
||||
ifeq (OS2,$(OS_ARCH))
|
||||
RUN_TEST_PROGRAM = $(topsrcdir)/build/os2/test_os2.cmd '$(LIBXUL_DIST)'
|
||||
else
|
||||
ifneq (WINNT,$(OS_ARCH))
|
||||
RUN_TEST_PROGRAM = $(LIBXUL_DIST)/bin/run-mozilla.sh
|
||||
endif # ! WINNT
|
||||
endif # ! OS2
|
||||
|
||||
#
|
||||
# Java macros
|
||||
#
|
||||
|
||||
# Make sure any compiled classes work with at least JVM 1.4
|
||||
JAVAC_FLAGS += -source 1.4
|
||||
|
||||
ifdef MOZ_DEBUG
|
||||
JAVAC_FLAGS += -g
|
||||
endif
|
||||
|
||||
CREATE_PRECOMPLETE_CMD = $(PYTHON) $(abspath $(topsrcdir)/config/createprecomplete.py)
|
||||
|
||||
# MDDEPDIR is the subdirectory where dependency files are stored
|
||||
MDDEPDIR := .deps
|
||||
|
||||
EXPAND_LIBS_EXEC = $(PYTHON) $(topsrcdir)/config/expandlibs_exec.py $(if $@,--depend $(MDDEPDIR)/$@.pp --target $@)
|
||||
EXPAND_LIBS_GEN = $(PYTHON) $(topsrcdir)/config/expandlibs_gen.py $(if $@,--depend $(MDDEPDIR)/$@.pp)
|
||||
EXPAND_AR = $(EXPAND_LIBS_EXEC) --extract -- $(AR)
|
||||
EXPAND_CC = $(EXPAND_LIBS_EXEC) --uselist -- $(CC)
|
||||
EXPAND_CCC = $(EXPAND_LIBS_EXEC) --uselist -- $(CCC)
|
||||
EXPAND_LD = $(EXPAND_LIBS_EXEC) --uselist -- $(LD)
|
||||
EXPAND_MKSHLIB_ARGS = --uselist
|
||||
ifdef SYMBOL_ORDER
|
||||
EXPAND_MKSHLIB_ARGS += --symbol-order $(SYMBOL_ORDER)
|
||||
endif
|
||||
EXPAND_MKSHLIB = $(EXPAND_LIBS_EXEC) $(EXPAND_MKSHLIB_ARGS) -- $(MKSHLIB)
|
||||
|
||||
ifneq (,$(MOZ_LIBSTDCXX_TARGET_VERSION)$(MOZ_LIBSTDCXX_HOST_VERSION))
|
||||
ifneq ($(OS_ARCH),Darwin)
|
||||
CHECK_STDCXX = objdump -p $(1) | grep -e 'GLIBCXX_3\.4\.\(9\|[1-9][0-9]\)' > /dev/null && echo 'TEST-UNEXPECTED-FAIL | | We do not want these libstdc++ symbols to be used:' && objdump -T $(1) | grep -e 'GLIBCXX_3\.4\.\(9\|[1-9][0-9]\)' && exit 1 || exit 0
|
||||
endif
|
||||
|
||||
ifdef MOZ_LIBSTDCXX_TARGET_VERSION
|
||||
EXTRA_LIBS += $(call EXPAND_LIBNAME_PATH,stdc++compat,$(DEPTH)/build/unix/stdc++compat)
|
||||
endif
|
||||
ifdef MOZ_LIBSTDCXX_HOST_VERSION
|
||||
HOST_EXTRA_LIBS += $(call EXPAND_LIBNAME_PATH,host_stdc++compat,$(DEPTH)/build/unix/stdc++compat)
|
||||
endif
|
||||
endif
|
||||
|
||||
# autoconf.mk sets OBJ_SUFFIX to an error to avoid use before including
|
||||
# this file
|
||||
OBJ_SUFFIX := $(_OBJ_SUFFIX)
|
||||
|
||||
# PGO builds with GCC build objects with instrumentation in a first pass,
|
||||
# then objects optimized, without instrumentation, in a second pass. If
|
||||
# we overwrite the ojects from the first pass with those from the second,
|
||||
# we end up not getting instrumentation data for better optimization on
|
||||
# incremental builds. As a consequence, we use a different object suffix
|
||||
# for the first pass.
|
||||
ifndef NO_PROFILE_GUIDED_OPTIMIZE
|
||||
ifdef MOZ_PROFILE_GENERATE
|
||||
ifdef GNU_CC
|
||||
OBJ_SUFFIX := i_o
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# EXPAND_LIBNAME - $(call EXPAND_LIBNAME,foo)
|
||||
# expands to $(LIB_PREFIX)foo.$(LIB_SUFFIX) or -lfoo, depending on linker
|
||||
# arguments syntax. Should only be used for system libraries
|
||||
|
||||
# EXPAND_LIBNAME_PATH - $(call EXPAND_LIBNAME_PATH,foo,dir)
|
||||
# expands to dir/$(LIB_PREFIX)foo.$(LIB_SUFFIX)
|
||||
|
||||
# EXPAND_MOZLIBNAME - $(call EXPAND_MOZLIBNAME,foo)
|
||||
# expands to $(DIST)/lib/$(LIB_PREFIX)foo.$(LIB_SUFFIX)
|
||||
|
||||
ifdef GNU_CC
|
||||
EXPAND_LIBNAME = $(addprefix -l,$(1))
|
||||
else
|
||||
EXPAND_LIBNAME = $(foreach lib,$(1),$(LIB_PREFIX)$(lib).$(LIB_SUFFIX))
|
||||
endif
|
||||
EXPAND_LIBNAME_PATH = $(foreach lib,$(1),$(2)/$(LIB_PREFIX)$(lib).$(LIB_SUFFIX))
|
||||
EXPAND_MOZLIBNAME = $(foreach lib,$(1),$(DIST)/lib/$(LIB_PREFIX)$(lib).$(LIB_SUFFIX))
|
||||
|
||||
PLY_INCLUDE = -I$(topsrcdir)/other-licenses/ply
|
||||
|
||||
export CL_INCLUDES_PREFIX
|
||||
# Make sure that the build system can handle non-ASCII characters
|
||||
# in environment variables to prevent it from breking silently on
|
||||
# non-English systems.
|
||||
export NONASCII
|
||||
|
||||
ifdef MOZ_GTK2_CFLAGS
|
||||
MOZ_GTK2_CFLAGS := -I$(topsrcdir)/widget/gtk/compat $(MOZ_GTK2_CFLAGS)
|
||||
endif
|
||||
|
||||
DEFINES += -DNO_NSPR_10_SUPPORT
|
||||
|
||||
ifdef IS_GYP_DIR
|
||||
LOCAL_INCLUDES += \
|
||||
-I$(topsrcdir)/ipc/chromium/src \
|
||||
-I$(topsrcdir)/ipc/glue \
|
||||
-I$(DEPTH)/ipc/ipdl/_ipdlheaders \
|
||||
$(NULL)
|
||||
|
||||
ifeq (WINNT,$(OS_TARGET))
|
||||
# These get set via VC project file settings for normal GYP builds.
|
||||
DEFINES += -DUNICODE -D_UNICODE
|
||||
LOCAL_INCLUDES += -I'$(MOZ_DIRECTX_SDK_PATH)/include'
|
||||
endif
|
||||
|
||||
STL_FLAGS=
|
||||
# Skip most Mozilla-specific include locations.
|
||||
INCLUDES = -I. $(LOCAL_INCLUDES) -I$(DEPTH)/dist/include
|
||||
endif
|
@ -1 +0,0 @@
|
||||
@ALLEMPTYSUBSTS@
|
@ -1,145 +0,0 @@
|
||||
# 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/.
|
||||
|
||||
'''Expandlibs is a system that allows to replace some libraries with a
|
||||
descriptor file containing some linking information about them.
|
||||
|
||||
The descriptor file format is as follows:
|
||||
---8<-----
|
||||
OBJS = a.o b.o ...
|
||||
LIBS = libfoo.a libbar.a ...
|
||||
--->8-----
|
||||
|
||||
(In the example above, OBJ_SUFFIX is o and LIB_SUFFIX is a).
|
||||
|
||||
Expandlibs also canonicalizes how to pass libraries to the linker, such
|
||||
that only the ${LIB_PREFIX}${ROOT}.${LIB_SUFFIX} form needs to be used:
|
||||
given a list of files, expandlibs will replace items with the form
|
||||
${LIB_PREFIX}${ROOT}.${LIB_SUFFIX} following these rules:
|
||||
|
||||
- If a ${DLL_PREFIX}${ROOT}.${DLL_SUFFIX} or
|
||||
${DLL_PREFIX}${ROOT}.${IMPORT_LIB_SUFFIX} file exists, use that instead
|
||||
- If the ${LIB_PREFIX}${ROOT}.${LIB_SUFFIX} file exists, use it
|
||||
- If a ${LIB_PREFIX}${ROOT}.${LIB_SUFFIX}.${LIB_DESC_SUFFIX} file exists,
|
||||
replace ${LIB_PREFIX}${ROOT}.${LIB_SUFFIX} with the OBJS and LIBS the
|
||||
descriptor contains. And for each of these LIBS, also apply the same
|
||||
rules.
|
||||
'''
|
||||
from __future__ import with_statement
|
||||
import sys, os, errno
|
||||
import expandlibs_config as conf
|
||||
|
||||
def ensureParentDir(file):
|
||||
'''Ensures the directory parent to the given file exists'''
|
||||
dir = os.path.dirname(file)
|
||||
if dir and not os.path.exists(dir):
|
||||
try:
|
||||
os.makedirs(dir)
|
||||
except OSError, error:
|
||||
if error.errno != errno.EEXIST:
|
||||
raise
|
||||
|
||||
def relativize(path):
|
||||
'''Returns a path relative to the current working directory, if it is
|
||||
shorter than the given path'''
|
||||
def splitpath(path):
|
||||
dir, file = os.path.split(path)
|
||||
if os.path.splitdrive(dir)[1] == os.sep:
|
||||
return [file]
|
||||
return splitpath(dir) + [file]
|
||||
|
||||
if not os.path.exists(path):
|
||||
return path
|
||||
curdir = splitpath(os.path.abspath(os.curdir))
|
||||
abspath = splitpath(os.path.abspath(path))
|
||||
while curdir and abspath and curdir[0] == abspath[0]:
|
||||
del curdir[0]
|
||||
del abspath[0]
|
||||
if not curdir and not abspath:
|
||||
return '.'
|
||||
relpath = os.path.join(*[os.pardir for i in curdir] + abspath)
|
||||
if len(path) > len(relpath):
|
||||
return relpath
|
||||
return path
|
||||
|
||||
def isObject(path):
|
||||
'''Returns whether the given path points to an object file, that is,
|
||||
ends with OBJ_SUFFIX or .i_o'''
|
||||
return os.path.splitext(path)[1] in [conf.OBJ_SUFFIX, '.i_o']
|
||||
|
||||
def isDynamicLib(path):
|
||||
'''Returns whether the given path points to a dynamic library, that is,
|
||||
ends with DLL_SUFFIX.'''
|
||||
# On mac, the xul library is named XUL, instead of libxul.dylib. Assume any
|
||||
# file by that name is a dynamic library.
|
||||
return os.path.splitext(path)[1] == conf.DLL_SUFFIX or os.path.basename(path) == 'XUL'
|
||||
|
||||
class LibDescriptor(dict):
|
||||
KEYS = ['OBJS', 'LIBS']
|
||||
|
||||
def __init__(self, content=None):
|
||||
'''Creates an instance of a lib descriptor, initialized with contents
|
||||
from a list of strings when given. This is intended for use with
|
||||
file.readlines()'''
|
||||
if isinstance(content, list) and all([isinstance(item, str) for item in content]):
|
||||
pass
|
||||
elif content is not None:
|
||||
raise TypeError("LibDescriptor() arg 1 must be None or a list of strings")
|
||||
super(LibDescriptor, self).__init__()
|
||||
for key in self.KEYS:
|
||||
self[key] = []
|
||||
if not content:
|
||||
return
|
||||
for key, value in [(s.strip() for s in item.split('=', 2)) for item in content if item.find('=') >= 0]:
|
||||
if key in self.KEYS:
|
||||
self[key] = value.split()
|
||||
|
||||
def __str__(self):
|
||||
'''Serializes the lib descriptor'''
|
||||
return '\n'.join('%s = %s' % (k, ' '.join(self[k])) for k in self.KEYS if len(self[k]))
|
||||
|
||||
class ExpandArgs(list):
|
||||
def __init__(self, args):
|
||||
'''Creates a clone of the |args| list and performs file expansion on
|
||||
each item it contains'''
|
||||
super(ExpandArgs, self).__init__()
|
||||
for arg in args:
|
||||
self += self._expand(arg)
|
||||
|
||||
def _expand(self, arg):
|
||||
'''Internal function doing the actual work'''
|
||||
(root, ext) = os.path.splitext(arg)
|
||||
if ext != conf.LIB_SUFFIX or not os.path.basename(root).startswith(conf.LIB_PREFIX):
|
||||
return [relativize(arg)]
|
||||
if len(conf.IMPORT_LIB_SUFFIX):
|
||||
dll = root + conf.IMPORT_LIB_SUFFIX
|
||||
else:
|
||||
dll = root.replace(conf.LIB_PREFIX, conf.DLL_PREFIX, 1) + conf.DLL_SUFFIX
|
||||
if os.path.exists(dll):
|
||||
return [relativize(dll)]
|
||||
if os.path.exists(arg):
|
||||
return [relativize(arg)]
|
||||
return self._expand_desc(arg)
|
||||
|
||||
def _expand_desc(self, arg):
|
||||
'''Internal function taking care of lib descriptor expansion only'''
|
||||
if os.path.exists(arg + conf.LIBS_DESC_SUFFIX):
|
||||
with open(arg + conf.LIBS_DESC_SUFFIX, 'r') as f:
|
||||
desc = LibDescriptor(f.readlines())
|
||||
objs = [relativize(o) for o in desc['OBJS']]
|
||||
for lib in desc['LIBS']:
|
||||
objs += self._expand(lib)
|
||||
return objs
|
||||
return [arg]
|
||||
|
||||
class ExpandLibsDeps(ExpandArgs):
|
||||
'''Same as ExpandArgs, but also adds the library descriptor to the list'''
|
||||
def _expand_desc(self, arg):
|
||||
objs = super(ExpandLibsDeps, self)._expand_desc(arg)
|
||||
if os.path.exists(arg + conf.LIBS_DESC_SUFFIX):
|
||||
objs += [relativize(arg + conf.LIBS_DESC_SUFFIX)]
|
||||
return objs
|
||||
|
||||
if __name__ == '__main__':
|
||||
print " ".join(ExpandArgs(sys.argv[1:]))
|
@ -1,27 +0,0 @@
|
||||
# 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/.
|
||||
|
||||
from buildconfig import substs
|
||||
|
||||
def normalize_suffix(suffix):
|
||||
'''Returns a normalized suffix, i.e. ensures it starts with a dot and
|
||||
doesn't starts or ends with whitespace characters'''
|
||||
value = suffix.strip()
|
||||
if len(value) and not value.startswith('.'):
|
||||
value = '.' + value
|
||||
return value
|
||||
|
||||
# Variables from the build system
|
||||
AR = substs['AR']
|
||||
AR_EXTRACT = substs['AR_EXTRACT'].replace('$(AR)', AR)
|
||||
DLL_PREFIX = substs['DLL_PREFIX']
|
||||
LIB_PREFIX = substs['LIB_PREFIX']
|
||||
OBJ_SUFFIX = normalize_suffix(substs['OBJ_SUFFIX'])
|
||||
LIB_SUFFIX = normalize_suffix(substs['LIB_SUFFIX'])
|
||||
DLL_SUFFIX = normalize_suffix(substs['DLL_SUFFIX'])
|
||||
IMPORT_LIB_SUFFIX = normalize_suffix(substs['IMPORT_LIB_SUFFIX'])
|
||||
LIBS_DESC_SUFFIX = normalize_suffix(substs['LIBS_DESC_SUFFIX'])
|
||||
EXPAND_LIBS_LIST_STYLE = substs['EXPAND_LIBS_LIST_STYLE']
|
||||
EXPAND_LIBS_ORDER_STYLE = substs['EXPAND_LIBS_ORDER_STYLE']
|
||||
LD_PRINT_ICF_SECTIONS = substs['LD_PRINT_ICF_SECTIONS']
|
@ -1,361 +0,0 @@
|
||||
# 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/.
|
||||
|
||||
'''expandlibs-exec.py applies expandlibs rules, and some more (see below) to
|
||||
a given command line, and executes that command line with the expanded
|
||||
arguments.
|
||||
|
||||
With the --extract argument (useful for e.g. $(AR)), it extracts object files
|
||||
from static libraries (or use those listed in library descriptors directly).
|
||||
|
||||
With the --uselist argument (useful for e.g. $(CC)), it replaces all object
|
||||
files with a list file. This can be used to avoid limitations in the length
|
||||
of a command line. The kind of list file format used depends on the
|
||||
EXPAND_LIBS_LIST_STYLE variable: 'list' for MSVC style lists (@file.list)
|
||||
or 'linkerscript' for GNU ld linker scripts.
|
||||
See https://bugzilla.mozilla.org/show_bug.cgi?id=584474#c59 for more details.
|
||||
|
||||
With the --symbol-order argument, followed by a file name, it will add the
|
||||
relevant linker options to change the order in which the linker puts the
|
||||
symbols appear in the resulting binary. Only works for ELF targets.
|
||||
'''
|
||||
from __future__ import with_statement
|
||||
import sys
|
||||
import os
|
||||
from expandlibs import (
|
||||
ExpandArgs,
|
||||
relativize,
|
||||
isDynamicLib,
|
||||
isObject,
|
||||
ensureParentDir,
|
||||
ExpandLibsDeps,
|
||||
)
|
||||
import expandlibs_config as conf
|
||||
from optparse import OptionParser
|
||||
import subprocess
|
||||
import tempfile
|
||||
import shutil
|
||||
import subprocess
|
||||
import re
|
||||
from mozbuild.makeutil import Makefile
|
||||
|
||||
# The are the insert points for a GNU ld linker script, assuming a more
|
||||
# or less "standard" default linker script. This is not a dict because
|
||||
# order is important.
|
||||
SECTION_INSERT_BEFORE = [
|
||||
('.text', '.fini'),
|
||||
('.rodata', '.rodata1'),
|
||||
('.data.rel.ro', '.dynamic'),
|
||||
('.data', '.data1'),
|
||||
]
|
||||
|
||||
class ExpandArgsMore(ExpandArgs):
|
||||
''' Meant to be used as 'with ExpandArgsMore(args) as ...: '''
|
||||
def __enter__(self):
|
||||
self.tmp = []
|
||||
return self
|
||||
|
||||
def __exit__(self, type, value, tb):
|
||||
'''Automatically remove temporary files'''
|
||||
for tmp in self.tmp:
|
||||
if os.path.isdir(tmp):
|
||||
shutil.rmtree(tmp, True)
|
||||
else:
|
||||
os.remove(tmp)
|
||||
|
||||
def extract(self):
|
||||
self[0:] = self._extract(self)
|
||||
|
||||
def _extract(self, args):
|
||||
'''When a static library name is found, either extract its contents
|
||||
in a temporary directory or use the information found in the
|
||||
corresponding lib descriptor.
|
||||
'''
|
||||
ar_extract = conf.AR_EXTRACT.split()
|
||||
newlist = []
|
||||
for arg in args:
|
||||
if os.path.splitext(arg)[1] == conf.LIB_SUFFIX:
|
||||
if os.path.exists(arg + conf.LIBS_DESC_SUFFIX):
|
||||
newlist += self._extract(self._expand_desc(arg))
|
||||
continue
|
||||
elif os.path.exists(arg) and (len(ar_extract) or conf.AR == 'lib'):
|
||||
tmp = tempfile.mkdtemp(dir=os.curdir)
|
||||
self.tmp.append(tmp)
|
||||
if conf.AR == 'lib':
|
||||
out = subprocess.check_output([conf.AR, '-NOLOGO', '-LIST', arg])
|
||||
files = out.splitlines()
|
||||
# If lib -list returns a list full of dlls, it's an
|
||||
# import lib.
|
||||
if all(isDynamicLib(f) for f in files):
|
||||
newlist += [arg]
|
||||
continue
|
||||
for f in files:
|
||||
subprocess.call([conf.AR, '-NOLOGO', '-EXTRACT:%s' % f, os.path.abspath(arg)], cwd=tmp)
|
||||
else:
|
||||
subprocess.call(ar_extract + [os.path.abspath(arg)], cwd=tmp)
|
||||
objs = []
|
||||
for root, dirs, files in os.walk(tmp):
|
||||
objs += [relativize(os.path.join(root, f)) for f in files if isObject(f)]
|
||||
newlist += sorted(objs)
|
||||
continue
|
||||
newlist += [arg]
|
||||
return newlist
|
||||
|
||||
def makelist(self):
|
||||
'''Replaces object file names with a temporary list file, using a
|
||||
list format depending on the EXPAND_LIBS_LIST_STYLE variable
|
||||
'''
|
||||
objs = [o for o in self if isObject(o)]
|
||||
if not len(objs): return
|
||||
fd, tmp = tempfile.mkstemp(suffix=".list",dir=os.curdir)
|
||||
if conf.EXPAND_LIBS_LIST_STYLE == "linkerscript":
|
||||
content = ['INPUT("%s")\n' % obj for obj in objs]
|
||||
ref = tmp
|
||||
elif conf.EXPAND_LIBS_LIST_STYLE == "filelist":
|
||||
content = ["%s\n" % obj for obj in objs]
|
||||
ref = "-Wl,-filelist," + tmp
|
||||
elif conf.EXPAND_LIBS_LIST_STYLE == "list":
|
||||
content = ["%s\n" % obj for obj in objs]
|
||||
ref = "@" + tmp
|
||||
else:
|
||||
os.close(fd)
|
||||
os.remove(tmp)
|
||||
return
|
||||
self.tmp.append(tmp)
|
||||
f = os.fdopen(fd, "w")
|
||||
f.writelines(content)
|
||||
f.close()
|
||||
idx = self.index(objs[0])
|
||||
newlist = self[0:idx] + [ref] + [item for item in self[idx:] if item not in objs]
|
||||
self[0:] = newlist
|
||||
|
||||
def _getFoldedSections(self):
|
||||
'''Returns a dict about folded sections.
|
||||
When section A and B are folded into section C, the dict contains:
|
||||
{ 'A': 'C',
|
||||
'B': 'C',
|
||||
'C': ['A', 'B'] }'''
|
||||
if not conf.LD_PRINT_ICF_SECTIONS:
|
||||
return {}
|
||||
|
||||
proc = subprocess.Popen(self + [conf.LD_PRINT_ICF_SECTIONS], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
|
||||
(stdout, stderr) = proc.communicate()
|
||||
result = {}
|
||||
# gold's --print-icf-sections output looks like the following:
|
||||
# ld: ICF folding section '.section' in file 'file.o'into '.section' in file 'file.o'
|
||||
# In terms of words, chances are this will change in the future,
|
||||
# especially considering "into" is misplaced. Splitting on quotes
|
||||
# seems safer.
|
||||
for l in stderr.split('\n'):
|
||||
quoted = l.split("'")
|
||||
if len(quoted) > 5 and quoted[1] != quoted[5]:
|
||||
result[quoted[1]] = [quoted[5]]
|
||||
if quoted[5] in result:
|
||||
result[quoted[5]].append(quoted[1])
|
||||
else:
|
||||
result[quoted[5]] = [quoted[1]]
|
||||
return result
|
||||
|
||||
def _getOrderedSections(self, ordered_symbols):
|
||||
'''Given an ordered list of symbols, returns the corresponding list
|
||||
of sections following the order.'''
|
||||
if not conf.EXPAND_LIBS_ORDER_STYLE in ['linkerscript', 'section-ordering-file']:
|
||||
raise Exception('EXPAND_LIBS_ORDER_STYLE "%s" is not supported' % conf.EXPAND_LIBS_ORDER_STYLE)
|
||||
finder = SectionFinder([arg for arg in self if isObject(arg) or os.path.splitext(arg)[1] == conf.LIB_SUFFIX])
|
||||
folded = self._getFoldedSections()
|
||||
sections = set()
|
||||
ordered_sections = []
|
||||
for symbol in ordered_symbols:
|
||||
symbol_sections = finder.getSections(symbol)
|
||||
all_symbol_sections = []
|
||||
for section in symbol_sections:
|
||||
if section in folded:
|
||||
if isinstance(folded[section], str):
|
||||
section = folded[section]
|
||||
all_symbol_sections.append(section)
|
||||
all_symbol_sections.extend(folded[section])
|
||||
else:
|
||||
all_symbol_sections.append(section)
|
||||
for section in all_symbol_sections:
|
||||
if not section in sections:
|
||||
ordered_sections.append(section)
|
||||
sections.add(section)
|
||||
return ordered_sections
|
||||
|
||||
def orderSymbols(self, order):
|
||||
'''Given a file containing a list of symbols, adds the appropriate
|
||||
argument to make the linker put the symbols in that order.'''
|
||||
with open(order) as file:
|
||||
sections = self._getOrderedSections([l.strip() for l in file.readlines() if l.strip()])
|
||||
split_sections = {}
|
||||
linked_sections = [s[0] for s in SECTION_INSERT_BEFORE]
|
||||
for s in sections:
|
||||
for linked_section in linked_sections:
|
||||
if s.startswith(linked_section):
|
||||
if linked_section in split_sections:
|
||||
split_sections[linked_section].append(s)
|
||||
else:
|
||||
split_sections[linked_section] = [s]
|
||||
break
|
||||
content = []
|
||||
# Order is important
|
||||
linked_sections = [s for s in linked_sections if s in split_sections]
|
||||
|
||||
if conf.EXPAND_LIBS_ORDER_STYLE == 'section-ordering-file':
|
||||
option = '-Wl,--section-ordering-file,%s'
|
||||
content = sections
|
||||
for linked_section in linked_sections:
|
||||
content.extend(split_sections[linked_section])
|
||||
content.append('%s.*' % linked_section)
|
||||
content.append(linked_section)
|
||||
|
||||
elif conf.EXPAND_LIBS_ORDER_STYLE == 'linkerscript':
|
||||
option = '-Wl,-T,%s'
|
||||
section_insert_before = dict(SECTION_INSERT_BEFORE)
|
||||
for linked_section in linked_sections:
|
||||
content.append('SECTIONS {')
|
||||
content.append(' %s : {' % linked_section)
|
||||
content.extend(' *(%s)' % s for s in split_sections[linked_section])
|
||||
content.append(' }')
|
||||
content.append('}')
|
||||
content.append('INSERT BEFORE %s' % section_insert_before[linked_section])
|
||||
else:
|
||||
raise Exception('EXPAND_LIBS_ORDER_STYLE "%s" is not supported' % conf.EXPAND_LIBS_ORDER_STYLE)
|
||||
|
||||
fd, tmp = tempfile.mkstemp(dir=os.curdir)
|
||||
f = os.fdopen(fd, "w")
|
||||
f.write('\n'.join(content)+'\n')
|
||||
f.close()
|
||||
self.tmp.append(tmp)
|
||||
self.append(option % tmp)
|
||||
|
||||
class SectionFinder(object):
|
||||
'''Instances of this class allow to map symbol names to sections in
|
||||
object files.'''
|
||||
|
||||
def __init__(self, objs):
|
||||
'''Creates an instance, given a list of object files.'''
|
||||
if not conf.EXPAND_LIBS_ORDER_STYLE in ['linkerscript', 'section-ordering-file']:
|
||||
raise Exception('EXPAND_LIBS_ORDER_STYLE "%s" is not supported' % conf.EXPAND_LIBS_ORDER_STYLE)
|
||||
self.mapping = {}
|
||||
for obj in objs:
|
||||
if not isObject(obj) and os.path.splitext(obj)[1] != conf.LIB_SUFFIX:
|
||||
raise Exception('%s is not an object nor a static library' % obj)
|
||||
for symbol, section in SectionFinder._getSymbols(obj):
|
||||
sym = SectionFinder._normalize(symbol)
|
||||
if sym in self.mapping:
|
||||
if not section in self.mapping[sym]:
|
||||
self.mapping[sym].append(section)
|
||||
else:
|
||||
self.mapping[sym] = [section]
|
||||
|
||||
def getSections(self, symbol):
|
||||
'''Given a symbol, returns a list of sections containing it or the
|
||||
corresponding thunks. When the given symbol is a thunk, returns the
|
||||
list of sections containing its corresponding normal symbol and the
|
||||
other thunks for that symbol.'''
|
||||
sym = SectionFinder._normalize(symbol)
|
||||
if sym in self.mapping:
|
||||
return self.mapping[sym]
|
||||
return []
|
||||
|
||||
@staticmethod
|
||||
def _normalize(symbol):
|
||||
'''For normal symbols, return the given symbol. For thunks, return
|
||||
the corresponding normal symbol.'''
|
||||
if re.match('^_ZThn[0-9]+_', symbol):
|
||||
return re.sub('^_ZThn[0-9]+_', '_Z', symbol)
|
||||
return symbol
|
||||
|
||||
@staticmethod
|
||||
def _getSymbols(obj):
|
||||
'''Returns a list of (symbol, section) contained in the given object
|
||||
file.'''
|
||||
proc = subprocess.Popen(['objdump', '-t', obj], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
|
||||
(stdout, stderr) = proc.communicate()
|
||||
syms = []
|
||||
for line in stdout.splitlines():
|
||||
# Each line has the following format:
|
||||
# <addr> [lgu!][w ][C ][W ][Ii ][dD ][FfO ] <section>\t<length> <symbol>
|
||||
tmp = line.split(' ',1)
|
||||
# This gives us ["<addr>", "[lgu!][w ][C ][W ][Ii ][dD ][FfO ] <section>\t<length> <symbol>"]
|
||||
# We only need to consider cases where "<section>\t<length> <symbol>" is present,
|
||||
# and where the [FfO] flag is either F (function) or O (object).
|
||||
if len(tmp) > 1 and len(tmp[1]) > 6 and tmp[1][6] in ['O', 'F']:
|
||||
tmp = tmp[1][8:].split()
|
||||
# That gives us ["<section>","<length>", "<symbol>"]
|
||||
syms.append((tmp[-1], tmp[0]))
|
||||
return syms
|
||||
|
||||
def print_command(out, args):
|
||||
print >>out, "Executing: " + " ".join(args)
|
||||
for tmp in [f for f in args.tmp if os.path.isfile(f)]:
|
||||
print >>out, tmp + ":"
|
||||
with open(tmp) as file:
|
||||
print >>out, "".join([" " + l for l in file.readlines()])
|
||||
out.flush()
|
||||
|
||||
def main():
|
||||
parser = OptionParser()
|
||||
parser.add_option("--depend", dest="depend", metavar="FILE",
|
||||
help="generate dependencies for the given execution and store it in the given file")
|
||||
parser.add_option("--target", dest="target", metavar="FILE",
|
||||
help="designate the target for dependencies")
|
||||
parser.add_option("--extract", action="store_true", dest="extract",
|
||||
help="when a library has no descriptor file, extract it first, when possible")
|
||||
parser.add_option("--uselist", action="store_true", dest="uselist",
|
||||
help="use a list file for objects when executing a command")
|
||||
parser.add_option("--verbose", action="store_true", dest="verbose",
|
||||
help="display executed command and temporary files content")
|
||||
parser.add_option("--symbol-order", dest="symbol_order", metavar="FILE",
|
||||
help="use the given list of symbols to order symbols in the resulting binary when using with a linker")
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
if not options.target:
|
||||
options.depend = False
|
||||
if options.depend:
|
||||
deps = ExpandLibsDeps(args)
|
||||
# Filter out common command wrappers
|
||||
while os.path.basename(deps[0]) in ['ccache', 'distcc']:
|
||||
deps.pop(0)
|
||||
# Remove command
|
||||
deps.pop(0)
|
||||
with ExpandArgsMore(args) as args:
|
||||
if options.extract:
|
||||
args.extract()
|
||||
if options.symbol_order:
|
||||
args.orderSymbols(options.symbol_order)
|
||||
if options.uselist:
|
||||
args.makelist()
|
||||
|
||||
if options.verbose:
|
||||
print_command(sys.stderr, args)
|
||||
try:
|
||||
proc = subprocess.Popen(args, stdout = subprocess.PIPE, stderr = subprocess.STDOUT)
|
||||
except Exception, e:
|
||||
print >>sys.stderr, 'error: Launching', args, ':', e
|
||||
raise e
|
||||
(stdout, stderr) = proc.communicate()
|
||||
if proc.returncode and not options.verbose:
|
||||
print_command(sys.stderr, args)
|
||||
sys.stderr.write(stdout)
|
||||
sys.stderr.flush()
|
||||
if proc.returncode:
|
||||
exit(proc.returncode)
|
||||
if not options.depend:
|
||||
return
|
||||
ensureParentDir(options.depend)
|
||||
mk = Makefile()
|
||||
deps = [dep for dep in deps if os.path.isfile(dep) and dep != options.target]
|
||||
no_dynamic_lib = [dep for dep in deps if not isDynamicLib(dep)]
|
||||
mk.create_rule([options.target]).add_dependencies(no_dynamic_lib)
|
||||
if len(deps) != len(no_dynamic_lib):
|
||||
mk.create_rule(['%s_order_only' % options.target]).add_dependencies(dep for dep in deps if isDynamicLib(dep))
|
||||
|
||||
with open(options.depend, 'w') as depfile:
|
||||
mk.dump(depfile, removal_guard=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
@ -1,50 +0,0 @@
|
||||
# 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/.
|
||||
|
||||
'''Given a list of object files and library names, prints a library
|
||||
descriptor to standard output'''
|
||||
|
||||
from __future__ import with_statement
|
||||
import sys
|
||||
import os
|
||||
import expandlibs_config as conf
|
||||
from expandlibs import LibDescriptor, isObject, ensureParentDir, ExpandLibsDeps
|
||||
from optparse import OptionParser
|
||||
|
||||
def generate(args):
|
||||
desc = LibDescriptor()
|
||||
for arg in args:
|
||||
if isObject(arg):
|
||||
if os.path.exists(arg):
|
||||
desc['OBJS'].append(os.path.abspath(arg))
|
||||
else:
|
||||
raise Exception("File not found: %s" % arg)
|
||||
elif os.path.splitext(arg)[1] == conf.LIB_SUFFIX:
|
||||
if os.path.exists(arg) or os.path.exists(arg + conf.LIBS_DESC_SUFFIX):
|
||||
desc['LIBS'].append(os.path.abspath(arg))
|
||||
else:
|
||||
raise Exception("File not found: %s" % arg)
|
||||
return desc
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = OptionParser()
|
||||
parser.add_option("--depend", dest="depend", metavar="FILE",
|
||||
help="generate dependencies for the given execution and store it in the given file")
|
||||
parser.add_option("-o", dest="output", metavar="FILE",
|
||||
help="send output to the given file")
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
if not options.output:
|
||||
raise Exception("Missing option: -o")
|
||||
|
||||
ensureParentDir(options.output)
|
||||
with open(options.output, 'w') as outfile:
|
||||
print >>outfile, generate(args)
|
||||
if options.depend:
|
||||
ensureParentDir(options.depend)
|
||||
with open(options.depend, 'w') as depfile:
|
||||
deps = ExpandLibsDeps(args)
|
||||
depfile.write("%s : %s\n" % (options.output, ' '.join(deps)))
|
||||
for dep in deps:
|
||||
depfile.write("%s :\n" % dep)
|
@ -1,352 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# 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/.
|
||||
from __future__ import print_function
|
||||
|
||||
usage = """%prog: A test for OOM conditions in the shell.
|
||||
|
||||
%prog finds segfaults and other errors caused by incorrect handling of
|
||||
allocation during OOM (out-of-memory) conditions.
|
||||
"""
|
||||
|
||||
help = """Check for regressions only. This runs a set of files with a known
|
||||
number of OOM errors (specified by REGRESSION_COUNT), and exits with a non-zero
|
||||
result if more or less errors are found. See js/src/Makefile.in for invocation.
|
||||
"""
|
||||
|
||||
|
||||
import hashlib
|
||||
import re
|
||||
import shlex
|
||||
import subprocess
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
|
||||
from optparse import OptionParser
|
||||
|
||||
#####################################################################
|
||||
# Utility functions
|
||||
#####################################################################
|
||||
def run(args, stdin=None):
|
||||
class ThreadWorker(threading.Thread):
|
||||
def __init__(self, pipe):
|
||||
super(ThreadWorker, self).__init__()
|
||||
self.all = ""
|
||||
self.pipe = pipe
|
||||
self.setDaemon(True)
|
||||
|
||||
def run(self):
|
||||
while True:
|
||||
line = self.pipe.readline()
|
||||
if line == '': break
|
||||
else:
|
||||
self.all += line
|
||||
|
||||
try:
|
||||
if type(args) == str:
|
||||
args = shlex.split(args)
|
||||
|
||||
args = [str(a) for a in args] # convert to strs
|
||||
|
||||
stdin_pipe = subprocess.PIPE if stdin else None
|
||||
proc = subprocess.Popen(args, stdin=stdin_pipe, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
if stdin_pipe:
|
||||
proc.stdin.write(stdin)
|
||||
proc.stdin.close()
|
||||
|
||||
stdout_worker = ThreadWorker(proc.stdout)
|
||||
stderr_worker = ThreadWorker(proc.stderr)
|
||||
stdout_worker.start()
|
||||
stderr_worker.start()
|
||||
|
||||
proc.wait()
|
||||
stdout_worker.join()
|
||||
stderr_worker.join()
|
||||
|
||||
except KeyboardInterrupt as e:
|
||||
sys.exit(-1)
|
||||
|
||||
stdout, stderr = stdout_worker.all, stderr_worker.all
|
||||
result = (stdout, stderr, proc.returncode)
|
||||
return result
|
||||
|
||||
def get_js_files():
|
||||
(out, err, exit) = run('find ../jit-test/tests -name "*.js"')
|
||||
if (err, exit) != ("", 0):
|
||||
sys.exit("Wrong directory, run from an objdir")
|
||||
return out.split()
|
||||
|
||||
|
||||
|
||||
#####################################################################
|
||||
# Blacklisting
|
||||
#####################################################################
|
||||
def in_blacklist(sig):
|
||||
return sig in blacklist
|
||||
|
||||
def add_to_blacklist(sig):
|
||||
blacklist[sig] = blacklist.get(sig, 0)
|
||||
blacklist[sig] += 1
|
||||
|
||||
# How often is a particular lines important for this.
|
||||
def count_lines():
|
||||
"""Keep track of the amount of times individual lines occur, in order to
|
||||
prioritize the errors which occur most frequently."""
|
||||
counts = {}
|
||||
for string,count in blacklist.items():
|
||||
for line in string.split("\n"):
|
||||
counts[line] = counts.get(line, 0) + count
|
||||
|
||||
lines = []
|
||||
for k,v in counts.items():
|
||||
lines.append("{0:6}: {1}".format(v, k))
|
||||
|
||||
lines.sort()
|
||||
|
||||
countlog = file("../OOM_count_log", "w")
|
||||
countlog.write("\n".join(lines))
|
||||
countlog.flush()
|
||||
countlog.close()
|
||||
|
||||
|
||||
#####################################################################
|
||||
# Output cleaning
|
||||
#####################################################################
|
||||
def clean_voutput(err):
|
||||
# Skip what we can't reproduce
|
||||
err = re.sub(r"^--\d+-- run: /usr/bin/dsymutil \"shell/js\"$", "", err, flags=re.MULTILINE)
|
||||
err = re.sub(r"^==\d+==", "", err, flags=re.MULTILINE)
|
||||
err = re.sub(r"^\*\*\d+\*\*", "", err, flags=re.MULTILINE)
|
||||
err = re.sub(r"^\s+by 0x[0-9A-Fa-f]+: ", "by: ", err, flags=re.MULTILINE)
|
||||
err = re.sub(r"^\s+at 0x[0-9A-Fa-f]+: ", "at: ", err, flags=re.MULTILINE)
|
||||
err = re.sub(r"(^\s+Address 0x)[0-9A-Fa-f]+( is not stack'd)", r"\1\2", err, flags=re.MULTILINE)
|
||||
err = re.sub(r"(^\s+Invalid write of size )\d+", r"\1x", err, flags=re.MULTILINE)
|
||||
err = re.sub(r"(^\s+Invalid read of size )\d+", r"\1x", err, flags=re.MULTILINE)
|
||||
err = re.sub(r"(^\s+Address 0x)[0-9A-Fa-f]+( is )\d+( bytes inside a block of size )[0-9,]+( free'd)", r"\1\2\3\4", err, flags=re.MULTILINE)
|
||||
|
||||
# Skip the repeating bit due to the segfault
|
||||
lines = []
|
||||
for l in err.split('\n'):
|
||||
if l == " Process terminating with default action of signal 11 (SIGSEGV)":
|
||||
break
|
||||
lines.append(l)
|
||||
err = '\n'.join(lines)
|
||||
|
||||
return err
|
||||
|
||||
def remove_failed_allocation_backtraces(err):
|
||||
lines = []
|
||||
|
||||
add = True
|
||||
for l in err.split('\n'):
|
||||
|
||||
# Set start and end conditions for including text
|
||||
if l == " The site of the failed allocation is:":
|
||||
add = False
|
||||
elif l[:2] not in ['by: ', 'at:']:
|
||||
add = True
|
||||
|
||||
if add:
|
||||
lines.append(l)
|
||||
|
||||
|
||||
err = '\n'.join(lines)
|
||||
|
||||
return err
|
||||
|
||||
|
||||
def clean_output(err):
|
||||
err = re.sub(r"^js\(\d+,0x[0-9a-f]+\) malloc: \*\*\* error for object 0x[0-9a-f]+: pointer being freed was not allocated\n\*\*\* set a breakppoint in malloc_error_break to debug\n$", "pointer being freed was not allocated", err, flags=re.MULTILINE)
|
||||
|
||||
return err
|
||||
|
||||
|
||||
#####################################################################
|
||||
# Consts, etc
|
||||
#####################################################################
|
||||
|
||||
command_template = 'shell/js' \
|
||||
+ ' -m -j -p' \
|
||||
+ ' -e "const platform=\'darwin\'; const libdir=\'../jit-test/lib/\';"' \
|
||||
+ ' -f ../jit-test/lib/prolog.js' \
|
||||
+ ' -f {0}'
|
||||
|
||||
|
||||
# Blacklists are things we don't want to see in our logs again (though we do
|
||||
# want to count them when they happen). Whitelists we do want to see in our
|
||||
# logs again, principally because the information we have isn't enough.
|
||||
|
||||
blacklist = {}
|
||||
add_to_blacklist(r"('', '', 1)") # 1 means OOM if the shell hasn't launched yet.
|
||||
add_to_blacklist(r"('', 'out of memory\n', 1)")
|
||||
|
||||
whitelist = set()
|
||||
whitelist.add(r"('', 'out of memory\n', -11)") # -11 means OOM
|
||||
whitelist.add(r"('', 'out of memory\nout of memory\n', -11)")
|
||||
|
||||
|
||||
|
||||
#####################################################################
|
||||
# Program
|
||||
#####################################################################
|
||||
|
||||
# Options
|
||||
parser = OptionParser(usage=usage)
|
||||
parser.add_option("-r", "--regression", action="store", metavar="REGRESSION_COUNT", help=help,
|
||||
type="int", dest="regression", default=None)
|
||||
|
||||
(OPTIONS, args) = parser.parse_args()
|
||||
|
||||
|
||||
if OPTIONS.regression != None:
|
||||
# TODO: This should be expanded as we get a better hang of the OOM problems.
|
||||
# For now, we'll just check that the number of OOMs in one short file does not
|
||||
# increase.
|
||||
files = ["../jit-test/tests/arguments/args-createontrace.js"]
|
||||
else:
|
||||
files = get_js_files()
|
||||
|
||||
# Use a command-line arg to reduce the set of files
|
||||
if len (args):
|
||||
files = [f for f in files if f.find(args[0]) != -1]
|
||||
|
||||
|
||||
if OPTIONS.regression == None:
|
||||
# Don't use a logfile, this is automated for tinderbox.
|
||||
log = file("../OOM_log", "w")
|
||||
|
||||
|
||||
num_failures = 0
|
||||
for f in files:
|
||||
|
||||
# Run it once to establish boundaries
|
||||
command = (command_template + ' -O').format(f)
|
||||
out, err, exit = run(command)
|
||||
max = re.match(".*OOM max count: (\d+).*", out, flags=re.DOTALL).groups()[0]
|
||||
max = int(max)
|
||||
|
||||
# OOMs don't recover well for the first 20 allocations or so.
|
||||
# TODO: revisit this.
|
||||
for i in range(20, max):
|
||||
|
||||
if OPTIONS.regression == None:
|
||||
print("Testing allocation {0}/{1} in {2}".format(i,max,f))
|
||||
else:
|
||||
sys.stdout.write('.') # something short for tinderbox, no space or \n
|
||||
|
||||
command = (command_template + ' -A {0}').format(f, i)
|
||||
out, err, exit = run(command)
|
||||
|
||||
# Success (5 is SM's exit code for controlled errors)
|
||||
if exit == 5 and err.find("out of memory") != -1:
|
||||
continue
|
||||
|
||||
# Failure
|
||||
else:
|
||||
|
||||
if OPTIONS.regression != None:
|
||||
# Just count them
|
||||
num_failures += 1
|
||||
continue
|
||||
|
||||
#########################################################################
|
||||
# The regression tests ends above. The rest of this is for running the
|
||||
# script manually.
|
||||
#########################################################################
|
||||
|
||||
problem = str((out, err, exit))
|
||||
if in_blacklist(problem) and problem not in whitelist:
|
||||
add_to_blacklist(problem)
|
||||
continue
|
||||
|
||||
add_to_blacklist(problem)
|
||||
|
||||
|
||||
# Get valgrind output for a good stack trace
|
||||
vcommand = "valgrind --dsymutil=yes -q --log-file=OOM_valgrind_log_file " + command
|
||||
run(vcommand)
|
||||
vout = file("OOM_valgrind_log_file").read()
|
||||
vout = clean_voutput(vout)
|
||||
sans_alloc_sites = remove_failed_allocation_backtraces(vout)
|
||||
|
||||
# Don't print duplicate information
|
||||
if in_blacklist(sans_alloc_sites):
|
||||
add_to_blacklist(sans_alloc_sites)
|
||||
continue
|
||||
|
||||
add_to_blacklist(sans_alloc_sites)
|
||||
|
||||
log.write ("\n")
|
||||
log.write ("\n")
|
||||
log.write ("=========================================================================")
|
||||
log.write ("\n")
|
||||
log.write ("An allocation failure at\n\tallocation {0}/{1} in {2}\n\t"
|
||||
"causes problems (detected using bug 624094)"
|
||||
.format(i, max, f))
|
||||
log.write ("\n")
|
||||
log.write ("\n")
|
||||
|
||||
log.write ("Command (from obj directory, using patch from bug 624094):\n " + command)
|
||||
log.write ("\n")
|
||||
log.write ("\n")
|
||||
log.write ("stdout, stderr, exitcode:\n " + problem)
|
||||
log.write ("\n")
|
||||
log.write ("\n")
|
||||
|
||||
double_free = err.find("pointer being freed was not allocated") != -1
|
||||
oom_detected = err.find("out of memory") != -1
|
||||
multiple_oom_detected = err.find("out of memory\nout of memory") != -1
|
||||
segfault_detected = exit == -11
|
||||
|
||||
log.write ("Diagnosis: ")
|
||||
log.write ("\n")
|
||||
if multiple_oom_detected:
|
||||
log.write (" - Multiple OOMs reported")
|
||||
log.write ("\n")
|
||||
if segfault_detected:
|
||||
log.write (" - segfault")
|
||||
log.write ("\n")
|
||||
if not oom_detected:
|
||||
log.write (" - No OOM checking")
|
||||
log.write ("\n")
|
||||
if double_free:
|
||||
log.write (" - Double free")
|
||||
log.write ("\n")
|
||||
|
||||
log.write ("\n")
|
||||
|
||||
log.write ("Valgrind info:\n" + vout)
|
||||
log.write ("\n")
|
||||
log.write ("\n")
|
||||
log.flush()
|
||||
|
||||
if OPTIONS.regression == None:
|
||||
count_lines()
|
||||
|
||||
print()
|
||||
|
||||
# Do the actual regression check
|
||||
if OPTIONS.regression != None:
|
||||
expected_num_failures = OPTIONS.regression
|
||||
|
||||
if num_failures != expected_num_failures:
|
||||
|
||||
print("TEST-UNEXPECTED-FAIL |", end='')
|
||||
if num_failures > expected_num_failures:
|
||||
print("More out-of-memory errors were found ({0}) than expected ({1}). "
|
||||
"This probably means an allocation site has been added without a "
|
||||
"NULL-check. If this is unavoidable, you can account for it by "
|
||||
"updating Makefile.in.".format(num_failures, expected_num_failures),
|
||||
end='')
|
||||
else:
|
||||
print("Congratulations, you have removed {0} out-of-memory error(s) "
|
||||
"({1} remain)! Please account for it by updating Makefile.in."
|
||||
.format(expected_num_failures - num_failures, num_failures),
|
||||
end='')
|
||||
sys.exit(-1)
|
||||
else:
|
||||
print('TEST-PASS | find_OOM_errors | Found the expected number of OOM '
|
||||
'errors ({0})'.format(expected_num_failures))
|
||||
|
@ -1,6 +0,0 @@
|
||||
/* 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/. */
|
||||
|
||||
/* Begin all files as hidden visibility */
|
||||
#pragma GCC visibility push(hidden)
|
@ -1,26 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# 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/.
|
||||
|
||||
$output_dir = shift;
|
||||
|
||||
while (<STDIN>) {
|
||||
chomp;
|
||||
if (-e "$output_dir/$_") {
|
||||
next;
|
||||
}
|
||||
|
||||
if (/(.*)\/[^\/*]/) {
|
||||
mkdir "$output_dir/$1";
|
||||
}
|
||||
|
||||
open OUT, ">$output_dir/$_";
|
||||
print OUT "#pragma GCC system_header\n"; # suppress include_next warning
|
||||
print OUT "#pragma GCC visibility push(default)\n";
|
||||
print OUT "#include_next \<$_\>\n";
|
||||
print OUT "#pragma GCC visibility pop\n";
|
||||
close OUT;
|
||||
}
|
||||
|
@ -1,94 +0,0 @@
|
||||
# -*- makefile -*-
|
||||
# vim:set ts=8 sw=8 sts=8 noet:
|
||||
#
|
||||
# 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/.
|
||||
#
|
||||
|
||||
ifndef INCLUDED_AUTOTARGETS_MK #{
|
||||
|
||||
# Conditional does not wrap the entire file so multiple
|
||||
# includes will be able to accumulate dependencies.
|
||||
|
||||
###########################################################################
|
||||
# AUTO_DEPS - A list of deps/targets drived from other macros.
|
||||
###########################################################################
|
||||
|
||||
MKDIR ?= mkdir -p
|
||||
TOUCH ?= touch
|
||||
|
||||
# declare for local use, rules.mk may not have been loaded
|
||||
space = $(NULL) $(NULL)
|
||||
|
||||
# Deps will be considered intermediate when used as a pre-requisite for
|
||||
# wildcard targets. Inhibit their removal, mkdir -p is a standalone op.
|
||||
.PRECIOUS: %/.mkdir.done
|
||||
|
||||
#########################
|
||||
##---] FUNCTIONS [---##
|
||||
#########################
|
||||
|
||||
# Squeeze can be overzealous, restore root for abspath
|
||||
getPathPrefix =$(if $(filter /%,$(1)),/)
|
||||
|
||||
# Squeeze '//' from the path, easily created by string functions
|
||||
_slashSqueeze =$(foreach val,$(getargv),$(call getPathPrefix,$(val))$(subst $(space),/,$(strip $(subst /,$(space),$(val)))))
|
||||
|
||||
# Squeeze extraneous directory slashes from the path
|
||||
# o protect embedded spaces within the path
|
||||
# o replace //+ sequences with /
|
||||
slash_strip = \
|
||||
$(strip \
|
||||
$(subst <--[**]-->,$(space),\
|
||||
$(call _slashSqueeze,\
|
||||
$(subst $(space),<--[**]-->,$(1))\
|
||||
)))
|
||||
|
||||
# Extract directory path from a dependency file.
|
||||
mkdir_stem =$(foreach val,$(getargv),$(subst /.mkdir.done,$(NULL),$(val)))
|
||||
|
||||
## Generate timestamp file for threadsafe directory creation
|
||||
mkdir_deps =$(foreach dir,$(getargv),$(call slash_strip,$(dir)/.mkdir.done))
|
||||
|
||||
#######################
|
||||
##---] TARGETS [---##
|
||||
#######################
|
||||
|
||||
%/.mkdir.done: # mkdir -p -p => mkdir -p
|
||||
$(subst $(space)-p,$(null),$(MKDIR)) -p '$(dir $@)'
|
||||
# Make the timestamp old enough for not being a problem with symbolic links
|
||||
# targets depending on it. Use Jan 3, 1980 to accomodate any timezone where
|
||||
# 198001010000 would translate to something older than FAT epoch.
|
||||
@$(TOUCH) -t 198001030000 '$@'
|
||||
|
||||
# A handful of makefiles are attempting "mkdir dot".
|
||||
# tbpl/valgrind builds are using this target
|
||||
# https://bugzilla.mozilla.org/show_bug.cgi?id=837754
|
||||
.mkdir.done:
|
||||
@echo 'WARNING: $(MKDIR) -dot- requested by $(MAKE) -C $(CURDIR) $(MAKECMDGOALS)'
|
||||
@$(TOUCH) -t 198001030000 '$@'
|
||||
|
||||
INCLUDED_AUTOTARGETS_MK = 1
|
||||
endif #}
|
||||
|
||||
|
||||
## Accumulate deps and cleanup
|
||||
ifneq (,$(GENERATED_DIRS))
|
||||
GENERATED_DIRS := $(strip $(sort $(GENERATED_DIRS)))
|
||||
tmpauto :=$(call mkdir_deps,GENERATED_DIRS)
|
||||
GENERATED_DIRS_DEPS +=$(tmpauto)
|
||||
GARBAGE_DIRS +=$(GENERATED_DIRS)
|
||||
endif
|
||||
|
||||
#################################################################
|
||||
# One ring/dep to rule them all:
|
||||
# config/rules.mk::all target is available by default
|
||||
# Add $(AUTO_DEPS) as an explicit target dependency when needed.
|
||||
#################################################################
|
||||
|
||||
AUTO_DEPS +=$(GENERATED_DIRS_DEPS)
|
||||
AUTO_DEPS := $(strip $(sort $(AUTO_DEPS)))
|
||||
|
||||
# Complain loudly if deps have not loaded so getargv != $(NULL)
|
||||
$(call requiredfunction,getargv)
|
@ -1,121 +0,0 @@
|
||||
# -*- makefile -*-
|
||||
# vim:set ts=8 sw=8 sts=8 noet:
|
||||
#
|
||||
# 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/.
|
||||
#
|
||||
|
||||
###########################################################################
|
||||
## Intent: Helper targets for displaying variables and state information
|
||||
###########################################################################
|
||||
|
||||
# Support usage outside of config/rules.mk
|
||||
ifndef INCLUDED_DEBUGMAKE_MK #{
|
||||
|
||||
define shell_quote
|
||||
'$(subst ','\'',$(1))'
|
||||
endef
|
||||
|
||||
echo-variable-%:
|
||||
@echo $(call shell_quote,$($*))
|
||||
|
||||
echo-tiers:
|
||||
@echo $(TIERS)
|
||||
|
||||
echo-tier-dirs:
|
||||
@$(foreach tier,$(TIERS),echo '$(tier):'; echo ' dirs: $(tier_$(tier)_dirs)'; $(if $(tier_$(tier)_staticdirs),echo ' staticdirs: $(tier_$(tier)_staticdirs)';) )
|
||||
|
||||
echo-dirs:
|
||||
@echo $(call shell_quote,$(DIRS))
|
||||
|
||||
define print_var
|
||||
@printf '%20s = %s\n' $1 $(call shell_quote,$($1))
|
||||
|
||||
endef
|
||||
|
||||
define print_vars
|
||||
$(foreach var,$1,$(call print_var,$(var)))
|
||||
endef
|
||||
|
||||
showtargs:
|
||||
ifneq (,$(filter $(PROGRAM) $(HOST_PROGRAM) $(SIMPLE_PROGRAMS) $(HOST_LIBRARY) $(LIBRARY) $(SHARED_LIBRARY),$(TARGETS)))
|
||||
@echo --------------------------------------------------------------------------------
|
||||
$(call print_vars,\
|
||||
PROGRAM \
|
||||
SIMPLE_PROGRAMS \
|
||||
LIBRARY \
|
||||
SHARED_LIBRARY \
|
||||
SHARED_LIBRARY_LIBS \
|
||||
LIBS \
|
||||
DEF_FILE \
|
||||
IMPORT_LIBRARY \
|
||||
STATIC_LIBS \
|
||||
EXTRA_DSO_LDOPTS \
|
||||
DEPENDENT_LIBS \
|
||||
)
|
||||
@echo --------------------------------------------------------------------------------
|
||||
endif
|
||||
$(LOOP_OVER_PARALLEL_DIRS)
|
||||
$(LOOP_OVER_DIRS)
|
||||
$(LOOP_OVER_TOOL_DIRS)
|
||||
|
||||
showbuild:
|
||||
$(call print_vars,\
|
||||
MOZ_BUILD_ROOT \
|
||||
MOZ_WIDGET_TOOLKIT \
|
||||
CC \
|
||||
CXX \
|
||||
CCC \
|
||||
CPP \
|
||||
LD \
|
||||
AR \
|
||||
IMPLIB \
|
||||
FILTER \
|
||||
MKSHLIB \
|
||||
MKCSHLIB \
|
||||
RC \
|
||||
MC \
|
||||
CFLAGS \
|
||||
OS_CFLAGS \
|
||||
COMPILE_CFLAGS \
|
||||
CXXFLAGS \
|
||||
OS_CXXFLAGS \
|
||||
COMPILE_CXXFLAGS \
|
||||
COMPILE_CMFLAGS \
|
||||
COMPILE_CMMFLAGS \
|
||||
LDFLAGS \
|
||||
OS_LDFLAGS \
|
||||
DSO_LDOPTS \
|
||||
OS_INCLUDES \
|
||||
OS_LIBS \
|
||||
EXTRA_LIBS \
|
||||
BIN_FLAGS \
|
||||
INCLUDES \
|
||||
DEFINES \
|
||||
ACDEFINES \
|
||||
BIN_SUFFIX \
|
||||
LIB_SUFFIX \
|
||||
DLL_SUFFIX \
|
||||
IMPORT_LIB_SUFFIX \
|
||||
INSTALL \
|
||||
VPATH \
|
||||
)
|
||||
|
||||
showhost:
|
||||
$(call print_vars,\
|
||||
HOST_CC \
|
||||
HOST_CXX \
|
||||
HOST_CFLAGS \
|
||||
HOST_LDFLAGS \
|
||||
HOST_LIBS \
|
||||
HOST_EXTRA_LIBS \
|
||||
HOST_EXTRA_DEPS \
|
||||
HOST_PROGRAM \
|
||||
HOST_OBJS \
|
||||
HOST_PROGOBJS \
|
||||
HOST_LIBRARY \
|
||||
)
|
||||
|
||||
INCLUDED_DEBUGMAKE_MK = 1
|
||||
endif #}
|
@ -1,34 +0,0 @@
|
||||
#
|
||||
# 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/.
|
||||
|
||||
#
|
||||
# functions.mk
|
||||
#
|
||||
# Defines functions that are needed by various Makefiles throughout the build
|
||||
# system, which are needed before config.mk can be included.
|
||||
#
|
||||
|
||||
# Define an include-at-most-once flag
|
||||
ifdef INCLUDED_FUNCTIONS_MK
|
||||
$(error Do not include functions.mk twice!)
|
||||
endif
|
||||
INCLUDED_FUNCTIONS_MK = 1
|
||||
|
||||
core_abspath = $(error core_abspath is unsupported, use $$(abspath) instead)
|
||||
core_realpath = $(error core_realpath is unsupported)
|
||||
|
||||
core_winabspath = $(error core_winabspath is unsupported)
|
||||
|
||||
# Run a named Python build action. The first argument is the name of the build
|
||||
# action. The second argument are the arguments to pass to the action (space
|
||||
# delimited arguments). e.g.
|
||||
#
|
||||
# libs::
|
||||
# $(call py_action,purge_manifests,_build_manifests/purge/foo.manifest)
|
||||
ifdef .PYMAKE
|
||||
py_action = %mozbuild.action.$(1) main $(2)
|
||||
else
|
||||
py_action = $(PYTHON) -m mozbuild.action.$(1) $(2)
|
||||
endif
|
@ -1,113 +0,0 @@
|
||||
# -*- makefile -*-
|
||||
# vim:set ts=8 sw=8 sts=8 noet:
|
||||
#
|
||||
# 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/.
|
||||
|
||||
ifndef INCLUDED_JAVA_BUILD_MK #{
|
||||
|
||||
ifdef JAVAFILES #{
|
||||
GENERATED_DIRS += classes
|
||||
|
||||
export:: classes
|
||||
classes: $(call mkdir_deps,classes)
|
||||
endif #} JAVAFILES
|
||||
|
||||
|
||||
ifdef ANDROID_APK_NAME #{
|
||||
android_res_dirs := $(addprefix $(srcdir)/,$(or $(ANDROID_RES_DIRS),res))
|
||||
_ANDROID_RES_FLAG := $(addprefix -S ,$(android_res_dirs))
|
||||
_ANDROID_ASSETS_FLAG := $(addprefix -A ,$(ANDROID_ASSETS_DIR))
|
||||
|
||||
GENERATED_DIRS += classes
|
||||
|
||||
classes.dex: $(call mkdir_deps,classes)
|
||||
classes.dex: R.java
|
||||
classes.dex: $(ANDROID_APK_NAME).ap_
|
||||
classes.dex: $(JAVAFILES)
|
||||
$(JAVAC) $(JAVAC_FLAGS) -d classes $(filter %.java,$^)
|
||||
$(DX) --dex --output=$@ classes $(ANDROID_EXTRA_JARS)
|
||||
|
||||
# R.java and $(ANDROID_APK_NAME).ap_ are both produced by aapt. To
|
||||
# save an aapt invocation, we produce them both at the same time.
|
||||
|
||||
R.java: .aapt.deps
|
||||
$(ANDROID_APK_NAME).ap_: .aapt.deps
|
||||
|
||||
# This uses the fact that Android resource directories list all
|
||||
# resource files one subdirectory below the parent resource directory.
|
||||
android_res_files := $(wildcard $(addsuffix /*,$(wildcard $(addsuffix /*,$(android_res_dirs)))))
|
||||
|
||||
.aapt.deps: AndroidManifest.xml $(android_res_files) $(wildcard $(ANDROID_ASSETS_DIR))
|
||||
$(AAPT) package -f -M $< -I $(ANDROID_SDK)/android.jar $(_ANDROID_RES_FLAG) $(_ANDROID_ASSETS_FLAG) \
|
||||
-J ${@D} \
|
||||
-F $(ANDROID_APK_NAME).ap_
|
||||
@$(TOUCH) $@
|
||||
|
||||
$(ANDROID_APK_NAME)-unsigned-unaligned.apk: $(ANDROID_APK_NAME).ap_ classes.dex
|
||||
cp $< $@
|
||||
$(ZIP) -0 $@ classes.dex
|
||||
|
||||
$(ANDROID_APK_NAME)-unaligned.apk: $(ANDROID_APK_NAME)-unsigned-unaligned.apk
|
||||
cp $< $@
|
||||
$(DEBUG_JARSIGNER) $@
|
||||
|
||||
$(ANDROID_APK_NAME).apk: $(ANDROID_APK_NAME)-unaligned.apk
|
||||
$(ZIPALIGN) -f -v 4 $< $@
|
||||
|
||||
GARBAGE += \
|
||||
R.java \
|
||||
classes.dex \
|
||||
$(ANDROID_APK_NAME).ap_ \
|
||||
$(ANDROID_APK_NAME)-unsigned-unaligned.apk \
|
||||
$(ANDROID_APK_NAME)-unaligned.apk \
|
||||
$(ANDROID_APK_NAME).apk \
|
||||
$(NULL)
|
||||
|
||||
JAVA_CLASSPATH := $(ANDROID_SDK)/android.jar
|
||||
ifdef ANDROID_EXTRA_JARS #{
|
||||
JAVA_CLASSPATH := $(JAVA_CLASSPATH):$(subst $(NULL) ,:,$(strip $(ANDROID_EXTRA_JARS)))
|
||||
endif #} ANDROID_EXTRA_JARS
|
||||
|
||||
# Include Android specific java flags, instead of what's in rules.mk.
|
||||
include $(topsrcdir)/config/android-common.mk
|
||||
endif #} ANDROID_APK_NAME
|
||||
|
||||
|
||||
ifdef JAVA_JAR_TARGETS #{
|
||||
# Arg 1: Output target name with .jar suffix, like jars/jarfile.jar.
|
||||
# Intermediate class files are generated in jars/jarfile-classes.
|
||||
# Arg 2: Java sources list. We use VPATH and $^ so sources can be
|
||||
# relative to $(srcdir) or $(CURDIR).
|
||||
# Arg 3: List of extra jars to link against. We do not use VPATH so
|
||||
# jars must be relative to $(CURDIR).
|
||||
# Arg 4: Additional JAVAC_FLAGS.
|
||||
define java_jar_template
|
||||
$(1): $(2) $(3)
|
||||
$$(REPORT_BUILD)
|
||||
@$$(NSINSTALL) -D $(1:.jar=)-classes
|
||||
@$$(if $$(filter-out .,$$(@D)),$$(NSINSTALL) -D $$(@D))
|
||||
$$(JAVAC) $$(JAVAC_FLAGS)\
|
||||
$(4)\
|
||||
-d $(1:.jar=)-classes\
|
||||
$(if $(strip $(3)),-classpath $(subst $(NULL) ,:,$(strip $(3))))\
|
||||
$$(filter %.java,$$^)
|
||||
$$(JAR) cMf $$@ -C $(1:.jar=)-classes .
|
||||
|
||||
GARBAGE += $(1)
|
||||
|
||||
GARBAGE_DIRS += $(1:.jar=)-classes
|
||||
endef
|
||||
|
||||
$(foreach jar,$(JAVA_JAR_TARGETS),\
|
||||
$(if $($(jar)_DEST),,$(error Missing $(jar)_DEST))\
|
||||
$(if $($(jar)_JAVAFILES),,$(error Missing $(jar)_JAVAFILES))\
|
||||
$(eval $(call java_jar_template,$($(jar)_DEST),$($(jar)_JAVAFILES) $($(jar)_PP_JAVAFILES),$($(jar)_EXTRA_JARS),$($(jar)_JAVAC_FLAGS)))\
|
||||
)
|
||||
endif #} JAVA_JAR_TARGETS
|
||||
|
||||
|
||||
INCLUDED_JAVA_BUILD_MK := 1
|
||||
|
||||
endif #} INCLUDED_JAVA_BUILD_MK
|
@ -1,121 +0,0 @@
|
||||
# -*- makefile -*-
|
||||
# vim:set ts=8 sw=8 sts=8 noet:
|
||||
#
|
||||
# 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/.
|
||||
|
||||
## Identify function argument types
|
||||
istype =$(if $(value ${1}),list,scalar)
|
||||
isval =$(if $(filter-out list,$(call istype,${1})),true)
|
||||
isvar =$(if $(filter-out scalar,$(call istype,${1})),true)
|
||||
|
||||
# Access up to 9 arguments passed, option needed to emulate $*
|
||||
# Inline for function expansion, do not use $(call )
|
||||
argv =$(strip
|
||||
argv +=$(if $(1), $(1))$(if $(2), $(2))$(if $(3), $(3))$(if $(4), $(4))
|
||||
argv +=$(if $(5), $(5))$(if $(6), $(6))$(if $(7), $(7))$(if $(8), $(8))
|
||||
argv +=$(if $(9), $(9))
|
||||
argv +=$(if $(10), $(error makeutils.mk::argv can only handle 9 arguments))
|
||||
argv +=)
|
||||
|
||||
###########################################################################
|
||||
## Access function args as a simple list, inline within user functions.
|
||||
## Usage: $(info ** $(call banner,$(getargv)))
|
||||
## $(call banner,scalar)
|
||||
## $(call banner,list0 list1 list2)
|
||||
## $(call banner,ref) ; ref=foo bar tans
|
||||
## getarglist() would be a more accurate name but is longer to type
|
||||
getargv = $(if $(call isvar,$(1)),$($(1)),$(argv))
|
||||
|
||||
###########################################################################
|
||||
# Strip [n] leading options from an argument list. This will allow passing
|
||||
# extra args to user functions that will not propogate to sub-$(call )'s
|
||||
# Usage: $(call subargv,2)
|
||||
subargv =$(wordlist $(1),$(words $(getargv)),$(getargv))
|
||||
|
||||
###########################################################################
|
||||
# Intent: Display a distinct banner heading in the output stream
|
||||
# Usage: $(call banner,BUILDING: foo bar tans)
|
||||
# Debug:
|
||||
# target-preqs = \
|
||||
# $(call banner,target-preqs-BEGIN) \
|
||||
# foo bar tans \
|
||||
# $(call banner,target-preqs-END) \
|
||||
# $(NULL)
|
||||
# target: $(target-preqs)
|
||||
|
||||
banner = \
|
||||
$(info ) \
|
||||
$(info ***************************************************************************) \
|
||||
$(info ** $(getargv)) \
|
||||
$(info ***************************************************************************) \
|
||||
$(NULL)
|
||||
|
||||
#####################################################################
|
||||
# Intent: Determine if a string or pattern is contained in a list
|
||||
# Usage: strcmp - $(call if_XinY,clean,$(MAKECMDGOALS))
|
||||
# : pattern - $(call if_XinY,clean%,$(MAKECMDGOALS))
|
||||
is_XinY =$(filter $(1),$(call subargv,3,$(getargv)))
|
||||
|
||||
#####################################################################
|
||||
# Provide an alternate var to support testing
|
||||
ifdef MAKEUTILS_UNIT_TEST
|
||||
mcg_goals=TEST_MAKECMDGOALS
|
||||
else
|
||||
mcg_goals=MAKECMDGOALS
|
||||
endif
|
||||
|
||||
# Intent: Conditionals for detecting common/tier target use
|
||||
isTargetStem = $(sort \
|
||||
$(foreach var,$(getargv),\
|
||||
$(foreach pat,$(var)% %$(var),\
|
||||
$(call is_XinY,$(pat),${$(mcg_goals)})\
|
||||
)))
|
||||
isTargetStemClean = $(call isTargetStem,clean)
|
||||
isTargetStemExport = $(call isTargetStem,export)
|
||||
isTargetStemLibs = $(call isTargetStem,libs)
|
||||
isTargetStemTools = $(call isTargetStem,tools)
|
||||
|
||||
##################################################
|
||||
# Intent: Validation functions / unit test helpers
|
||||
|
||||
errorifneq =$(if $(subst $(strip $(1)),$(NULL),$(strip $(2))),$(error expected [$(1)] but found [$(2)]))
|
||||
|
||||
# Intent: verify function declaration exists
|
||||
requiredfunction =$(foreach func,$(1) $(2) $(3) $(4) $(5) $(6) $(7) $(8) $(9),$(if $(value $(func)),$(NULL),$(error required function [$(func)] is unavailable)))
|
||||
|
||||
|
||||
|
||||
## http://www.gnu.org/software/make/manual/make.html#Call-Function
|
||||
## Usage: o = $(call map,origin,o map $(MAKE))
|
||||
map = $(foreach val,$(2),$(call $(1),$(val)))
|
||||
|
||||
|
||||
## Disable checking for clean targets
|
||||
ifeq (,$(filter %clean clean%,$(MAKECMDGOALS))) #{
|
||||
|
||||
# Usage: $(call checkIfEmpty,[error|warning] foo NULL bar)
|
||||
checkIfEmpty =$(foreach var,$(wordlist 2,100,$(argv)),$(if $(strip $($(var))),$(NOP),$(call $(1),Variable $(var) does not contain a value)))
|
||||
|
||||
# Usage: $(call errorIfEmpty,foo NULL bar)
|
||||
errorIfEmpty =$(call checkIfEmpty,error $(argv))
|
||||
warnIfEmpty =$(call checkIfEmpty,warning $(argv))
|
||||
|
||||
endif #}
|
||||
|
||||
###########################################################################
|
||||
## Common makefile library loader
|
||||
###########################################################################
|
||||
topORerr =$(if $(topsrcdir),$(topsrcdir),$(error topsrcdir is not defined))
|
||||
|
||||
ifdef USE_AUTOTARGETS_MK # mkdir_deps
|
||||
include $(topORerr)/config/makefiles/autotargets.mk
|
||||
endif
|
||||
|
||||
ifdef USE_RCS_MK
|
||||
include $(topORerr)/config/makefiles/rcs.mk
|
||||
endif
|
||||
|
||||
## copy(src, dst): recursive copy
|
||||
copy_dir = (cd $(1)/. && $(TAR) $(TAR_CREATE_FLAGS) - .) | (cd $(2)/. && tar -xf -)
|
@ -1,52 +0,0 @@
|
||||
# -*- makefile -*-
|
||||
# vim:set ts=8 sw=8 sts=8 noet:
|
||||
#
|
||||
# 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/.
|
||||
|
||||
ifndef INCLUDED_TESTS_MOCHITEST_MK #{
|
||||
|
||||
# $1- test directory name
|
||||
# $2- optional: if passed dot used to flatten directory hierarchy copy
|
||||
# else- relativesrcdir
|
||||
mochitestdir = \
|
||||
$(strip \
|
||||
$(if $(2),$(DEPTH)/_tests/testing/mochitest/$1/. \
|
||||
,$(DEPTH)/_tests/testing/mochitest/$1/$(relativesrcdir) \
|
||||
))
|
||||
|
||||
|
||||
ifdef MOCHITEST_FILES
|
||||
MOCHITEST_DEST := $(call mochitestdir,tests)
|
||||
INSTALL_TARGETS += MOCHITEST
|
||||
endif
|
||||
|
||||
ifdef MOCHITEST_CHROME_FILES
|
||||
MOCHITEST_CHROME_DEST := $(call mochitestdir,chrome)
|
||||
INSTALL_TARGETS += MOCHITEST_CHROME
|
||||
endif
|
||||
|
||||
ifdef MOCHITEST_BROWSER_FILES
|
||||
MOCHITEST_BROWSER_DEST := $(call mochitestdir,browser)
|
||||
INSTALL_TARGETS += MOCHITEST_BROWSER
|
||||
endif
|
||||
|
||||
ifdef MOCHITEST_A11Y_FILES
|
||||
MOCHITEST_A11Y_DEST := $(call mochitestdir,a11y)
|
||||
INSTALL_TARGETS += MOCHITEST_A11Y
|
||||
endif
|
||||
|
||||
ifdef MOCHITEST_METRO_FILES
|
||||
MOCHITEST_METRO_DEST := $(call mochitestdir,metro)
|
||||
INSTALL_TARGETS += MOCHITEST_METRO
|
||||
endif
|
||||
|
||||
ifdef MOCHITEST_ROBOCOP_FILES
|
||||
MOCHITEST_ROBOCOP_DEST := $(call mochitestdir,tests/robocop,flat_hierarchy)
|
||||
INSTALL_TARGETS += MOCHITEST_ROBOCOP
|
||||
endif
|
||||
|
||||
INCLUDED_TESTS_MOCHITEST_MK := 1
|
||||
|
||||
endif #} INCLUDED_TESTS_MOCHITEST_MK
|
@ -1,68 +0,0 @@
|
||||
# -*- makefile -*-
|
||||
# vim:set ts=8 sw=8 sts=8 noet:
|
||||
#
|
||||
# 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/.
|
||||
|
||||
# The purpose of this file is to pull in non-recursive targets when performing
|
||||
# a partial tree (not top-level) build. This will allow people to continue to
|
||||
# build individual directories while some of the targets may not be normally
|
||||
# defined in that make file.
|
||||
#
|
||||
# Non-recursive targets are attached to existing make targets. The
|
||||
# NONRECURSIVE_TARGETS variable lists the make targets that modified. For
|
||||
# each target in this list, the NONRECURSIVE_TARGET_<target> variable will
|
||||
# contain a list of partial variable names. We will then look in variables
|
||||
# named NONRECURSIVE_TARGETS_<target>_<fragment>_* for information describing
|
||||
# how to evaluate non-recursive make targets.
|
||||
#
|
||||
# Targets are defined by the following variables:
|
||||
#
|
||||
# FILE - The make file to evaluate. This is equivalent to
|
||||
# |make -f <FILE>|
|
||||
# DIRECTORY - The directory whose Makefile to evaluate. This is
|
||||
# equivalent to |make -C <DIRECTORY>|.
|
||||
# TARGETS - Targets to evaluate in that make file.
|
||||
#
|
||||
# Only 1 of FILE or DIRECTORY may be defined.
|
||||
#
|
||||
# For example:
|
||||
#
|
||||
# NONRECURSIVE_TARGETS = export libs
|
||||
# NONRECURSIVE_TARGETS_export = headers
|
||||
# NONRECURSIVE_TARGETS_export_headers_FILE = /path/to/exports.mk
|
||||
# NONRECURSIVE_TARGETS_export_headers_TARGETS = $(DIST)/include/foo.h $(DIST)/include/bar.h
|
||||
# NONRECURSIVE_TARGETS_libs = cppsrcs
|
||||
# NONRECURSIVE_TARGETS_libs_cppsrcs_DIRECTORY = $(DEPTH)/foo
|
||||
# NONRECURSIVE_TARGETS_libs_cppsrcs_TARGETS = /path/to/foo.o /path/to/bar.o
|
||||
#
|
||||
# Will get turned into the following:
|
||||
#
|
||||
# exports::
|
||||
# $(MAKE) -C $(DEPTH) -f /path/to/exports.mk $(DIST)/include/foo.h $(DIST)/include/bar.h
|
||||
#
|
||||
# libs::
|
||||
# $(MAKE) -C $(DEPTH)/foo /path/to/foo.o /path/to/bar.o
|
||||
|
||||
ifndef INCLUDED_NONRECURSIVE_MK
|
||||
|
||||
define define_nonrecursive_target
|
||||
$(1)::
|
||||
$$(MAKE) -C $(or $(4),$$(DEPTH)) $(addprefix -f ,$(3)) $(2)
|
||||
endef
|
||||
|
||||
$(foreach target,$(NONRECURSIVE_TARGETS), \
|
||||
$(foreach entry,$(NONRECURSIVE_TARGETS_$(target)), \
|
||||
$(eval $(call define_nonrecursive_target, \
|
||||
$(target), \
|
||||
$(NONRECURSIVE_TARGETS_$(target)_$(entry)_TARGETS), \
|
||||
$(NONRECURSIVE_TARGETS_$(target)_$(entry)_FILE), \
|
||||
$(NONRECURSIVE_TARGETS_$(target)_$(entry)_DIRECTORY), \
|
||||
)) \
|
||||
) \
|
||||
)
|
||||
|
||||
INCLUDED_NONRECURSIVE_MK := 1
|
||||
endif
|
||||
|
@ -1,54 +0,0 @@
|
||||
# -*- makefile -*-
|
||||
# vim:set ts=8 sw=8 sts=8 noet:
|
||||
#
|
||||
# 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/.
|
||||
#
|
||||
|
||||
ifdef USE_RCS_MK #{
|
||||
|
||||
ifndef INCLUDED_RCS_MK #{
|
||||
|
||||
MOZ_RCS_TYPE_HG ?= $(notdir $(wildcard $(topsrcdir)/.hg))
|
||||
MOZ_RCS_TYPE_GIT ?= $(notdir $(wildcard $(topsrcdir)/.git))
|
||||
|
||||
|
||||
###########################################################################
|
||||
# HAVE_MERCURIAL_RCS
|
||||
###########################################################################
|
||||
ifeq (.hg,$(MOZ_RCS_TYPE_HG)) #{
|
||||
|
||||
# Intent: Retrieve the http:// repository path for a directory.
|
||||
# Usage: $(call getSourceRepo[,repo_dir|args])
|
||||
# Args:
|
||||
# path (optional): repository to query. Defaults to $(topsrcdir)
|
||||
getSourceRepo = \
|
||||
$(call FUNC_getSourceRepo,$(if $(1),cd $(1) && hg,hg --repository $(topsrcdir)))
|
||||
|
||||
# return: http://hg.mozilla.org/mozilla-central
|
||||
FUNC_getSourceRepo = \
|
||||
$(strip \
|
||||
$(patsubst %/,%,\
|
||||
$(patsubst ssh://%,http://%,\
|
||||
$(firstword $(shell $(getargv) showconfig paths.default))\
|
||||
)))
|
||||
|
||||
#} HAVE_MERCURIAL_RCS
|
||||
|
||||
###########################################################################
|
||||
# HAVE_GIT_RCS
|
||||
###########################################################################
|
||||
else ifeq (.git,$(MOZ_RCS_TYPE_GIT)) #{
|
||||
|
||||
GIT ?= git
|
||||
getSourceRepo = \
|
||||
$(shell cd $(topsrcdir) && $(GIT) rev-parse --verify HEAD)
|
||||
|
||||
endif #} HAVE_GIT_RCS
|
||||
|
||||
|
||||
INCLUDED_RCS_MK := 1
|
||||
endif #}
|
||||
|
||||
endif #}
|
@ -1,122 +0,0 @@
|
||||
# -*- makefile -*-
|
||||
# vim:set ts=8 sw=8 sts=8 noet:
|
||||
#
|
||||
# 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/.
|
||||
|
||||
ifdef EXPORT_LIBRARY
|
||||
ifeq ($(EXPORT_LIBRARY),1)
|
||||
ifdef IS_COMPONENT
|
||||
EXPORT_LIBRARY = $(DEPTH)/staticlib/components
|
||||
else
|
||||
EXPORT_LIBRARY = $(DEPTH)/staticlib
|
||||
endif
|
||||
else
|
||||
# If EXPORT_LIBRARY has a value, we'll be installing there. We also need to cleanup there
|
||||
GARBAGE += $(foreach lib,$(LIBRARY),$(EXPORT_LIBRARY)/$(lib))
|
||||
endif
|
||||
endif # EXPORT_LIBRARY
|
||||
|
||||
binaries libs:: $(SUBMAKEFILES) $(TARGETS)
|
||||
ifndef NO_DIST_INSTALL
|
||||
ifdef SHARED_LIBRARY
|
||||
ifdef IS_COMPONENT
|
||||
$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)/components
|
||||
ifndef NO_COMPONENTS_MANIFEST
|
||||
$(call py_action,buildlist,$(FINAL_TARGET)/chrome.manifest 'manifest components/components.manifest')
|
||||
$(call py_action,buildlist,$(FINAL_TARGET)/components/components.manifest 'binary-component $(SHARED_LIBRARY)')
|
||||
endif
|
||||
endif # IS_COMPONENT
|
||||
endif # SHARED_LIBRARY
|
||||
endif # !NO_DIST_INSTALL
|
||||
|
||||
ifndef NO_DIST_INSTALL
|
||||
|
||||
ifneq (,$(strip $(PROGRAM)$(SIMPLE_PROGRAMS)))
|
||||
PROGRAMS_EXECUTABLES = $(SIMPLE_PROGRAMS) $(PROGRAM)
|
||||
PROGRAMS_DEST ?= $(FINAL_TARGET)
|
||||
PROGRAMS_TARGET := binaries libs
|
||||
INSTALL_TARGETS += PROGRAMS
|
||||
endif
|
||||
|
||||
ifdef LIBRARY
|
||||
ifdef EXPORT_LIBRARY
|
||||
LIBRARY_FILES = $(LIBRARY)
|
||||
LIBRARY_DEST ?= $(EXPORT_LIBRARY)
|
||||
LIBRARY_TARGET = binaries libs
|
||||
INSTALL_TARGETS += LIBRARY
|
||||
endif
|
||||
ifdef DIST_INSTALL
|
||||
ifdef IS_COMPONENT
|
||||
$(error Shipping static component libs makes no sense.)
|
||||
else
|
||||
DIST_LIBRARY_FILES = $(LIBRARY)
|
||||
DIST_LIBRARY_DEST ?= $(DIST)/lib
|
||||
DIST_LIBRARY_TARGET = binaries libs
|
||||
INSTALL_TARGETS += DIST_LIBRARY
|
||||
endif
|
||||
endif # DIST_INSTALL
|
||||
endif # LIBRARY
|
||||
|
||||
|
||||
ifdef SHARED_LIBRARY
|
||||
ifndef IS_COMPONENT
|
||||
SHARED_LIBRARY_FILES = $(SHARED_LIBRARY)
|
||||
SHARED_LIBRARY_DEST ?= $(FINAL_TARGET)
|
||||
SHARED_LIBRARY_TARGET = binaries libs
|
||||
INSTALL_TARGETS += SHARED_LIBRARY
|
||||
|
||||
ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
|
||||
ifndef NO_INSTALL_IMPORT_LIBRARY
|
||||
IMPORT_LIB_FILES = $(IMPORT_LIBRARY)
|
||||
endif # NO_INSTALL_IMPORT_LIBRARY
|
||||
else
|
||||
IMPORT_LIB_FILES = $(SHARED_LIBRARY)
|
||||
endif
|
||||
|
||||
IMPORT_LIB_DEST ?= $(DIST)/lib
|
||||
IMPORT_LIB_TARGET = binaries libs
|
||||
ifdef IMPORT_LIB_FILES
|
||||
INSTALL_TARGETS += IMPORT_LIB
|
||||
endif
|
||||
|
||||
endif # ! IS_COMPONENT
|
||||
endif # SHARED_LIBRARY
|
||||
|
||||
ifneq (,$(strip $(HOST_SIMPLE_PROGRAMS)$(HOST_PROGRAM)))
|
||||
HOST_PROGRAMS_EXECUTABLES = $(HOST_SIMPLE_PROGRAMS) $(HOST_PROGRAM)
|
||||
HOST_PROGRAMS_DEST ?= $(DIST)/host/bin
|
||||
HOST_PROGRAMS_TARGET = binaries libs
|
||||
INSTALL_TARGETS += HOST_PROGRAMS
|
||||
endif
|
||||
|
||||
ifdef HOST_LIBRARY
|
||||
HOST_LIBRARY_FILES = $(HOST_LIBRARY)
|
||||
HOST_LIBRARY_DEST ?= $(DIST)/host/lib
|
||||
HOST_LIBRARY_TARGET = binaries libs
|
||||
INSTALL_TARGETS += HOST_LIBRARY
|
||||
endif
|
||||
|
||||
endif # !NO_DIST_INSTALL
|
||||
|
||||
ifdef MOZ_PSEUDO_DERECURSE
|
||||
BINARIES_INSTALL_TARGETS := $(foreach category,$(INSTALL_TARGETS),$(if $(filter binaries,$($(category)_TARGET)),$(category)))
|
||||
|
||||
# Fill a dependency file with all the binaries installed somewhere in $(DIST)
|
||||
# and with dependencies on the relevant backend files.
|
||||
BINARIES_PP := $(MDDEPDIR)/binaries.pp
|
||||
|
||||
$(BINARIES_PP): Makefile $(wildcard backend.mk) $(call mkdir_deps,$(MDDEPDIR))
|
||||
@echo '$(strip $(foreach category,$(BINARIES_INSTALL_TARGETS),\
|
||||
$(foreach file,$($(category)_FILES) $($(category)_EXECUTABLES),\
|
||||
$($(category)_DEST)/$(notdir $(file)): $(file)%\
|
||||
)\
|
||||
))binaries: Makefile $(wildcard backend.mk)' | tr % '\n' > $@
|
||||
|
||||
else
|
||||
binaries::
|
||||
$(error The binaries target is not supported without MOZ_PSEUDO_DERECURSE)
|
||||
endif
|
||||
|
||||
# EOF
|
@ -1,94 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
# 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/.
|
||||
|
||||
use Getopt::Long;
|
||||
|
||||
use strict;
|
||||
use vars qw(
|
||||
$OBJDIR
|
||||
$SRCDIR
|
||||
$TOPSRCDIR
|
||||
$SCRIPTDIR
|
||||
@TEMPLATE_FILE
|
||||
$MILESTONE_FILE
|
||||
$MILESTONE
|
||||
$MILESTONE_NUM
|
||||
@MILESTONE_PARTS
|
||||
$MINI_VERSION
|
||||
$MICRO_VERSION
|
||||
$opt_debug
|
||||
$opt_template
|
||||
$opt_uaversion
|
||||
$opt_symbolversion
|
||||
$opt_help
|
||||
);
|
||||
|
||||
$SCRIPTDIR = $0;
|
||||
$SCRIPTDIR =~ s/[^\/]*$//;
|
||||
push(@INC,$SCRIPTDIR);
|
||||
|
||||
require "Moz/Milestone.pm";
|
||||
|
||||
&GetOptions('topsrcdir=s' => \$TOPSRCDIR, 'srcdir=s' => \$SRCDIR, 'objdir=s' => \$OBJDIR, 'debug', 'help', 'template', 'uaversion', 'symbolversion');
|
||||
|
||||
if (defined($opt_help)) {
|
||||
&usage();
|
||||
exit;
|
||||
}
|
||||
|
||||
if (defined($opt_template)) {
|
||||
@TEMPLATE_FILE = @ARGV;
|
||||
if ($opt_debug) {
|
||||
print("TEMPLATE_FILE = --@TEMPLATE_FILE--\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (!defined($SRCDIR)) { $SRCDIR = '.'; }
|
||||
if (!defined($OBJDIR)) { $OBJDIR = '.'; }
|
||||
|
||||
$MILESTONE_FILE = "$TOPSRCDIR/config/milestone.txt";
|
||||
@MILESTONE_PARTS = (0, 0, 0, 0);
|
||||
|
||||
#
|
||||
# Grab milestone (top line of $MILESTONE_FILE that starts with a digit)
|
||||
#
|
||||
my $milestone = Moz::Milestone::getOfficialMilestone($MILESTONE_FILE);
|
||||
|
||||
if (@TEMPLATE_FILE) {
|
||||
my $TFILE;
|
||||
|
||||
foreach $TFILE (@TEMPLATE_FILE) {
|
||||
my $BUILT_FILE = "$OBJDIR/$TFILE";
|
||||
$TFILE = "$SRCDIR/$TFILE.tmpl";
|
||||
|
||||
if (-e $TFILE) {
|
||||
|
||||
Moz::Milestone::build_file($TFILE,$BUILT_FILE);
|
||||
|
||||
} else {
|
||||
warn("$0: No such file $TFILE!\n");
|
||||
}
|
||||
}
|
||||
} elsif(defined($opt_uaversion)) {
|
||||
# Only expose the major milestone in the UA string, hide the patch level
|
||||
# (bugs 572659 and 870868).
|
||||
my $uaversion = Moz::Milestone::getMilestoneMajor($milestone) . ".0";
|
||||
print "$uaversion\n";
|
||||
} elsif(defined($opt_symbolversion)) {
|
||||
# Only expose major milestone and alpha version. Used for symbol versioning
|
||||
# on Linux.
|
||||
my $symbolversion = Moz::Milestone::getMilestoneMajor($milestone) .
|
||||
Moz::Milestone::getMilestoneABWithNum($milestone);
|
||||
print "$symbolversion\n";
|
||||
} else {
|
||||
print "$milestone\n";
|
||||
}
|
||||
|
||||
sub usage() {
|
||||
print <<END
|
||||
`milestone.pl [--topsrcdir TOPSRCDIR] [--objdir OBJDIR] [--srcdir SRCDIR] --template [file list] --uaversion --symbolversion` # will build file list from .tmpl files
|
||||
END
|
||||
;
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
# Holds the current milestone.
|
||||
# Should be in the format of
|
||||
#
|
||||
# x.x.x
|
||||
# x.x.x.x
|
||||
# x.x.x+
|
||||
#
|
||||
# Referenced by milestone.pl.
|
||||
# Hopefully I'll be able to automate replacement of *all*
|
||||
# hardcoded milestones in the tree from these two files.
|
||||
#--------------------------------------------------------
|
||||
|
||||
29.0a1
|
@ -1,29 +0,0 @@
|
||||
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
CONFIGURE_SUBST_FILES += [
|
||||
'autoconf.mk',
|
||||
'emptyvars.mk',
|
||||
]
|
||||
|
||||
NO_DIST_INSTALL = True
|
||||
# For sanity's sake, we compile nsinstall without the wrapped system
|
||||
# headers, so that we can use it to set up the wrapped system headers.
|
||||
NO_VISIBILITY_FLAGS = True
|
||||
|
||||
if CONFIG['HOST_OS_ARCH'] != 'WINNT':
|
||||
HOST_SOURCES += [
|
||||
'nsinstall.c',
|
||||
'pathsub.c',
|
||||
]
|
||||
HOST_PROGRAM = 'nsinstall_real'
|
||||
|
||||
# Force wrap zlib system header if building js as a shared library.
|
||||
if CONFIG['JS_SHARED_LIBRARY'] or CONFIG['MOZ_NATIVE_ZLIB']:
|
||||
DEFINES['MOZ_NATIVE_ZLIB'] = 1
|
||||
|
||||
if CONFIG['MOZ_SHARED_ICU']:
|
||||
DEFINES['MOZ_SHARED_ICU'] = True
|
@ -1,452 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
/*
|
||||
** Netscape portable install command.
|
||||
**
|
||||
** Brendan Eich, 7/20/95
|
||||
*/
|
||||
#include <stdio.h> /* OSF/1 requires this before grp.h, so put it first */
|
||||
#include <assert.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <dirent.h>
|
||||
#include <limits.h>
|
||||
#include <grp.h>
|
||||
#include <pwd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <utime.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "pathsub.h"
|
||||
|
||||
#ifdef HAVE_GETOPT_H
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
|
||||
#ifdef SUNOS4
|
||||
#include "sunos4.h"
|
||||
#endif
|
||||
|
||||
#ifdef NEXTSTEP
|
||||
#include <bsd/libc.h>
|
||||
#endif
|
||||
|
||||
#ifdef __QNX__
|
||||
#include <unix.h>
|
||||
#endif
|
||||
|
||||
#ifdef NEED_S_ISLNK
|
||||
#if !defined(S_ISLNK) && defined(S_IFLNK)
|
||||
#define S_ISLNK(a) (((a) & S_IFMT) == S_IFLNK)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _DIRECTORY_SEPARATOR
|
||||
#define _DIRECTORY_SEPARATOR "/"
|
||||
#endif /* _DIRECTORY_SEPARATOR */
|
||||
|
||||
#ifdef NEED_FCHMOD_PROTO
|
||||
extern int fchmod(int fildes, mode_t mode);
|
||||
#endif
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"usage: %s [-C cwd] [-L linkprefix] [-m mode] [-o owner] [-g group]\n"
|
||||
" %*s [-DdltR] file [file ...] directory\n",
|
||||
program, (int) strlen(program), "");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
static int
|
||||
mkdirs(char *path, mode_t mode)
|
||||
{
|
||||
char *cp;
|
||||
struct stat sb;
|
||||
int res;
|
||||
int l;
|
||||
|
||||
/* strip trailing "/." */
|
||||
l = strlen(path);
|
||||
if(l > 1 && path[l - 1] == '.' && path[l - 2] == '/')
|
||||
path[l - 2] = 0;
|
||||
|
||||
while (*path == '/' && path[1] == '/')
|
||||
path++;
|
||||
for (cp = strrchr(path, '/'); cp && cp != path && *(cp - 1) == '/'; cp--);
|
||||
if (cp && cp != path) {
|
||||
*cp = '\0';
|
||||
if ((lstat(path, &sb) < 0 || !S_ISDIR(sb.st_mode)) &&
|
||||
mkdirs(path, mode) < 0) {
|
||||
return -1;
|
||||
}
|
||||
*cp = '/';
|
||||
}
|
||||
|
||||
res = mkdir(path, mode);
|
||||
if ((res != 0) && (errno == EEXIST))
|
||||
return 0;
|
||||
else
|
||||
return res;
|
||||
}
|
||||
|
||||
static uid_t
|
||||
touid(char *owner)
|
||||
{
|
||||
struct passwd *pw;
|
||||
uid_t uid;
|
||||
char *cp;
|
||||
|
||||
pw = getpwnam(owner);
|
||||
if (pw)
|
||||
return pw->pw_uid;
|
||||
uid = strtol(owner, &cp, 0);
|
||||
if (uid == 0 && cp == owner)
|
||||
fail("cannot find uid for %s", owner);
|
||||
return uid;
|
||||
}
|
||||
|
||||
static gid_t
|
||||
togid(char *group)
|
||||
{
|
||||
struct group *gr;
|
||||
gid_t gid;
|
||||
char *cp;
|
||||
|
||||
gr = getgrnam(group);
|
||||
if (gr)
|
||||
return gr->gr_gid;
|
||||
gid = strtol(group, &cp, 0);
|
||||
if (gid == 0 && cp == group)
|
||||
fail("cannot find gid for %s", group);
|
||||
return gid;
|
||||
}
|
||||
|
||||
static void
|
||||
copyfile( char *name, char *toname, mode_t mode, char *group, char *owner,
|
||||
int dotimes, uid_t uid, gid_t gid )
|
||||
{
|
||||
int fromfd, tofd = -1, cc, wc, exists;
|
||||
char buf[BUFSIZ], *bp;
|
||||
struct stat sb, tosb;
|
||||
struct utimbuf utb;
|
||||
|
||||
exists = (lstat(toname, &tosb) == 0);
|
||||
|
||||
fromfd = open(name, O_RDONLY);
|
||||
if (fromfd < 0 || fstat(fromfd, &sb) < 0)
|
||||
fail("cannot access %s", name);
|
||||
if (exists) {
|
||||
if (S_ISREG(tosb.st_mode)) {
|
||||
/* See if we can open it. This is more reliable than 'access'. */
|
||||
tofd = open(toname, O_CREAT | O_WRONLY, 0666);
|
||||
}
|
||||
if (tofd < 0) {
|
||||
(void) (S_ISDIR(tosb.st_mode) ? rmdir : unlink)(toname);
|
||||
}
|
||||
}
|
||||
if (tofd < 0) {
|
||||
tofd = open(toname, O_CREAT | O_WRONLY, 0666);
|
||||
if (tofd < 0)
|
||||
fail("cannot create %s", toname);
|
||||
}
|
||||
|
||||
bp = buf;
|
||||
while ((cc = read(fromfd, bp, sizeof buf)) > 0)
|
||||
{
|
||||
while ((wc = write(tofd, bp, (unsigned int)cc)) > 0)
|
||||
{
|
||||
if ((cc -= wc) == 0)
|
||||
break;
|
||||
bp += wc;
|
||||
}
|
||||
if (wc < 0)
|
||||
fail("cannot write to %s", toname);
|
||||
}
|
||||
if (cc < 0)
|
||||
fail("cannot read from %s", name);
|
||||
|
||||
if (ftruncate(tofd, sb.st_size) < 0)
|
||||
fail("cannot truncate %s", toname);
|
||||
#if !defined(VMS)
|
||||
if (dotimes)
|
||||
{
|
||||
utb.actime = sb.st_atime;
|
||||
utb.modtime = sb.st_mtime;
|
||||
if (utime(toname, &utb) < 0)
|
||||
fail("cannot set times of %s", toname);
|
||||
}
|
||||
#ifdef HAVE_FCHMOD
|
||||
if (fchmod(tofd, mode) < 0)
|
||||
#else
|
||||
if (chmod(toname, mode) < 0)
|
||||
#endif
|
||||
fail("cannot change mode of %s", toname);
|
||||
#endif
|
||||
if ((owner || group) && fchown(tofd, uid, gid) < 0)
|
||||
fail("cannot change owner of %s", toname);
|
||||
|
||||
/* Must check for delayed (NFS) write errors on close. */
|
||||
if (close(tofd) < 0)
|
||||
fail("cannot write to %s", toname);
|
||||
close(fromfd);
|
||||
#if defined(VMS)
|
||||
if (chmod(toname, (mode & (S_IREAD | S_IWRITE))) < 0)
|
||||
fail("cannot change mode of %s", toname);
|
||||
if (dotimes)
|
||||
{
|
||||
utb.actime = sb.st_atime;
|
||||
utb.modtime = sb.st_mtime;
|
||||
if (utime(toname, &utb) < 0)
|
||||
fail("cannot set times of %s", toname);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
copydir( char *from, char *to, mode_t mode, char *group, char *owner,
|
||||
int dotimes, uid_t uid, gid_t gid)
|
||||
{
|
||||
int i;
|
||||
DIR *dir;
|
||||
struct dirent *ep;
|
||||
struct stat sb;
|
||||
char *base, *destdir, *direntry, *destentry;
|
||||
|
||||
base = xbasename(from);
|
||||
|
||||
/* create destination directory */
|
||||
destdir = xmalloc((unsigned int)(strlen(to) + 1 + strlen(base) + 1));
|
||||
sprintf(destdir, "%s%s%s", to, _DIRECTORY_SEPARATOR, base);
|
||||
if (mkdirs(destdir, mode) != 0) {
|
||||
fail("cannot make directory %s\n", destdir);
|
||||
free(destdir);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(dir = opendir(from))) {
|
||||
fail("cannot open directory %s\n", from);
|
||||
free(destdir);
|
||||
return;
|
||||
}
|
||||
|
||||
direntry = xmalloc((unsigned int)PATH_MAX);
|
||||
destentry = xmalloc((unsigned int)PATH_MAX);
|
||||
|
||||
while ((ep = readdir(dir)))
|
||||
{
|
||||
if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0)
|
||||
continue;
|
||||
|
||||
sprintf(direntry, "%s/%s", from, ep->d_name);
|
||||
sprintf(destentry, "%s%s%s", destdir, _DIRECTORY_SEPARATOR, ep->d_name);
|
||||
|
||||
if (stat(direntry, &sb) == 0 && S_ISDIR(sb.st_mode))
|
||||
copydir( direntry, destdir, mode, group, owner, dotimes, uid, gid );
|
||||
else
|
||||
copyfile( direntry, destentry, mode, group, owner, dotimes, uid, gid );
|
||||
}
|
||||
|
||||
free(destdir);
|
||||
free(direntry);
|
||||
free(destentry);
|
||||
closedir(dir);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int onlydir, dodir, dolink, dorelsymlink, dotimes, opt, len, lplen, tdlen, bnlen, exists, fromfd, tofd, cc, wc;
|
||||
mode_t mode = 0755;
|
||||
char *linkprefix, *owner, *group, *cp, *cwd, *todir, *toname, *name, *base, *linkname, *bp, buf[BUFSIZ];
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
struct stat sb, tosb, fromsb;
|
||||
struct utimbuf utb;
|
||||
|
||||
program = argv[0];
|
||||
cwd = linkname = linkprefix = owner = group = 0;
|
||||
onlydir = dodir = dolink = dorelsymlink = dotimes = lplen = 0;
|
||||
|
||||
while ((opt = getopt(argc, argv, "C:DdlL:Rm:o:g:t")) != EOF) {
|
||||
switch (opt) {
|
||||
case 'C':
|
||||
cwd = optarg;
|
||||
break;
|
||||
case 'D':
|
||||
onlydir = 1;
|
||||
break;
|
||||
case 'd':
|
||||
dodir = 1;
|
||||
break;
|
||||
case 'L':
|
||||
linkprefix = optarg;
|
||||
lplen = strlen(linkprefix);
|
||||
dolink = 1;
|
||||
break;
|
||||
case 'R':
|
||||
dolink = dorelsymlink = 1;
|
||||
break;
|
||||
case 'm':
|
||||
mode = strtoul(optarg, &cp, 8);
|
||||
if (mode == 0 && cp == optarg)
|
||||
usage();
|
||||
break;
|
||||
case 'o':
|
||||
owner = optarg;
|
||||
break;
|
||||
case 'g':
|
||||
group = optarg;
|
||||
break;
|
||||
case 't':
|
||||
dotimes = 1;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
}
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
if (argc < 2 - onlydir)
|
||||
usage();
|
||||
|
||||
todir = argv[argc-1];
|
||||
if ((stat(todir, &sb) < 0 || !S_ISDIR(sb.st_mode)) &&
|
||||
mkdirs(todir, 0777) < 0) {
|
||||
fail("cannot make directory %s", todir);
|
||||
}
|
||||
if (onlydir)
|
||||
return 0;
|
||||
|
||||
if (!cwd) {
|
||||
#ifndef NEEDS_GETCWD
|
||||
#ifndef GETCWD_CANT_MALLOC
|
||||
cwd = getcwd(0, PATH_MAX);
|
||||
#else
|
||||
cwd = malloc(PATH_MAX + 1);
|
||||
cwd = getcwd(cwd, PATH_MAX);
|
||||
#endif
|
||||
#else
|
||||
cwd = malloc(PATH_MAX + 1);
|
||||
cwd = getwd(cwd);
|
||||
#endif
|
||||
}
|
||||
|
||||
xchdir(todir);
|
||||
#ifndef NEEDS_GETCWD
|
||||
#ifndef GETCWD_CANT_MALLOC
|
||||
todir = getcwd(0, PATH_MAX);
|
||||
#else
|
||||
todir = malloc(PATH_MAX + 1);
|
||||
todir = getcwd(todir, PATH_MAX);
|
||||
#endif
|
||||
#else
|
||||
todir = malloc(PATH_MAX + 1);
|
||||
todir = getwd(todir);
|
||||
#endif
|
||||
tdlen = strlen(todir);
|
||||
xchdir(cwd);
|
||||
tdlen = strlen(todir);
|
||||
|
||||
uid = owner ? touid(owner) : (uid_t)(-1);
|
||||
gid = group ? togid(group) : (gid_t)(-1);
|
||||
|
||||
while (--argc > 0) {
|
||||
name = *argv++;
|
||||
len = strlen(name);
|
||||
base = xbasename(name);
|
||||
bnlen = strlen(base);
|
||||
toname = xmalloc((unsigned int)(tdlen + 1 + bnlen + 1));
|
||||
sprintf(toname, "%s%s%s", todir, _DIRECTORY_SEPARATOR, base);
|
||||
exists = (lstat(toname, &tosb) == 0);
|
||||
|
||||
if (dodir) {
|
||||
/* -d means create a directory, always */
|
||||
if (exists && !S_ISDIR(tosb.st_mode)) {
|
||||
(void) unlink(toname);
|
||||
exists = 0;
|
||||
}
|
||||
if (!exists && mkdir(toname, mode) < 0)
|
||||
fail("cannot make directory %s", toname);
|
||||
if ((owner || group) && chown(toname, uid, gid) < 0)
|
||||
fail("cannot change owner of %s", toname);
|
||||
} else if (dolink) {
|
||||
if (access(name, R_OK) != 0) {
|
||||
fail("cannot access %s", name);
|
||||
}
|
||||
if (*name == '/') {
|
||||
/* source is absolute pathname, link to it directly */
|
||||
linkname = 0;
|
||||
} else {
|
||||
if (linkprefix) {
|
||||
/* -L prefixes names with a $cwd arg. */
|
||||
len += lplen + 1;
|
||||
linkname = xmalloc((unsigned int)(len + 1));
|
||||
sprintf(linkname, "%s/%s", linkprefix, name);
|
||||
} else if (dorelsymlink) {
|
||||
/* Symlink the relative path from todir to source name. */
|
||||
linkname = xmalloc(PATH_MAX);
|
||||
|
||||
if (*todir == '/') {
|
||||
/* todir is absolute: skip over common prefix. */
|
||||
lplen = relatepaths(todir, cwd, linkname);
|
||||
strcpy(linkname + lplen, name);
|
||||
} else {
|
||||
/* todir is named by a relative path: reverse it. */
|
||||
reversepath(todir, name, len, linkname);
|
||||
xchdir(cwd);
|
||||
}
|
||||
|
||||
len = strlen(linkname);
|
||||
}
|
||||
name = linkname;
|
||||
}
|
||||
|
||||
/* Check for a pre-existing symlink with identical content. */
|
||||
if ((exists && (!S_ISLNK(tosb.st_mode) ||
|
||||
readlink(toname, buf, sizeof buf) != len ||
|
||||
strncmp(buf, name, (unsigned int)len) != 0)) ||
|
||||
((stat(name, &fromsb) == 0) &&
|
||||
(fromsb.st_mtime > tosb.st_mtime))) {
|
||||
(void) (S_ISDIR(tosb.st_mode) ? rmdir : unlink)(toname);
|
||||
exists = 0;
|
||||
}
|
||||
if (!exists && symlink(name, toname) < 0)
|
||||
fail("cannot make symbolic link %s", toname);
|
||||
#ifdef HAVE_LCHOWN
|
||||
if ((owner || group) && lchown(toname, uid, gid) < 0)
|
||||
fail("cannot change owner of %s", toname);
|
||||
#endif
|
||||
|
||||
if (linkname) {
|
||||
free(linkname);
|
||||
linkname = 0;
|
||||
}
|
||||
} else {
|
||||
/* Copy from name to toname, which might be the same file. */
|
||||
if( stat(name, &sb) == 0 && S_IFDIR & sb.st_mode )
|
||||
{
|
||||
/* then is directory: must explicitly create destination dir */
|
||||
/* and manually copy files over */
|
||||
copydir( name, todir, mode, group, owner, dotimes, uid, gid );
|
||||
}
|
||||
else
|
||||
{
|
||||
copyfile(name, toname, mode, group, owner, dotimes, uid, gid);
|
||||
}
|
||||
}
|
||||
|
||||
free(toname);
|
||||
}
|
||||
|
||||
free(cwd);
|
||||
free(todir);
|
||||
return 0;
|
||||
}
|
@ -1,180 +0,0 @@
|
||||
# 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/.
|
||||
|
||||
# This is a partial python port of nsinstall.
|
||||
# It's intended to be used when there's no natively compile nsinstall
|
||||
# available, and doesn't intend to be fully equivalent.
|
||||
# Its major use is for l10n repackaging on systems that don't have
|
||||
# a full build environment set up.
|
||||
# The basic limitation is, it doesn't even try to link and ignores
|
||||
# all related options.
|
||||
from __future__ import print_function
|
||||
from optparse import OptionParser
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
import shutil
|
||||
import stat
|
||||
|
||||
def _nsinstall_internal(argv):
|
||||
usage = "usage: %prog [options] arg1 [arg2 ...] target-directory"
|
||||
p = OptionParser(usage=usage)
|
||||
|
||||
p.add_option('-D', action="store_true",
|
||||
help="Create a single directory only")
|
||||
p.add_option('-t', action="store_true",
|
||||
help="Preserve time stamp")
|
||||
p.add_option('-m', action="store",
|
||||
help="Set mode", metavar="mode")
|
||||
p.add_option('-d', action="store_true",
|
||||
help="Create directories in target")
|
||||
p.add_option('-R', action="store_true",
|
||||
help="Use relative symbolic links (ignored)")
|
||||
p.add_option('-L', action="store", metavar="linkprefix",
|
||||
help="Link prefix (ignored)")
|
||||
p.add_option('-X', action="append", metavar="file",
|
||||
help="Ignore a file when installing a directory recursively.")
|
||||
|
||||
# The remaining arguments are not used in our tree, thus they're not
|
||||
# implented.
|
||||
def BadArg(option, opt, value, parser):
|
||||
parser.error('option not supported: {0}'.format(opt))
|
||||
|
||||
p.add_option('-C', action="callback", metavar="CWD",
|
||||
callback=BadArg,
|
||||
help="NOT SUPPORTED")
|
||||
p.add_option('-o', action="callback", callback=BadArg,
|
||||
help="Set owner (NOT SUPPORTED)", metavar="owner")
|
||||
p.add_option('-g', action="callback", callback=BadArg,
|
||||
help="Set group (NOT SUPPORTED)", metavar="group")
|
||||
|
||||
(options, args) = p.parse_args(argv)
|
||||
|
||||
if options.m:
|
||||
# mode is specified
|
||||
try:
|
||||
options.m = int(options.m, 8)
|
||||
except:
|
||||
sys.stderr.write('nsinstall: {0} is not a valid mode\n'
|
||||
.format(options.m))
|
||||
return 1
|
||||
|
||||
# just create one directory?
|
||||
def maybe_create_dir(dir, mode, try_again):
|
||||
dir = os.path.abspath(dir)
|
||||
if os.path.exists(dir):
|
||||
if not os.path.isdir(dir):
|
||||
print('nsinstall: {0} is not a directory'.format(dir), file=sys.stderr)
|
||||
return 1
|
||||
if mode:
|
||||
os.chmod(dir, mode)
|
||||
return 0
|
||||
|
||||
try:
|
||||
if mode:
|
||||
os.makedirs(dir, mode)
|
||||
else:
|
||||
os.makedirs(dir)
|
||||
except Exception as e:
|
||||
# We might have hit EEXIST due to a race condition (see bug 463411) -- try again once
|
||||
if try_again:
|
||||
return maybe_create_dir(dir, mode, False)
|
||||
print("nsinstall: failed to create directory {0}: {1}".format(dir, e))
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
|
||||
if options.X:
|
||||
options.X = [os.path.abspath(p) for p in options.X]
|
||||
|
||||
if options.D:
|
||||
return maybe_create_dir(args[0], options.m, True)
|
||||
|
||||
# nsinstall arg1 [...] directory
|
||||
if len(args) < 2:
|
||||
p.error('not enough arguments')
|
||||
|
||||
def copy_all_entries(entries, target):
|
||||
for e in entries:
|
||||
e = os.path.abspath(e)
|
||||
if options.X and e in options.X:
|
||||
continue
|
||||
|
||||
dest = os.path.join(target, os.path.basename(e))
|
||||
dest = os.path.abspath(dest)
|
||||
handleTarget(e, dest)
|
||||
if options.m:
|
||||
os.chmod(dest, options.m)
|
||||
|
||||
# set up handler
|
||||
if options.d:
|
||||
# we're supposed to create directories
|
||||
def handleTarget(srcpath, targetpath):
|
||||
# target directory was already created, just use mkdir
|
||||
os.mkdir(targetpath)
|
||||
else:
|
||||
# we're supposed to copy files
|
||||
def handleTarget(srcpath, targetpath):
|
||||
if os.path.isdir(srcpath):
|
||||
if not os.path.exists(targetpath):
|
||||
os.mkdir(targetpath)
|
||||
entries = [os.path.join(srcpath, e) for e in os.listdir(srcpath)]
|
||||
copy_all_entries(entries, targetpath)
|
||||
# options.t is not relevant for directories
|
||||
if options.m:
|
||||
os.chmod(targetpath, options.m)
|
||||
else:
|
||||
if os.path.exists(targetpath):
|
||||
# On Windows, read-only files can't be deleted
|
||||
os.chmod(targetpath, stat.S_IWUSR)
|
||||
os.remove(targetpath)
|
||||
if options.t:
|
||||
shutil.copy2(srcpath, targetpath)
|
||||
else:
|
||||
shutil.copy(srcpath, targetpath)
|
||||
|
||||
# the last argument is the target directory
|
||||
target = args.pop()
|
||||
# ensure target directory (importantly, we do not apply a mode to the directory
|
||||
# because we want to copy files into it and the mode might be read-only)
|
||||
rv = maybe_create_dir(target, None, True)
|
||||
if rv != 0:
|
||||
return rv
|
||||
|
||||
copy_all_entries(args, target)
|
||||
return 0
|
||||
|
||||
# nsinstall as a native command is always UTF-8
|
||||
def nsinstall(argv):
|
||||
return _nsinstall_internal([unicode(arg, "utf-8") for arg in argv])
|
||||
|
||||
if __name__ == '__main__':
|
||||
# sys.argv corrupts characters outside the system code page on Windows
|
||||
# <http://bugs.python.org/issue2128>. Use ctypes instead. This is also
|
||||
# useful because switching to Unicode strings makes python use the wide
|
||||
# Windows APIs, which is what we want here since the wide APIs normally do a
|
||||
# better job at handling long paths and such.
|
||||
if sys.platform == "win32":
|
||||
import ctypes
|
||||
from ctypes import wintypes
|
||||
GetCommandLine = ctypes.windll.kernel32.GetCommandLineW
|
||||
GetCommandLine.argtypes = []
|
||||
GetCommandLine.restype = wintypes.LPWSTR
|
||||
|
||||
CommandLineToArgv = ctypes.windll.shell32.CommandLineToArgvW
|
||||
CommandLineToArgv.argtypes = [wintypes.LPWSTR, ctypes.POINTER(ctypes.c_int)]
|
||||
CommandLineToArgv.restype = ctypes.POINTER(wintypes.LPWSTR)
|
||||
|
||||
argc = ctypes.c_int(0)
|
||||
argv_arr = CommandLineToArgv(GetCommandLine(), ctypes.byref(argc))
|
||||
# The first argv will be "python", the second will be the .py file
|
||||
argv = argv_arr[1:argc.value]
|
||||
else:
|
||||
# For consistency, do it on Unix as well
|
||||
if sys.stdin.encoding is not None:
|
||||
argv = [unicode(arg, sys.stdin.encoding) for arg in sys.argv]
|
||||
else:
|
||||
argv = [unicode(arg) for arg in sys.argv]
|
||||
|
||||
sys.exit(_nsinstall_internal(argv[1:]))
|
@ -1,215 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
/*
|
||||
** Pathname subroutines.
|
||||
**
|
||||
** Brendan Eich, 8/29/95
|
||||
*/
|
||||
#include <assert.h>
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include "pathsub.h"
|
||||
|
||||
#ifdef USE_REENTRANT_LIBC
|
||||
#include <libc_r.h>
|
||||
#endif
|
||||
|
||||
#ifdef SUNOS4
|
||||
#include "sunos4.h"
|
||||
#endif
|
||||
|
||||
#ifndef D_INO
|
||||
#define D_INO d_ino
|
||||
#endif
|
||||
|
||||
char *program;
|
||||
|
||||
void
|
||||
fail(char *format, ...)
|
||||
{
|
||||
int error;
|
||||
va_list ap;
|
||||
|
||||
#ifdef USE_REENTRANT_LIBC
|
||||
R_STRERROR_INIT_R();
|
||||
#endif
|
||||
|
||||
error = errno;
|
||||
fprintf(stderr, "%s: ", program);
|
||||
va_start(ap, format);
|
||||
vfprintf(stderr, format, ap);
|
||||
va_end(ap);
|
||||
if (error) {
|
||||
|
||||
#ifdef USE_REENTRANT_LIBC
|
||||
R_STRERROR_R(errno);
|
||||
fprintf(stderr, ": %s", r_strerror_r);
|
||||
#else
|
||||
fprintf(stderr, ": %s", strerror(errno));
|
||||
#endif
|
||||
}
|
||||
|
||||
putc('\n', stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
char *
|
||||
getcomponent(char *path, char *name)
|
||||
{
|
||||
if (*path == '\0')
|
||||
return 0;
|
||||
if (*path == '/') {
|
||||
*name++ = '/';
|
||||
} else {
|
||||
do {
|
||||
*name++ = *path++;
|
||||
} while (*path != '/' && *path != '\0');
|
||||
}
|
||||
*name = '\0';
|
||||
while (*path == '/')
|
||||
path++;
|
||||
return path;
|
||||
}
|
||||
|
||||
#ifdef LAME_READDIR
|
||||
#include <sys/param.h>
|
||||
/*
|
||||
** The static buffer in Unixware's readdir is too small.
|
||||
*/
|
||||
struct dirent *readdir(DIR *d)
|
||||
{
|
||||
static struct dirent *buf = NULL;
|
||||
|
||||
if(buf == NULL)
|
||||
buf = (struct dirent *) malloc(sizeof(struct dirent) + MAXPATHLEN);
|
||||
return(readdir_r(d, buf));
|
||||
}
|
||||
#endif
|
||||
|
||||
char *
|
||||
ino2name(ino_t ino)
|
||||
{
|
||||
DIR *dp;
|
||||
struct dirent *ep;
|
||||
char *name;
|
||||
|
||||
dp = opendir("..");
|
||||
if (!dp)
|
||||
fail("cannot read parent directory");
|
||||
for (;;) {
|
||||
if (!(ep = readdir(dp)))
|
||||
fail("cannot find current directory");
|
||||
if (ep->D_INO == ino)
|
||||
break;
|
||||
}
|
||||
name = xstrdup(ep->d_name);
|
||||
closedir(dp);
|
||||
return name;
|
||||
}
|
||||
|
||||
void *
|
||||
xmalloc(size_t size)
|
||||
{
|
||||
void *p = malloc(size);
|
||||
if (!p)
|
||||
fail("cannot allocate %u bytes", size);
|
||||
return p;
|
||||
}
|
||||
|
||||
char *
|
||||
xstrdup(char *s)
|
||||
{
|
||||
return strcpy(xmalloc(strlen(s) + 1), s);
|
||||
}
|
||||
|
||||
char *
|
||||
xbasename(char *path)
|
||||
{
|
||||
char *cp;
|
||||
|
||||
while ((cp = strrchr(path, '/')) && cp[1] == '\0')
|
||||
*cp = '\0';
|
||||
if (!cp) return path;
|
||||
return cp + 1;
|
||||
}
|
||||
|
||||
void
|
||||
xchdir(char *dir)
|
||||
{
|
||||
if (chdir(dir) < 0)
|
||||
fail("cannot change directory to %s", dir);
|
||||
}
|
||||
|
||||
int
|
||||
relatepaths(char *from, char *to, char *outpath)
|
||||
{
|
||||
char *cp, *cp2;
|
||||
int len;
|
||||
char buf[NAME_MAX];
|
||||
|
||||
assert(*from == '/' && *to == '/');
|
||||
for (cp = to, cp2 = from; *cp == *cp2; cp++, cp2++)
|
||||
if (*cp == '\0')
|
||||
break;
|
||||
while (cp[-1] != '/')
|
||||
cp--, cp2--;
|
||||
if (cp - 1 == to) {
|
||||
/* closest common ancestor is /, so use full pathname */
|
||||
len = strlen(strcpy(outpath, to));
|
||||
if (outpath[len] != '/') {
|
||||
outpath[len++] = '/';
|
||||
outpath[len] = '\0';
|
||||
}
|
||||
} else {
|
||||
len = 0;
|
||||
while ((cp2 = getcomponent(cp2, buf)) != 0) {
|
||||
strcpy(outpath + len, "../");
|
||||
len += 3;
|
||||
}
|
||||
while ((cp = getcomponent(cp, buf)) != 0) {
|
||||
sprintf(outpath + len, "%s/", buf);
|
||||
len += strlen(outpath + len);
|
||||
}
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
void
|
||||
reversepath(char *inpath, char *name, int len, char *outpath)
|
||||
{
|
||||
char *cp, *cp2;
|
||||
char buf[NAME_MAX];
|
||||
struct stat sb;
|
||||
|
||||
cp = strcpy(outpath + PATH_MAX - (len + 1), name);
|
||||
cp2 = inpath;
|
||||
while ((cp2 = getcomponent(cp2, buf)) != 0) {
|
||||
if (strcmp(buf, ".") == 0)
|
||||
continue;
|
||||
if (strcmp(buf, "..") == 0) {
|
||||
if (stat(".", &sb) < 0)
|
||||
fail("cannot stat current directory");
|
||||
name = ino2name(sb.st_ino);
|
||||
len = strlen(name);
|
||||
cp -= len + 1;
|
||||
strcpy(cp, name);
|
||||
cp[len] = '/';
|
||||
free(name);
|
||||
xchdir("..");
|
||||
} else {
|
||||
cp -= 3;
|
||||
strncpy(cp, "../", 3);
|
||||
xchdir(buf);
|
||||
}
|
||||
}
|
||||
strcpy(outpath, cp);
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef pathsub_h___
|
||||
#define pathsub_h___
|
||||
/*
|
||||
** Pathname subroutines.
|
||||
**
|
||||
** Brendan Eich, 8/29/95
|
||||
*/
|
||||
#include <limits.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX 1024
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Just prevent stupidity
|
||||
*/
|
||||
#undef NAME_MAX
|
||||
#define NAME_MAX 256
|
||||
|
||||
extern char *program;
|
||||
|
||||
extern void fail(char *format, ...);
|
||||
extern char *getcomponent(char *path, char *name);
|
||||
extern char *ino2name(ino_t ino);
|
||||
extern void *xmalloc(size_t size);
|
||||
extern char *xstrdup(char *s);
|
||||
extern char *xbasename(char *path);
|
||||
extern void xchdir(char *dir);
|
||||
|
||||
/* Relate absolute pathnames from and to returning the result in outpath. */
|
||||
extern int relatepaths(char *from, char *to, char *outpath);
|
||||
|
||||
/* XXX changes current working directory -- caveat emptor */
|
||||
extern void reversepath(char *inpath, char *name, int len, char *outpath);
|
||||
|
||||
#endif /* pathsub_h___ */
|
@ -1,56 +0,0 @@
|
||||
# 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/.
|
||||
|
||||
"""
|
||||
Run a python script, adding extra directories to the python path.
|
||||
"""
|
||||
|
||||
|
||||
def main(args):
|
||||
def usage():
|
||||
print >>sys.stderr, "pythonpath.py -I directory script.py [args...]"
|
||||
sys.exit(150)
|
||||
|
||||
paths = []
|
||||
|
||||
while True:
|
||||
try:
|
||||
arg = args[0]
|
||||
except IndexError:
|
||||
usage()
|
||||
|
||||
if arg == '-I':
|
||||
args.pop(0)
|
||||
try:
|
||||
path = args.pop(0)
|
||||
except IndexError:
|
||||
usage()
|
||||
|
||||
paths.append(os.path.abspath(path))
|
||||
continue
|
||||
|
||||
if arg.startswith('-I'):
|
||||
paths.append(os.path.abspath(args.pop(0)[2:]))
|
||||
continue
|
||||
|
||||
break
|
||||
|
||||
script = args[0]
|
||||
|
||||
sys.path[0:0] = [os.path.abspath(os.path.dirname(script))] + paths
|
||||
sys.argv = args
|
||||
sys.argc = len(args)
|
||||
|
||||
frozenglobals['__name__'] = '__main__'
|
||||
frozenglobals['__file__'] = script
|
||||
|
||||
execfile(script, frozenglobals)
|
||||
|
||||
# Freeze scope here ... why this makes things work I have no idea ...
|
||||
frozenglobals = globals()
|
||||
|
||||
import sys, os
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(sys.argv[1:])
|
@ -1,44 +0,0 @@
|
||||
# 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 errno
|
||||
|
||||
def mtime(path):
|
||||
try:
|
||||
return os.stat(path).st_mtime
|
||||
except OSError as e:
|
||||
if e.errno == errno.ENOENT:
|
||||
return -1
|
||||
raise
|
||||
|
||||
def rebuild_check(args):
|
||||
target = args[0]
|
||||
deps = args[1:]
|
||||
t = mtime(target)
|
||||
if t < 0:
|
||||
print target
|
||||
return
|
||||
|
||||
newer = []
|
||||
removed = []
|
||||
for dep in deps:
|
||||
deptime = mtime(dep)
|
||||
if deptime < 0:
|
||||
removed.append(dep)
|
||||
elif mtime(dep) > t:
|
||||
newer.append(dep)
|
||||
|
||||
if newer and removed:
|
||||
print 'Rebuilding %s because %s changed and %s was removed' % (target, ', '.join(newer), ', '.join(removed))
|
||||
elif newer:
|
||||
print 'Rebuilding %s because %s changed' % (target, ', '.join(newer))
|
||||
elif removed:
|
||||
print 'Rebuilding %s because %s was removed' % (target, ', '.join(removed))
|
||||
else:
|
||||
print 'Rebuilding %s for an unknown reason' % target
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
rebuild_check(sys.argv[1:])
|
@ -1,243 +0,0 @@
|
||||
# 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/.
|
||||
|
||||
ifndef INCLUDED_RULES_MK
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
endif
|
||||
|
||||
# The traditional model of directory traversal with make is as follows:
|
||||
# make -C foo
|
||||
# Entering foo
|
||||
# make -C bar
|
||||
# Entering foo/bar
|
||||
# make -C baz
|
||||
# Entering foo/baz
|
||||
# make -C qux
|
||||
# Entering qux
|
||||
#
|
||||
# Pseudo derecurse transforms the above into:
|
||||
# make -C foo
|
||||
# make -C foo/bar
|
||||
# make -C foo/baz
|
||||
# make -C qux
|
||||
|
||||
# MOZ_PSEUDO_DERECURSE can have values other than 1.
|
||||
ifeq (1_.,$(if $(MOZ_PSEUDO_DERECURSE),1)_$(DEPTH))
|
||||
|
||||
include root.mk
|
||||
|
||||
# Disable build status for mach in top directories without TIERS.
|
||||
# In practice this disables it when recursing under js/src, which confuses mach.
|
||||
ifndef TIERS
|
||||
BUILDSTATUS =
|
||||
endif
|
||||
|
||||
# Main rules (export, compile, binaries, libs and tools) call recurse_* rules.
|
||||
# This wrapping is only really useful for build status.
|
||||
compile binaries libs export tools::
|
||||
$(call BUILDSTATUS,TIER_START $@ $($@_subtiers))
|
||||
+$(MAKE) recurse_$@
|
||||
$(call BUILDSTATUS,TIER_FINISH $@)
|
||||
|
||||
# Carefully avoid $(eval) type of rule generation, which makes pymake slower
|
||||
# than necessary.
|
||||
# Get current tier and corresponding subtiers from the data in root.mk.
|
||||
CURRENT_TIER := $(filter $(foreach tier,compile binaries libs export tools,recurse_$(tier) $(tier)-deps),$(MAKECMDGOALS))
|
||||
ifneq (,$(filter-out 0 1,$(words $(CURRENT_TIER))))
|
||||
$(error $(CURRENT_TIER) not supported on the same make command line)
|
||||
endif
|
||||
CURRENT_TIER := $(subst recurse_,,$(CURRENT_TIER:-deps=))
|
||||
CURRENT_SUBTIERS := $($(CURRENT_TIER)_subtiers)
|
||||
|
||||
# The rules here are doing directory traversal, so we don't want further
|
||||
# recursion to happen when running make -C subdir $tier. But some make files
|
||||
# further call make -C something else, and sometimes expect recursion to
|
||||
# happen in that case (see browser/metro/locales/Makefile.in for example).
|
||||
# Conveniently, every invocation of make increases MAKELEVEL, so only stop
|
||||
# recursion from happening at current MAKELEVEL + 1.
|
||||
ifdef CURRENT_TIER
|
||||
ifeq (0,$(MAKELEVEL))
|
||||
export NO_RECURSE_MAKELEVEL=1
|
||||
else
|
||||
export NO_RECURSE_MAKELEVEL=$(word $(MAKELEVEL),2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Get all directories traversed for all subtiers in the current tier, or use
|
||||
# directly the $(*_dirs) variables available in root.mk when there is no
|
||||
# TIERS (like for js/src).
|
||||
CURRENT_DIRS := $(or $($(CURRENT_TIER)_dirs),$(foreach subtier,$(CURRENT_SUBTIERS),$($(CURRENT_TIER)_subtier_$(subtier))))
|
||||
|
||||
ifneq (,$(filter binaries libs,$(CURRENT_TIER)))
|
||||
WANT_STAMPS = 1
|
||||
STAMP_TOUCH = $(TOUCH) $(@D)/binaries
|
||||
endif
|
||||
|
||||
# Subtier delimiter rules
|
||||
$(addprefix subtiers/,$(addsuffix _start/$(CURRENT_TIER),$(CURRENT_SUBTIERS))): subtiers/%_start/$(CURRENT_TIER): $(if $(WANT_STAMPS),$(call mkdir_deps,subtiers/%_start))
|
||||
$(call BUILDSTATUS,SUBTIER_START $(CURRENT_TIER) $* $(if $(BUG_915535_FIXED),$($(CURRENT_TIER)_subtier_$*)))
|
||||
@$(STAMP_TOUCH)
|
||||
|
||||
$(addprefix subtiers/,$(addsuffix _finish/$(CURRENT_TIER),$(CURRENT_SUBTIERS))): subtiers/%_finish/$(CURRENT_TIER): $(if $(WANT_STAMPS),$(call mkdir_deps,subtiers/%_finish))
|
||||
$(call BUILDSTATUS,SUBTIER_FINISH $(CURRENT_TIER) $*)
|
||||
@$(STAMP_TOUCH)
|
||||
|
||||
$(addprefix subtiers/,$(addsuffix /$(CURRENT_TIER),$(CURRENT_SUBTIERS))): %/$(CURRENT_TIER): $(if $(WANT_STAMPS),$(call mkdir_deps,%))
|
||||
@$(STAMP_TOUCH)
|
||||
|
||||
GARBAGE_DIRS += subtiers
|
||||
|
||||
# Recursion rule for all directories traversed for all subtiers in the
|
||||
# current tier.
|
||||
# root.mk defines subtier_of_* variables, that map a normalized subdir path to
|
||||
# a subtier name (e.g. subtier_of_memory_jemalloc = base)
|
||||
$(addsuffix /$(CURRENT_TIER),$(CURRENT_DIRS)): %/$(CURRENT_TIER):
|
||||
ifdef BUG_915535_FIXED
|
||||
$(call BUILDSTATUS,TIERDIR_START $(CURRENT_TIER) $(subtier_of_$(subst /,_,$*)) $*)
|
||||
endif
|
||||
+@$(MAKE) -C $* $(if $(filter $*,$(tier_$(subtier_of_$(subst /,_,$*))_staticdirs)),,$(CURRENT_TIER))
|
||||
# Ensure existing stamps are up-to-date, but don't create one if submake didn't create one.
|
||||
$(if $(wildcard $@),@$(STAMP_TOUCH))
|
||||
ifdef BUG_915535_FIXED
|
||||
$(call BUILDSTATUS,TIERDIR_FINISH $(CURRENT_TIER) $(subtier_of_$(subst /,_,$*)) $*)
|
||||
endif
|
||||
|
||||
# Dummy rules for possibly inexisting dependencies for the above tier targets
|
||||
$(addsuffix /Makefile,$(CURRENT_DIRS)) $(addsuffix /backend.mk,$(CURRENT_DIRS)):
|
||||
|
||||
# The export tier requires nsinstall, which is built from config. So every
|
||||
# subdirectory traversal needs to happen after traversing config.
|
||||
ifeq ($(CURRENT_TIER),export)
|
||||
$(addsuffix /$(CURRENT_TIER),$(filter-out config,$(CURRENT_DIRS))): config/$(CURRENT_TIER)
|
||||
endif
|
||||
|
||||
ifdef COMPILE_ENVIRONMENT
|
||||
ifneq (,$(filter libs binaries,$(CURRENT_TIER)))
|
||||
# When doing a "libs" build, target_libs.mk ensures the interesting dependency data
|
||||
# is available in the "binaries" stamp. Once recursion is done, aggregate all that
|
||||
# dependency info so that stamps depend on relevant files and relevant other stamps.
|
||||
# When doing a "binaries" build, the aggregate dependency file and those stamps are
|
||||
# used and allow to skip recursing directories where changes are not going to require
|
||||
# rebuild. A few directories, however, are still traversed all the time, mostly, the
|
||||
# gyp managed ones and js/src.
|
||||
# A few things that are not traversed by a "binaries" build, but should, in an ideal
|
||||
# world, are nspr, nss, icu and ffi.
|
||||
recurse_$(CURRENT_TIER):
|
||||
@$(MAKE) binaries-deps
|
||||
|
||||
# Creating binaries-deps.mk directly would make us build it twice: once when beginning
|
||||
# the build because of the include, and once at the end because of the stamps.
|
||||
binaries-deps: $(addsuffix /binaries,$(CURRENT_DIRS))
|
||||
@$(call py_action,link_deps,-o $@.mk --group-by-depfile --topsrcdir $(topsrcdir) --topobjdir $(DEPTH) --dist $(DIST) --guard $(addprefix ',$(addsuffix ',$^)))
|
||||
@$(TOUCH) $@
|
||||
|
||||
ifeq (recurse_binaries,$(MAKECMDGOALS))
|
||||
$(call include_deps,binaries-deps.mk)
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
DIST_GARBAGE += binaries-deps.mk binaries-deps
|
||||
|
||||
endif
|
||||
|
||||
else
|
||||
|
||||
# Don't recurse if MAKELEVEL is NO_RECURSE_MAKELEVEL as defined above, but
|
||||
# still recurse for externally managed make files (gyp-generated ones).
|
||||
ifeq ($(EXTERNALLY_MANAGED_MAKE_FILE)_$(NO_RECURSE_MAKELEVEL),_$(MAKELEVEL))
|
||||
|
||||
compile binaries libs export tools::
|
||||
|
||||
else
|
||||
#########################
|
||||
# Tier traversal handling
|
||||
#########################
|
||||
|
||||
ifdef TIERS
|
||||
|
||||
libs export tools::
|
||||
$(call BUILDSTATUS,TIER_START $@ $(filter-out $(if $(filter export,$@),,precompile),$(TIERS)))
|
||||
$(foreach tier,$(TIERS), $(if $(filter-out libs_precompile tools_precompile,$@_$(tier)), \
|
||||
$(call BUILDSTATUS,SUBTIER_START $@ $(tier) $(if $(filter libs,$@),$(tier_$(tier)_staticdirs)) $(tier_$(tier)_dirs)) \
|
||||
$(if $(filter libs,$@),$(foreach dir, $(tier_$(tier)_staticdirs), $(call TIER_DIR_SUBMAKE,$@,$(tier),$(dir),,1))) \
|
||||
$(foreach dir, $(tier_$(tier)_dirs), $(call TIER_DIR_SUBMAKE,$@,$(tier),$(dir),$@)) \
|
||||
$(call BUILDSTATUS,SUBTIER_FINISH $@ $(tier))))
|
||||
$(call BUILDSTATUS,TIER_FINISH $@)
|
||||
|
||||
else
|
||||
|
||||
define CREATE_SUBTIER_TRAVERSAL_RULE
|
||||
PARALLEL_DIRS_$(1) = $$(addsuffix _$(1),$$(PARALLEL_DIRS))
|
||||
|
||||
.PHONY: $(1) $$(PARALLEL_DIRS_$(1))
|
||||
|
||||
ifdef PARALLEL_DIRS
|
||||
$$(PARALLEL_DIRS_$(1)): %_$(1): %/Makefile
|
||||
+@$$(call SUBMAKE,$(1),$$*)
|
||||
endif
|
||||
|
||||
$(1):: $$(SUBMAKEFILES)
|
||||
ifdef PARALLEL_DIRS
|
||||
+@$(MAKE) $$(PARALLEL_DIRS_$(1))
|
||||
endif
|
||||
$$(LOOP_OVER_DIRS)
|
||||
|
||||
endef
|
||||
|
||||
$(foreach subtier,export compile binaries libs tools,$(eval $(call CREATE_SUBTIER_TRAVERSAL_RULE,$(subtier))))
|
||||
|
||||
tools export:: $(SUBMAKEFILES)
|
||||
$(LOOP_OVER_TOOL_DIRS)
|
||||
|
||||
endif # ifdef TIERS
|
||||
|
||||
endif # ifeq ($(EXTERNALLY_MANAGED_MAKE_FILE)_$(NO_RECURSE_MAKELEVEL),_$(MAKELEVEL))
|
||||
|
||||
endif # ifeq (1_.,$(MOZ_PSEUDO_DERECURSE)_$(DEPTH))
|
||||
|
||||
ifdef MOZ_PSEUDO_DERECURSE
|
||||
ifdef EXTERNALLY_MANAGED_MAKE_FILE
|
||||
# gyp-managed directories
|
||||
recurse_targets := $(addsuffix /binaries,$(DIRS) $(PARALLEL_DIRS))
|
||||
else
|
||||
ifeq (.,$(DEPTH))
|
||||
# top-level directories
|
||||
recurse_targets := $(addsuffix /binaries,$(binaries_dirs))
|
||||
ifdef recurse_targets
|
||||
# only js/src has binaries_dirs, and we want to adjust paths for it.
|
||||
want_abspaths = 1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef COMPILE_ENVIRONMENT
|
||||
|
||||
# Aggregate all dependency files relevant to a binaries build except in
|
||||
# the mozilla top-level directory.
|
||||
ifneq (_.,$(recurse_targets)_$(DEPTH))
|
||||
ALL_DEP_FILES := \
|
||||
$(BINARIES_PP) \
|
||||
$(addsuffix .pp,$(addprefix $(MDDEPDIR)/,$(sort \
|
||||
$(TARGETS) \
|
||||
$(filter-out $(SOBJS) $(ASOBJS) $(EXCLUDED_OBJS),$(OBJ_TARGETS)) \
|
||||
))) \
|
||||
$(recurse_targets) \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
binaries libs:: $(TARGETS) $(BINARIES_PP)
|
||||
ifneq (_.,$(recurse_targets)_$(DEPTH))
|
||||
@$(if $(or $(recurse_targets),$^),$(call py_action,link_deps,-o binaries --group-all $(if $(want_abspaths),--abspaths )--topsrcdir $(topsrcdir) --topobjdir $(DEPTH) --dist $(DIST) $(ALL_DEP_FILES)))
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
endif # ifdef MOZ_PSEUDO_DERECURSE
|
||||
|
||||
recurse:
|
||||
@$(RECURSED_COMMAND)
|
||||
$(LOOP_OVER_PARALLEL_DIRS)
|
||||
$(LOOP_OVER_DIRS)
|
||||
$(LOOP_OVER_TOOL_DIRS)
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +0,0 @@
|
||||
# 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/.
|
||||
|
||||
hwcap_1 = OVERRIDE;
|
@ -1,36 +0,0 @@
|
||||
# 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/.
|
||||
|
||||
DEHYDRA_SCRIPT = $(topsrcdir)/config/static-checking.js
|
||||
|
||||
DEHYDRA_MODULES = \
|
||||
$(NULL)
|
||||
|
||||
TREEHYDRA_MODULES = \
|
||||
$(topsrcdir)/jsstack.js \
|
||||
$(NULL)
|
||||
|
||||
DEHYDRA_ARG_PREFIX=-fplugin-arg-gcc_treehydra-
|
||||
|
||||
DEHYDRA_ARGS = \
|
||||
$(DEHYDRA_ARG_PREFIX)script=$(DEHYDRA_SCRIPT) \
|
||||
$(DEHYDRA_ARG_PREFIX)topsrcdir=$(topsrcdir) \
|
||||
$(DEHYDRA_ARG_PREFIX)objdir=$(DEPTH) \
|
||||
$(DEHYDRA_ARG_PREFIX)dehydra-modules=$(subst $(NULL) ,$(COMMA),$(strip $(DEHYDRA_MODULES))) \
|
||||
$(DEHYDRA_ARG_PREFIX)treehydra-modules=$(subst $(NULL) ,$(COMMA),$(strip $(TREEHYDRA_MODULES))) \
|
||||
$(NULL)
|
||||
|
||||
DEHYDRA_FLAGS = -fplugin=$(DEHYDRA_PATH) $(DEHYDRA_ARGS)
|
||||
|
||||
ifdef DEHYDRA_PATH
|
||||
OS_CXXFLAGS += $(DEHYDRA_FLAGS)
|
||||
endif
|
||||
|
||||
ifdef ENABLE_CLANG_PLUGIN
|
||||
# Load the clang plugin from the mozilla topsrcdir. This implies that the clang
|
||||
# plugin is only usable if we're building js/src under mozilla/, though.
|
||||
CLANG_PLUGIN := $(DEPTH)/../../build/clang-plugin/$(DLL_PREFIX)clang-plugin$(DLL_SUFFIX)
|
||||
OS_CXXFLAGS += -Xclang -load -Xclang $(CLANG_PLUGIN) -Xclang -add-plugin -Xclang moz-check
|
||||
OS_CFLAGS += -Xclang -load -Xclang $(CLANG_PLUGIN) -Xclang -add-plugin -Xclang moz-check
|
||||
endif
|
@ -1,147 +0,0 @@
|
||||
/* 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/. */
|
||||
|
||||
/**
|
||||
* A script for GCC-dehydra to analyze the Mozilla codebase and catch
|
||||
* patterns that are incorrect, but which cannot be detected by a compiler. */
|
||||
|
||||
/**
|
||||
* Activate Treehydra outparams analysis if running in Treehydra.
|
||||
*/
|
||||
|
||||
function treehydra_enabled() {
|
||||
return this.hasOwnProperty('TREE_CODE');
|
||||
}
|
||||
|
||||
sys.include_path.push(options.topsrcdir);
|
||||
|
||||
include('string-format.js');
|
||||
|
||||
let modules = [];
|
||||
|
||||
function LoadModules(modulelist)
|
||||
{
|
||||
if (modulelist == "")
|
||||
return;
|
||||
|
||||
let modulenames = modulelist.split(',');
|
||||
for each (let modulename in modulenames) {
|
||||
let module = { __proto__: this };
|
||||
include(modulename, module);
|
||||
modules.push(module);
|
||||
}
|
||||
}
|
||||
|
||||
LoadModules(options['dehydra-modules']);
|
||||
if (treehydra_enabled())
|
||||
LoadModules(options['treehydra-modules']);
|
||||
|
||||
function process_type(c)
|
||||
{
|
||||
for each (let module in modules)
|
||||
if (module.hasOwnProperty('process_type'))
|
||||
module.process_type(c);
|
||||
}
|
||||
|
||||
function hasAttribute(c, attrname)
|
||||
{
|
||||
var attr;
|
||||
|
||||
if (c.attributes === undefined)
|
||||
return false;
|
||||
|
||||
for each (attr in c.attributes)
|
||||
if (attr.name == 'user' && attr.value[0] == attrname)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// This is useful for detecting method overrides
|
||||
function signaturesMatch(m1, m2)
|
||||
{
|
||||
if (m1.shortName != m2.shortName)
|
||||
return false;
|
||||
|
||||
if ((!!m1.isVirtual) != (!!m2.isVirtual))
|
||||
return false;
|
||||
|
||||
if (m1.isStatic != m2.isStatic)
|
||||
return false;
|
||||
|
||||
let p1 = m1.type.parameters;
|
||||
let p2 = m2.type.parameters;
|
||||
|
||||
if (p1.length != p2.length)
|
||||
return false;
|
||||
|
||||
for (let i = 0; i < p1.length; ++i)
|
||||
if (!params_match(p1[i], p2[i]))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function params_match(p1, p2)
|
||||
{
|
||||
[p1, p2] = unwrap_types(p1, p2);
|
||||
|
||||
for (let i in p1)
|
||||
if (i == "type" && !types_match(p1.type, p2.type))
|
||||
return false;
|
||||
else if (i != "type" && p1[i] !== p2[i])
|
||||
return false;
|
||||
|
||||
for (let i in p2)
|
||||
if (!(i in p1))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function types_match(t1, t2)
|
||||
{
|
||||
if (!t1 || !t2)
|
||||
return false;
|
||||
|
||||
[t1, t2] = unwrap_types(t1, t2);
|
||||
|
||||
return t1 === t2;
|
||||
}
|
||||
|
||||
function unwrap_types(t1, t2)
|
||||
{
|
||||
while (t1.variantOf)
|
||||
t1 = t1.variantOf;
|
||||
|
||||
while (t2.variantOf)
|
||||
t2 = t2.variantOf;
|
||||
|
||||
return [t1, t2];
|
||||
}
|
||||
|
||||
const forward_functions = [
|
||||
'process_type',
|
||||
'process_tree_type',
|
||||
'process_decl',
|
||||
'process_tree_decl',
|
||||
'process_function',
|
||||
'process_tree',
|
||||
'process_cp_pre_genericize',
|
||||
'input_end'
|
||||
];
|
||||
|
||||
function setup_forwarding(n)
|
||||
{
|
||||
this[n] = function() {
|
||||
for each (let module in modules) {
|
||||
if (module.hasOwnProperty(n)) {
|
||||
module[n].apply(this, arguments);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for each (let n in forward_functions)
|
||||
setup_forwarding(n);
|
@ -1,65 +0,0 @@
|
||||
/* 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/. */
|
||||
|
||||
String.prototype.format = function string_format() {
|
||||
// there are two modes of operation... unnamed indices are read in order;
|
||||
// named indices using %(name)s. The two styles cannot be mixed.
|
||||
// Unnamed indices can be passed as either a single argument to this function,
|
||||
// multiple arguments to this function, or as a single array argument
|
||||
let curindex = 0;
|
||||
let d;
|
||||
|
||||
if (arguments.length > 1) {
|
||||
d = arguments;
|
||||
}
|
||||
else
|
||||
d = arguments[0];
|
||||
|
||||
function r(s, key, type) {
|
||||
if (type == '%')
|
||||
return '%';
|
||||
|
||||
let v;
|
||||
if (key == "") {
|
||||
if (curindex == -1)
|
||||
throw Error("Cannot mix named and positional indices in string formatting.");
|
||||
|
||||
if (curindex == 0 && (!(d instanceof Object) || !(0 in d))) {
|
||||
v = d;
|
||||
}
|
||||
else if (!(curindex in d))
|
||||
throw Error("Insufficient number of items in format, requesting item %i".format(curindex));
|
||||
else {
|
||||
v = d[curindex];
|
||||
}
|
||||
|
||||
++curindex;
|
||||
}
|
||||
else {
|
||||
key = key.slice(1, -1);
|
||||
if (curindex > 0)
|
||||
throw Error("Cannot mix named and positional indices in string formatting.");
|
||||
curindex = -1;
|
||||
|
||||
if (!(key in d))
|
||||
throw Error("Key '%s' not present during string substitution.".format(key));
|
||||
v = d[key];
|
||||
}
|
||||
switch (type) {
|
||||
case "s":
|
||||
if (v === undefined)
|
||||
return "<undefined>";
|
||||
return v.toString();
|
||||
case "r":
|
||||
return uneval(v);
|
||||
case "i":
|
||||
return parseInt(v);
|
||||
case "f":
|
||||
return Number(v);
|
||||
default:
|
||||
throw Error("Unexpected format character '%s'.".format(type));
|
||||
}
|
||||
}
|
||||
return this.replace(/%(\([^)]+\))?(.)/g, r);
|
||||
};
|
File diff suppressed because it is too large
Load Diff
@ -1,51 +0,0 @@
|
||||
# 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/.
|
||||
|
||||
ifndef INCLUDED_VERSION_MK
|
||||
INCLUDED_VERSION_MK=1
|
||||
|
||||
# Windows gmake build:
|
||||
# Build default .rc file if $(RESFILE) isn't defined.
|
||||
# TODO:
|
||||
# PBI : Private build info. Not used currently.
|
||||
# Guessing the best way would be to set an env var.
|
||||
# BINARY : Binary name. Not used currently.
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
|
||||
ifndef RESFILE
|
||||
RCFILE=./module.rc
|
||||
RESFILE=./module.res
|
||||
_RC_STRING = -QUIET 1 -DEPTH $(DEPTH) -TOPSRCDIR $(topsrcdir) -OBJDIR . -SRCDIR $(srcdir) -DISPNAME $(MOZ_APP_DISPLAYNAME) -APPVERSION $(MOZ_APP_VERSION)
|
||||
ifdef MOZILLA_OFFICIAL
|
||||
_RC_STRING += -OFFICIAL 1
|
||||
endif
|
||||
ifdef MOZ_DEBUG
|
||||
_RC_STRING += -DEBUG 1
|
||||
endif
|
||||
ifdef PROGRAM
|
||||
_RC_STRING += -BINARY $(PROGRAM)
|
||||
else
|
||||
ifdef _PROGRAM
|
||||
_RC_STRING += -BINARY $(_PROGRAM)
|
||||
else
|
||||
ifdef SHARED_LIBRARY
|
||||
_RC_STRING += -BINARY $(SHARED_LIBRARY)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
ifdef RCINCLUDE
|
||||
_RC_STRING += -RCINCLUDE $(srcdir)/$(RCINCLUDE)
|
||||
endif
|
||||
|
||||
GARBAGE += $(RESFILE) $(RCFILE)
|
||||
|
||||
#dummy target so $(RCFILE) doesn't become the default =P
|
||||
all::
|
||||
|
||||
$(RCFILE): $(RCINCLUDE) $(topsrcdir)/config/version_win.pl
|
||||
$(PERL) $(topsrcdir)/config/version_win.pl $(_RC_STRING)
|
||||
|
||||
endif # RESFILE
|
||||
endif # Windows
|
||||
|
||||
endif
|
@ -1,374 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
# 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/.
|
||||
|
||||
#use diagnostics;
|
||||
require strict;
|
||||
my $dir = $0;
|
||||
$dir =~ s/[^\/]*$//;
|
||||
push(@INC, "$dir");
|
||||
require "Moz/Milestone.pm";
|
||||
use Getopt::Long;
|
||||
use Getopt::Std;
|
||||
use POSIX;
|
||||
|
||||
# Calculate the number of days since Jan. 1, 2000 from a buildid string
|
||||
sub daysFromBuildID
|
||||
{
|
||||
my ($buildid,) = @_;
|
||||
|
||||
my ($y, $m, $d, $h) = ($buildid =~ /^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/);
|
||||
$d || die("Unrecognized buildid string.");
|
||||
|
||||
my $secondstodays = 60 * 60 * 24;
|
||||
return sprintf("%d",
|
||||
(POSIX::mktime(00, 00, 00, $d, $m - 1, $y - 1900) -
|
||||
POSIX::mktime(00, 00, 00, 01, 00, 100)) / $secondstodays);
|
||||
}
|
||||
|
||||
#Creates version resource file
|
||||
|
||||
#Paramaters are passed on the command line:
|
||||
|
||||
#Example: -MODNAME nsToolkitCompsModule -DEBUG=1
|
||||
|
||||
# DEBUG - Mozilla's global debug variable - tells if its debug version
|
||||
# OFFICIAL - tells Mozilla is building a milestone or nightly
|
||||
# MSTONE - tells which milestone is being built;
|
||||
# OBJDIR - Holds the object directory;
|
||||
# MODNAME - tells what the name of the module is like nsBMPModule
|
||||
# DEPTH - Holds the path to the root obj dir
|
||||
# TOPSRCDIR - Holds the path to the root mozilla dir
|
||||
# SRCDIR - Holds module.ver and source
|
||||
# BINARY - Holds the name of the binary file
|
||||
# DISPNAME - Holds the display name of the built application
|
||||
# APPVERSION - Holds the version string of the built application
|
||||
# RCINCLUDE - Holds the name of the RC File to include or ""
|
||||
# QUIET - Turns off output
|
||||
|
||||
#Description and Comment come from module.ver
|
||||
#Bug 23560
|
||||
#http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/rc_7x2d.asp
|
||||
|
||||
#Get next .ver file entry
|
||||
sub getNextEntry
|
||||
{
|
||||
while (<VERFILE>)
|
||||
{
|
||||
my $mline = $_;
|
||||
($mline) = split(/#/,$mline);
|
||||
my ($entry, $value)=split(/=/,$mline,2);
|
||||
if (defined($entry))
|
||||
{
|
||||
if (defined($value))
|
||||
{
|
||||
$entry =~ s/^\s*(.*?)\s*$/$1/;
|
||||
$value =~ s/^\s*(.*?)\s*$/$1/;
|
||||
return ($entry,$value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
my ($quiet,$objdir,$debug,$official,$milestone,$buildid,$module,$binary,$depth,$rcinclude,$srcdir,$fileversion,$productversion);
|
||||
|
||||
GetOptions( "QUIET" => \$quiet,
|
||||
"DEBUG=s" => \$debug,
|
||||
"OFFICIAL=s" => \$official,
|
||||
"MSTONE=s" => \$milestone,
|
||||
"MODNAME=s" => \$module,
|
||||
"BINARY=s" => \$binary,
|
||||
"DISPNAME=s" => \$displayname,
|
||||
"APPVERSION=s" => \$appversion,
|
||||
"SRCDIR=s" => \$srcdir,
|
||||
"TOPSRCDIR=s" => \$topsrcdir,
|
||||
"DEPTH=s" => \$depth,
|
||||
"RCINCLUDE=s" => \$rcinclude,
|
||||
"OBJDIR=s" => \$objdir);
|
||||
if (!defined($debug)) {$debug="";}
|
||||
if (!defined($official)) {$official="";}
|
||||
if (!defined($milestone)) {$milestone="";}
|
||||
if (!defined($module)) {$module="";}
|
||||
if (!defined($binary)) {$binary="";}
|
||||
if (!defined($displayname)) {$displayname="Mozilla";}
|
||||
if (!defined($appversion)) {$appversion=$milestone;}
|
||||
if (!defined($depth)) {$depth=".";}
|
||||
if (!defined($rcinclude)) {$rcinclude="";}
|
||||
if (!defined($objdir)) {$objdir=".";}
|
||||
if (!defined($srcdir)) {$srcdir=".";}
|
||||
if (!defined($topsrcdir)) {$topsrcdir=".";}
|
||||
my $mfversion = "Personal";
|
||||
my $mpversion = "Personal";
|
||||
my @fileflags = ("0");
|
||||
my $comment="";
|
||||
my $description="";
|
||||
if (!defined($module))
|
||||
{
|
||||
$module = $binary;
|
||||
($module) = split(/\./,$module);
|
||||
}
|
||||
|
||||
my $bufferstr=" ";
|
||||
|
||||
my $MILESTONE_FILE = "$topsrcdir/config/milestone.txt";
|
||||
my $BUILDID_FILE = "$depth/config/buildid";
|
||||
|
||||
#Read module.ver file
|
||||
#Version file overrides for WIN32:
|
||||
#WIN32_MODULE_COMMENT
|
||||
#WIN32_MODULE_DESCRIPTION
|
||||
#WIN32_MODULE_FILEVERSION
|
||||
#WIN32_MODULE_COMPANYNAME
|
||||
#WIN32_MODULE_FILEVERSION_STRING
|
||||
#WIN32_MODULE_NAME
|
||||
#WIN32_MODULE_COPYRIGHT
|
||||
#WIN32_MODULE_TRADEMARKS
|
||||
#WIN32_MODULE_ORIGINAL_FILENAME
|
||||
#WIN32_MODULE_PRODUCTNAME
|
||||
#WIN32_MODULE_PRODUCTVERSION
|
||||
#WIN32_MODULE_PRODUCTVERSION_STRING
|
||||
|
||||
#Override values obtained from the .ver file
|
||||
my $override_comment;
|
||||
my $override_description;
|
||||
my $override_fileversion;
|
||||
my $override_company;
|
||||
my $override_mfversion;
|
||||
my $override_module;
|
||||
my $override_copyright;
|
||||
my $override_trademarks;
|
||||
my $override_filename;
|
||||
my $override_productname;
|
||||
my $override_productversion;
|
||||
my $override_mpversion;
|
||||
if (open(VERFILE, "<$srcdir/module.ver"))
|
||||
{
|
||||
|
||||
my ($a,$b) = getNextEntry();
|
||||
while (defined($a))
|
||||
{
|
||||
if ($a eq "WIN32_MODULE_COMMENT") { $override_comment = $b; }
|
||||
if ($a eq "WIN32_MODULE_DESCRIPTION") { $override_description = $b; }
|
||||
if ($a eq "WIN32_MODULE_FILEVERSION") { $override_fileversion = $b; }
|
||||
if ($a eq "WIN32_MODULE_COMPANYNAME") { $override_company = $b; }
|
||||
if ($a eq "WIN32_MODULE_FILEVERSION_STRING") { $override_mfversion = $b; }
|
||||
if ($a eq "WIN32_MODULE_NAME") { $override_module = $b; }
|
||||
if ($a eq "WIN32_MODULE_COPYRIGHT") { $override_copyright = $b; }
|
||||
if ($a eq "WIN32_MODULE_TRADEMARKS") { $override_trademarks = $b; }
|
||||
if ($a eq "WIN32_MODULE_ORIGINAL_FILENAME") { $override_filename = $b; }
|
||||
if ($a eq "WIN32_MODULE_PRODUCTNAME") { $override_productname = $b; }
|
||||
if ($a eq "WIN32_MODULE_PRODUCTVERSION") { $override_productversion = $b; }
|
||||
if ($a eq "WIN32_MODULE_PRODUCTVERSION_STRING") { $override_mpversion = $b; }
|
||||
($a,$b) = getNextEntry();
|
||||
}
|
||||
close(VERFILE)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!$quiet || $quiet ne "1") { print "$bufferstr" . "WARNING: No module.ver file included ($module, $binary). Default values used\n"; }
|
||||
}
|
||||
#Get rid of trailing and leading whitespace
|
||||
$debug =~ s/^\s*(.*)\s*$/$1/;
|
||||
$comment =~ s/^\s*(.*)\s*$/$1/;
|
||||
$official =~ s/^\s*(.*)\s*$/$1/;
|
||||
$milestone =~ s/^\s*(.*)\s*$/$1/;
|
||||
$description =~ s/^\s*(.*)\s*$/$1/;
|
||||
$module =~ s/^\s*(.*)\s*$/$1/;
|
||||
$depth =~ s/^\s*(.*)\s*$/$1/;
|
||||
$binary =~ s/^\s*(.*)\s*$/$1/;
|
||||
$displayname =~ s/^\s*(.*)\s*$/$1/;
|
||||
|
||||
open(BUILDID, "<", $BUILDID_FILE) || die("Couldn't open buildid file: $BUILDID_FILE");
|
||||
$buildid = <BUILDID>;
|
||||
$buildid =~ s/\s*$//;
|
||||
close BUILDID;
|
||||
|
||||
my $daycount = daysFromBuildID($buildid);
|
||||
|
||||
if ($milestone eq "") {
|
||||
$milestone = Moz::Milestone::getOfficialMilestone($MILESTONE_FILE);
|
||||
}
|
||||
|
||||
$mfversion = $mpversion = $milestone;
|
||||
if ($appversion eq "") {
|
||||
$appversion = $milestone;
|
||||
}
|
||||
|
||||
if ($debug eq "1")
|
||||
{
|
||||
push @fileflags, "VS_FF_DEBUG";
|
||||
$mpversion .= " Debug";
|
||||
$mfversion .= " Debug";
|
||||
}
|
||||
|
||||
if ($official ne "1") {
|
||||
push @fileflags, "VS_FF_PRIVATEBUILD";
|
||||
}
|
||||
|
||||
if ($milestone =~ /[a-z]/) {
|
||||
push @fileflags, "VS_FF_PRERELEASE";
|
||||
}
|
||||
|
||||
my @mstone = split(/\./,$milestone);
|
||||
$mstone[1] =~s/\D.*$//;
|
||||
if (!$mstone[2]) {
|
||||
$mstone[2] = "0";
|
||||
}
|
||||
else {
|
||||
$mstone[2] =~s/\D.*$//;
|
||||
}
|
||||
$fileversion = $productversion="$mstone[0],$mstone[1],$mstone[2],$daycount";
|
||||
|
||||
my @appver = split(/\./,$appversion);
|
||||
for ($j = 1; $j < 4; $j++)
|
||||
{
|
||||
if (!$appver[$j]) {
|
||||
$appver[$j] = "0";
|
||||
}
|
||||
else {
|
||||
$appver[$j] =~s/\D.*$//;
|
||||
}
|
||||
}
|
||||
my $winappversion = "$appver[0],$appver[1],$appver[2],$appver[3]";
|
||||
|
||||
my $copyright = "License: MPL 2";
|
||||
my $company = "Mozilla Foundation";
|
||||
my $trademarks = "Mozilla";
|
||||
my $productname = $displayname;
|
||||
|
||||
|
||||
if (defined($override_comment)){$override_comment =~ s/\@MOZ_APP_DISPLAYNAME\@/$displayname/g; $comment=$override_comment;}
|
||||
if (defined($override_description)){$override_description =~ s/\@MOZ_APP_DISPLAYNAME\@/$displayname/g; $description=$override_description;}
|
||||
if (defined($override_fileversion)){$override_fileversion =~ s/\@MOZ_APP_WINVERSION\@/$winappversion/g; $fileversion=$override_fileversion;}
|
||||
if (defined($override_mfversion)){$override_mfversion =~ s/\@MOZ_APP_VERSION\@/$appversion/g; $mfversion=$override_mfversion;}
|
||||
if (defined($override_company)){$company=$override_company;}
|
||||
if (defined($override_module)){$override_module =~ s/\@MOZ_APP_DISPLAYNAME\@/$displayname/g; $module=$override_module;}
|
||||
if (defined($override_copyright)){$override_copyright =~ s/\@MOZ_APP_DISPLAYNAME\@/$displayname/g; $copyright=$override_copyright;}
|
||||
if (defined($override_trademarks)){$override_trademarks =~ s/\@MOZ_APP_DISPLAYNAME\@/$displayname/g; $trademarks=$override_trademarks;}
|
||||
if (defined($override_filename)){$binary=$override_filename;}
|
||||
if (defined($override_productname)){$override_productname =~ s/\@MOZ_APP_DISPLAYNAME\@/$displayname/g; $productname=$override_productname;}
|
||||
if (defined($override_productversion)){$override_productversion =~ s/\@MOZ_APP_WINVERSION\@/$winappversion/g; $productversion=$override_productversion;}
|
||||
if (defined($override_mpversion)){$override_mpversion =~ s/\@MOZ_APP_VERSION\@/$appversion/g; $mpversion=$override_mpversion;}
|
||||
|
||||
|
||||
#Override section
|
||||
|
||||
open(RCFILE, ">$objdir/module.rc") || die("Can't edit module.rc - It must be locked.\n");
|
||||
print RCFILE qq{
|
||||
// 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/.
|
||||
|
||||
#include<winver.h>
|
||||
|
||||
// Note: if you contain versioning information in an included
|
||||
// RC script, it will be discarded
|
||||
// Use module.ver to explicitly set these values
|
||||
|
||||
// Do not edit this file. Changes won't affect the build.
|
||||
|
||||
};
|
||||
|
||||
my $versionlevel=0;
|
||||
my $insideversion=0;
|
||||
if (open(RCINCLUDE, "<$rcinclude"))
|
||||
{
|
||||
print RCFILE "// From included resource $rcinclude\n";
|
||||
# my $mstring="";
|
||||
while (<RCINCLUDE>)
|
||||
{
|
||||
$_ =~ s/\@MOZ_APP_DISPLAYNAME\@/$displayname/g;
|
||||
print RCFILE $_;
|
||||
# my $instr=$_;
|
||||
# chomp($instr);
|
||||
# $mstring .= "$instr\;";
|
||||
}
|
||||
close(RCINCLUDE);
|
||||
# $mstring =~ s/\/\*.*\*\///g;
|
||||
# my @mlines = split(/\;/,$mstring);
|
||||
# for(@mlines)
|
||||
# {
|
||||
# my ($nocomment)=split(/\/\//,$_);
|
||||
# if (defined($nocomment) && $nocomment ne "")
|
||||
# {
|
||||
# my ($firststring,$secondstring) = split(/\s+/,$nocomment);
|
||||
# if (!defined($firststring)) {$firststring="";}
|
||||
# if (!defined($secondstring)) {$secondstring="";}
|
||||
# if ($secondstring eq "VERSIONINFO")
|
||||
# {
|
||||
#if (!$quiet || $quiet ne "1") {
|
||||
# print "$bufferstr" . "WARNING: Included RC file ($rcinclude, $module, $binary)\n";
|
||||
# print "$bufferstr" . "WARNING: contains versioning information that will be discarded\n";
|
||||
# print "$bufferstr" . "WARNING: Remove it and use relevant overrides (in module.ver)\n";
|
||||
#}
|
||||
# $versionlevel = 0;
|
||||
# $insideversion = 1;
|
||||
# }
|
||||
# if ($firststring eq "BEGIN") { $versionlevel++; }
|
||||
# if ($secondstring eq "END")
|
||||
# {
|
||||
# $versionlevel--;
|
||||
# if ($insideversion==1 && $versionlevel==0) {$versionlevel=0;}
|
||||
# }
|
||||
# my $includecheck = $firststring . $secondstring;
|
||||
# $includecheck =~ s/<|>/"/g;
|
||||
# $includecheck = lc($includecheck);
|
||||
# if ($includecheck ne "#include\"winver.h\"")
|
||||
# {
|
||||
# if ($insideversion == 0 && $versionlevel == 0)
|
||||
# {
|
||||
# print RCFILE "$nocomment\n";
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
|
||||
}
|
||||
|
||||
my $fileflags = join(' | ', @fileflags);
|
||||
|
||||
print RCFILE qq{
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
1 VERSIONINFO
|
||||
FILEVERSION $fileversion
|
||||
PRODUCTVERSION $productversion
|
||||
FILEFLAGSMASK 0x3fL
|
||||
FILEFLAGS $fileflags
|
||||
FILEOS VOS__WINDOWS32
|
||||
FILETYPE VFT_DLL
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "000004b0"
|
||||
BEGIN
|
||||
VALUE "Comments", "$comment"
|
||||
VALUE "LegalCopyright", "$copyright"
|
||||
VALUE "CompanyName", "$company"
|
||||
VALUE "FileDescription", "$description"
|
||||
VALUE "FileVersion", "$mfversion"
|
||||
VALUE "ProductVersion", "$mpversion"
|
||||
VALUE "InternalName", "$module"
|
||||
VALUE "LegalTrademarks", "$trademarks"
|
||||
VALUE "OriginalFilename", "$binary"
|
||||
VALUE "ProductName", "$productname"
|
||||
VALUE "BuildID", "$buildid"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x0, 1200
|
||||
END
|
||||
END
|
||||
|
||||
};
|
||||
close(RCFILE);
|
@ -8,8 +8,8 @@ dnl Process this file with autoconf to produce a configure script.
|
||||
dnl ========================================================
|
||||
|
||||
AC_PREREQ(2.13)
|
||||
AC_INIT(jsapi.h)
|
||||
AC_CONFIG_AUX_DIR(${srcdir}/../../build/autoconf)
|
||||
AC_INIT(js/src/jsapi.h)
|
||||
AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
|
||||
AC_CANONICAL_SYSTEM
|
||||
TARGET_CPU="${target_cpu}"
|
||||
TARGET_VENDOR="${target_vendor}"
|
||||
@ -73,7 +73,7 @@ _PTHREAD_LDFLAGS=""
|
||||
|
||||
dnl Do not allow a separate objdir build if a srcdir build exists.
|
||||
dnl ==============================================================
|
||||
_topsrcdir=`cd \`dirname $0\`; pwd`
|
||||
_topsrcdir=`cd $srcdir; pwd`
|
||||
_objdir=`pwd`
|
||||
|
||||
if test "$_topsrcdir" != "$_objdir"
|
||||
@ -165,6 +165,8 @@ else
|
||||
AC_DEFINE(JS_STANDALONE)
|
||||
fi
|
||||
AC_SUBST(JS_STANDALONE)
|
||||
BUILDING_JS=1
|
||||
AC_SUBST(BUILDING_JS)
|
||||
|
||||
MOZ_ARG_WITH_STRING(gonk,
|
||||
[ --with-gonk=DIR
|
||||
@ -1157,7 +1159,7 @@ if test "$GNU_CC"; then
|
||||
esac
|
||||
fi
|
||||
|
||||
_DEFINES_CFLAGS='-include $(DEPTH)/js-confdefs.h -DMOZILLA_CLIENT'
|
||||
_DEFINES_CFLAGS='-include $(DEPTH)/js/src/js-confdefs.h -DMOZILLA_CLIENT'
|
||||
_USE_CPP_INCLUDE_FLAG=1
|
||||
|
||||
elif test "$SOLARIS_SUNPRO_CC"; then
|
||||
@ -1219,7 +1221,7 @@ if test "$GNU_CXX"; then
|
||||
esac
|
||||
fi
|
||||
|
||||
_DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/js-confdefs.h'
|
||||
_DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/js/src/js-confdefs.h'
|
||||
_USE_CPP_INCLUDE_FLAG=1
|
||||
|
||||
# Recent clang and gcc support C++11 deleted functions without warnings if
|
||||
@ -1639,8 +1641,8 @@ ia64*-hpux*)
|
||||
MKSHLIB_UNFORCE_ALL=
|
||||
DSO_LDOPTS=-SUBSYSTEM:WINDOWS
|
||||
_USE_CPP_INCLUDE_FLAG=1
|
||||
_DEFINES_CFLAGS='-FI $(DEPTH)/js-confdefs.h -DMOZILLA_CLIENT'
|
||||
_DEFINES_CXXFLAGS='-FI $(DEPTH)/js-confdefs.h -DMOZILLA_CLIENT'
|
||||
_DEFINES_CFLAGS='-FI $(DEPTH)/js/src/js-confdefs.h -DMOZILLA_CLIENT'
|
||||
_DEFINES_CXXFLAGS='-FI $(DEPTH)/js/src/js-confdefs.h -DMOZILLA_CLIENT'
|
||||
CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
|
||||
CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
|
||||
if test "$_CC_SUITE" -ge "12"; then
|
||||
@ -2252,7 +2254,7 @@ EOF
|
||||
])
|
||||
if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
|
||||
"$ac_cv_have_visibility_class_bug" = "no"; then
|
||||
VISIBILITY_FLAGS='-I$(DIST)/system_wrappers_js -include $(topsrcdir)/config/gcc_hidden.h'
|
||||
VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
|
||||
WRAP_SYSTEM_INCLUDES=1
|
||||
else
|
||||
VISIBILITY_FLAGS='-fvisibility=hidden'
|
||||
@ -3866,7 +3868,7 @@ if test -z "$SKIP_LIBRARY_CHECKS" -a -z "$NO_EDITLINE"; then
|
||||
else
|
||||
dnl By default, we use editline
|
||||
JS_NATIVE_EDITLINE=1
|
||||
EDITLINE_LIBS='$(DEPTH)/editline/$(LIB_PREFIX)editline.$(LIB_SUFFIX)'
|
||||
EDITLINE_LIBS='$(DEPTH)/js/src/editline/$(LIB_PREFIX)editline.$(LIB_SUFFIX)'
|
||||
fi
|
||||
|
||||
dnl Either way, we want to build with line editing support.
|
||||
@ -4277,7 +4279,7 @@ if test -n "$ENABLE_INTL_API" -a -z "$MOZ_NATIVE_ICU"; then
|
||||
ICU_CROSS_BUILD_OPT=""
|
||||
ICU_SRCDIR=""
|
||||
if test "$HOST_OS_ARCH" = "WINNT"; then
|
||||
ICU_SRCDIR="--srcdir=$(cd $srcdir/../../intl/icu/source; pwd -W)"
|
||||
ICU_SRCDIR="--srcdir=$(cd $srcdir/intl/icu/source; pwd -W)"
|
||||
fi
|
||||
|
||||
if test "$CROSS_COMPILE"; then
|
||||
@ -4326,7 +4328,7 @@ if test -n "$ENABLE_INTL_API" -a -z "$MOZ_NATIVE_ICU"; then
|
||||
CPPFLAGS="$ICU_CPPFLAGS" \
|
||||
CXXFLAGS="$HOST_ICU_CXXFLAGS $HOST_OPTIMIZE_FLAGS" \
|
||||
LDFLAGS="$HOST_LDFLAGS" \
|
||||
$SHELL $abs_srcdir/../../intl/icu/source/runConfigureICU \
|
||||
$SHELL $abs_srcdir/intl/icu/source/runConfigureICU \
|
||||
$HOST_ICU_BUILD_OPTS \
|
||||
$ICU_TARGET \
|
||||
dnl Shell quoting is fun.
|
||||
@ -4436,7 +4438,7 @@ if test -n "$ENABLE_INTL_API" -a -z "$MOZ_NATIVE_ICU"; then
|
||||
CFLAGS="$ICU_CFLAGS" \
|
||||
CXXFLAGS="$ICU_CXXFLAGS" \
|
||||
LDFLAGS="$ICU_LDFLAGS $LDFLAGS" \
|
||||
$SHELL $_topsrcdir/../../intl/icu/source/configure \
|
||||
$SHELL $_topsrcdir/intl/icu/source/configure \
|
||||
$ICU_BUILD_OPTS \
|
||||
$ICU_CROSS_BUILD_OPT \
|
||||
$ICU_LINK_OPTS \
|
||||
@ -4468,7 +4470,7 @@ AC_OUTPUT()
|
||||
# Produce the js-config script at configure time; see the comments for
|
||||
# 'js*-config' in Makefile.in.
|
||||
AC_MSG_RESULT(invoking $MAKE to create $JS_CONFIG_NAME script)
|
||||
$MAKE $JS_CONFIG_NAME
|
||||
$MAKE -C js/src $JS_CONFIG_NAME
|
||||
|
||||
# Build jsctypes if it's enabled.
|
||||
if test "$JS_HAS_CTYPES" -a -z "$MOZ_NATIVE_FFI"; then
|
||||
@ -4494,10 +4496,10 @@ if test "$JS_HAS_CTYPES" -a -z "$MOZ_NATIVE_FFI"; then
|
||||
case "${target_cpu}" in
|
||||
x86_64)
|
||||
# Need target since MSYS tools into mozilla-build may be 32bit
|
||||
ac_configure_args="$ac_configure_args CC=\"$_topsrcdir/ctypes/libffi/msvcc.sh -m64\" --build=$build --host=$target"
|
||||
ac_configure_args="$ac_configure_args CC=\"$_topsrcdir/js/src/ctypes/libffi/msvcc.sh -m64\" --build=$build --host=$target"
|
||||
;;
|
||||
*)
|
||||
ac_configure_args="$ac_configure_args CC=$_topsrcdir/ctypes/libffi/msvcc.sh"
|
||||
ac_configure_args="$ac_configure_args CC=$_topsrcdir/js/src/ctypes/libffi/msvcc.sh"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
@ -4523,12 +4525,12 @@ if test "$JS_HAS_CTYPES" -a -z "$MOZ_NATIVE_FFI"; then
|
||||
|
||||
# Use a separate cache file for libffi, since it does things differently
|
||||
# from our configure.
|
||||
mkdir -p $_objdir/ctypes/libffi
|
||||
mkdir -p $_objdir/js/src/ctypes/libffi
|
||||
old_cache_file=$cache_file
|
||||
cache_file=$_objdir/ctypes/libffi/config.cache
|
||||
cache_file=$_objdir/js/src/ctypes/libffi/config.cache
|
||||
old_config_files=$CONFIG_FILES
|
||||
unset CONFIG_FILES
|
||||
AC_OUTPUT_SUBDIRS(ctypes/libffi)
|
||||
AC_OUTPUT_SUBDIRS(js/src/ctypes/libffi)
|
||||
cache_file=$old_cache_file
|
||||
ac_configure_args="$_SUBDIR_CONFIG_ARGS"
|
||||
CONFIG_FILES=$old_config_files
|
||||
|
@ -4,9 +4,9 @@
|
||||
# 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/.
|
||||
|
||||
LIBS = $(DEPTH)/$(LIB_PREFIX)js_static.$(LIB_SUFFIX) $(NSPR_LIBS) $(MOZ_ZLIB_LIBS)
|
||||
LIBS = ../$(LIB_PREFIX)js_static.$(LIB_SUFFIX) $(NSPR_LIBS) $(MOZ_ZLIB_LIBS)
|
||||
|
||||
LOCAL_INCLUDES += -I$(topsrcdir) -I..
|
||||
LOCAL_INCLUDES += -I$(srcdir)/.. -I..
|
||||
|
||||
ifdef MOZ_SHARED_ICU
|
||||
EXTRA_LIBS += $(MOZ_ICU_LIBS)
|
||||
@ -18,7 +18,7 @@ EXTRA_LIBS += $(MOZ_FFI_LIBS)
|
||||
# in the build directory and in the dist/bin directory.
|
||||
PP_TARGETS += GDB_AUTOLOAD
|
||||
GDB_AUTOLOAD := gdb-tests-gdb.py.in
|
||||
GDB_AUTOLOAD_FLAGS := -Dtopsrcdir=$(abspath $(topsrcdir))
|
||||
GDB_AUTOLOAD_FLAGS := -Dtopsrcdir=$(abspath $(srcdir)/..)
|
||||
|
||||
INSTALL_TARGETS += GDB_INSTALL_AUTOLOAD
|
||||
GDB_INSTALL_AUTOLOAD_FILES := $(CURDIR)/gdb-tests-gdb.py
|
||||
|
@ -4,9 +4,9 @@
|
||||
# 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/.
|
||||
|
||||
LIBS = $(DEPTH)/$(LIB_PREFIX)js_static.$(LIB_SUFFIX) $(NSPR_LIBS) $(MOZ_ZLIB_LIBS)
|
||||
LIBS = ../$(LIB_PREFIX)js_static.$(LIB_SUFFIX) $(NSPR_LIBS) $(MOZ_ZLIB_LIBS)
|
||||
|
||||
LOCAL_INCLUDES += -I$(topsrcdir) -I..
|
||||
LOCAL_INCLUDES += -I$(srcdir)/.. -I..
|
||||
|
||||
ifdef MOZ_SHARED_ICU
|
||||
EXTRA_LIBS += $(MOZ_ICU_LIBS)
|
||||
@ -22,7 +22,7 @@ endif
|
||||
# the build directory.
|
||||
PP_TARGETS += JSAPI_TESTS_AUTOLOAD
|
||||
JSAPI_TESTS_AUTOLOAD := jsapi-tests-gdb.py.in
|
||||
JSAPI_TESTS_AUTOLOAD_FLAGS := -Dtopsrcdir=$(abspath $(topsrcdir))
|
||||
JSAPI_TESTS_AUTOLOAD_FLAGS := -Dtopsrcdir=$(abspath $(srcdir)/..)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
@ -39,9 +39,17 @@ case $cmd in
|
||||
${MKDIR} -p ${tgtpath}/intl
|
||||
cp -t ${tgtpath}/intl -dRp ${SRCDIR}/../../intl/icu
|
||||
|
||||
# copy autoconf config directory.
|
||||
# copy main moz.build and Makefile.in
|
||||
cp -t ${tgtpath} -dRp ${SRCDIR}/../../Makefile.in ${SRCDIR}/../../moz.build
|
||||
|
||||
# copy a nspr file used by the build system
|
||||
${MKDIR} -p ${tgtpath}/nsprpub/config
|
||||
cp -t ${tgtpath}/nsprpub/config -dRp \
|
||||
${SRCDIR}/../../nsprpub/config/make-system-wrappers.pl
|
||||
|
||||
# copy build and config directory.
|
||||
${MKDIR} -p ${tgtpath}/build
|
||||
cp -t ${tgtpath}/build -dRp ${SRCDIR}/../../build/autoconf
|
||||
cp -t ${tgtpath} -dRp ${SRCDIR}/../../build ${SRCDIR}/../../config
|
||||
|
||||
# put in js itself
|
||||
cp -t ${tgtpath} -dRp ${SRCDIR}/../../mfbt
|
||||
@ -54,32 +62,17 @@ case $cmd in
|
||||
${MAKE} -C ${tgtpath}/js/src distclean
|
||||
fi
|
||||
|
||||
# put in the virtualenv and supporting files if it doesnt already exist
|
||||
if [ ! -e ${SRCDIR}/build/virtualenv_packages.txt ]; then
|
||||
cp -t ${tgtpath}/js/src/build -dRp \
|
||||
${SRCDIR}/../../build/virtualenv_packages.txt \
|
||||
${SRCDIR}/../../build/buildconfig.py
|
||||
fi
|
||||
if [ ! -e ${SRCDIR}/python ]; then
|
||||
cp -t ${tgtpath}/js/src -dRp \
|
||||
${SRCDIR}/../../python
|
||||
fi
|
||||
if [ ! -e ${SRCDIR}/dom/bindings/mozwebidlcodegen ]; then
|
||||
${MKDIR} -p ${tgtpath}/js/src/dom/bindings
|
||||
cp -t ${tgtpath}/js/src/dom/bindings -dRp \
|
||||
${SRCDIR}/../../dom/bindings/mozwebidlcodegen
|
||||
fi
|
||||
if [ ! -e ${SRCDIR}/media/webrtc/trunk/tools/gyp ]; then
|
||||
${MKDIR} -p ${tgtpath}/js/src/media/webrtc/trunk/tools
|
||||
cp -t ${tgtpath}/js/src/media/webrtc/trunk/tools -dRp \
|
||||
${SRCDIR}/../../media/webrtc/trunk/tools/gyp
|
||||
fi
|
||||
if [ ! -e ${SRCDIR}/testing ]; then
|
||||
${MKDIR} -p ${tgtpath}/js/src/testing
|
||||
cp -t ${tgtpath}/js/src/testing -dRp \
|
||||
${SRCDIR}/../../testing/mozbase
|
||||
fi
|
||||
# end of virtualenv injection
|
||||
cp -t ${tgtpath} -dRp \
|
||||
${SRCDIR}/../../python
|
||||
${MKDIR} -p ${tgtpath}/dom/bindings
|
||||
cp -t ${tgtpath}/dom/bindings -dRp \
|
||||
${SRCDIR}/../../dom/bindings/mozwebidlcodegen
|
||||
${MKDIR} -p ${tgtpath}/media/webrtc/trunk/tools
|
||||
cp -t ${tgtpath}/media/webrtc/trunk/tools -dRp \
|
||||
${SRCDIR}/../../media/webrtc/trunk/tools/gyp
|
||||
${MKDIR} -p ${tgtpath}/testing
|
||||
cp -t ${tgtpath}/testing -dRp \
|
||||
${SRCDIR}/../../testing/mozbase
|
||||
|
||||
# remove *.pyc and *.pyo files if any
|
||||
find ${tgtpath} -type f -name "*.pyc" -o -name "*.pyo" |xargs rm -f
|
||||
|
@ -4,8 +4,6 @@
|
||||
# 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/.
|
||||
|
||||
DIRS += ['config']
|
||||
|
||||
if CONFIG['DEHYDRA_PATH']:
|
||||
DIRS += ['analysis-tests']
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
# 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/.
|
||||
|
||||
LIBS = $(NSPR_LIBS) $(EDITLINE_LIBS) $(DEPTH)/$(LIB_PREFIX)js_static.$(LIB_SUFFIX) $(MOZ_ZLIB_LIBS)
|
||||
LIBS = $(NSPR_LIBS) $(EDITLINE_LIBS) ../$(LIB_PREFIX)js_static.$(LIB_SUFFIX) $(MOZ_ZLIB_LIBS)
|
||||
ifdef MOZ_NATIVE_FFI
|
||||
EXTRA_LIBS += $(MOZ_FFI_LIBS)
|
||||
endif
|
||||
@ -12,7 +12,7 @@ ifdef MOZ_SHARED_ICU
|
||||
EXTRA_LIBS += $(MOZ_ICU_LIBS)
|
||||
endif
|
||||
|
||||
LOCAL_INCLUDES += -I$(topsrcdir) -I..
|
||||
LOCAL_INCLUDES += -I$(srcdir)/.. -I..
|
||||
|
||||
ifeq ($(OS_ARCH),Darwin)
|
||||
ifeq ($(TARGET_CPU),x86_64)
|
||||
@ -28,7 +28,7 @@ endif
|
||||
# the build directory and in the dist/bin directory.
|
||||
PP_TARGETS += SHELL_AUTOLOAD
|
||||
SHELL_AUTOLOAD := js-gdb.py.in
|
||||
SHELL_AUTOLOAD_FLAGS := -Dtopsrcdir=$(abspath $(topsrcdir))
|
||||
SHELL_AUTOLOAD_FLAGS := -Dtopsrcdir=$(abspath $(srcdir)/..)
|
||||
|
||||
INSTALL_TARGETS += SHELL_INSTALL_AUTOLOAD
|
||||
SHELL_INSTALL_AUTOLOAD_FILES := $(CURDIR)/js-gdb.py
|
||||
@ -42,9 +42,9 @@ include $(topsrcdir)/config/rules.mk
|
||||
|
||||
# People expect the js shell to wind up in the top-level JS dir.
|
||||
libs::
|
||||
$(INSTALL) $(IFLAGS2) $(PROGRAM) $(DEPTH)
|
||||
$(INSTALL) $(IFLAGS2) $(PROGRAM) ..
|
||||
|
||||
GARBAGE += $(DEPTH)/$(PROGRAM)
|
||||
GARBAGE += ../$(PROGRAM)
|
||||
|
||||
install:: $(PROGRAM)
|
||||
$(SYSINSTALL) $^ $(DESTDIR)$(bindir)
|
||||
|
44
moz.build
44
moz.build
@ -5,30 +5,40 @@
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
CONFIGURE_SUBST_FILES += [
|
||||
'mozilla-config.h',
|
||||
'tools/update-packaging/Makefile',
|
||||
'config/autoconf.mk',
|
||||
'config/emptyvars.mk',
|
||||
]
|
||||
|
||||
if CONFIG['ENABLE_CLANG_PLUGIN']:
|
||||
add_tier_dir('base', 'build/clang-plugin', external=True)
|
||||
if CONFIG['BUILDING_JS']:
|
||||
if CONFIG['JS_STANDALONE']:
|
||||
DIRS += ['config']
|
||||
DIRS += ['js/src']
|
||||
else:
|
||||
CONFIGURE_SUBST_FILES += [
|
||||
'mozilla-config.h',
|
||||
'tools/update-packaging/Makefile',
|
||||
]
|
||||
|
||||
add_tier_dir('base', ['config', 'build', 'probes', 'python'])
|
||||
if CONFIG['ENABLE_CLANG_PLUGIN']:
|
||||
add_tier_dir('base', 'build/clang-plugin', external=True)
|
||||
|
||||
if not CONFIG['LIBXUL_SDK']:
|
||||
add_tier_dir('base', ['mfbt'])
|
||||
add_tier_dir('base', ['config', 'build', 'probes', 'python'])
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gonk'):
|
||||
add_tier_dir('base', ['other-licenses/android'])
|
||||
if not CONFIG['LIBXUL_SDK']:
|
||||
add_tier_dir('base', ['mfbt'])
|
||||
|
||||
if CONFIG['MOZ_MEMORY']:
|
||||
add_tier_dir('base', ['memory'])
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gonk'):
|
||||
add_tier_dir('base', ['other-licenses/android'])
|
||||
|
||||
if not CONFIG['MOZ_NATIVE_ZLIB']:
|
||||
add_tier_dir('base', ['modules/zlib'])
|
||||
if CONFIG['MOZ_MEMORY']:
|
||||
add_tier_dir('base', ['memory'])
|
||||
|
||||
add_tier_dir('base', ['mozglue', 'memory/mozalloc'])
|
||||
if not CONFIG['MOZ_NATIVE_ZLIB']:
|
||||
add_tier_dir('base', ['modules/zlib'])
|
||||
|
||||
add_tier_dir('precompile', 'xpcom/xpidl')
|
||||
add_tier_dir('base', ['mozglue', 'memory/mozalloc'])
|
||||
|
||||
# Bring in the configuration for the configured application.
|
||||
include('/' + CONFIG['MOZ_BUILD_APP'] + '/app.mozbuild')
|
||||
add_tier_dir('precompile', 'xpcom/xpidl')
|
||||
|
||||
# Bring in the configuration for the configured application.
|
||||
include('/' + CONFIG['MOZ_BUILD_APP'] + '/app.mozbuild')
|
||||
|
@ -554,7 +554,8 @@ class RecursiveMakeBackend(CommonBackend):
|
||||
if dirs:
|
||||
# For build systems without tiers (js/src), output a list
|
||||
# of directories for each tier.
|
||||
root_mk.add_statement('%s_dirs := %s' % (tier, ' '.join(dirs)))
|
||||
all_dirs = self._traversal.traverse('', filter)
|
||||
root_mk.add_statement('%s_dirs := %s' % (tier, ' '.join(all_dirs)))
|
||||
continue
|
||||
if subtiers:
|
||||
# Output the list of filtered subtiers for the given tier.
|
||||
|
@ -479,7 +479,7 @@ stage-xpcshell: make-stage-dir
|
||||
$(MAKE) -C $(DEPTH)/testing/xpcshell stage-package
|
||||
|
||||
stage-jstests: make-stage-dir
|
||||
$(MAKE) -C $(DEPTH)/js/src/tests stage-package
|
||||
$(MAKE) -C $(DEPTH)/js/src/js/src/tests stage-package
|
||||
|
||||
stage-android: make-stage-dir
|
||||
ifdef MOZ_ENABLE_SZIP
|
||||
|
@ -381,8 +381,11 @@ RELEASE_SIGN_ANDROID_APK = \
|
||||
$(RM) $(2)-unaligned.apk
|
||||
|
||||
ROBOCOP_PATH = $(abspath $(_ABS_DIST)/../build/mobile/robocop)
|
||||
# Normally, $(NSINSTALL) would be used instead of cp, but INNER_ROBOCOP_PACKAGE
|
||||
# is used in a series of commands that run under a "cd something", while
|
||||
# $(NSINSTALL) is relative.
|
||||
INNER_ROBOCOP_PACKAGE= \
|
||||
$(NSINSTALL) $(GECKO_APP_AP_PATH)/fennec_ids.txt $(_ABS_DIST) && \
|
||||
cp $(GECKO_APP_AP_PATH)/fennec_ids.txt $(_ABS_DIST) && \
|
||||
$(call RELEASE_SIGN_ANDROID_APK,$(ROBOCOP_PATH)/robocop-debug-unsigned-unaligned.apk,$(_ABS_DIST)/robocop.apk)
|
||||
|
||||
BACKGROUND_TESTS_PATH = $(abspath $(_ABS_DIST)/../mobile/android/tests/background/junit3)
|
||||
|
Loading…
Reference in New Issue
Block a user