foxygit / doom Log in
commit c040f8c1a464f8082ddec0211baaf0d8c7208682
Author:     Simon Howard <fraggle@soulsphere.org>
AuthorDate: Thu Jun 16 23:12:06 2022 -0400
Commit:     Simon Howard <fraggle@soulsphere.org>
CommitDate: Thu Jun 16 23:53:03 2022 -0400

    Build app.icns from doom.png automatically.

    It's not necessary to maintain app.icns as a separate file that must
    be manually updated.
---
 pkg/osx/.gitignore         |   2 ++
 pkg/osx/GNUmakefile        |  10 +++++++++-
 pkg/osx/Resources/app.icns | Bin 51625 -> 0 bytes
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/pkg/osx/.gitignore b/pkg/osx/.gitignore
index 74b42f91..2cc92237 100644
--- a/pkg/osx/.gitignore
+++ b/pkg/osx/.gitignore
@@ -1,4 +1,6 @@
 Info.plist
+app.iconset
+app.icns
 launcher
 *.o
 *.d
diff --git a/pkg/osx/GNUmakefile b/pkg/osx/GNUmakefile
index 8efef921..4e07af46 100644
--- a/pkg/osx/GNUmakefile
+++ b/pkg/osx/GNUmakefile
@@ -37,12 +37,13 @@ SRC_INFO_PLIST=Info.plist
 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 @@ $(STAGING_DIR): launcher $(TOPLEVEL_DOCS)
 	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)
diff --git a/pkg/osx/Resources/app.icns b/pkg/osx/Resources/app.icns
deleted file mode 100644
index 9b535a25..00000000
Binary files a/pkg/osx/Resources/app.icns and /dev/null differ