1# given a package with an executable and an icon, make a darwin bundle for
2# it. This package should be used when generating launchers for native Darwin
3# applications. If the package contains a .desktop file use
4# `desktopToDarwinBundle` instead.
5
6{
7 lib,
8 writeShellScript,
9 writeDarwinBundle,
10}:
11
12{
13 name, # The name of the Application file.
14 exec, # Executable file.
15 icon ? "", # Optional icon file.
16}:
17
18writeShellScript "make-darwin-bundle-${name}" (''
19 function makeDarwinBundlePhase() {
20 mkdir -p "''${!outputBin}/Applications/${name}.app/Contents/MacOS"
21 mkdir -p "''${!outputBin}/Applications/${name}.app/Contents/Resources"
22
23 if [ -n "${icon}" ]; then
24 ln -s "${icon}" "''${!outputBin}/Applications/${name}.app/Contents/Resources"
25 fi
26
27 ${writeDarwinBundle}/bin/write-darwin-bundle "''${!outputBin}" "${name}" "${exec}"
28 }
29
30 appendToVar preDistPhases makeDarwinBundlePhase
31'')