Skip to content

Commit b693f98

Browse files
committedDec 20, 2017
keepassxc: support macOS
Closes #32879, taking the new description from the PR
1 parent c47ac0d commit b693f98

File tree

3 files changed

+89
-8
lines changed

3 files changed

+89
-8
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Fix "No known features for CXX compiler", see
2+
https://cmake.org/pipermail/cmake/2016-December/064733.html and the note at
3+
https://cmake.org/cmake/help/v3.10/command/cmake_minimum_required.html
4+
--- a/CMakeLists.txt
5+
+++ b/CMakeLists.txt
6+
@@ -20,10 +20,10 @@ if(NOT CMAKE_BUILD_TYPE)
7+
FORCE)
8+
endif()
9+
10+
-project(KeePassXC)
11+
-
12+
cmake_minimum_required(VERSION 3.1.0)
13+
14+
+project(KeePassXC)
15+
+
16+
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
17+
18+
# Support Visual Studio Code

‎pkgs/applications/misc/keepassx/community.nix

+19-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{ stdenv, fetchFromGitHub, fetchpatch,
2-
cmake, libgcrypt, zlib, libmicrohttpd, libXtst, qtbase, qttools, libgpgerror, glibcLocales, libyubikey, yubikey-personalization, libXi, qtx11extras
1+
{ stdenv, fetchFromGitHub, cmake, makeWrapper, qttools
2+
, libgcrypt, zlib, libmicrohttpd, libXtst, qtbase, libgpgerror, glibcLocales, libyubikey, yubikey-personalization, libXi, qtx11extras
33
, withKeePassHTTP ? true
44
}:
55

@@ -16,6 +16,8 @@ stdenv.mkDerivation rec {
1616
sha256 = "0q913v2ka6p7jr7c4w9fq8aqh5v6nxqgcv9h7zllk5p0amsf8d80";
1717
};
1818

19+
patches = [ ./cmake.patch ./darwin.patch ];
20+
1921
cmakeFlags = [
2022
"-DWITH_GUI_TESTS=ON"
2123
"-DWITH_XC_AUTOTYPE=ON"
@@ -28,13 +30,22 @@ stdenv.mkDerivation rec {
2830
make test ARGS+="-E testgui --output-on-failure"
2931
'';
3032

31-
buildInputs = [ cmake libgcrypt zlib qtbase qttools libXtst libmicrohttpd libgpgerror glibcLocales libyubikey yubikey-personalization libXi qtx11extras ];
33+
nativeBuildInputs = [ cmake makeWrapper qttools ];
34+
35+
buildInputs = [ libgcrypt zlib qtbase libXtst libmicrohttpd libgpgerror glibcLocales libyubikey yubikey-personalization libXi qtx11extras ];
36+
37+
postInstall = optionalString stdenv.isDarwin ''
38+
# Make it work without Qt in PATH.
39+
wrapProgram $out/Applications/KeePassXC.app/Contents/MacOS/KeePassXC \
40+
--set QT_PLUGIN_PATH ${qtbase.bin}/${qtbase.qtPluginPrefix}
41+
'';
3242

3343
meta = {
34-
description = "Fork of the keepassX password-manager with additional http-interface to allow browser-integration an use with plugins such as PasslFox (https://github.com/pfn/passifox). See also keepassX2.";
35-
homepage = https://github.com/keepassxreboot/keepassxc;
36-
license = stdenv.lib.licenses.gpl2;
37-
maintainers = with stdenv.lib.maintainers; [ s1lvester jonafato ];
38-
platforms = with stdenv.lib.platforms; linux;
44+
description = "Password manager to store your passwords safely and auto-type them into your everyday websites and applications";
45+
longDescription = "A community fork of KeePassX, which is itself a port of KeePass Password Safe. The goal is to extend and improve KeePassX with new features and bugfixes to provide a feature-rich, fully cross-platform and modern open-source password manager. Accessible via native cross-platform GUI and via CLI. Includes optional http-interface to allow browser-integration with plugins like PassIFox (https://github.com/pfn/passifox).";
46+
homepage = https://keepassxc.org/;
47+
license = licenses.gpl2;
48+
maintainers = with maintainers; [ s1lvester jonafato ];
49+
platforms = with platforms; linux ++ darwin;
3950
};
4051
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
Remove the use of macdeployqt to avoid copying dependencies and
2+
reduce installation size from 90 MB to 9 MB.
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -188,8 +188,8 @@ else()
6+
set(PROGNAME keepassxc)
7+
endif()
8+
9+
-if(APPLE AND WITH_APP_BUNDLE AND "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/local")
10+
- set(CMAKE_INSTALL_PREFIX "/Applications")
11+
+if(APPLE AND WITH_APP_BUNDLE)
12+
+ set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/Applications")
13+
endif()
14+
15+
if(MINGW)
16+
@@ -198,7 +198,7 @@ if(MINGW)
17+
set(PLUGIN_INSTALL_DIR ".")
18+
set(DATA_INSTALL_DIR "share")
19+
elseif(APPLE AND WITH_APP_BUNDLE)
20+
- set(CLI_INSTALL_DIR "/usr/local/bin")
21+
+ set(CLI_INSTALL_DIR "../bin")
22+
set(BIN_INSTALL_DIR ".")
23+
set(PLUGIN_INSTALL_DIR "${PROGNAME}.app/Contents/PlugIns")
24+
set(DATA_INSTALL_DIR "${PROGNAME}.app/Contents/Resources")
25+
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
26+
index 5255186..0175983 100644
27+
--- a/src/CMakeLists.txt
28+
+++ b/src/CMakeLists.txt
29+
@@ -282,11 +282,6 @@ if(APPLE AND WITH_APP_BUNDLE)
30+
if(NOT DEFINED QT_BINARY_DIR)
31+
set(QT_BINARY_DIR "/usr/local/opt/qt5/bin" CACHE PATH "QT binary folder")
32+
endif()
33+
- add_custom_command(TARGET ${PROGNAME}
34+
- POST_BUILD
35+
- COMMAND ${QT_BINARY_DIR}/macdeployqt ${PROGNAME}.app
36+
- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
37+
- COMMENT "Deploying app bundle")
38+
endif()
39+
40+
if(MINGW)
41+
diff --git a/src/autotype/mac/CMakeLists.txt b/src/autotype/mac/CMakeLists.txt
42+
index ac93de0..03d502e 100644
43+
--- a/src/autotype/mac/CMakeLists.txt
44+
+++ b/src/autotype/mac/CMakeLists.txt
45+
@@ -16,7 +16,6 @@ if(WITH_APP_BUNDLE)
46+
add_custom_command(TARGET keepassx-autotype-cocoa
47+
POST_BUILD
48+
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/libkeepassx-autotype-cocoa.so ${PLUGIN_INSTALL_DIR}
49+
- COMMAND ${QT_BINARY_DIR}/macdeployqt ${PROGNAME}.app -executable=${PLUGIN_INSTALL_DIR}/libkeepassx-autotype-cocoa.so -no-plugins
50+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
51+
COMMENT "Deploying autotype plugin")
52+
else()

0 commit comments

Comments
 (0)
Please sign in to comment.