aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Clarke <clarkema@clarkema.org>2019-02-17 23:45:12 +0000
committerGitHub <noreply@github.com>2019-02-17 23:45:12 +0000
commitff85243b9c1ed7f492d95a140e3057e64bc4a33f (patch)
tree6b520f6fea65d97975f995a41092940e51d9939f
parent693478cc2034a6baf14b147f2ca39ef81c1068a6 (diff)
parent46760080c149ce7e61225330765c418b26174098 (diff)
Merge pull request #126 from clarkema/macos-build
Fix DMG creation on newer versions of macOS
-rwxr-xr-xports/darwin_dmg/fileicon33
-rwxr-xr-xports/darwin_dmg/package_darwin_dmg.pl11
2 files changed, 35 insertions, 9 deletions
diff --git a/ports/darwin_dmg/fileicon b/ports/darwin_dmg/fileicon
new file mode 100755
index 0000000..1e1d2a2
--- /dev/null
+++ b/ports/darwin_dmg/fileicon
@@ -0,0 +1,33 @@
+#! /usr/bin/swift
+
+import Darwin
+import Cocoa
+
+func die(_ msg: String) {
+ fputs("\(msg)\n", stderr)
+ exit(1)
+}
+
+let name = CommandLine.arguments[0]
+
+/*
+ * We don't do anything with the 'set' at the moment; it's just there to
+ * reserve a space for a subcommand to allow for future expansion without
+ * changing the interface.
+ */
+if CommandLine.argc == 4 && CommandLine.arguments[1] == "set" {
+ let target_file = CommandLine.arguments[2]
+ let icon_file_name = CommandLine.arguments[3]
+
+ if let icon = Cocoa.NSImage.init(contentsOfFile: icon_file_name) {
+ if !NSWorkspace.shared.setIcon(icon, forFile: target_file) {
+ die("Failed to set icon for '\(target_file)'")
+ }
+ }
+ else {
+ die("Failed to read icon file '\(icon_file_name)'")
+ }
+}
+else {
+ die("Usage: \(name) set FILE ICON_FILE")
+}
diff --git a/ports/darwin_dmg/package_darwin_dmg.pl b/ports/darwin_dmg/package_darwin_dmg.pl
index c669c39..7c3ade6 100755
--- a/ports/darwin_dmg/package_darwin_dmg.pl
+++ b/ports/darwin_dmg/package_darwin_dmg.pl
@@ -132,19 +132,12 @@ run "CpMac -r '$src_dir' '$vol_dir'";
run "cp ../HOW_TO_INSTALL.txt '$vol_dir/README.txt'";
run "cp -pr ../../../docs '$vol_dir/Docs'";
-run "touch '$vol_dir/Rakudo/Icon\r'";
run "cp ../2000px-Camelia.svg.icns $vol_dir/.VolumeIcon.icns";
-run "sips -i $vol_dir/.VolumeIcon.icns";
-run "DeRez -only icns $vol_dir/.VolumeIcon.icns > tempicns.rsrc";
-run "Rez -append tempicns.rsrc -o '$vol_dir/Rakudo/bin/perl6'";
+run "../fileicon set '$vol_dir/Rakudo/bin/perl6' ../2000px-Camelia.svg.icns";
run "mkdir $vol_dir/.background";
-run "cp ../installerbg.png $vol_dir/.background";
+run "cp ../installerbg.png $vol_dir/.background";
run "SetFile -c icnC '$vol_dir/.VolumeIcon.icns'";
run "SetFile -a C '$vol_dir'";
-run "SetFile -a C '$vol_dir/Rakudo'";
-run "SetFile -a C '$vol_dir/Rakudo/bin/perl6'";
-run "SetFile -a V '$vol_dir/Rakudo/Icon\r'";
-run "rm tempicns.rsrc";
print ">>> Adjusting sizes and positions in installation window\n";