feat(install): generate WiX sources for MSI packaging
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 12s
VoidBuildSystem CI / signing-openssl-gcc16 (push) Failing after 17s
VoidBuildSystem CI / sanitizers-gcc16 (push) Failing after 8s
VoidBuildSystem CI / wine-windows-gcc16 (push) Failing after 54s

This commit is contained in:
faumaray committed 2026-12-05 10:54:26 +03:00
1 parent e63ec85809
commit fd9e8673c0
7 files changed
+182 -25

No files matched your search

+2
View File
@@ -332,6 +332,8 @@ Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1–2C + Track A + Track B (B
- **Wave 119 (VoidLibrary Install/Packaging Rules & Profiles)**: added install rules (module archives to `lib`, headers, documentation), a `build.profiles.cpp` (default profiles plus `relwithdebinfo`) to the `build-vbs` branch, and verified a full `vbs install` of VoidLibrary (320 files) plus a 185 MB DEB accepted by `dpkg-deb`. VoidLibrary has no LICENSE file, so [Void/Library#63](https://git.faumaray.com/Void/Library/issues/63) was filed. The DEB writer now streams members (a 16 MiB read limit was hit on the large payload).
- **Wave 120 (WiX/MSI-Style Packaging & VoidLibrary CI)**: added `vbs install --archive FILE --archive-format wix`, which emits a WiX v3 source (deterministic Product/Upgrade GUIDs, directory tree, component per file, feature/component group) - the CPack WIX model consumed by candle/light on Windows; the XML is validated by a real parser and asserted in the install test. A `.gitea/workflows/vbs.yml` template (native build, smoke test, install check) was pushed to the VoidLibrary `build-vbs` branch.
## Remaining future scope
- **Superiority plan ([22-superiority-and-gaps.md](../roadmap/22-superiority-and-gaps.md), 2026-12-05)**: revised platform strategy - **macOS deferred**, **Windows via MinGW-w64 cross-compilation + Wine execution** (`dev cpp-gcc -p pkgsCross.mingwW64.stdenv.cc`, `dev cpp-gcc -p wine64`), native MSVC deferred; plus packaging parity (ZIP/DEB/RPM), IDE ecosystem, migration tooling, test-runner parity, benchmarks, CI runners, and remote execution in prioritized order.
+1
View File
@@ -122,4 +122,5 @@ Base HEAD: `fe0d1a6`
| Wave 116 (CLion extension repo) | `vbs ide plugin --editor clion` emits a JetBrains plugin skeleton; published to `Void/VbsCLion` | COMPLETE & VERIFIED (unit test passes; repo contents confirmed via the Gitea API; full CTest 8/8) | `src/Editor/CompDb.cpp`, `tests/FullV1Tests.cpp`, [Void/VbsCLion](https://git.faumaray.com/Void/VbsCLion), docs |
| Wave 118 (VoidLibrary in-repo build description) | Branch `build-vbs` in Void/Library with build.cpp + module table + smoke test; #61 updated | PUSHED & VERIFIED IN CLONE (branch content confirmed via Gitea API) | [Void/Library branch build-vbs](https://git.faumaray.com/Void/Library/src/branch/build-vbs), `contrib/voidlibrary-migration/`, Void/Library#61 |
| Wave 119 (VoidLibrary install rules + profiles) | install rules, `build.profiles.cpp`, verified 320-file prefix and a dpkg-valid DEB; streaming DEB writer; LICENSE issue #63 | COMPLETE & VERIFIED IN CLONE | `contrib/voidlibrary-migration/`, [Void/Library build-vbs](https://git.faumaray.com/Void/Library/src/branch/build-vbs), `src/Install/Installer.cpp`, Void/Library#63 |
| Wave 120 (WiX/MSI-style packaging + VoidLibrary CI) | `--archive-format wix` WiX v3 source generator; `.gitea/workflows/vbs.yml` template on the branch | COMPLETE & VERIFIED for the generator (XML parsed, install test passes, full CTest 8/8); CI template unexecuted | `src/Install/Installer.cpp`, `src/Main.cpp`, `tests/FullV1Tests.cpp`, [Void/Library build-vbs](https://git.faumaray.com/Void/Library/src/branch/build-vbs), docs |
| Future (Plan 20 Slice 3 / Tracks C, E3 editor extensions) |"}] Live `conan` CLI verification; macOS/Windows/cross-compile; binary-variant signing and key distribution; daemon-side dependency materialization and editor plugins; `Void::Net`/`Void::Sqlite` alignment | PLANNED (unimplemented) | [21-expansion-roadmap.md](../roadmap/21-expansion-roadmap.md), [20-future-translation-platforms.md](../roadmap/20-future-translation-platforms.md) |
+11
View File
@@ -1651,6 +1651,17 @@ vbs ide plugin --project <proj> --build-dir <build> --editor vscode --output <di
`Void::Build::dependency_option(name)` reads them; the native-subproject fixture now throws
unless it receives `SUB_MATH_ENABLED=yes` (**passed**, 4.16 s).
## WiX/MSI-Style Packaging (GCC 16.2, pin `0002e74`)
- `vbs install --archive FILE --archive-format wix` writes a WiX v3 source with deterministic
Product/Upgrade GUIDs, a directory per installed path segment, one Component/File per installed
file, and a Feature referencing `ProductComponents`.
- `python3 -c "xml.etree.ElementTree.parse(...)"` parses it: root `{...}Wix`, Product
`CliHiPkg 0.1.0`, and **4** `File` elements matching the installed files.
- `FullV1Tests.foreign_cmake_meson_providers_bridge_and_relocatable_install` asserts the Product,
Version, UpgradeCode, a `Source="bin/cli_hi"` File and the ComponentGroup (**passed**, 7.16 s).
- Full CTest: **8 / 8 passed** in 281.07 s.
## Limits and Unrun Checks
1. **HTTPS git fetch**: the host shell is proxy-restricted, but the Docker container could clone `https://git.faumaray.com/Void/VoidLibrary.git`; the pinned commit `3e254055e081a104f08df68dde39711bc7813518` was fetched directly for the verification above. A separate configure against the local `/home/faumaray/Projects/Library` checkout via `VBS_VOID_SOURCE_DIR` also succeeded (development-only override, checkout unmodified).
+1 -1
View File
@@ -52,7 +52,7 @@ Concrete work this implies:
| Languages | C, C++, CUDA, Fortran, ObjC, ASM, HIP… | C, C++, Rust, D, Fortran, Java… | C/C++ focused | C, C++ | ASM/CUDA/ObjC or a documented extension API |
| Toolchains | MSVC, clang-cl, GCC, Clang, Apple, many | GCC, Clang, MSVC, many | GCC, Clang, MSVC | GCC, Clang (Linux) | MinGW target; MSVC deferred |
| Package/registry | External (vcpkg, Conan, FetchContent) | wrapdb, subprojects | cppget.org / brep | **Built-in registry + solver + lock + binary variants + signatures + SBOM** | federation, mirrors, key distribution |
| Install/package | `install()`, `install(EXPORT)`, CPack (TGZ/ZIP/DEB/RPM/WIX/DMG/NuGet/APK…) | `install_data`, `install_headers`, dist scripts | install module | prefix staging, components, relocatable CMake + native exports, tar, self-extracting `sh`, **stored ZIP**, **DEB (dpkg-validated)**, SBOM, **Ed25519-signed archives with checksums** | **RPM (rpm 6.1-validated)**, MSI/DMG-style |
| Install/package | `install()`, `install(EXPORT)`, CPack (TGZ/ZIP/DEB/RPM/WIX/DMG/NuGet/APK…) | `install_data`, `install_headers`, dist scripts | install module | prefix staging, components, relocatable CMake + native exports, tar, self-extracting `sh`, **stored ZIP**, **DEB (dpkg-validated)**, SBOM, **Ed25519-signed archives with checksums** | **RPM (rpm 6.1-validated)**, **WiX source for MSI** (candle/light on Windows), DMG-style |
| IDE integration | File API, presets, every IDE | `meson-info` introspection | limited | `vbs ide generate/query`, CompDB, daemon protocol | File API shim, `CMakePresets.json` import, plugins |
| Test runner | CTest: fixtures, labels, resource locks, timeouts, JUnit/CDash | `meson test`: suites, timeouts, JUnit | test module | `VOID_TEST` runner; `vbs test --junit --test-timeout` | fixtures, labels, resource locks, CDash |
| Incremental / cache | compiler depfiles, ccache external | depfiles, ccache | internal caching model | **content-addressed state, immutable snapshots, remote action cache** | scale benchmarks |
+139 -18
View File
@@ -13,8 +13,8 @@
#include <algorithm>
#include <array>
#include <fstream>
#include <format>
#include <fstream>
#include <set>
#include <unistd.h>
@@ -192,8 +192,7 @@ void append_ar_member(std::string &out, std::string_view name, std::string_view
}
}
void append_ar_member_to_stream(std::ostream &out, std::string_view name,
std::string_view data) {
void append_ar_member_to_stream(std::ostream &out, std::string_view name, std::string_view data) {
out << ar_member_header(name, data.size());
out.write(data.data(), static_cast<std::streamsize>(data.size()));
if (data.size() % 2 != 0) {
@@ -214,9 +213,9 @@ append_ar_member_file(std::ostream &out, std::string_view name,
}
std::ifstream in{source, std::ios::binary};
if (!in) {
return std::unexpected{Void::System::make_system_error(
Void::System::SystemErrorCode::io_error,
std::format("cannot open '{}'", source.string()))};
return std::unexpected{
Void::System::make_system_error(Void::System::SystemErrorCode::io_error,
std::format("cannot open '{}'", source.string()))};
}
out << ar_member_header(name, size);
std::array<char, 64 * 1024> buffer{};
@@ -482,6 +481,123 @@ write_rpm_package(const std::filesystem::path &output, const InstallOptions &opt
return Platform::atomic_write_file(output, package, true);
}
std::string wix_guid_from(std::string_view seed) {
const std::string digest = Util::sha256_hex(seed);
std::string guid = digest.substr(0, 8) + "-" + digest.substr(8, 4) + "-4" +
digest.substr(13, 3) + "-a" + digest.substr(17, 3) + "-" +
digest.substr(20, 12);
std::ranges::transform(guid, guid.begin(), [](char c) {
return static_cast<char>(std::toupper(static_cast<unsigned char>(c)));
});
return guid;
}
std::string wix_id(std::string_view prefix, std::string_view text) {
std::string out{prefix};
for (const char c : text) {
out.push_back(std::isalnum(static_cast<unsigned char>(c)) != 0 ? c : '_');
}
return out;
}
std::string wix_xml_escape(std::string_view text) {
std::string out;
for (const char c : text) {
switch (c) {
case '&':
out += "&amp;";
break;
case '<':
out += "&lt;";
break;
case '>':
out += "&gt;";
break;
case '"':
out += "&quot;";
break;
default:
out.push_back(c);
break;
}
}
return out;
}
// WiX v3 source (the CPack WIX model): consumed by candle/light on Windows to produce an MSI.
Void::Result::Result<void, Void::Result::Error>
write_wix_source(const std::filesystem::path &output, const InstallOptions &options,
const std::vector<Package::ArchiveEntrySpec> &entries) {
const std::string product_guid = wix_guid_from("product:" + options.package_name);
const std::string upgrade_guid = wix_guid_from("upgrade:" + options.package_name);
const std::string manufacturer =
options.maintainer.empty() ? std::string{"Void"} : options.maintainer;
const std::string description =
options.package_description.empty() ? options.package_name : options.package_description;
std::map<std::string, std::vector<std::string>, std::less<>> files_by_dir;
for (const auto &entry : entries) {
const auto rel = std::filesystem::path{entry.archive_path};
files_by_dir[rel.parent_path().generic_string()].push_back(rel.filename().string());
}
std::string xml =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<Wix xmlns=\"http://schemas.microsoft.com/wix/2006/wi\">\n"
" <Product Id=\"" +
product_guid + "\" Name=\"" + wix_xml_escape(options.package_name) +
"\" Language=\"1033\" Version=\"" + wix_xml_escape(options.package_version) +
"\" Manufacturer=\"" + wix_xml_escape(manufacturer) + "\" UpgradeCode=\"" + upgrade_guid +
"\">\n"
" <Package InstallerVersion=\"200\" Compressed=\"yes\" "
"Platform=\"x64\" InstallScope=\"perMachine\" Description=\"" +
wix_xml_escape(description) +
"\"/>\n"
" <MajorUpgrade DowngradeErrorMessage=\"A newer version is installed.\"/>\n"
" <MediaTemplate EmbedCab=\"yes\"/>\n"
" <Directory Id=\"TARGETDIR\" Name=\"SourceDir\">\n"
" <Directory Id=\"ProgramFiles64Folder\">\n"
" <Directory Id=\"INSTALLDIR\" Name=\"" +
wix_xml_escape(options.package_name) + "\">\n";
for (const auto &[dir, files] : files_by_dir) {
if (dir.empty()) {
continue;
}
xml += " <Directory Id=\"" + wix_id("d_", dir) + "\" Name=\"" +
wix_xml_escape(std::filesystem::path{dir}.filename().string()) + "\">\n";
for (const auto &file : files) {
const std::string rel = dir + "/" + file;
xml += " <Component Id=\"" + wix_id("c_", rel) +
"\" Guid=\"*\">\n"
" <File Id=\"" +
wix_id("f_", rel) + "\" Source=\"" + wix_xml_escape(rel) +
"\" KeyPath=\"yes\"/>\n"
" </Component>\n";
}
xml += " </Directory>\n";
}
xml += " </Directory>\n"
" </Directory>\n"
" </Directory>\n"
" <Feature Id=\"DefaultFeature\" Title=\"" +
wix_xml_escape(options.package_name) +
"\" Level=\"1\" Display=\"expand\">\n"
" <ComponentGroupRef Id=\"ProductComponents\"/>\n"
" </Feature>\n"
" </Product>\n"
" <Fragment>\n"
" <ComponentGroup Id=\"ProductComponents\">\n";
for (const auto &entry : entries) {
xml += " <ComponentRef Id=\"" + wix_id("c_", entry.archive_path) + "\"/>\n";
}
xml += " </ComponentGroup>\n"
" </Fragment>\n"
"</Wix>\n";
return Platform::atomic_write_file(output, xml, true);
}
// Debian package: ar container with debian-binary, control.tar and data.tar (uncompressed).
Void::Result::Result<void, Void::Result::Error>
write_deb_package(const std::filesystem::path &output, const InstallOptions &options,
@@ -538,9 +654,9 @@ write_deb_package(const std::filesystem::path &output, const InstallOptions &opt
const auto temp_deb = output.parent_path() / (output.filename().string() + ".tmp");
std::ofstream deb{temp_deb, std::ios::binary | std::ios::trunc};
if (!deb) {
return std::unexpected{Void::System::make_system_error(
Void::System::SystemErrorCode::io_error,
std::format("cannot create '{}'", temp_deb.string()))};
return std::unexpected{
Void::System::make_system_error(Void::System::SystemErrorCode::io_error,
std::format("cannot create '{}'", temp_deb.string()))};
}
deb << "!<arch>\n";
append_ar_member_to_stream(deb, "debian-binary", "2.0\n");
@@ -553,9 +669,9 @@ write_deb_package(const std::filesystem::path &output, const InstallOptions &opt
deb.flush();
deb.close();
if (!deb) {
return std::unexpected{Void::System::make_system_error(
Void::System::SystemErrorCode::io_error,
std::format("failed writing '{}'", temp_deb.string()))};
return std::unexpected{
Void::System::make_system_error(Void::System::SystemErrorCode::io_error,
std::format("failed writing '{}'", temp_deb.string()))};
}
std::error_code rename_ec;
std::filesystem::rename(temp_deb, output, rename_ec);
@@ -921,6 +1037,11 @@ install_project(const Graph::ProjectDescription &description, const Graph::Build
!packed) {
return std::unexpected{packed.error()};
}
} else if (options.archive_format == "wix") {
if (auto packed = write_wix_source(*options.archive_path, options, archive_entries);
!packed) {
return std::unexpected{packed.error()};
}
} else {
const bool archive_as_script = options.archive_format == "sh";
const auto archive_target = archive_as_script
@@ -1000,10 +1121,10 @@ install_project(const Graph::ProjectDescription &description, const Graph::Build
}
const std::string canonical_message = installer_signing_message(report.archive_sha256);
auto signature = Provenance::sign_message(
std::as_bytes(std::span<const char>{canonical_message.data(),
canonical_message.size()}),
*options.signing_seed_path);
auto signature =
Provenance::sign_message(std::as_bytes(std::span<const char>{
canonical_message.data(), canonical_message.size()}),
*options.signing_seed_path);
if (!signature) {
return std::unexpected{signature.error()};
}
@@ -1023,8 +1144,8 @@ install_project(const Graph::ProjectDescription &description, const Graph::Build
!written) {
return std::unexpected{written.error()};
}
if (auto written = Platform::atomic_write_file(
options.archive_path->string() + ".msg", canonical_message, true);
if (auto written = Platform::atomic_write_file(options.archive_path->string() + ".msg",
canonical_message, true);
!written) {
return std::unexpected{written.error()};
}
+3 -3
View File
@@ -1913,9 +1913,9 @@ int execute_install_command(const InstallCmdOptions &opts) {
iopts.bundle_runtime_dependencies = opts.bundle_dependencies;
if (opts.archive_format_arg != "tar" && opts.archive_format_arg != "sh" &&
opts.archive_format_arg != "zip" && opts.archive_format_arg != "deb" &&
opts.archive_format_arg != "rpm") {
opts.archive_format_arg != "rpm" && opts.archive_format_arg != "wix") {
std::cerr << "vbs install: unsupported --archive-format '" << opts.archive_format_arg
<< "' (expected tar, sh, zip, deb or rpm)\n";
<< "' (expected tar, sh, zip, deb, rpm or wix)\n";
return 2;
}
if (opts.archive_arg && !opts.archive_arg->empty()) {
@@ -3109,7 +3109,7 @@ int main(int argc, char **argv) {
.option("--archive", "", "Write a deterministic installer archive of the prefix",
install_opts.archive_arg)
.option_default("--archive-format", "",
"Installer archive format: tar (default), sh, zip, deb or rpm",
"Installer archive format: tar (default), sh, zip, deb, rpm or wix",
install_opts.archive_format_arg, "tar")
.option("--signing-key", "",
"Ed25519 seed file; signs the archive and writes .sha256/.sig/.pub",
+25 -3
View File
@@ -1068,6 +1068,29 @@ void build(Void::Build::Project &p) {
Void::Testing::expect(sign_res.has_value() && !sign_res->succeeded());
}
// WiX source generator for MSI packaging on Windows.
const auto wix_source = tmp / "cli_hi.wxs";
auto wix_req = inst_req;
for (auto &arg : wix_req.arguments) {
if (arg == installer_archive.string()) {
arg = wix_source.string();
}
}
wix_req.arguments.push_back("--archive-format");
wix_req.arguments.push_back("wix");
auto wix_res = Platform::run_supervised(wix_req);
Void::Testing::expect(wix_res.has_value() && wix_res->succeeded());
auto wix_text = Void::FileSystem::read_file(wix_source);
Void::Testing::require(wix_text.has_value());
Void::Testing::expect(wix_text->starts_with("<?xml"));
Void::Testing::expect(wix_text->find("<Product Id=") != std::string::npos);
Void::Testing::expect(wix_text->find("Name=\"CliHiPkg\"") != std::string::npos);
Void::Testing::expect(wix_text->find("Version=\"0.1.0\"") != std::string::npos);
Void::Testing::expect(wix_text->find("UpgradeCode=") != std::string::npos);
Void::Testing::expect(wix_text->find("Source=\"bin/cli_hi\"") != std::string::npos);
Void::Testing::expect(wix_text->find("ComponentGroup Id=\"ProductComponents\"") !=
std::string::npos);
// RPM package generator: lead + header magic + newc cpio payload.
const auto rpm_archive = tmp / "cli_hi.rpm";
auto rpm_req = inst_req;
@@ -1161,9 +1184,8 @@ VOID_TEST(FullV1Tests, ide_plugin_assets_export_vscode_extension) {
auto clion_report = Editor::generate_ide_plugin_assets(clion_options);
Void::Testing::require(clion_report.has_value());
Void::Testing::expect_eq(clion_report->written_files.size(), std::size_t{4});
auto plugin_xml =
Void::FileSystem::read_file(clion_options.output_dir / "src" / "main" / "resources" /
"META-INF" / "plugin.xml");
auto plugin_xml = Void::FileSystem::read_file(clion_options.output_dir / "src" / "main" /
"resources" / "META-INF" / "plugin.xml");
Void::Testing::require(plugin_xml.has_value());
Void::Testing::expect(plugin_xml->find("<id>com.faumaray.vbs</id>") != std::string::npos);
Void::Testing::expect(std::filesystem::exists(clion_options.output_dir / "build.gradle.kts"));