Skip to content

Commit 3035e45

Browse files
betamoslucasfernog
andauthored
Remove target triple from sidecar bin paths, closes #3355 (#3356)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
1 parent 5a94200 commit 3035e45

File tree

4 files changed

+29
-11
lines changed

4 files changed

+29
-11
lines changed

.changes/sidecar-runtime-rename.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"tauri": patch
3+
"tauri-bundler": patch
4+
---
5+
6+
**Breaking change**: The sidecar's target triple suffix is now removed at build time.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"tauri-bundler": patch
3+
"api": patch
4+
---
5+
6+
When building Universal macOS Binaries through the virtual target `universal-apple-darwin`:
7+
8+
- Expect a universal binary to be created by the user
9+
- Ensure that binary is bundled and accessed correctly at runtime

core/tauri/src/api/process/command.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,7 @@ impl Command {
177177
/// A sidecar program is a embedded external binary in order to make your application work
178178
/// or to prevent users having to install additional dependencies (e.g. Node.js, Python, etc).
179179
pub fn new_sidecar<S: Into<String>>(program: S) -> crate::Result<Self> {
180-
let program = format!(
181-
"{}-{}",
182-
program.into(),
183-
platform::target_triple().expect("unsupported platform")
184-
);
185-
Ok(Self::new(relative_command_path(program)?))
180+
Ok(Self::new(relative_command_path(program.into())?))
186181
}
187182

188183
/// Appends arguments to the command.

tooling/bundler/src/bundle/settings.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,18 @@ pub struct BundleSettings {
287287
pub bin: Option<HashMap<String, BundleSettings>>,
288288
/// External binaries to add to the bundle.
289289
///
290-
/// Note that each binary name will have the target platform's target triple appended,
291-
/// so if you're bundling the `sqlite3` app, the bundler will look for e.g.
292-
/// `sqlite3-x86_64-unknown-linux-gnu` on linux,
290+
/// Note that each binary name should have the target platform's target triple appended,
291+
/// as well as `.exe` for Windows.
292+
/// For example, if you're bundling a sidecar called `sqlite3`, the bundler expects
293+
/// a binary named `sqlite3-x86_64-unknown-linux-gnu` on linux,
293294
/// and `sqlite3-x86_64-pc-windows-gnu.exe` on windows.
294295
///
295-
/// The possible target triples can be seen by running `$ rustup target list`.
296+
/// Run `tauri build --help` for more info on targets.
297+
///
298+
/// If you are building a universal binary for MacOS, the bundler expects
299+
/// your external binary to also be universal, and named after the target triple,
300+
/// e.g. `sqlite3-universal-apple-darwin`. See
301+
/// https://developer.apple.com/documentation/apple-silicon/building-a-universal-macos-binary
296302
pub external_bin: Option<Vec<String>>,
297303
/// Debian-specific settings.
298304
pub deb: DebianSettings,
@@ -617,7 +623,9 @@ impl Settings {
617623
let dest = path.join(
618624
src
619625
.file_name()
620-
.expect("failed to extract external binary filename"),
626+
.expect("failed to extract external binary filename")
627+
.to_string_lossy()
628+
.replace(&format!("-{}", self.target), ""),
621629
);
622630
common::copy_file(&src, &dest)?;
623631
}

0 commit comments

Comments
 (0)