Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove target triple from sidecar bin paths, closes #3355 #3356

Merged
merged 2 commits into from
Feb 8, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changes/universal-apple-target-sidecar.md
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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