Skip to content

Commit

Permalink
fix macos-14 code signing
Browse files Browse the repository at this point in the history
this only work for calm made applications,
for calm itself manually de-quarantine is still necessary.
  • Loading branch information
VitoVan committed Aug 8, 2024
1 parent d7c5039 commit 8662808
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 2 additions & 0 deletions build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ build_darwin () {
echo "build launcher ..."
brew install gcc
gcc src/calm.c -o calm
# codesign for macos-14 enhanced security
codesign --sign - --force --preserve-metadata=entitlements,requirements,flags,runtime calm

echo "remove Windows fonts dir ..."
sed '/<dir>C:\\Windows\\Fonts<\/dir>/d' s/usr/all/fonts.conf > tmp-fonts.conf
Expand Down
3 changes: 2 additions & 1 deletion s/dev/darwin/config-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,6 @@ ls -lah .
# copy all typelibs
cp -L -R $(brew --prefix)/lib/girepository-1.0/*.typelib ./

# codesign for macos-14, since we changed those libs
# codesign for macos-14 enhanced security
ls *.dylib | xargs -I _ codesign --sign - --force --preserve-metadata=entitlements,requirements,flags,runtime _
ls *.typelib | xargs -I _ sudo codesign --sign - --force --preserve-metadata=entitlements,requirements,flags,runtime _
15 changes: 13 additions & 2 deletions s/usr/macos/bundle.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
(dist-dir-abs (or (uiop:absolute-pathname-p dist-dir)
(uiop:merge-pathnames* dist-dir *calm-env-app-dir*)))
(app-icon-abs (or (uiop:absolute-pathname-p app-icon)
(uiop:merge-pathnames* app-icon *calm-env-app-dir*))))
(uiop:merge-pathnames* app-icon *calm-env-app-dir*)))
(codesign-cmd "codesign --sign - --force --preserve-metadata=entitlements,requirements,flags,runtime "))

;; clean old bunlde
(uiop:delete-directory-tree app-dir :validate t :if-does-not-exist :ignore)
Expand All @@ -38,7 +39,17 @@
dist-dir-abs
app-macos-dir)
;; copy icon
(u:copy-file app-icon-abs (merge-pathnames "icon.icns" app-resources-dir)))
(u:copy-file app-icon-abs (merge-pathnames "icon.icns" app-resources-dir))

(u:calm-log "signing everything... (some files need sudo permission)")
(u:exec (str:concat "find " app-name ".app/Contents/MacOS/ -type f | xargs -I _ sudo " codesign-cmd " _")
:ignore-error-status t)
(u:calm-log "signing calm launcher...")
(u:exec (str:concat "sudo " codesign-cmd app-name ".app/Contents/MacOS/calm")
:ignore-error-status t)
(u:calm-log "signing the application bundle itself...")
(u:exec (str:concat "sudo " codesign-cmd app-name ".app")
:ignore-error-status t))

(u:calm-log-fancy "~%Application Bundle created: ~A.app~%" app-name))

Expand Down

0 comments on commit 8662808

Please sign in to comment.