diff --git a/.github/workflows/windows7.yml b/.github/workflows/windows7.yml new file mode 100644 index 00000000..aeaa756c --- /dev/null +++ b/.github/workflows/windows7.yml @@ -0,0 +1,43 @@ +# Experimental, unsupported Windows 7 SP1 x64 portable build (docs/windows7.md). It runs by hand and +# weekly, so ordinary PRs never wait on it, and the weekly run shows when a dependency update starts +# importing a post-Windows-7 API. packaging/windows/windows7.ps1 does the work: it is the only build +# that uses the patched vendor/windows-link. A modern Windows runner proves compilation and host +# smoke tests only: run the checklist in docs/windows7.md on actual Windows 7 before claiming support. +name: Windows 7 x64 compatibility + +on: + schedule: + - cron: "23 5 * * 1" # weekly + workflow_dispatch: + +permissions: + contents: read + +env: + CARGO_TERM_COLOR: always + CARGO_INCREMENTAL: 0 + +jobs: + build: + runs-on: windows-2022 + timeout-minutes: 90 + steps: + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + - uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 + with: + arch: x64 + - uses: dtolnay/rust-toolchain@7e38f4b43b4db5c8dd498af069a4f6196df1d067 # master + with: + toolchain: nightly-2026-10-01 + components: rust-src + - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 + with: + key: windows7-x64 + - name: Build, check and test the portable package + shell: pwsh + run: ./packaging/windows/windows7.ps1 -Test + - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: vectorcraft-windows7-x64-portable + path: dist/release/vectorcraft-windows7-x64-portable.zip + if-no-files-found: error diff --git a/Cargo.lock b/Cargo.lock index 0052d34e..99bacbca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -952,6 +952,7 @@ dependencies = [ "egui-wgpu", "egui-winit", "egui_glow", + "glow", "glutin", "glutin-winit", "image", diff --git a/NOTICE b/NOTICE index 77776d1d..73e64928 100644 --- a/NOTICE +++ b/NOTICE @@ -30,6 +30,11 @@ based in part on the work of the Independent JPEG Group. WebAssembly plug-ins run in the wasmi interpreter (MIT OR Apache-2.0); its wasmparser dependency is under the Apache License 2.0 with the LLVM exception. +The experimental Windows 7 build (packaging/windows/windows7.ps1) compiles a modified copy of the +windows-link crate 0.2.1 (vendor/windows-link; Microsoft, MIT OR Apache-2.0) that binds CoTaskMemFree +through ole32.dll. Its license texts are in vendor/windows-link and ship in that build's ZIP; every +other build uses the unmodified crate from crates.io. + Builds made with craft-fonts (the CRAFT_FONTS_DIR build option; all official releases) embed the fonts listed in https://github.com/storytold/craft-fonts/blob/main/ATTRIBUTION.md (BIZ UDPGothic, Shippori Mincho, BIZ UDMincho, Noto Sans CJK SC and Noto Sans Arabic in the current manifest; diff --git a/README.md b/README.md index b7e4a6c3..e9f52f61 100644 --- a/README.md +++ b/README.md @@ -176,6 +176,8 @@ claude mcp add vectorcraft -- /path/to/vectorcraft-cli mcp The details are in [`docs/mcp.md`](docs/mcp.md) and [`docs/control-protocol.md`](docs/control-protocol.md). +For the experimental, unsupported 64-bit Windows 7 build, see [Windows 7 instructions](docs/windows7.md). + ## Status VectorCraft is under active development. [**ROADMAP.md**](ROADMAP.md) covers what ships today, the diff --git a/ROADMAP.md b/ROADMAP.md index 73cd7a55..ea1f6122 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -42,7 +42,7 @@ since 2026-10-01. | **Bundled content:** brush, symbol, style and swatch libraries | ~30% | Ours are original and generated in code, and far fewer than Illustrator ships; brush and symbol libraries are still missing | | **Performance** | unverified | Multithreaded, off-thread rendering and caches are in place. The last budget run (2026-10-01, loaded machine) measured 290 ms for a 50k-path fit against a 16 ms budget. Re-run `vectorcraft-cli perf` on an idle machine | | **Robustness** | good, new | ~2,840 tests, property tests, no panics in shipped code (lints, the `guard` safety net, import fuzzing), Data Recovery. Missing: a corpus of real-world files, Windows/Linux/browser QA | -| **Platforms and 1.0 polish** | ~60% | The macOS app and the web build work, and Finder opens every readable format with the macOS app (#295, #354); hybrid-graphics laptops render on the power-saving GPU by default (#306); web drops land in the document they were dropped on (#359); Windows/Linux packaging and accessibility are pending | +| **Platforms and 1.0 polish** | ~60% | The macOS app and the web build work, and Finder opens every readable format with the macOS app (#295, #354); hybrid-graphics laptops render on the power-saving GPU by default (#306); web drops land in the document they were dropped on (#359); Windows/Linux packaging and accessibility are pending; an experimental, unsupported Windows 7 x64 OpenGL build exists (community-contributed, not verified by maintainers) | | **Agent automation** | beyond Illustrator | Every command, gesture and dialog is drivable over MCP, the CLI and the control channel | ### Where we're lacking (in priority order) @@ -169,7 +169,7 @@ grade by behaviour against `plan/illustrator/`, not by whether a menu item exist | M11 | Artboards & views (artboard panel/tool, Trim View, middle-button pan, print tiling and the status bar's artboard navigator done; multiple windows, presentation polish) | 🟡 | 15–25 | | M12 | Advanced color & art (CMYK/ICC, separations, Gradient Mesh, Live Paint, Image Trace, Graphs) | 🟡 Gradient Mesh, Live Paint, Image Trace (12 presets, 18 ms/1k² image), Recolor Artwork, colour management (ICC, soft proofing, separations preview), Graphs (all 9 tools, Graph Data/Type, regenerate in place) done; graph Design/Column/Marker designs pending | 6–10 | | M13 | Automation (Actions ✅ record/playback, persisted; variables, scripting, batch) | 🟡 | 18–27 | -| M14 | 1.0 polish (preferences, shortcut editor, workspaces, accessibility, packaging for all OSes) | 🟡 Preferences, shortcut editor (chords with Shift and a punctuation key fire as typed), workspaces, a custom title bar on Windows/Linux with a Home button, content-sized dialogs and menus that scroll when longer than the window done; accessibility, Windows/Linux packaging pending | 18–28 | +| M14 | 1.0 polish (preferences, shortcut editor, workspaces, accessibility, packaging for all OSes) | 🟡 Preferences, shortcut editor (chords with Shift and a punctuation key fire as typed), workspaces, a custom title bar on Windows/Linux with a Home button, content-sized dialogs and menus that scroll when longer than the window done; an experimental, unsupported Windows 7 x64 portable OpenGL build (not verified by maintainers); accessibility and broader Windows/Linux packaging/QA pending | 18–28 | | — | Interaction fidelity pass (every tool's modifiers, Properties panel per context, isolation, nuance) | ⬜ | 60–90 | | — | Hardening at scale (big-file corpus, fuzzing, cross-platform + browser QA) | 🟡 | 50–80 | | | **Total to full parity** (one agent; re-derived from the [Parity estimate](#parity-estimate) table) | | **~320–500** | diff --git a/apps/vectorcraft/Cargo.toml b/apps/vectorcraft/Cargo.toml index 1ff93988..556525ff 100644 --- a/apps/vectorcraft/Cargo.toml +++ b/apps/vectorcraft/Cargo.toml @@ -9,10 +9,17 @@ default-run = "vectorcraft" [lints] workspace = true +[features] +default = ["wgpu", "accessibility"] +wgpu = ["eframe/wgpu"] +accessibility = ["eframe/accesskit"] +# Build with --no-default-features --features windows7 and the win7 Rust target. +windows7 = ["eframe/glow"] + [dependencies] vectorcraft-engine = { workspace = true } vectorcraft-ui-egui = { workspace = true } -eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit", "wayland", "x11"] } +eframe = { workspace = true, features = ["default_fonts", "wayland", "x11"] } egui = { workspace = true } serde_json = { workspace = true } log = { workspace = true } diff --git a/apps/vectorcraft/src/main.rs b/apps/vectorcraft/src/main.rs index 6d4d26cc..3292b693 100644 --- a/apps/vectorcraft/src/main.rs +++ b/apps/vectorcraft/src/main.rs @@ -7,6 +7,13 @@ //! See `vectorcraft_ui_egui::control` for the methods. #![cfg_attr(all(target_os = "windows", not(debug_assertions)), windows_subsystem = "windows")] +#[cfg(all(feature = "windows7", any(feature = "wgpu", feature = "accessibility")))] +compile_error!("windows7 requires --no-default-features (wgpu and accessibility must be disabled)"); +#[cfg(all(windows, feature = "windows7", not(target_vendor = "win7")))] +compile_error!("windows7 requires --target x86_64-win7-windows-msvc; the ordinary Windows target still imports newer APIs"); +#[cfg(all(target_vendor = "win7", not(feature = "windows7")))] +compile_error!("the win7 target requires --no-default-features --features windows7"); + mod clipboard; mod control_server; #[cfg(target_os = "macos")] @@ -50,9 +57,14 @@ impl eframe::App for App { discard_marked_text(); } } + #[cfg(not(feature = "windows7"))] fn on_exit(&mut self) { save_prefs(&self.0); } + #[cfg(feature = "windows7")] + fn on_exit(&mut self, _gl: Option<&eframe::glow::Context>) { + save_prefs(&self.0); + } } /// Open files handed to the app (command line, macOS Finder and Dock) as documents. A file that @@ -262,6 +274,7 @@ fn app_icon() -> egui::IconData { /// integrated GPU of a hybrid-graphics laptop does easily, while presenting frames rendered on the /// discrete GPU through the integrated one made the window flicker on some laptops. With a single /// GPU both preferences pick it. +#[cfg(feature = "wgpu")] fn power_preference(pref: Option<&str>, env: Option) -> eframe::wgpu::PowerPreference { use eframe::wgpu::PowerPreference; match (env, pref) { @@ -272,6 +285,7 @@ fn power_preference(pref: Option<&str>, env: Option String { format!("{} ({:?}, {:?})", info.name.trim(), info.backend, info.device_type) } @@ -297,9 +311,11 @@ fn main() -> eframe::Result { } let saved = read_prefs(); let saved_window = saved.as_ref().and_then(|ui| ui.window); + #[cfg(feature = "wgpu")] let gpu_pref = saved.as_ref().and_then(|ui| ui.engine_prefs.get("gpuPreference")).and_then(serde_json::Value::as_str); + #[cfg(feature = "wgpu")] let power = power_preference(gpu_pref, eframe::wgpu::PowerPreference::from_env()); - let mut options = eframe::NativeOptions { + let options = eframe::NativeOptions { viewport: egui::ViewportBuilder::default() .with_title("VectorCraft") .with_inner_size(window::DEFAULT_SIZE) @@ -311,11 +327,18 @@ fn main() -> eframe::Result { .with_title_shown(false) .with_icon(app_icon()) .with_app_id("ai.storyteller.vectorcraft"), + #[cfg(feature = "windows7")] + renderer: eframe::Renderer::Glow, ..Default::default() }; - if let eframe::egui_wgpu::WgpuSetup::CreateNew(create) = &mut options.wgpu_options.wgpu_setup { - create.power_preference = power; - } + #[cfg(feature = "wgpu")] + let options = { + let mut options = options; + if let eframe::egui_wgpu::WgpuSetup::CreateNew(create) = &mut options.wgpu_options.wgpu_setup { + create.power_preference = power; + } + options + }; // Files opened from Finder and the Dock arrive as events, not arguments. #[cfg(target_os = "macos")] open_documents::install(); @@ -340,11 +363,16 @@ fn main() -> eframe::Result { let recovery = prefs_path().and_then(|p| Some(p.parent()?.join("Data Recovery").to_string_lossy().to_string())); app.session.recovery.set_default_folder(recovery); } + #[cfg(feature = "wgpu")] if let Some(rs) = &cc.wgpu_render_state { let summary = adapter_summary(&rs.adapter.get_info()); log::info!("vectorcraft: rendering with {summary} (power preference {power:?})"); app.graphics_adapter = Some(summary); } + #[cfg(feature = "windows7")] + { + app.graphics_adapter = Some("OpenGL (Windows 7 compatibility)".into()); + } app.integrated_titlebar = cfg!(target_os = "macos"); app.custom_titlebar = CUSTOM_TITLEBAR; if let Some(port) = control_port { @@ -363,7 +391,7 @@ fn main() -> eframe::Result { ) } -#[cfg(test)] +#[cfg(all(test, feature = "wgpu"))] mod tests { use super::*; use eframe::wgpu::PowerPreference; diff --git a/apps/vectorcraft/src/printing.rs b/apps/vectorcraft/src/printing.rs index 5566e905..005a5f64 100644 --- a/apps/vectorcraft/src/printing.rs +++ b/apps/vectorcraft/src/printing.rs @@ -156,6 +156,9 @@ mod system { } pub fn printers() -> Vec { + #[cfg(feature = "windows7")] + let script = "Get-WmiObject Win32_Printer | ForEach-Object { \"$($_.Default)`t$($_.Name)\" }"; + #[cfg(not(feature = "windows7"))] let script = "Get-CimInstance Win32_Printer | ForEach-Object { \"$($_.Default)`t$($_.Name)\" }"; output(&mut powershell(script)).map(|t| windows_printers(&t)).unwrap_or_default() } @@ -174,7 +177,19 @@ mod system { } pub fn setup(_printer: Option<&str>) -> Result<(), String> { - Command::new("explorer").arg("ms-settings:printers").spawn().map(|_| ()).map_err(|e| e.to_string()) + #[cfg(feature = "windows7")] + let mut command = { + let mut command = Command::new("control.exe"); + command.arg("printers"); + command + }; + #[cfg(not(feature = "windows7"))] + let mut command = { + let mut command = Command::new("explorer"); + command.arg("ms-settings:printers"); + command + }; + command.spawn().map(|_| ()).map_err(|e| e.to_string()) } } diff --git a/docs/windows7.md b/docs/windows7.md new file mode 100644 index 00000000..52fa0ece --- /dev/null +++ b/docs/windows7.md @@ -0,0 +1,82 @@ +# Windows 7 x64 compatibility build (experimental, unsupported) + +Windows 7 is not a supported platform. This build is experimental and community-maintained, +and the VectorCraft maintainers have not verified it on Windows 7. + +This separate build targets **64-bit Windows 7 SP1**. It uses OpenGL instead of wgpu, +and omits the native AccessKit accessibility adapter. Printer discovery supports the +PowerShell version included with Windows 7, and printer setup opens Control Panel. +The normal desktop and web builds retain their existing defaults. A vendor graphics driver providing **OpenGL 3.3 or newer** +is required; the Windows built-in generic display driver is insufficient. GPU selection +in Preferences and `WGPU_POWER_PREF` do not control this OpenGL build. + +## Build or download + +In your GitHub fork, open **Actions → Windows 7 x64 compatibility → Run workflow** (it +also runs weekly, never on pull requests). +When it succeeds, download the `vectorcraft-windows7-x64-portable` artifact, extract the +contained portable ZIP, then run `vectorcraft.exe` on Windows 7. The CLI is included. +No MSI is provided: the existing installer remains for modern Windows. + +To build locally, use a **Windows 10/11 build computer**, with Rust/rustup and Visual Studio +2022 C++ build tools (x64 compiler and Windows SDK). Open an **x64 Native Tools Command +Prompt for VS 2022**, change to your clone's repository root (the directory containing +`Cargo.toml`), and run: + +```powershell +powershell -ExecutionPolicy Bypass -File packaging/windows/windows7.ps1 +``` + +Add `-Test` to also run the app and CLI tests on the build computer. + +Output: `dist/release/vectorcraft-windows7-x64-portable.zip`. The script installs the pinned +nightly compiler and `rust-src`, rebuilds the standard library for +`x86_64-win7-windows-msvc`, and links the C runtime statically. It never installs Rust on +the Windows 7 machine. The optional `CRAFT_FONTS_DIR` setting works as in the normal build. +Without it, install fonts for the languages you need on the destination machine. + +The Windows 7 target matters: modern Rust's ordinary `x86_64-pc-windows-msvc` target +requires Windows 10, including standard-library and random-number APIs. Selecting OpenGL +alone or changing an installer version check cannot fix that. + +References: [Rust's Windows 7 target](https://doc.rust-lang.org/rustc/platform-support/win7-windows-msvc.html) +and [Windows baseline change](https://blog.rust-lang.org/2024/02/26/Windows-7/). + +The packaging script checks x64 PE headers, the subsystem version, and known incompatible +imports (including `GetSystemTimePreciseAsFileTime`) before creating the ZIP. This is a +regression check, not an exhaustive audit of every Windows API. + +The small vendored `windows-link` patch routes `CoTaskMemFree` to its documented +`ole32.dll` export on the Windows 7 target; the newer binding otherwise imports +`combase.dll`, which is absent on Windows 7. Only this script uses it: it passes +`--config "patch.crates-io.windows-link.path='vendor/windows-link'"` to Cargo, so every other +build, including the normal Windows one, keeps the checksum-verified crates.io crate. Cargo +records the patch in `Cargo.lock`, so the script resolves once, fails if anything other than +windows-link's source changed, builds with `--locked`, and then restores `Cargo.lock`. + +## Runtime validation + +The contributor reports that a user ran the portable x64 compatibility build on Windows 7 SP1 +with an NVIDIA graphics card. Their original build failed at startup with +`GetSystemTimePreciseAsFileTime` missing from `kernel32.dll`; the compatibility +build resolved that failure. The tested build was based on upstream commit +`1f7873273b67007b0aefc63313e0d34a39f45453`. The exact GPU/driver version and completion +of every checklist item below were not recorded, and the maintainers have not reproduced it, +so the build remains experimental and unsupported. + +## Runtime acceptance checklist + +A successful build on the Windows 2022 CI runner does **not** prove Windows 7 runtime +compatibility. Before declaring support, test on a Windows 7 SP1 x64 machine and record +its GPU, driver version, Windows updates and any missing-DLL/entry-point error: + +- Start `vectorcraft.exe`; verify a visible canvas, resizing, minimize/restore and exit. +- Draw a shape, save a `.vectorcraft` document, close and reopen it. +- Open `examples/dusk-poster.vectorcraft`; export PNG and PDF and inspect both. +- Exercise native Open/Save dialogs, clipboard text/images and drag-and-drop. +- Change a preference, exit and verify it survives restarting. +- Run `vectorcraft-cli.exe --version` and a headless export from a Command Prompt in the + extracted application folder. + +This build is experimental until that checklist passes. New dependency versions can add +newer Windows imports, so retain Cargo.lock and repeat runtime QA after dependency updates. diff --git a/packaging/windows/windows7.ps1 b/packaging/windows/windows7.ps1 new file mode 100644 index 00000000..cab9db70 --- /dev/null +++ b/packaging/windows/windows7.ps1 @@ -0,0 +1,91 @@ +<# Experimental, unsupported Windows 7 SP1 x64 build (docs/windows7.md). + Build on Windows 10/11 with the VS 2022 x64 C++ tools and Windows SDK. + From the repository root: powershell -File packaging/windows/windows7.ps1 [-Test] + The resulting portable ZIP targets Windows 7 SP1 x64 with an OpenGL 3.3 driver. + The compiler runs on the build host, not on Windows 7. -Test also runs the app and CLI tests + on the build host. #> +param([string] $Toolchain = 'nightly-2026-10-01', [switch] $Test) +$ErrorActionPreference = 'Stop' +$Root = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path +$Target = 'x86_64-win7-windows-msvc' +function Invoke-Checked([scriptblock] $Command) { + & $Command + if ($LASTEXITCODE -ne 0) { throw "Command failed with exit code $LASTEXITCODE" } +} +# Cargo.lock without windows-link's registry source and checksum lines (and with LF line endings), +# so the lock files with and without the patch below compare equal. +function Get-LockWithoutWindowsLinkSource([string] $Text) { + ($Text -replace "`r`n", "`n") -replace '(?m)^(name = "windows-link"\nversion = "[^"]*"\n)source = "[^"]*"\nchecksum = "[^"]*"\n', '$1' +} +Push-Location $Root +$FlagName = 'CARGO_TARGET_X86_64_WIN7_WINDOWS_MSVC_RUSTFLAGS' +$OldFlags = [Environment]::GetEnvironmentVariable($FlagName) +$OldWinres = $env:VECTORCRAFT_REQUIRE_WINRES +$Lock = Join-Path $Root 'Cargo.lock' +$LockBytes = [IO.File]::ReadAllBytes($Lock) +try { + Invoke-Checked { rustup toolchain install $Toolchain --profile minimal --component rust-src } + # windows-sys imports CoTaskMemFree from combase.dll, which Windows 7 lacks. Only this build uses + # the patched copy in vendor/windows-link (see its VECTORCRAFT-PATCH.md); every other build keeps + # the crates.io crate. Cargo records the patch in Cargo.lock, so resolve once, check that nothing + # but windows-link's source moved, then build --locked. The finally block restores Cargo.lock. + $Patch = @('--config', "patch.crates-io.windows-link.path='vendor/windows-link'") + Invoke-Checked { cargo "+$Toolchain" metadata --format-version 1 @Patch | Out-Null } + $Before = Get-LockWithoutWindowsLinkSource ([Text.Encoding]::UTF8.GetString($LockBytes)) + $After = Get-LockWithoutWindowsLinkSource ([IO.File]::ReadAllText($Lock)) + if ($Before -cne $After) { throw 'Cargo.lock is out of date: applying the windows-link patch changed other entries' } + $CargoArgs = @('--locked') + $Patch + @('--target', $Target, '--no-default-features', '--features', 'vectorcraft/windows7') + $Tree = cargo "+$Toolchain" tree @CargoArgs -p vectorcraft -e normal --prefix none + if ($LASTEXITCODE -ne 0) { throw 'dependency inspection failed' } + if ($Tree -match '^(wgpu|wgpu-core|wgpu-hal|accesskit_windows) v') { throw 'unsupported Windows backend in compatibility build' } + if (-not ($Tree -match '^windows-link v[^ ]+ \(.*vendor[\\/]windows-link\)')) { throw 'the patched windows-link is not in use' } + # The ordinary pc-windows-msvc standard library requires Windows 10. Rebuild std for win7. + [Environment]::SetEnvironmentVariable($FlagName, '-C target-feature=+crt-static') + $env:VECTORCRAFT_REQUIRE_WINRES = '1' + $CargoArgs += @('-p', 'vectorcraft', '-p', 'vectorcraft-cli') + Invoke-Checked { cargo "+$Toolchain" build -Z build-std=std,panic_unwind @CargoArgs --release } + $TargetDir = if ($env:CARGO_TARGET_DIR) { $env:CARGO_TARGET_DIR } else { 'target' } + $Bin = Join-Path $TargetDir "$Target\release" + foreach ($Name in 'vectorcraft.exe', 'vectorcraft-cli.exe') { + $Exe = Join-Path $Bin $Name + $Bytes = [IO.File]::ReadAllBytes($Exe) + $Pe = [BitConverter]::ToInt32($Bytes, 0x3c) + if ([BitConverter]::ToUInt16($Bytes, $Pe + 4) -ne 0x8664) { throw "$Name is not x64" } + $Major = [BitConverter]::ToUInt16($Bytes, $Pe + 0x48) + $Minor = [BitConverter]::ToUInt16($Bytes, $Pe + 0x4a) + if ($Major -gt 6 -or ($Major -eq 6 -and $Minor -gt 1)) { throw "$Name requires subsystem $Major.$Minor" } + $Imports = & dumpbin /nologo /imports $Exe + if ($LASTEXITCODE -ne 0) { throw "Could not inspect $Name imports" } + # Regression gate for known loader failures; actual Win7 runtime QA remains necessary. + if ($Imports -match '(?i)\b(GetSystemTimePreciseAsFileTime|ProcessPrng|WaitOnAddress|WakeByAddressSingle|WakeByAddressAll)\b|combase\.dll|bcryptprimitives\.dll|d3d12\.dll|api-ms-win-core-path-') { + throw "$Name directly imports a known post-Windows-7 API" + } + } + Invoke-Checked { & (Join-Path $Bin 'vectorcraft-cli.exe') --version } + $Stage = Join-Path $TargetDir ('windows7-portable-' + [Guid]::NewGuid().ToString('N')) + New-Item -ItemType Directory -Force $Stage | Out-Null + Copy-Item (Join-Path $Bin 'vectorcraft.exe'), (Join-Path $Bin 'vectorcraft-cli.exe') $Stage + Copy-Item LICENSE-MIT, LICENSE-APACHE, NOTICE $Stage + Copy-Item vendor/windows-link/license-mit (Join-Path $Stage 'LICENSE-windows-link-MIT') + Copy-Item vendor/windows-link/license-apache-2.0 (Join-Path $Stage 'LICENSE-windows-link-Apache-2.0') + Copy-Item docs/windows7.md (Join-Path $Stage 'WINDOWS7.md') + if ($env:CRAFT_FONTS_DIR) { + foreach ($ofl in Get-ChildItem (Join-Path $env:CRAFT_FONTS_DIR 'fonts\*\OFL.txt')) { + Copy-Item $ofl.FullName (Join-Path $Stage "OFL-$($ofl.Directory.Name).txt") + } + } + New-Item -ItemType Directory -Force dist/release | Out-Null + $Zip = Join-Path $Root 'dist/release/vectorcraft-windows7-x64-portable.zip' + Compress-Archive -Path (Join-Path $Stage '*') -DestinationPath $Zip -Force + Remove-Item -Recurse -Force $Stage + Get-Item $Zip + if ($Test) { + # Exercises the Windows code paths on the build host only; it doesn't prove Windows 7 runtime support. + Invoke-Checked { cargo "+$Toolchain" test -Z build-std=std,panic_unwind,test @CargoArgs } + } +} finally { + [IO.File]::WriteAllBytes($Lock, $LockBytes) + [Environment]::SetEnvironmentVariable($FlagName, $OldFlags) + $env:VECTORCRAFT_REQUIRE_WINRES = $OldWinres + Pop-Location +} diff --git a/vendor/windows-link/Cargo.toml b/vendor/windows-link/Cargo.toml new file mode 100644 index 00000000..6b29fd6b --- /dev/null +++ b/vendor/windows-link/Cargo.toml @@ -0,0 +1,39 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g., crates.io) dependencies. +# +# If you are reading this file be aware that the original Cargo.toml +# will likely look very different (and much more reasonable). +# See Cargo.toml.orig for the original contents. + +[package] +edition = "2021" +rust-version = "1.71" +name = "windows-link" +version = "0.2.1" +build = false +autolib = false +autobins = false +autoexamples = false +autotests = false +autobenches = false +description = "Linking for Windows" +readme = "readme.md" +categories = ["os::windows-apis"] +license = "MIT OR Apache-2.0" +repository = "https://github.com/microsoft/windows-rs" + +[lib] +name = "windows_link" +path = "src/lib.rs" + +[lints.rust] +missing_unsafe_on_extern = "warn" + +[lints.rust.unexpected_cfgs] +level = "warn" +priority = 0 +check-cfg = ["cfg(windows_raw_dylib, windows_slim_errors)"] diff --git a/vendor/windows-link/VECTORCRAFT-PATCH.md b/vendor/windows-link/VECTORCRAFT-PATCH.md new file mode 100644 index 00000000..e6fcaece --- /dev/null +++ b/vendor/windows-link/VECTORCRAFT-PATCH.md @@ -0,0 +1,21 @@ +# Windows 7 x64 import compatibility + +Upstream: Microsoft windows-link 0.2.1, from crates.io, MIT OR Apache-2.0. +Source: https://crates.io/crates/windows-link/0.2.1 +The original license texts are retained here. + +Only the non-x86 win7-target macro differs: CoTaskMemFree is imported from +ole32.dll rather than combase.dll. windows-sys 0.61.2 otherwise causes native +file dialogs to introduce a DLL absent on Windows 7. Ordinary targets retain +upstream behavior. This is a binding correction, not a replacement allocator. + +Microsoft documents Ole32.dll and Windows 2000 as the API's minimum: +https://learn.microsoft.com/en-us/windows/win32/api/combaseapi/nf-combaseapi-cotaskmemfree + +Only the experimental Windows 7 build uses this copy: packaging/windows/windows7.ps1 +passes `--config "patch.crates-io.windows-link.path='vendor/windows-link'"`. The +workspace has no [patch], so every other build uses the crates.io crate, verified +by the checksum in Cargo.lock. + +The Windows 7 packaging check rejects combase.dll to guard this fix. Remove this +patch when upstream bindings provide the same compatibility and recheck imports. diff --git a/vendor/windows-link/license-apache-2.0 b/vendor/windows-link/license-apache-2.0 new file mode 100644 index 00000000..b5ed4ece --- /dev/null +++ b/vendor/windows-link/license-apache-2.0 @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright (c) Microsoft Corporation. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/windows-link/license-mit b/vendor/windows-link/license-mit new file mode 100644 index 00000000..9e841e7a --- /dev/null +++ b/vendor/windows-link/license-mit @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/vendor/windows-link/readme.md b/vendor/windows-link/readme.md new file mode 100644 index 00000000..f6c343f6 --- /dev/null +++ b/vendor/windows-link/readme.md @@ -0,0 +1,26 @@ +## Linking for Windows + +The [windows-link](https://crates.io/crates/windows-link) crate provides the `link` macro that simplifies linking. The `link` macro is much the same as the one provided by [windows-targets](https://crates.io/crates/windows-targets) but uses `raw-dylib` and thus does not require import lib files. + +* [Getting started](https://kennykerr.ca/rust-getting-started/) +* [Samples](https://github.com/microsoft/windows-rs/tree/master/crates/samples) +* [Releases](https://github.com/microsoft/windows-rs/releases) + +Start by adding the following to your Cargo.toml file: + +```toml +[dependencies.windows-link] +version = "0.2" +``` + +Use the `link` macro to define the external functions you wish to call: + +```rust +windows_link::link!("kernel32.dll" "system" fn SetLastError(code: u32)); +windows_link::link!("kernel32.dll" "system" fn GetLastError() -> u32); + +unsafe { + SetLastError(1234); + assert_eq!(GetLastError(), 1234); +} +``` diff --git a/vendor/windows-link/src/lib.rs b/vendor/windows-link/src/lib.rs new file mode 100644 index 00000000..d4ee9876 --- /dev/null +++ b/vendor/windows-link/src/lib.rs @@ -0,0 +1,57 @@ +#![doc = include_str!("../readme.md")] +#![no_std] + +/// Defines an external function to import. +#[cfg(all(windows, target_arch = "x86"))] +#[macro_export] +macro_rules! link { + ($library:literal $abi:literal $($link_name:literal)? fn $($function:tt)*) => ( + #[link(name = $library, kind = "raw-dylib", modifiers = "+verbatim", import_name_type = "undecorated")] + extern $abi { + $(#[link_name=$link_name])? + pub fn $($function)*; + } + ) +} + +/// Defines an external function to import. +#[cfg(all(windows, not(target_arch = "x86"), not(target_vendor = "win7")))] +#[macro_export] +macro_rules! link { + ($library:literal $abi:literal $($link_name:literal)? fn $($function:tt)*) => ( + #[link(name = $library, kind = "raw-dylib", modifiers = "+verbatim")] + extern $abi { + $(#[link_name=$link_name])? + pub fn $($function)*; + } + ) +} + +/// Defines an external function to import. +#[cfg(not(windows))] +#[macro_export] +macro_rules! link { + ($library:literal $abi:literal $($link_name:literal)? fn $($function:tt)*) => ( + extern $abi { + pub fn $($function)*; + } + ) +} + +// VectorCraft compatibility patch: windows-sys 0.61.2 binds CoTaskMemFree to +// combase.dll (Windows 8+). The same API is exported by ole32.dll on Windows 7. +// Redirect only this known API; leave every other binding unchanged. +#[cfg(all(windows, not(target_arch = "x86"), target_vendor = "win7"))] +#[macro_export] +macro_rules! link { + ("combase.dll" $abi:literal fn CoTaskMemFree $($signature:tt)*) => ( + $crate::link!("ole32.dll" $abi fn CoTaskMemFree $($signature)*); + ); + ($library:literal $abi:literal $($link_name:literal)? fn $($function:tt)*) => ( + #[link(name = $library, kind = "raw-dylib", modifiers = "+verbatim")] + extern $abi { + $(#[link_name=$link_name])? + pub fn $($function)*; + } + ) +}