From 3dc74b34438f44351f1230ed192b42bcc6e4bfae Mon Sep 17 00:00:00 2001 From: Angel Peralta Date: Fri, 1 May 2026 18:43:10 -0400 Subject: [PATCH 1/2] fix(macos): enhance deployment and packaging for macOS - Add automatic .icns icon generation from PNG in Makefile - Skip desktop integration install on macOS (Darwin-specific) - Copy .icns file to app bundle during deployment - Configure deploy library to exclude optional tree-sitter libraries from bundling (they're loaded at runtime when available) These changes improve macOS app packaging by: 1. Generating proper .icns icons for dock/taskbar display 2. Avoiding Linux-specific desktop file installations on macOS 3. Preventing tree-sitter library bundling issues on macOS --- Makefile | 24 +++++++++++++++++++++++- scripts/macos-deploy.bash | 3 ++- src/macosx.lisp | 10 ++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 601689636..a615ac011 100644 --- a/Makefile +++ b/Makefile @@ -50,12 +50,17 @@ install-bin: install -m 755 lem $(PREFIX)/bin # TODO: on the fly edit lem.desktop depends on $(PREFIX) -install-desktop: +install-desktop: install -m 644 scripts/install/lem.svg /usr/share/icons/hicolor/scalable/apps/ gtk-update-icon-cache /usr/share/icons/hicolor install -m 644 scripts/install/lem-$(VARIANT).desktop /usr/share/applications/lem.desktop +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Darwin) +install: install-bin +else install: install-bin install-desktop +endif @echo "+--------------------------------+" @echo "| Lem installation complete! |" @echo "+--------------------------------+" @@ -144,5 +149,22 @@ lint: .qlot/bin/sblint extensions/yaml-mode/lem-yaml-mode.asd .qlot/bin/sblint extensions/ruby-mode/lem-ruby-mode.asd +resources/lem.icns: resources/lem.png + mkdir -p resources/lem.iconset + sips -z 16 16 $< --out resources/lem.iconset/icon_16x16.png + sips -z 32 32 $< --out resources/lem.iconset/icon_16x16@2x.png + sips -z 32 32 $< --out resources/lem.iconset/icon_32x32.png + sips -z 64 64 $< --out resources/lem.iconset/icon_32x32@2x.png + sips -z 128 128 $< --out resources/lem.iconset/icon_128x128.png + sips -z 256 256 $< --out resources/lem.iconset/icon_128x128@2x.png + sips -z 256 256 $< --out resources/lem.iconset/icon_256x256.png + sips -z 256 256 $< --out resources/lem.iconset/icon_256x256@2x.png + sips -z 256 256 $< --out resources/lem.iconset/icon_512x512.png + sips -z 256 256 $< --out resources/lem.iconset/icon_512x512@2x.png + iconutil -c icns resources/lem.iconset -o $@ + rm -rf resources/lem.iconset + +icns: resources/lem.icns + AppImage: docker buildx build -f docker/Dockerfile-AppImage --progress=plain --target artifact --output type=local,dest=./artifacts . diff --git a/scripts/macos-deploy.bash b/scripts/macos-deploy.bash index 69f881b9a..e09228916 100755 --- a/scripts/macos-deploy.bash +++ b/scripts/macos-deploy.bash @@ -11,7 +11,8 @@ cd "$parent_dir" qlot install qlot exec sbcl --eval '(ql:quickload :lem)' --eval '(asdf:make :lem)' -# アイコン(存在しなくても続行) +# アイコン(.icns for macOS dock/taskbar icon, .png as fallback) +cp resources/lem.icns bin/lem.app/Contents/Resources/ || true cp resources/lem.png bin/lem.app/Contents/Resources/ || true # ===== 2) OpenSSL を同梱し、参照先を @loader_path 化 ===== diff --git a/src/macosx.lisp b/src/macosx.lisp index 951f3e851..f51fab623 100644 --- a/src/macosx.lisp +++ b/src/macosx.lisp @@ -1,5 +1,15 @@ (in-package :lem-core) +;; Tell the deploy library not to bundle tree-sitter native libraries. +;; They are optional and loaded at runtime only when available. +(when (find-package :tree-sitter/ffi) + (let ((ts (find-symbol "TREE-SITTER" :tree-sitter/ffi)) + (tw (find-symbol "TS-WRAPPER" :tree-sitter/ffi))) + (when ts + (setf (deploy:library-dont-deploy-p (deploy:ensure-library ts)) T)) + (when tw + (setf (deploy:library-dont-deploy-p (deploy:ensure-library tw)) T)))) + (add-hook *after-init-hook* (lambda () ;; PATH injection for macOS From f4f8d215210aef4ed632aba9ef1ad53f7181cdcc Mon Sep 17 00:00:00 2001 From: Angel Peralta Date: Fri, 1 May 2026 18:46:01 -0400 Subject: [PATCH 2/2] fix: move tree-sitter deploy config after add-hook (file_structure_rule) --- src/macosx.lisp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/macosx.lisp b/src/macosx.lisp index f51fab623..76e25e1c0 100644 --- a/src/macosx.lisp +++ b/src/macosx.lisp @@ -1,15 +1,5 @@ (in-package :lem-core) -;; Tell the deploy library not to bundle tree-sitter native libraries. -;; They are optional and loaded at runtime only when available. -(when (find-package :tree-sitter/ffi) - (let ((ts (find-symbol "TREE-SITTER" :tree-sitter/ffi)) - (tw (find-symbol "TS-WRAPPER" :tree-sitter/ffi))) - (when ts - (setf (deploy:library-dont-deploy-p (deploy:ensure-library ts)) T)) - (when tw - (setf (deploy:library-dont-deploy-p (deploy:ensure-library tw)) T)))) - (add-hook *after-init-hook* (lambda () ;; PATH injection for macOS @@ -20,3 +10,13 @@ (let ((dir (user-homedir-pathname))) (setq *default-pathname-defaults* dir) (uiop:chdir dir))))) + +;; Tell the deploy library not to bundle tree-sitter native libraries. +;; They are optional and loaded at runtime only when available. +(when (find-package :tree-sitter/ffi) + (let ((ts (find-symbol "TREE-SITTER" :tree-sitter/ffi)) + (tw (find-symbol "TS-WRAPPER" :tree-sitter/ffi))) + (when ts + (setf (deploy:library-dont-deploy-p (deploy:ensure-library ts)) T)) + (when tw + (setf (deploy:library-dont-deploy-p (deploy:ensure-library tw)) T))))