From 6a0dc18655fe40dbd72b52439c9076cc99d4a61f Mon Sep 17 00:00:00 2001 From: bherbruck Date: Thu, 15 Oct 2026 20:34:03 +0000 Subject: [PATCH] Fix the Windows 32-bit and macOS release builds On 32-bit Windows SetWindowLongPtrW is SetWindowLongW, which takes and returns i32, so the window-procedure hook didn't compile for i686. The macOS app bundle now signs the bundled solidcraft-cli before the bundle itself; codesign refuses a bundle with an unsigned helper. Co-Authored-By: Claude Opus 5.5 (cherry picked from commit 94e76cd97e782af96261952b9ccfbb1b2aaa707e) --- apps/solidcraft/src/native_frame.rs | 8 +++++--- packaging/macos/package.sh | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/solidcraft/src/native_frame.rs b/apps/solidcraft/src/native_frame.rs index 9bac6d4e..d6fb5117 100644 --- a/apps/solidcraft/src/native_frame.rs +++ b/apps/solidcraft/src/native_frame.rs @@ -48,11 +48,13 @@ pub fn install(window: &impl HasWindowHandle) -> bool { // SAFETY: `hwnd` is the live window eframe just created on this thread; `frame_proc` has the // WNDPROC signature and stays valid for the life of the process. SetWindowLongPtrW returns // the previous procedure, which `frame_proc` calls for every other message. - let previous = unsafe { SetWindowLongPtrW(hwnd, GWLP_WNDPROC, frame_proc as *const () as isize) }; + let previous = unsafe { SetWindowLongPtrW(hwnd, GWLP_WNDPROC, frame_proc as *const () as isize as _) }; + // `as _`: on 32-bit Windows SetWindowLongPtrW is SetWindowLongW, which takes and + // returns i32. if previous == 0 { return false; } - PREVIOUS.store(previous, Ordering::SeqCst); + PREVIOUS.store(previous as _, Ordering::SeqCst); true } @@ -97,7 +99,7 @@ unsafe extern "system" fn frame_proc(hwnd: HWND, msg: u32, wparam: WPARAM, lpara // Hand the window back to winit's procedure for its last message. if prev.is_some() { // SAFETY: restores the procedure this window had before `install`. - unsafe { SetWindowLongPtrW(hwnd, GWLP_WNDPROC, PREVIOUS.load(Ordering::SeqCst)) }; + unsafe { SetWindowLongPtrW(hwnd, GWLP_WNDPROC, PREVIOUS.load(Ordering::SeqCst) as _) }; } call_previous() } diff --git a/packaging/macos/package.sh b/packaging/macos/package.sh index 06881f4e..08112bb9 100755 --- a/packaging/macos/package.sh +++ b/packaging/macos/package.sh @@ -73,7 +73,9 @@ copy_docs "$APP/Contents/Resources/Licenses" sed -e "s/@VERSION@/$VERSION/g" -e "s/@SHORT_VERSION@/$SHORT_VERSION/g" "$ROOT/assets/platforms/macos/Info.plist.in" >"$APP/Contents/Info.plist" plutil -lint "$APP/Contents/Info.plist" printf 'APPL????' >"$APP/Contents/PkgInfo" -# Ad-hoc signature over the whole bundle (Apple silicon refuses unsigned code). +# Ad-hoc signature over the whole bundle (Apple silicon refuses unsigned code). Nested code is +# signed first: the bundle signature refuses an unsigned helper in Contents/MacOS. +codesign --force --sign - --timestamp=none --identifier "$MACOS_BUNDLE_ID-cli" "$APP/Contents/MacOS/solidcraft-cli" codesign --force --sign - --timestamp=none "$APP" codesign --verify --strict --deep --verbose=2 "$APP" test -x "$APP/Contents/MacOS/solidcraft-cli" || { echo "solidcraft-cli is missing from $APP" >&2; exit 1; }