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/10/08 07:44:00 UTC
(openoffice) 01/02: build(desktop): ship unopkg as upstream's .com/.exe/.bin, and let the launchers start
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 689cf78956db2284c5a49b194f9a12088e0da71e
Author: Peter <pe...@apache.org>
AuthorDate: Thu Oct 8 09:43:51 2026 +0200
build(desktop): ship unopkg as upstream's .com/.exe/.bin, and let the launchers start
program/ now has upstream's three files for unopkg, each of which finds
the next by its own filename: unopkg.com (unopkgio) -> unopkg.exe
(guiloader) -> unopkg.bin (the tool). Before, the tool itself was
staged as unopkg.exe and the front ends under their build names, so
the .com's console-to-UTF-16 input conversion was unreachable.
crashrep.com (guistdio) is produced the same way. The names are made
by copy_file at the producing package; staging accepts .bin and .com.
Every small EXE in desktop, and crashrep.exe, now embeds the VC90
manifest on the winXP builds. All of them link /MD with /MANIFEST:NO,
so on winXP-x86 and winXP-x64 fifteen of them -- the swriter/scalc/...
launchers, quickstart, rebaseoo, rebasegui, unoinfo, the loaders and
crashrep -- died at load with a System Error box. The win10 build
gets no VC90 manifest, unopkg included: its runtime is not
side-by-side.
Co-Authored-By: Claude Opus 5.5 <no...@anthropic.com>
---
main/crashrep/BUILD.bazel | 18 +++++-
main/desktop/BUILD.bazel | 118 +++++++++++++++++++++++++++-------
main/staging/collect_files_aspect.bzl | 4 +-
3 files changed, 112 insertions(+), 28 deletions(-)
diff --git a/main/crashrep/BUILD.bazel b/main/crashrep/BUILD.bazel
index 4c75696c1f..b9df9b03f8 100644
--- a/main/crashrep/BUILD.bazel
+++ b/main/crashrep/BUILD.bazel
@@ -88,6 +88,20 @@ _COPTS = [
"/D_INPATH=\\\"wntmsci9\\\"",
]
+# VC9 runtime manifest at RT_MANIFEST id 1, winXP builds only -- the same
+# select as the small EXEs in //main/desktop, which explains it. Without it
+# crashrep.exe died at load with a "System Error" box, i.e. a crash produced a
+# second failure instead of a report.
+_VC90_MANIFEST_INPUTS = select({
+ "//build/constraints:is_win10": [],
+ "//conditions:default": ["//main/external/msvcp90:vc90_app_manifest_res"],
+})
+
+_VC90_MANIFEST_LINKOPTS = select({
+ "//build/constraints:is_win10": [],
+ "//conditions:default": ["$(execpath //main/external/msvcp90:vc90_app_manifest_res)"],
+})
+
# ── crashrep.exe — Windows GUI crash reporter (= soreport.exe in dmake) ──────
# d.lst delivers soreport.exe as bin/crashrep.exe; naming the target "crashrep"
# achieves the rename without a post-build step.
@@ -107,7 +121,7 @@ cc_binary(
additional_linker_inputs = [
":soreport_res",
"//main/sal:sal_implib",
- ],
+ ] + _VC90_MANIFEST_INPUTS,
linkopts = [
"$(execpath :soreport_res)",
"$(execpath //main/sal:sal_implib)",
@@ -122,7 +136,7 @@ cc_binary(
"psapi.lib",
"/SUBSYSTEM:WINDOWS",
"/MANIFEST:NO",
- ],
+ ] + _VC90_MANIFEST_LINKOPTS,
deps = [
"//main/sal:sal_headers",
"//main/stlport:stlport",
diff --git a/main/desktop/BUILD.bazel b/main/desktop/BUILD.bazel
index 7ffd93048b..02daf6ebfb 100644
--- a/main/desktop/BUILD.bazel
+++ b/main/desktop/BUILD.bazel
@@ -1,5 +1,6 @@
package(default_visibility = ["//visibility:public"])
+load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
load("//build/rules:rsc_pipeline.bzl", "rsc_res")
load("//build/rules:gtest_test.bzl", "gtest_test")
@@ -788,11 +789,13 @@ cc_binary(
":unopkgapp",
# Launcher / helper EXEs shipped alongside soffice.exe
":officeloader",
- ":guiloader",
":unoinfo",
- ":guistdio",
- ":unopkgio",
- ":unopkg",
+ # Under their installed names only -- guiloader, guistdio and unopkgio
+ # are never shipped under their build names (desktop/prj/d.lst).
+ ":unopkg_com",
+ ":unopkg_exe",
+ ":unopkg_bin",
+ ":crashrep_com",
":swriter",
":scalc",
":sdraw",
@@ -807,6 +810,25 @@ cc_binary(
visibility = ["//visibility:public"],
)
+# ── VC9 runtime manifest for the small EXEs ───────────────────────────────────
+# Every EXE below links /MD and /MANIFEST:NO. Under VC9 the CRT is a
+# side-by-side assembly: without a manifest naming Microsoft.VC90.CRT the
+# loader never consults WinSxS, MSVCR90.dll is unresolvable, and the process
+# dies before main() with a "System Error" box (0xC0000135). dmake embedded a
+# manifest into every EXE with mt.exe; here it is linked in as a .res at
+# RT_MANIFEST id 1. The modern toolchain's runtime is not side-by-side, so a
+# win10 build gets nothing -- a VC90 manifest there would demand an assembly
+# the image never uses.
+_VC90_MANIFEST_INPUTS = select({
+ "//build/constraints:is_win10": [],
+ "//conditions:default": ["//main/external/msvcp90:vc90_app_manifest_res"],
+})
+
+_VC90_MANIFEST_LINKOPTS = select({
+ "//build/constraints:is_win10": [],
+ "//conditions:default": ["$(execpath //main/external/msvcp90:vc90_app_manifest_res)"],
+})
+
# ── officeloader.exe ──────────────────────────────────────────────────────────
# Bootstrap loader (delivered as soffice.exe in the final install)
cc_binary(
@@ -829,7 +851,8 @@ cc_binary(
"advapi32.lib", "shell32.lib", "shlwapi.lib", "user32.lib",
"/SUBSYSTEM:WINDOWS",
"/MANIFEST:NO",
- ],
+ ] + _VC90_MANIFEST_LINKOPTS,
+ additional_linker_inputs = _VC90_MANIFEST_INPUTS,
visibility = ["//visibility:public"],
)
@@ -858,7 +881,8 @@ cc_binary(
"shlwapi.lib", "user32.lib",
"/SUBSYSTEM:WINDOWS",
"/MANIFEST:NO",
- ],
+ ] + _VC90_MANIFEST_LINKOPTS,
+ additional_linker_inputs = _VC90_MANIFEST_INPUTS,
visibility = ["//visibility:public"],
)
@@ -882,7 +906,8 @@ cc_binary(
linkopts = [
"/SUBSYSTEM:CONSOLE",
"/MANIFEST:NO",
- ],
+ ] + _VC90_MANIFEST_LINKOPTS,
+ additional_linker_inputs = _VC90_MANIFEST_INPUTS,
visibility = ["//visibility:public"],
)
@@ -904,7 +929,8 @@ cc_binary(
"user32.lib",
"/SUBSYSTEM:CONSOLE",
"/MANIFEST:NO",
- ],
+ ] + _VC90_MANIFEST_LINKOPTS,
+ additional_linker_inputs = _VC90_MANIFEST_INPUTS,
visibility = ["//visibility:public"],
)
@@ -925,12 +951,15 @@ cc_binary(
linkopts = [
"/SUBSYSTEM:CONSOLE",
"/MANIFEST:NO",
- ],
+ ] + _VC90_MANIFEST_LINKOPTS,
+ additional_linker_inputs = _VC90_MANIFEST_INPUTS,
visibility = ["//visibility:public"],
)
-# ── unopkg.exe ────────────────────────────────────────────────────────────────
-# Thin bootstrap loader that calls unopkg_main() from unopkgapp.dll
+# ── unopkg.exe → program/unopkg.bin ──────────────────────────────────────────
+# Thin bootstrap that calls unopkg_main() from unopkgapp.dll. Upstream ships it
+# as unopkg.bin behind two front ends (see "unopkg front ends" below); staging
+# takes it from :unopkg_bin under that name, never under its build name.
cc_binary(
name = "unopkg",
srcs = ["source/pkgchk/unopkg/unopkg_main.c"],
@@ -943,27 +972,62 @@ cc_binary(
"SUPD=680",
],
deps = ["//main/sal:sal_headers"],
- # The VC90-CRT manifest at RT_MANIFEST id 1, as uno-skeletonmaker carries
- # it. Staging installs this exe AS program/unopkg.exe (upstream's
- # unopkg.bin, behind a guiloader unopkg.exe) and stages no external
- # unopkg.exe.manifest, so without it the /MD CRT is unresolvable and the
- # process dies at load with 0xC0000135 before running a line -- every
- # `unopkg add/list/remove` failed silently that way.
additional_linker_inputs = [
- "//main/external/msvcp90:vc90_app_manifest_res",
"//main/sal:sal_implib",
":unopkgapp_implib",
- ],
+ ] + _VC90_MANIFEST_INPUTS,
linkopts = [
- "$(execpath //main/external/msvcp90:vc90_app_manifest_res)",
"$(execpath //main/sal:sal_implib)",
"$(execpath :unopkgapp_implib)",
"/SUBSYSTEM:WINDOWS",
"/MANIFEST:NO",
- ],
+ ] + _VC90_MANIFEST_LINKOPTS,
visibility = ["//visibility:public"],
)
+# ── unopkg front ends ─────────────────────────────────────────────────────────
+# Upstream installs THREE files for one tool (desktop/prj/d.lst, scp2
+# common_brand.scp), and each finds the next by its OWN filename:
+# unopkg.com = unopkgio.exe console wrapper; guistdio.inc swaps its .COM
+# for .EXE and relays stdin/stdout/stderr
+# unopkg.exe = guiloader.exe extendLoaderEnvironment() swaps .exe for .bin
+# unopkg.bin = :unopkg the tool
+# So the names are the lookup keys and are produced here, at the producing
+# package, not by a staging rename table. Typed at a console, `unopkg`
+# resolves to unopkg.COM (PATHEXT puts .COM before .EXE), which is the point:
+# unopkg.bin is a /SUBSYSTEM:WINDOWS image whose output reaches a console only
+# through the .com's pipes. The copies live under brand/ so that unopkg.exe
+# does not collide with :unopkg's own output in this package.
+copy_file(
+ name = "unopkg_com",
+ src = ":unopkgio",
+ out = "brand/unopkg.com",
+ is_executable = True,
+)
+
+copy_file(
+ name = "unopkg_exe",
+ src = ":guiloader",
+ out = "brand/unopkg.exe",
+ is_executable = True,
+)
+
+copy_file(
+ name = "unopkg_bin",
+ src = ":unopkg",
+ out = "brand/unopkg.bin",
+ is_executable = True,
+)
+
+# crashrep.com — same trick for the crash reporter (scp2 file_crashrep.scp):
+# guistdio.exe renamed, which starts crashrep.exe beside it.
+copy_file(
+ name = "crashrep_com",
+ src = ":guistdio",
+ out = "brand/crashrep.com",
+ is_executable = True,
+)
+
# ── Application launcher EXEs (swriter, scalc, etc.) ─────────────────────────
[cc_binary(
name = app,
@@ -985,7 +1049,8 @@ cc_binary(
"user32.lib",
"/SUBSYSTEM:WINDOWS",
"/MANIFEST:NO",
- ],
+ ] + _VC90_MANIFEST_LINKOPTS,
+ additional_linker_inputs = _VC90_MANIFEST_INPUTS,
visibility = ["//visibility:public"],
) for app in ["swriter", "scalc", "sdraw", "simpress", "sbase", "smath", "sweb"]]
@@ -1011,7 +1076,8 @@ cc_binary(
"shell32.lib", "imagehlp.lib", "user32.lib",
"/SUBSYSTEM:WINDOWS",
"/MANIFEST:NO",
- ],
+ ] + _VC90_MANIFEST_LINKOPTS,
+ additional_linker_inputs = _VC90_MANIFEST_INPUTS,
visibility = ["//visibility:public"],
)
@@ -1037,7 +1103,8 @@ cc_binary(
"shell32.lib", "imagehlp.lib", "user32.lib",
"/SUBSYSTEM:WINDOWS",
"/MANIFEST:NO",
- ],
+ ] + _VC90_MANIFEST_LINKOPTS,
+ additional_linker_inputs = _VC90_MANIFEST_INPUTS,
visibility = ["//visibility:public"],
)
@@ -1064,7 +1131,8 @@ cc_binary(
"oleaut32.lib", "comdlg32.lib", "kernel32.lib", "uuid.lib",
"/SUBSYSTEM:WINDOWS",
"/MANIFEST:NO",
- ],
+ ] + _VC90_MANIFEST_LINKOPTS,
+ additional_linker_inputs = _VC90_MANIFEST_INPUTS,
visibility = ["//visibility:public"],
)
diff --git a/main/staging/collect_files_aspect.bzl b/main/staging/collect_files_aspect.bzl
index 23f222c10b..d16c4ed32e 100644
--- a/main/staging/collect_files_aspect.bzl
+++ b/main/staging/collect_files_aspect.bzl
@@ -112,7 +112,9 @@ res_stage = rule(
# "pyd": Python extension modules. Python 2.7's importer accepts ONLY this
# suffix on Windows (Python/dynload_win.c), so pyuno ships as pyuno.pyd; without
# it here the file is collected but silently dropped on the way to program/.
-_INSTALL_EXTS = {"exe": True, "dll": True, "pyd": True, "rdb": True, "zip": True, "py": True, "ini": True, "manifest": True}
+# "bin"/"com": unopkg.bin, unopkg.com and crashrep.com, the launcher front ends
+# //main/desktop produces under their installed names (see unopkg_com there).
+_INSTALL_EXTS = {"exe": True, "dll": True, "pyd": True, "rdb": True, "zip": True, "py": True, "ini": True, "manifest": True, "bin": True, "com": True}
def _flat_install_impl(ctx):
all_files = depset(transitive = [