diff --git a/build.Dockerfile b/build.Dockerfile index 2ffcae6..d4d6b46 100644 --- a/build.Dockerfile +++ b/build.Dockerfile @@ -1,24 +1,39 @@ # This Dockerfile produces a base image for builds. # It includes all dependencies necessary to cross-compile for Windows/MacOS/Linux. -FROM crazymax/osxcross:latest-ubuntu AS osxcross +FROM debian:bookworm AS osxcross +ADD --chmod=644 "https://apt.llvm.org/llvm-snapshot.gpg.key" /etc/apt/trusted.gpg.d/apt.llvm.org.asc +WORKDIR /build/osxcross +ADD "https://github.com/tpoechtrager/osxcross.git#47936a512273bb3b414b5a2e83043c92eabc7ae7" . +ADD "https://github.com/joseluisq/macosx-sdks/releases/download/14.5/MacOSX14.5.sdk.tar.xz" ./tarballs/MacOSX14.5.sdk.tar.xz +RUN apt-get update && \ + apt-get install -y ca-certificates +COPY llvm.sources /etc/apt/sources.list.d/llvm.sources +RUN apt-get update && \ + apt-get install -y bash bzip2 clang-20 git lld-20 llvm-20 make patch xz-utils && \ + ln -s $(which clang-20) /usr/bin/clang && \ + ln -s $(which clang++-20) /usr/bin/clang++ && \ + ln -s $(which ld64.lld-20) /usr/bin/ld64.lld && \ + SDK_VERSION=14.5 UNATTENDED=1 ENABLE_COMPILER_RT_INSTALL=1 TARGET_DIR=/osxcross ./build.sh -FROM rust:latest +FROM rust:1.89-bookworm +ADD --chmod=644 "https://apt.llvm.org/llvm-snapshot.gpg.key" /etc/apt/trusted.gpg.d/apt.llvm.org.asc +COPY llvm.sources /etc/apt/sources.list.d/llvm.sources RUN rustup target add x86_64-pc-windows-msvc && \ rustup target add x86_64-apple-darwin && \ rustup target add aarch64-apple-darwin && \ apt-get update && \ - apt-get install -y clang-19 lld-19 libc6-dev libasound2-dev libudev-dev genisoimage mingw-w64 && \ + apt-get install -y clang-20 lld-20 libc6-dev libasound2-dev libudev-dev genisoimage mingw-w64 && \ cargo install cargo-bundle xwin && \ xwin --accept-license splat --output xwin && \ rm -rf .xwin-cache && \ - ln -s $(which clang-19) /usr/bin/clang && \ - ln -s $(which clang++-19) /usr/bin/clang++ + ln -s $(which clang-20) /usr/bin/clang && \ + ln -s $(which clang++-20) /usr/bin/clang++ COPY --from=osxcross /osxcross /osxcross ENV PATH="/osxcross/bin:$PATH" \ LD_LIBRARY_PATH="/osxcross/lib" \ - CC="clang-19" CXX="clang++-19" AR="llvm-ar-19" \ + CC="clang-20" CXX="clang++-20" AR="llvm-ar-20" \ CC_x86_64-apple-darwin="o64-clang" \ CXX_x86_64-apple-darwin="o64-clang++" \ CC_aarch64-apple-darwin="oa64-clang" \ @@ -27,10 +42,10 @@ ENV PATH="/osxcross/bin:$PATH" \ CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS="-Clinker-plugin-lto -Clinker=clang -Clink-arg=-fuse-ld=lld" \ SHROOMS_CFLAGS_x86_64-pc-windows-msvc="-flto" \ CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_RUSTFLAGS="-Lnative=/xwin/crt/lib/x86_64 -Lnative=/xwin/sdk/lib/um/x86_64 -Lnative=/xwin/sdk/lib/ucrt/x86_64 -Clinker-plugin-lto -Clink-arg=-fuse-ld=lld" \ - CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_LINKER="lld-link-19" \ + CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_LINKER="lld-link-20" \ CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER="o64-clang" \ - CARGO_TARGET_X86_64_APPLE_DARWIN_AR="llvm-ar-19" \ + CARGO_TARGET_X86_64_APPLE_DARWIN_AR="llvm-ar-20" \ CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER="oa64-clang" \ - CARGO_TARGET_AARCH64_APPLE_DARWIN_AR="llvm-ar-19" \ - RC_PATH="llvm-rc-19" \ + CARGO_TARGET_AARCH64_APPLE_DARWIN_AR="llvm-ar-20" \ + RC_PATH="llvm-rc-20" \ MACOSX_DEPLOYMENT_TARGET="14.5" diff --git a/llvm.sources b/llvm.sources new file mode 100644 index 0000000..543f158 --- /dev/null +++ b/llvm.sources @@ -0,0 +1,4 @@ +Types: deb deb-src +URIs: http://apt.llvm.org/bookworm/ +Suites: llvm-toolchain-bookworm-20 +Components: main diff --git a/scripts/bundle.sh b/scripts/bundle.sh new file mode 100755 index 0000000..249b73a --- /dev/null +++ b/scripts/bundle.sh @@ -0,0 +1,4 @@ +set -e + +docker build --pull -f build.Dockerfile -t lemur-build . +MSYS_NO_PATHCONV=1 docker run -it --rm -v .:/app -w /app --entrypoint sh lemur-build /app/scripts/do-bundle.sh diff --git a/scripts/release.sh b/scripts/release.sh index 7e87b20..9fea101 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -24,8 +24,7 @@ if ! command -v docker 2>&1 >/dev/null; then exit 1 fi -docker build -f build.Dockerfile -t lemur-build . -MSYS_NO_PATHCONV=1 docker run -it --rm -v .:/app -w /app --entrypoint bash lemur-build /app/scripts/do-bundle.sh +./scripts/bundle.sh body=$(cat < for Application { .focused .as_ref() .and_then(|id| self.viewports.get_mut(id)) + && viewport.app.handle_gamepad_event(&event) { - if viewport.app.handle_gamepad_event(&event) { - return; - } + return; } self.controllers.handle_gamepad_event(&event); } @@ -289,10 +288,10 @@ impl ApplicationHandler for Application { fn exiting(&mut self, _event_loop: &ActiveEventLoop) { let (sender, receiver) = oneshot::channel(); - if self.client.send_command(EmulatorCommand::Exit(sender)) { - if let Err(error) = receiver.recv_timeout(Duration::from_secs(5)) { - error!(%error, "could not gracefully exit."); - } + if self.client.send_command(EmulatorCommand::Exit(sender)) + && let Err(error) = receiver.recv_timeout(Duration::from_secs(5)) + { + error!(%error, "could not gracefully exit."); } } } diff --git a/src/emulator.rs b/src/emulator.rs index d73b276..85ac5f1 100644 --- a/src/emulator.rs +++ b/src/emulator.rs @@ -455,11 +455,11 @@ impl Emulator { let Some(sim) = self.sims.get_mut(sim_id.to_index()) else { return true; }; - if let Some(text) = sim.take_stdout() { - if stdout.send(text).is_err() { - sim.watch_stdout(false); - return false; - } + if let Some(text) = sim.take_stdout() + && stdout.send(text).is_err() + { + sim.watch_stdout(false); + return false; } true }); diff --git a/src/memory.rs b/src/memory.rs index c2264e1..aa73d4f 100644 --- a/src/memory.rs +++ b/src/memory.rs @@ -169,7 +169,7 @@ impl MemoryRef<'_> { T::from_bytes(&self.inner[from..to]) } - pub fn range(&self, start: usize, count: usize) -> MemoryIter { + pub fn range(&self, start: usize, count: usize) -> MemoryIter<'_, T> { let from = start * size_of::(); let to = from + (count * size_of::()); MemoryIter::new(&self.inner[from..to]) diff --git a/src/window/game.rs b/src/window/game.rs index 51b6d24..c71abd0 100644 --- a/src/window/game.rs +++ b/src/window/game.rs @@ -457,7 +457,7 @@ impl GameWindow { self.config = new_config; } - fn button_for(&self, ctx: &Context, text: &str, command: Command) -> Button { + fn button_for(&self, ctx: &Context, text: &str, command: Command) -> Button<'_> { let button = Button::new(text); match self.shortcuts.shortcut_for(command) { Some(shortcut) => button.shortcut_text(ctx.format_shortcut(&shortcut)), diff --git a/src/window/hotkeys.rs b/src/window/hotkeys.rs index 5b8a835..8e650b6 100644 --- a/src/window/hotkeys.rs +++ b/src/window/hotkeys.rs @@ -62,8 +62,8 @@ impl HotkeysWindow { } }); }); - if let Some(command) = self.now_binding { - if let Some(shortcut) = ui.input_mut(|i| { + if let Some(command) = self.now_binding + && let Some(shortcut) = ui.input_mut(|i| { i.events.iter().find_map(|event| match event { Event::Key { key, @@ -73,10 +73,10 @@ impl HotkeysWindow { } => Some(KeyboardShortcut::new(*modifiers, *key)), _ => None, }) - }) { - self.shortcuts.set(command, shortcut); - self.now_binding = None; - } + }) + { + self.shortcuts.set(command, shortcut); + self.now_binding = None; } } diff --git a/src/window/utils.rs b/src/window/utils.rs index e33030e..d25e167 100644 --- a/src/window/utils.rs +++ b/src/window/utils.rs @@ -86,10 +86,10 @@ impl UiExt for Ui { let (rect, _) = ui.allocate_at_least(Vec2::new(100.0, 100.0), Sense::hover()); ui.painter().rect_filled(rect, 0.0, *color); let resp = ui.text_edit_singleline(hex); - if resp.changed() { - if let Ok(new_color) = HexColor::from_str_without_hash(hex) { - *color = new_color.color(); - } + if resp.changed() + && let Ok(new_color) = HexColor::from_str_without_hash(hex) + { + *color = new_color.color(); } resp },