commit 33610f84b07dbca3d304f7518b94303bdda067f1
parent 078264cfe20b4df617a6dba80d03439d2c1768cf
Author: Yannis Juglaret <yjuglaret@mozilla.com>
Date: Mon, 13 Oct 2025 09:32:38 +0000
Bug 1976038 - Add a build project for the standalone zucchini binary. r=firefox-build-system-reviewers,sergesanspaille
This lets us build the standalone zucchini binary without building all
Firefox, by using a mozconfig file containing:
ac_add_options --enable-project="tools/zucchini"
Differential Revision: https://phabricator.services.mozilla.com/D266392
Diffstat:
5 files changed, 71 insertions(+), 42 deletions(-)
diff --git a/build/moz.configure/update-programs.configure b/build/moz.configure/update-programs.configure
@@ -268,42 +268,26 @@ set_config("MOZ_NOTIFICATION_SERVER", True, when="--enable-notification-server")
# Supported patch formats for the updater
# =======================================
-
-@depends(target, when="--enable-updater")
-def zucchini_is_available(target):
- # Desktop Linux, macOS or Windows: we exclude Android by checking for GNU.
- return (target.os, target.kernel) == ("GNU", "Linux") or target.os in (
- "OSX",
- "WINNT",
- )
-
-
-with only_when(~zucchini_is_available):
- set_config("MOZ_BSPATCH", True, when="--enable-updater")
- set_define("MOZ_BSPATCH", True, when="--enable-updater")
-
-
-with only_when(zucchini_is_available):
- option(
- "--disable-bspatch",
- help="Disable bspatch support",
- )
-
- set_config("MOZ_BSPATCH", True, when="--enable-bspatch")
- set_define("MOZ_BSPATCH", True, when="--enable-bspatch")
-
- option(
- "--disable-zucchini",
- help="Disable zucchini support",
- )
-
- set_config("MOZ_ZUCCHINI", True, when="--enable-zucchini")
- set_define("MOZ_ZUCCHINI", True, when="--enable-zucchini")
-
- @depends("--enable-bspatch", "--enable-zucchini")
- def check_at_least_one_patch_format(bspatch, zucchini):
- if not bspatch and not zucchini:
- die(
- "You must enable at least one patch format when --enable-updater "
- "is used. Use --enable-bspatch or --enable-zucchini."
- )
+with only_when("--enable-updater"):
+ include("zucchini.configure")
+
+ with only_when(~zucchini_is_available):
+ set_config("MOZ_BSPATCH", True)
+ set_define("MOZ_BSPATCH", True)
+
+ with only_when(zucchini_is_available):
+ option(
+ "--disable-bspatch",
+ help="Disable bspatch support",
+ )
+
+ set_config("MOZ_BSPATCH", True, when="--enable-bspatch")
+ set_define("MOZ_BSPATCH", True, when="--enable-bspatch")
+
+ @depends("--enable-bspatch", "--enable-zucchini")
+ def check_at_least_one_patch_format(bspatch, zucchini):
+ if not bspatch and not zucchini:
+ die(
+ "You must enable at least one patch format when --enable-updater "
+ "is used. Use --enable-bspatch or --enable-zucchini."
+ )
diff --git a/build/moz.configure/zucchini.configure b/build/moz.configure/zucchini.configure
@@ -0,0 +1,24 @@
+# -*- 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/.
+
+
+@depends(target)
+def zucchini_is_available(target):
+ # Desktop Linux, macOS or Windows: we exclude Android by checking for GNU.
+ return (target.os, target.kernel) == ("GNU", "Linux") or target.os in (
+ "OSX",
+ "WINNT",
+ )
+
+
+with only_when(zucchini_is_available):
+ option(
+ "--disable-zucchini",
+ help="Disable zucchini support",
+ )
+
+ set_config("MOZ_ZUCCHINI", True, when="--enable-zucchini")
+ set_define("MOZ_ZUCCHINI", True, when="--enable-zucchini")
diff --git a/third_party/zucchini/moz.build b/third_party/zucchini/moz.build
@@ -161,6 +161,7 @@ DIRS += [
"executable",
]
-TEST_DIRS += [
- "tests/gtest",
-]
+if CONFIG["MOZ_APP_NAME"] != "zucchini":
+ TEST_DIRS += [
+ "tests/gtest",
+ ]
diff --git a/tools/zucchini/app.mozbuild b/tools/zucchini/app.mozbuild
@@ -0,0 +1,7 @@
+# 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/.
+
+DIRS += [
+ "/third_party/zucchini",
+]
diff --git a/tools/zucchini/moz.configure b/tools/zucchini/moz.configure
@@ -0,0 +1,13 @@
+# 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/.
+
+set_config("MOZ_APP_NAME", "zucchini")
+
+include("../../build/moz.configure/zucchini.configure")
+
+
+@depends(zucchini_is_available)
+def check_zucchini_available(available):
+ if not available:
+ die("Cannot build zucchini for this platform!")