summary refs log tree commit diff
path: root/pkgs/build-support/setup-hooks/desktop-to-darwin-bundle.sh
diff options
context:
space:
mode:
authorMichael Hoang <enzime@users.noreply.github.com>2023-08-15 15:07:22 +1000
committerMichael Hoang <enzime@users.noreply.github.com>2023-08-21 13:29:12 +1000
commit66884a4912003e8090ef6e2a203f9544c4d7702c (patch)
tree0eefa3236cb9853aa406c9c6d984aa8d67dcddc6 /pkgs/build-support/setup-hooks/desktop-to-darwin-bundle.sh
parent55d5ebb07a992762c4535c01602ece55e85ada72 (diff)
downloadnixpkgs-66884a4912003e8090ef6e2a203f9544c4d7702c.tar
nixpkgs-66884a4912003e8090ef6e2a203f9544c4d7702c.tar.gz
nixpkgs-66884a4912003e8090ef6e2a203f9544c4d7702c.tar.bz2
nixpkgs-66884a4912003e8090ef6e2a203f9544c4d7702c.tar.lz
nixpkgs-66884a4912003e8090ef6e2a203f9544c4d7702c.tar.xz
nixpkgs-66884a4912003e8090ef6e2a203f9544c4d7702c.tar.zst
nixpkgs-66884a4912003e8090ef6e2a203f9544c4d7702c.zip
writeDarwinBundle: use binary wrapper
Previously `writeDarwinBundle` used a handcrafted shell wrapper, however
this causes issues on Apple Silicon Macs as script-only application
bundles are always run under Rosetta[0][1].

Replacing the handcrafted shell wrapper with a binary wrapper allows
apps to run natively instead of requiring Rosetta. However, this means
we can no longer use `$1` and `$@`.

After checking nearly every current usage of `desktopToDarwinBundle`,
there were no apps that used `%[fFuU]` before the last argument, meaning
removing them naively is good enough for the current apps.

[0]: https://developer.apple.com/documentation/apple-silicon/building-a-universal-macos-binary
[1]: https://stackoverflow.com/a/68208374
Diffstat (limited to 'pkgs/build-support/setup-hooks/desktop-to-darwin-bundle.sh')
-rw-r--r--pkgs/build-support/setup-hooks/desktop-to-darwin-bundle.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/pkgs/build-support/setup-hooks/desktop-to-darwin-bundle.sh b/pkgs/build-support/setup-hooks/desktop-to-darwin-bundle.sh
index e4e7fba8477..5b38f437607 100644
--- a/pkgs/build-support/setup-hooks/desktop-to-darwin-bundle.sh
+++ b/pkgs/build-support/setup-hooks/desktop-to-darwin-bundle.sh
@@ -204,8 +204,8 @@ processExecFieldCodes() {
   local -r execNoKC="${execNoK/\%c/$(getDesktopParam "${file}" "Name")}"
   local -r icon=$(getDesktopParam "${file}" "Icon")
   local -r execNoKCI="${execNoKC/\%i/${icon:+--icon }${icon}}"
-  local -r execNoKCIfu="${execNoKCI/\%[fu]/\$1}"
-  local -r exec="${execNoKCIfu/\%[FU]/\$@}"
+  local -r execNoKCIfu="${execNoKCI/ \%[fu]/}"
+  local -r exec="${execNoKCIfu/ \%[FU]/}"
   if [[ "$exec" != "$execRaw" ]]; then
     echo 1>&2 "desktopToDarwinBundle: Application bundles do not understand desktop entry field codes. Changed '$execRaw' to '$exec'."
   fi