tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit f25a99a5629f4efb8639fbe1766bfad62b79e3c8
parent 5a817f04d4377d8d5cc97e31b17716cd9769b298
Author: serge-sans-paille <sguelton@mozilla.com>
Date:   Thu, 13 Nov 2025 14:19:01 +0000

Bug 1498414 - Obsolete (HOST_)?EXTRA_DEPS in favor of automatic generation through create_rc.py r=glandium

Interestingly, this finds a few missed dependencies doing so.

Differential Revision: https://phabricator.services.mozilla.com/D271494

Diffstat:
Mbrowser/app/Makefile.in | 8--------
Mconfig/create_rc.py | 35+++++++++++++++++++++++++++++++----
Mconfig/makefiles/debugmake.mk | 1-
Mconfig/rules.mk | 21+++++++++++----------
Mipc/app/Makefile.in | 6------
Dmozglue/build/Makefile.in | 15---------------
Dtoolkit/mozapps/defaultagent/proxy/Makefile.in | 8--------
7 files changed, 42 insertions(+), 52 deletions(-)

diff --git a/browser/app/Makefile.in b/browser/app/Makefile.in @@ -18,14 +18,6 @@ CXX := $(filter-out -march=% -msse -msse2 -mfpmath=sse,$(CXX)) CXX += -march=pentiumpro endif -ifeq ($(OS_ARCH),WINNT) -# Rebuild firefox.exe if the manifest changes - it's included by splash.rc. -# (this dependency should really be just for firefox.exe, not other targets) -# Note the manifest file exists in the tree, so we use the explicit filename -# here. -EXTRA_DEPS += $(srcdir)/firefox.exe.manifest -endif - PROGRAMS_DEST = $(DIST)/bin objdir = $(topobjdir)/browser/app diff --git a/config/create_rc.py b/config/create_rc.py @@ -4,10 +4,11 @@ import io import os -import sys +from argparse import ArgumentParser from datetime import datetime import buildconfig +from mozbuild.makeutil import Makefile from mozbuild.preprocessor import Preprocessor from variables import get_buildid @@ -225,8 +226,22 @@ def has_manifest(module_rc, manifest_id): return False -def generate_module_rc(binary="", rcinclude=None): +def generate_module_rc(): + + parser = ArgumentParser() + parser.add_argument( + "binary", help="Binary for which the resource file is generated" + ) + parser.add_argument("--include", help="Included resources") + parser.add_argument("--dep-file", help="Path to the dependency file") + args = parser.parse_args() + + binary = args.binary + rcinclude = args.rc_include + dep_file = args.dep_file + deps = set() + extra_deps = set() buildid = get_buildid() milestone = buildconfig.substs["GRE_MILESTONE"] app_version = buildconfig.substs.get("MOZ_APP_VERSION") or milestone @@ -302,10 +317,22 @@ def generate_module_rc(binary="", rcinclude=None): if os.path.exists(manifest_path): manifest_path = manifest_path.replace("\\", "\\\\") data += f'\n{manifest_id} RT_MANIFEST "{manifest_path}"\n' + extra_deps.add(manifest_path) - with open("{}.rc".format(binary or "module"), "w", encoding="latin1") as fh: + target = binary or "module" + with open(f"{target}.rc", "w", encoding="latin1") as fh: fh.write(data) + if dep_file is not None and extra_deps: + dep_dirname = os.path.dirname(dep_file) + os.makedirs(dep_dirname, exist_ok=True) + + mk = Makefile() + rule = mk.create_rule([target, f"{target}.rc"]) + rule.add_dependencies(sorted(extra_deps)) + with open(dep_file, "w") as dep_fd: + mk.dump(dep_fd) + if __name__ == "__main__": - generate_module_rc(*sys.argv[1:]) + generate_module_rc() diff --git a/config/makefiles/debugmake.mk b/config/makefiles/debugmake.mk @@ -104,7 +104,6 @@ showhost: HOST_LDFLAGS \ HOST_LIBS \ HOST_EXTRA_LIBS \ - HOST_EXTRA_DEPS \ HOST_PROGRAM \ HOST_OBJS \ HOST_PROGOBJS \ diff --git a/config/rules.mk b/config/rules.mk @@ -414,7 +414,7 @@ endef # PROGRAM = Foo # creates OBJS, links with LIBS to create Foo # -$(PROGRAM): $(PROGOBJS) $(STATIC_LIBS) $(EXTRA_DEPS) $(call resfile,$(PROGRAM)) $(GLOBAL_DEPS) $(call mkdir_deps,$(FINAL_TARGET)) +$(PROGRAM): $(PROGOBJS) $(STATIC_LIBS) $(call resfile,$(PROGRAM)) $(GLOBAL_DEPS) $(call mkdir_deps,$(FINAL_TARGET)) $(REPORT_BUILD) $(call BUILDSTATUS,START_Program $(@F)) ifeq (clang-cl_WINNT,$(CC_TYPE)_$(OS_ARCH)) @@ -429,7 +429,7 @@ ifdef ENABLE_STRIP endif $(call BUILDSTATUS,END_Program $(@F)) -$(HOST_PROGRAM): $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS) $(call mkdir_deps,$(DEPTH)/dist/host/bin) +$(HOST_PROGRAM): $(HOST_PROGOBJS) $(HOST_LIBS) $(GLOBAL_DEPS) $(call mkdir_deps,$(DEPTH)/dist/host/bin) $(REPORT_BUILD) $(call BUILDSTATUS,START_Program $(@F)) ifeq (clang-cl_WINNT,$(HOST_CC_TYPE)_$(HOST_OS_ARCH)) @@ -452,7 +452,7 @@ endif # creates Foo.o Bar.o, links with LIBS to create Foo, Bar. # define simple_program_deps -$1: $(1:$(BIN_SUFFIX)=.$(OBJ_SUFFIX)) $(STATIC_LIBS) $(EXTRA_DEPS) $(call resfile_for_manifest,$1) $(GLOBAL_DEPS) +$1: $(1:$(BIN_SUFFIX)=.$(OBJ_SUFFIX)) $(STATIC_LIBS) $(call resfile_for_manifest,$1) $(GLOBAL_DEPS) endef $(foreach p,$(SIMPLE_PROGRAMS),$(eval $(call simple_program_deps,$(p)))) @@ -471,7 +471,7 @@ ifdef ENABLE_STRIP endif $(call BUILDSTATUS,END_Program $(@F)) -$(HOST_SIMPLE_PROGRAMS): host_%$(HOST_BIN_SUFFIX): $(HOST_LIBS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS) +$(HOST_SIMPLE_PROGRAMS): host_%$(HOST_BIN_SUFFIX): $(HOST_LIBS) $(GLOBAL_DEPS) $(REPORT_BUILD) $(call BUILDSTATUS,START_Program $(@F)) ifeq (WINNT_clang-cl,$(HOST_OS_ARCH)_$(HOST_CC_TYPE)) @@ -485,14 +485,14 @@ endif endif $(call BUILDSTATUS,END_Program $(@F)) -$(LIBRARY): $(OBJS) $(STATIC_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS) +$(LIBRARY): $(OBJS) $(STATIC_LIBS) $(GLOBAL_DEPS) $(REPORT_BUILD) $(call BUILDSTATUS,START_StaticLib $@) $(RM) $(REAL_LIBRARY) $(AR) $(AR_FLAGS) $($@_OBJS) $(call BUILDSTATUS,END_StaticLib $@) -$(WASM_ARCHIVE): $(CWASMOBJS) $(CPPWASMOBJS) $(STATIC_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS) +$(WASM_ARCHIVE): $(CWASMOBJS) $(CPPWASMOBJS) $(STATIC_LIBS) $(GLOBAL_DEPS) $(REPORT_BUILD_VERBOSE) $(call BUILDSTATUS,START_WasmLib $@) $(RM) $(WASM_ARCHIVE) @@ -526,7 +526,7 @@ endif # symlinks back to the originals. The symlinks are a no-op for stabs debugging, # so no need to conditionalize on OS version or debugging format. -$(SHARED_LIBRARY): $(OBJS) $(call resfile,$(SHARED_LIBRARY)) $(STATIC_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS) $(call mkdir_deps,$(FINAL_TARGET)) +$(SHARED_LIBRARY): $(OBJS) $(call resfile,$(SHARED_LIBRARY)) $(STATIC_LIBS) $(GLOBAL_DEPS) $(call mkdir_deps,$(FINAL_TARGET)) $(REPORT_BUILD) $(call BUILDSTATUS,START_SharedLib $@) $(RM) $@ @@ -791,8 +791,7 @@ endif endif -# EXTRA_DEPS contains manifests (manually added in Makefile.in ; bug 1498414) -%.res: $(or $(RCFILE),%.rc) $(MOZILLA_DIR)/config/create_res.py $(EXTRA_DEPS) +%.res: $(or $(RCFILE),%.rc) $(MOZILLA_DIR)/config/create_res.py $(REPORT_BUILD) $(call BUILDSTATUS,START_Res $@) $(PYTHON3) $(MOZILLA_DIR)/config/create_res.py $(DEFINES) $(INCLUDES) -o $@ $< @@ -800,9 +799,11 @@ endif $(notdir $(addsuffix .rc,$(PROGRAM) $(SHARED_LIBRARY) $(SIMPLE_PROGRAMS) module)): %.rc: $(RCINCLUDE) $(MOZILLA_DIR)/config/create_rc.py $(call BUILDSTATUS,START_Rc $@) - $(PYTHON3) $(MOZILLA_DIR)/config/create_rc.py '$(if $(filter module,$*),,$*)' '$(RCINCLUDE)' + $(PYTHON3) $(MOZILLA_DIR)/config/create_rc.py '$(if $(filter module,$*),,$*)' --include '$(RCINCLUDE)' --dep-file '$(MDDEPDIR)/$@.d' $(call BUILDSTATUS,END_Rc $@) +-include $(addsuffix .rc.d, $(addprefix $(MDDEPDIR)/,$(PROGRAM) $(SHARED_LIBRARY) $(SIMPLE_PROGRAMS) module)) + # Cancel GNU make built-in implicit rules MAKEFLAGS += -r diff --git a/ipc/app/Makefile.in b/ipc/app/Makefile.in @@ -10,12 +10,6 @@ ifneq ($(MOZ_WIDGET_TOOLKIT),android) #LIBS += ../contentproc/$(LIB_PREFIX)plugin-container.$(LIB_SUFFIX) endif -ifeq ($(OS_ARCH),WINNT) #{ -# Note the manifest file exists in the tree, so we use the explicit filename -# here. -EXTRA_DEPS += plugin-container.exe.manifest -endif #} - ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) #{ libs:: diff --git a/mozglue/build/Makefile.in b/mozglue/build/Makefile.in @@ -1,15 +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/. - -# For FORCE_SHARED_LIB -include $(topsrcdir)/config/config.mk - -ifeq (WINNT,$(OS_TARGET)) -# Rebuild mozglue.dll if the manifest changes - it's included by mozglue.rc. -# (this dependency should really be just for mozglue.dll, not other targets) -# Note the manifest file exists in the tree, so we use the explicit filename -# here. -EXTRA_DEPS += $(srcdir)/mozglue.dll.manifest -endif diff --git a/toolkit/mozapps/defaultagent/proxy/Makefile.in b/toolkit/mozapps/defaultagent/proxy/Makefile.in @@ -1,8 +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/. - -# Rebuild if the resources or manifest change. -EXTRA_DEPS += $(srcdir)/default-browser-agent.exe.manifest - -include $(topsrcdir)/config/rules.mk