You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by pe...@apache.org on 2026/07/25 09:00:31 UTC
(openoffice) 17/20: build/win64: name the target platforms winXP-x86/winXP-x64 + win_version constraint
This is an automated email from the ASF dual-hosted git repository.
leginee pushed a commit to branch bazel-migration
in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit 6759c81b933b3e4bc19afbf66f0ff0e9122f52f4
Author: Peter Kovacs <pe...@apache.org>
AuthorDate: Sat Jul 25 10:47:13 2026 +0200
build/win64: name the target platforms winXP-x86/winXP-x64 + win_version constraint
Rename //build/platforms:windows_x86/x64 -> winXP-x86/winXP-x64 to record the
intent (VC9/VS2008 + SDK v7.0 is the XP-era toolchain we stay on). Add a
//build/constraints:win_version constraint_setting (winxp/win10 values +
is_winxp/is_win10 config_settings) composed ORTHOGONALLY with @platforms//cpu:*
in the platforms. This is the Bazel-native way to model the target Windows
floor: a future win10-x64 becomes a new constraint point that select() can
branch on to drive deps/defines, not a stringly-typed --config.
.bazelrc keeps only the thin --config=winXP-x86/x64 -> --platforms alias plus
the per-arch --platform_suffix / --symlink_prefix (output trees
bazel-winXP-x86-/bazel-winXP-x64-). register_execution_platforms + toolchain
comments updated to the new labels.
Co-Authored-By: Claude Opus 4.8 <no...@anthropic.com>
(cherry picked from commit 6e86c614c63b2ea60c3e4bf087f8a387f3dddb6a)
---
.bazelrc | 24 +++++++++++--------
MODULE.bazel | 12 +++++-----
build/constraints/BUILD.bazel | 54 +++++++++++++++++++++++++++++++++++++++++++
build/platforms/BUILD.bazel | 28 +++++++++++++++++-----
build/toolchain/BUILD.bazel | 4 ++--
5 files changed, 98 insertions(+), 24 deletions(-)
diff --git a/.bazelrc b/.bazelrc
index 6c308e625c..776d516956 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -15,15 +15,19 @@ common --registry=https://bcr.bazel.build
# pinned explicitly (the auto host platform is x86_64 and would not resolve it).
# Each arch pins --platforms + a distinct --platform_suffix (separate bazel-out
# trees, no clobber) + --symlink_prefix (both convenience symlinks coexist).
-# --config=x64 overrides these x86 defaults (all three are last-value-wins).
-build --platforms=//build/platforms:windows_x86
-build --platform_suffix=x86
-build --symlink_prefix=bazel-x86-
+# Thin alias only: --config=winXP-x64 => target the winXP-x64 platform, into its
+# own output tree. The SEMANTICS (target Windows floor, and any deps/defines that
+# vary by it) live in the //build/constraints:win_version constraint carried by the
+# platform, NOT here. --config=winXP-x64 overrides the winXP-x86 default (all
+# last-value-wins).
+build --platforms=//build/platforms:winXP-x86
+build --platform_suffix=winXP-x86
+build --symlink_prefix=bazel-winXP-x86-
-build:x86 --platforms=//build/platforms:windows_x86
-build:x86 --platform_suffix=x86
-build:x86 --symlink_prefix=bazel-x86-
+build:winXP-x86 --platforms=//build/platforms:winXP-x86
+build:winXP-x86 --platform_suffix=winXP-x86
+build:winXP-x86 --symlink_prefix=bazel-winXP-x86-
-build:x64 --platforms=//build/platforms:windows_x64
-build:x64 --platform_suffix=x64
-build:x64 --symlink_prefix=bazel-x64-
\ No newline at end of file
+build:winXP-x64 --platforms=//build/platforms:winXP-x64
+build:winXP-x64 --platform_suffix=winXP-x64
+build:winXP-x64 --symlink_prefix=bazel-winXP-x64-
\ No newline at end of file
diff --git a/MODULE.bazel b/MODULE.bazel
index 68d76092fa..c0619fbf17 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -72,21 +72,21 @@ register_toolchains("//build/toolchain:cc_toolchain_x64_vs2008_def")
# Execution platforms. ORDER MATTERS — register_execution_platforms prepends, so the
# FIRST entry is the highest-priority exec platform.
-# windows_x64 (x86_64) MUST be first: it becomes the exec platform for all build
+# winXP-x64 (x86_64) MUST be first: it becomes the exec platform for all build
# actions and cfg="exec" tools (idlc/regmerge/cppumaker/rsc/…), so those tools are
# built x64 and run natively on this x64 host (matching the amd64 CRT staging).
# A target that requires no cc toolchain (e.g. idl_library, which just runs the
-# staged tools) picks the first exec platform outright — if windows_x86 were first,
+# staged tools) picks the first exec platform outright — if winXP-x86 were first,
# those tools would be built x86_32 (breaking the x64 regmerge/idlc link + CRT).
-# windows_x86 (x86_32) is the fallback: this x64 host also runs 32-bit binaries via
+# winXP-x86 (x86_32) is the fallback: this x64 host also runs 32-bit binaries via
# WOW64, so x86 TEST targets (target cpu:x86_32) resolve their test toolchain here
# (Bazel runs tests on an exec platform matching the target's constraints; without
# this, x86 `bazel test` fails "no matching default_test_toolchain_type"). Only the
# test-run action lands here — cc/exec-tool actions need a cc toolchain, which is
-# exec_compatible_with x86_64 only, so they never select windows_x86.
+# exec_compatible_with x86_64 only, so they never select winXP-x86.
register_execution_platforms(
- "//build/platforms:windows_x64",
- "//build/platforms:windows_x86",
+ "//build/platforms:winXP-x64",
+ "//build/platforms:winXP-x86",
)
# Use preinstalled pkg-config instead of building it from source (building it
# from source requires gettext_runtime whose BUILD uses a removed cc_import builtin).
diff --git a/build/constraints/BUILD.bazel b/build/constraints/BUILD.bazel
new file mode 100644
index 0000000000..b6aa22279a
--- /dev/null
+++ b/build/constraints/BUILD.bazel
@@ -0,0 +1,54 @@
+# Windows target-version constraint dimension.
+#
+# This is the Bazel-native way to model "which Windows do we target" — the same
+# mechanism @platforms//os and @platforms//cpu use. It composes ORTHOGONALLY
+# with @platforms//cpu:{x86_32,x86_64} inside the target platforms, so the target
+# space is {winxp, win10, ...} x {x86, x64}, not a flat list of stringly-typed
+# --config names.
+#
+# Why a constraint and not just a platform name: a constraint_value can be the
+# subject of select() (via the config_settings below). So the target Windows
+# floor can DRIVE DEPENDENCIES AND DEFINES, e.g.
+#
+# _WIN32_WINNT = select({
+# "//build/constraints:is_winxp": ["_WIN32_WINNT=0x0501"],
+# "//build/constraints:is_win10": ["_WIN32_WINNT=0x0A00"],
+# })
+# deps = select({
+# "//build/constraints:is_win10": ["@some_lib//:win10_variant"],
+# "//conditions:default": ["@some_lib//:legacy_variant"],
+# })
+#
+# Adding win10 later is then a new constraint_value + platforms + config_setting
+# here — every consumer's select() picks it up; nothing else is stringly-coupled.
+
+package(default_visibility = ["//visibility:public"])
+
+# The dimension itself. No default_constraint_value: platforms state their floor
+# explicitly, and the auto-detected host (exec) platform simply leaves it unset
+# (exec-config tool builds don't care about the target Windows floor).
+constraint_setting(name = "win_version")
+
+# Current: XP-era (VC9 / VS2008 + SDK v7.0 — the toolchain we stay on for XP
+# compatibility). Future values slot in beside this one.
+constraint_value(
+ name = "winxp",
+ constraint_setting = ":win_version",
+)
+
+# Placeholder for the planned win10 target (not yet wired to a platform/toolchain).
+constraint_value(
+ name = "win10",
+ constraint_setting = ":win_version",
+)
+
+# select()-able views of the constraint.
+config_setting(
+ name = "is_winxp",
+ constraint_values = [":winxp"],
+)
+
+config_setting(
+ name = "is_win10",
+ constraint_values = [":win10"],
+)
diff --git a/build/platforms/BUILD.bazel b/build/platforms/BUILD.bazel
index 1d9a9b88ae..34311eaf83 100644
--- a/build/platforms/BUILD.bazel
+++ b/build/platforms/BUILD.bazel
@@ -1,26 +1,42 @@
# Target platforms for the dual-arch Windows build.
-# Selected via --platforms (wired to --config=x86 / --config=x64 in .bazelrc);
-# the target cpu constraint picks which //build/toolchain cc_toolchain resolves.
+# Selected via --platforms (wired to --config=winXP-x86 / --config=winXP-x64 in
+# .bazelrc); the target cpu constraint picks which //build/toolchain cc_toolchain
+# resolves. The "winXP" name records the intent — VC9 (VS2008) + SDK v7.0 is the
+# XP-era toolchain we stay on for XP compatibility — it is a label only and does
+# NOT set _WIN32_WINNT (currently 0x0500 on x86 / 0x0600 on the x64 bridge).
#
-# windows_x86 → @platforms//cpu:x86_32 → cc_toolchain_x86_vs2008 (default build)
-# windows_x64 → @platforms//cpu:x86_64 → cc_toolchain_x64_vs2008 (Win64 build)
+# winXP-x86 → @platforms//cpu:x86_32 → cc_toolchain_x86_vs2008 (default build)
+# winXP-x64 → @platforms//cpu:x86_64 → cc_toolchain_x64_vs2008 (Win64 build)
#
# The exec (host) platform stays Bazel's auto-detected x64 Windows host for both.
platform(
- name = "windows_x86",
+ name = "winXP-x86",
constraint_values = [
"@platforms//os:windows",
"@platforms//cpu:x86_32",
+ "//build/constraints:winxp",
],
visibility = ["//visibility:public"],
)
platform(
- name = "windows_x64",
+ name = "winXP-x64",
constraint_values = [
"@platforms//os:windows",
"@platforms//cpu:x86_64",
+ "//build/constraints:winxp",
],
visibility = ["//visibility:public"],
)
+
+# Future (planned, not yet wired to a toolchain):
+# platform(
+# name = "win10-x64",
+# constraint_values = [
+# "@platforms//os:windows",
+# "@platforms//cpu:x86_64",
+# "//build/constraints:win10",
+# ],
+# visibility = ["//visibility:public"],
+# )
diff --git a/build/toolchain/BUILD.bazel b/build/toolchain/BUILD.bazel
index 19fc963dd0..54ce2ce8ad 100644
--- a/build/toolchain/BUILD.bazel
+++ b/build/toolchain/BUILD.bazel
@@ -120,7 +120,7 @@ toolchain(
target_compatible_with = [
# FIX: the x86 toolchain builds 32-bit binaries, so its TARGET cpu is
# x86_32 — not x86_64 as it wrongly declared before. Resolved against
- # //build/platforms:windows_x86 (--config=x86, the default).
+ # //build/platforms:winXP-x86 (--config=winXP-x86, the default).
"@platforms//cpu:x86_32",
"@platforms//os:windows",
],
@@ -240,7 +240,7 @@ toolchain(
"@platforms//os:windows",
],
target_compatible_with = [
- # Target = Win64. Resolved against //build/platforms:windows_x64 (--config=x64).
+ # Target = Win64. Resolved against //build/platforms:winXP-x64 (--config=winXP-x64).
"@platforms//cpu:x86_64",
"@platforms//os:windows",
],