shithub: choc

Download patch

ref: c040f8c1a464f8082ddec0211baaf0d8c7208682
parent: 6e2d5f924cb23eb3ad2984ce85bdbae702117d0d
author: Simon Howard <fraggle@soulsphere.org>
date: Thu Jun 16 19:12:06 EDT 2022

Build app.icns from doom.png automatically.

It's not necessary to maintain app.icns as a separate file that must
be manually updated.

--- a/pkg/osx/.gitignore
+++ b/pkg/osx/.gitignore
@@ -1,4 +1,6 @@
 Info.plist
+app.iconset
+app.icns
 launcher
 *.o
 *.d
--- a/pkg/osx/GNUmakefile
+++ b/pkg/osx/GNUmakefile
@@ -37,12 +37,13 @@
 APP_DOC_DIR=$(APP_BIN_DIR)/Documentation
 APP_DOC_RELDIR=$(patsubst $(STAGING_DIR)/%,%,$(APP_DOC_DIR))
 
-$(STAGING_DIR): launcher $(TOPLEVEL_DOCS)
+$(STAGING_DIR): launcher $(TOPLEVEL_DOCS) app.icns
 	rm -rf $(STAGING_DIR)
 	mkdir $(STAGING_DIR)
 
 	mkdir -p "$(APP_TOP_DIR)"
 	cp -R Resources "$(APP_TOP_DIR)"
+	cp app.icns "$(APP_TOP_DIR)/Resources"
 	cp PkgInfo "$(APP_TOP_DIR)"
 	cp $(SRC_INFO_PLIST) "$(APP_TOP_DIR)"
 
@@ -86,9 +87,16 @@
 	cp disk/dir.DS_Store $(STAGING_DIR)/.DS_Store
 	cp disk/background.png $(STAGING_DIR)/background.png
 
+app.icns: $(TOPLEVEL)/data/doom.png
+	mkdir app.iconset
+	sips -z 64 64 $(TOPLEVEL)/data/doom.png \
+	     --out app.iconset/icon_32x32@2x.png
+	iconutil -c icns app.iconset
+
 clean : launcher_clean
 	rm -f $(DMG)
 	rm -rf $(STAGING_DIR)
+	rm -rf app.icns app.iconset
 
 # Launcher build:
 CFLAGS = -Wall -I$(TOPLEVEL)
binary files a/pkg/osx/Resources/app.icns /dev/null differ