mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-09-28 10:50:15 +00:00
[Backport release-26.05] deskflow: Refactor to add Darwin support (#567155)
This commit is contained in:
@@ -2,31 +2,42 @@
|
||||
lib,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
|
||||
# nativeBuildInputs
|
||||
cmake,
|
||||
doxygen,
|
||||
ninja,
|
||||
pkg-config,
|
||||
qt6,
|
||||
|
||||
# nativeCheckInputs
|
||||
writableTmpDirAsHomeHook,
|
||||
|
||||
# buildInputs (Linux and Darwin)
|
||||
gtest,
|
||||
libei,
|
||||
libportal,
|
||||
libx11,
|
||||
libxkbfile,
|
||||
libxtst,
|
||||
libxinerama,
|
||||
libxi,
|
||||
libxrandr,
|
||||
libxkbcommon,
|
||||
openssl,
|
||||
pugixml,
|
||||
python3,
|
||||
|
||||
# buildInputs (Linux-specific)
|
||||
gdk-pixbuf,
|
||||
libnotify,
|
||||
qt6,
|
||||
xkeyboard_config,
|
||||
wayland-protocols,
|
||||
wayland,
|
||||
libsysprof-capture,
|
||||
lerc,
|
||||
doxygen,
|
||||
writableTmpDirAsHomeHook,
|
||||
libei,
|
||||
libnotify,
|
||||
libportal,
|
||||
libsysprof-capture,
|
||||
libx11,
|
||||
libxi,
|
||||
libxinerama,
|
||||
libxkbcommon,
|
||||
libxkbfile,
|
||||
libxrandr,
|
||||
libxtst,
|
||||
wayland,
|
||||
wayland-protocols,
|
||||
xkeyboard_config,
|
||||
|
||||
# Update script for `passthru`.
|
||||
nix-update-script,
|
||||
}:
|
||||
|
||||
@@ -41,57 +52,69 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
hash = "sha256-XcSG47Ysjn+wrJH5DC/XXGXcneXcW7xIhAn6sguuv+s=";
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace src/lib/deskflow/unix/AppUtilUnix.cpp \
|
||||
--replace-fail "/usr/share/X11/xkb/rules/evdev.xml" "${xkeyboard_config}/share/X11/xkb/rules/evdev.xml"
|
||||
substituteInPlace deploy/linux/deploy.cmake \
|
||||
--replace-fail 'message(FATAL_ERROR "Unable to read file /etc/os-release")' 'set(RELEASE_FILE_CONTENTS "")'
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
doxygen
|
||||
ninja
|
||||
pkg-config
|
||||
qt6.wrapQtAppsHook
|
||||
doxygen # docs
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
gtest
|
||||
openssl
|
||||
pugixml
|
||||
python3
|
||||
qt6.qtbase
|
||||
qt6.qttools
|
||||
qt6.qttranslations
|
||||
]
|
||||
++ (lib.optionals stdenv.hostPlatform.isLinux [
|
||||
gdk-pixbuf
|
||||
lerc
|
||||
libei
|
||||
libnotify
|
||||
libportal
|
||||
libsysprof-capture
|
||||
libx11
|
||||
libxi
|
||||
libxinerama
|
||||
libxkbcommon
|
||||
libxkbfile
|
||||
libxrandr
|
||||
libxtst
|
||||
qt6.qtdeclarative
|
||||
qt6.qtwayland
|
||||
wayland
|
||||
wayland-protocols
|
||||
]);
|
||||
|
||||
preConfigure = lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||
export PATH="${qt6.qtbase}/bin:$PATH"
|
||||
'';
|
||||
|
||||
postPatch = ''
|
||||
${lib.optionalString stdenv.hostPlatform.isLinux ''
|
||||
substituteInPlace src/lib/deskflow/unix/AppUtilUnix.cpp \
|
||||
--replace-fail "/usr/share/X11/xkb/rules/evdev.xml" "${xkeyboard_config}/share/X11/xkb/rules/evdev.xml"
|
||||
substituteInPlace deploy/linux/deploy.cmake \
|
||||
--replace-fail 'message(FATAL_ERROR "Unable to read file /etc/os-release")' 'set(RELEASE_FILE_CONTENTS "")'
|
||||
''}
|
||||
substituteInPlace translations/CMakeLists.txt \
|
||||
--replace-fail 'PATHS ''${QT_ROOT_DIR} PATH_SUFFIXES "translations" "share/qt/translations"' 'PATHS "${qt6.qttranslations}/translations"'
|
||||
substituteInPlace src/lib/net/CMakeLists.txt \
|
||||
--replace-fail "set(OPENSSL_USE_STATIC_LIBS TRUE)" ""
|
||||
'';
|
||||
|
||||
cmakeFlags = [
|
||||
"-DCMAKE_SKIP_RPATH=ON" # Avoid generating incorrect RPATH
|
||||
"-DSKIP_BUILD_TESTS=ON" # Perform unit tests in `checkPhase` manually, with one job at a time.
|
||||
];
|
||||
|
||||
qtWrapperArgs = lib.optional stdenv.hostPlatform.isLinux "--set QT_QPA_PLATFORM_PLUGIN_PATH ${qt6.qtwayland}/${qt6.qtbase.qtPluginPrefix}/platforms";
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
buildInputs = [
|
||||
gtest
|
||||
libei
|
||||
libportal
|
||||
libx11
|
||||
libxkbfile
|
||||
libxinerama
|
||||
libxi
|
||||
libxrandr
|
||||
libxtst
|
||||
libxkbcommon
|
||||
pugixml
|
||||
gdk-pixbuf
|
||||
libnotify
|
||||
python3
|
||||
qt6.qtbase
|
||||
wayland-protocols
|
||||
qt6.qtwayland
|
||||
qt6.qtdeclarative
|
||||
qt6.qttools
|
||||
wayland
|
||||
libsysprof-capture
|
||||
lerc
|
||||
];
|
||||
|
||||
qtWrapperArgs = [
|
||||
"--set QT_QPA_PLATFORM_PLUGIN_PATH ${qt6.qtwayland}/${qt6.qtbase.qtPluginPrefix}/platforms"
|
||||
];
|
||||
|
||||
doCheck = true;
|
||||
|
||||
nativeCheckInputs = [ writableTmpDirAsHomeHook ];
|
||||
@@ -100,7 +123,8 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
runHook preCheck
|
||||
|
||||
export QT_QPA_PLATFORM=offscreen
|
||||
ctest --test-dir "src/unittests" --output-on-failure
|
||||
ctest --test-dir "src/unittests" --output-on-failure \
|
||||
--exclude-regex "OSX(KeyState|Clipboard)Tests"
|
||||
./bin/legacytests
|
||||
|
||||
runHook postCheck
|
||||
@@ -127,9 +151,9 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
];
|
||||
license = with lib.licenses; [
|
||||
gpl2Plus
|
||||
openssl
|
||||
lib.licenses.openssl # We have to be explicit here, as `openssl` is a buildInput.
|
||||
mit # share/applications/org.deskflow.deskflow.desktop
|
||||
];
|
||||
platforms = lib.platforms.linux;
|
||||
platforms = lib.platforms.unix;
|
||||
};
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user