From efaae15f111814b50f1cedd1fd2a653db3eed8e2 Mon Sep 17 00:00:00 2001 From: Benitoite Date: Mon, 17 Sep 2018 15:51:59 -0700 Subject: [PATCH 1/3] Mac: set a cached variable with codesign ID --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ea95d818c..bca387153 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -252,6 +252,12 @@ if(DEFINED LENSFUNDBDIR AND NOT IS_ABSOLUTE "${LENSFUNDBDIR}") set(LENSFUNDBDIR "${DATADIR}/${LENSFUNDBDIR}") endif() +if(APPLE) + if("${CODESIGNID}") + set(CODESIGNID "${CODESIGNID}" CAHCE STRING "Codesigning Identity") + endif() +endif() + # Enforce absolute paths for non-bundle builds: if(NOT BUILD_BUNDLE) foreach(path BINDIR DATADIR LIBDIR DOCDIR CREDITSDIR LICENCEDIR) From d6e4ba296e9018835b8150cc0bb2a80bd0720bc8 Mon Sep 17 00:00:00 2001 From: Benitoite Date: Mon, 17 Sep 2018 15:58:19 -0700 Subject: [PATCH 2/3] Mac: codesign app and dmg Gets the cached CODESIGNID value via cmake and signs the app and dmg with it. --- tools/osx/macosx_bundle.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/osx/macosx_bundle.sh b/tools/osx/macosx_bundle.sh index 591699cbb..e5c9d0bd3 100644 --- a/tools/osx/macosx_bundle.sh +++ b/tools/osx/macosx_bundle.sh @@ -199,8 +199,11 @@ s|@arch@|${arch}|" \ "${CONTENTS}/Info.plist" plutil -convert binary1 "${CONTENTS}/Info.plist" - - +# Sign the app +CODESIGNID="$(cmake .. -LA -N | grep "CODESIGNID" | cut -d "=" -f2)" +codesign --deep --force -v -s "${CODESIGNID}" "${APP}" +spctl -a -vvvv "${APP}" + function CreateDmg { local srcDir="$(mktemp -dt $$)" @@ -227,6 +230,9 @@ function CreateDmg { msg "Creating disk image:" hdiutil create -format UDBZ -srcdir "${srcDir}" -volname "${PROJECT_NAME}_${PROJECT_FULL_VERSION}" "${dmg_name}.dmg" + # Sign disk image + codesign --deep --force -v -s "${CODESIGNID}" "${dmg_name}.dmg" + # Zip disk image for redistribution zip "${dmg_name}.zip" "${dmg_name}.dmg" AboutThisBuild.txt rm "${dmg_name}.dmg" From cdc187f9aa88135f7c57dfad71374da85d93f6ac Mon Sep 17 00:00:00 2001 From: Benitoite Date: Mon, 17 Sep 2018 16:39:48 -0700 Subject: [PATCH 3/3] Mac: fix typo I made --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bca387153..f2739c4da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -254,7 +254,7 @@ endif() if(APPLE) if("${CODESIGNID}") - set(CODESIGNID "${CODESIGNID}" CAHCE STRING "Codesigning Identity") + set(CODESIGNID "${CODESIGNID}" CACHE STRING "Codesigning Identity") endif() endif()