Skip to content

Commit

Permalink
Remove target triple from sidecar bin paths, closes #3355 (#3356)
Browse files Browse the repository at this point in the history
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
  • Loading branch information
betamos and lucasfernog committed Feb 8, 2022
1 parent 5a94200 commit 3035e45
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 11 deletions.
6 changes: 6 additions & 0 deletions .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.
9 changes: 9 additions & 0 deletions .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
7 changes: 1 addition & 6 deletions core/tauri/src/api/process/command.rs
Expand Up @@ -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<S: Into<String>>(program: S) -> crate::Result<Self> {
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.
Expand Down
18 changes: 13 additions & 5 deletions tooling/bundler/src/bundle/settings.rs
Expand Up @@ -287,12 +287,18 @@ pub struct BundleSettings {
pub bin: Option<HashMap<String, BundleSettings>>,
/// 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<Vec<String>>,
/// Debian-specific settings.
pub deb: DebianSettings,
Expand Down Expand Up @@ -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)?;
}
Expand Down

0 comments on commit 3035e45

Please sign in to comment.