Skip to content

Commit

Permalink
Fix macOS building and code signing, resolves keepassxreboot#1344
Browse files Browse the repository at this point in the history
  • Loading branch information
phoerious committed Jan 13, 2018
1 parent 43a620b commit c2ead0e
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 14 deletions.
4 changes: 4 additions & 0 deletions COPYING
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,7 @@ Files: src/gui/KMessageWidget.h
Copyright: 2011 Aurélien Gâteau <[email protected]>
2014 Dominik Haumann <[email protected]>
License: LGPL-2.1

Files: share/macosx/dmg-background.tiff
Copyright: 2008-2014, Andrey Tarantsov
License: MIT
19 changes: 19 additions & 0 deletions LICENSE.MIT
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
25 changes: 12 additions & 13 deletions release-tool
Original file line number Diff line number Diff line change
Expand Up @@ -317,13 +317,6 @@ checkCodesignCommandExists() {
fi
}

checkCreateDMGCommandExists() {
command -v create-dmg > /dev/null
if [ 0 -ne $? ]; then
exitError "create-dmg command not found on the PATH! Please install it using 'npm install --global create-dmg'."
fi
}

checkQt5LUpdateExists() {
command -v lupdate > /dev/null
if [ 0 -eq $? ] && ! $(lupdate -version | grep -q "lupdate version 5\."); then
Expand Down Expand Up @@ -813,17 +806,16 @@ appsign() {
fi

checkCodesignCommandExists
checkCreateDMGCommandExists

local orig_dir="$(pwd)"
for f in "${sign_files[@]}"; do
if [[ ${f: -4} == '.dmg' ]]; then
logInfo "Unpacking disk image '${f}'..."
local tmp_dir="/tmp/KeePassXC_${RANDOM}"
mkdir -p ${tmp_dir}/{mnt,app}
mkdir -p ${tmp_dir}/mnt
hdiutil attach -quiet -noautoopen -mountpoint ${tmp_dir}/mnt "${f}"
cd ${tmp_dir}
cp -a ./mnt/KeePassXC.app ./app
cp -a ./mnt ./app
hdiutil detach -quiet ${tmp_dir}/mnt

if [ ! -d ./app/KeePassXC.app ]; then
Expand All @@ -839,10 +831,17 @@ appsign() {
exitError "Signing failed!"
fi

logInfo "Repacking and signing disk image..."
create-dmg ./app/KeePassXC.app
logInfo "Repacking disk image..."
hdiutil create \
-volname "KeePassXC" \
-size $((1000 * ($(du -sk ./app | cut -f1) + 5000))) \
-srcfolder ./app \
-fs HFS+ \
-fsargs "-c c=64,a=16,e=16" \
-format UDBZ \
"${tmp_dir}/$(basename "${f}")"
cd "${orig_dir}"
cp -f ${tmp_dir}/KeePassXC-*.dmg "${f}"
cp -f "${tmp_dir}/$(basename "${f}")" "${f}"
rm -Rf ${tmp_dir}
else
logInfo "Skipping non-DMG file '${f}'..."
Expand Down
Binary file added share/macosx/DS_Store.in
Binary file not shown.
2 changes: 1 addition & 1 deletion share/macosx/Info.plist.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<key>CFBundleVersion</key>
<string>${KEEPASSXC_VERSION_NUM}</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright 2016-2017 KeePassXC Development Team</string>
<string>Copyright 2016-2018 KeePassXC Development Team</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
Expand Down
Binary file added share/macosx/background.tiff
Binary file not shown.
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ if(APPLE AND WITH_APP_BUNDLE)

set(CPACK_GENERATOR "DragNDrop")
set(CPACK_DMG_FORMAT "UDBZ")
set(CPACK_DMG_DS_STORE "${CMAKE_SOURCE_DIR}/share/macosx/DS_Store.in")
set(CPACK_DMG_BACKGROUND_IMAGE "${CMAKE_SOURCE_DIR}/share/macosx/background.tiff")
set(CPACK_DMG_VOLUME_NAME "${PROGNAME}")
set(CPACK_SYSTEM_NAME "OSX")
set(CPACK_STRIP_FILES ON)
Expand Down

0 comments on commit c2ead0e

Please sign in to comment.