diff --git a/.changes/sidecar-runtime-rename.md b/.changes/sidecar-runtime-rename.md new file mode 100644 index 00000000000..97828c5bd67 --- /dev/null +++ b/.changes/sidecar-runtime-rename.md @@ -0,0 +1,6 @@ +--- +"tauri": patch +"tauri-bundler": patch +--- + +**Breaking change**: The sidecar's target triple suffix is now removed at build time. diff --git a/.changes/universal-apple-target-sidecar.md b/.changes/universal-apple-target-sidecar.md new file mode 100644 index 00000000000..13eb66b4345 --- /dev/null +++ b/.changes/universal-apple-target-sidecar.md @@ -0,0 +1,9 @@ +--- +"tauri-bundler": patch +"api": patch +--- + +When building Universal macOS Binaries through the virtual target `universal-apple-darwin`: + +- Expect a universal binary to be created by the user +- Ensure that binary is bundled and accessed correctly at runtime diff --git a/core/tauri/src/api/process/command.rs b/core/tauri/src/api/process/command.rs index 88ed5c4cc64..d81116aaf36 100644 --- a/core/tauri/src/api/process/command.rs +++ b/core/tauri/src/api/process/command.rs @@ -177,12 +177,7 @@ impl Command { /// A sidecar program is a embedded external binary in order to make your application work /// or to prevent users having to install additional dependencies (e.g. Node.js, Python, etc). pub fn new_sidecar>(program: S) -> crate::Result { - let program = format!( - "{}-{}", - program.into(), - platform::target_triple().expect("unsupported platform") - ); - Ok(Self::new(relative_command_path(program)?)) + Ok(Self::new(relative_command_path(program.into())?)) } /// Appends arguments to the command. diff --git a/tooling/bundler/src/bundle/settings.rs b/tooling/bundler/src/bundle/settings.rs index bb27bf3e829..2befbd83da6 100644 --- a/tooling/bundler/src/bundle/settings.rs +++ b/tooling/bundler/src/bundle/settings.rs @@ -287,12 +287,18 @@ pub struct BundleSettings { pub bin: Option>, /// External binaries to add to the bundle. /// - /// Note that each binary name will have the target platform's target triple appended, - /// so if you're bundling the `sqlite3` app, the bundler will look for e.g. - /// `sqlite3-x86_64-unknown-linux-gnu` on linux, + /// Note that each binary name should have the target platform's target triple appended, + /// as well as `.exe` for Windows. + /// For example, if you're bundling a sidecar called `sqlite3`, the bundler expects + /// a binary named `sqlite3-x86_64-unknown-linux-gnu` on linux, /// and `sqlite3-x86_64-pc-windows-gnu.exe` on windows. /// - /// The possible target triples can be seen by running `$ rustup target list`. + /// Run `tauri build --help` for more info on targets. + /// + /// If you are building a universal binary for MacOS, the bundler expects + /// your external binary to also be universal, and named after the target triple, + /// e.g. `sqlite3-universal-apple-darwin`. See + /// https://developer.apple.com/documentation/apple-silicon/building-a-universal-macos-binary pub external_bin: Option>, /// Debian-specific settings. pub deb: DebianSettings, @@ -617,7 +623,9 @@ impl Settings { let dest = path.join( src .file_name() - .expect("failed to extract external binary filename"), + .expect("failed to extract external binary filename") + .to_string_lossy() + .replace(&format!("-{}", self.target), ""), ); common::copy_file(&src, &dest)?; }