diff --git a/pkgs/applications/misc/synergy/build-tests.patch b/pkgs/applications/misc/synergy/build-tests.patch new file mode 100644 index 000000000000..ab08195e794d --- /dev/null +++ b/pkgs/applications/misc/synergy/build-tests.patch @@ -0,0 +1,97 @@ +From 9c2278dad498b8e4040f30c80cf65b3a089ba218 Mon Sep 17 00:00:00 2001 +From: talyz +Date: Fri, 14 Feb 2020 16:26:36 +0100 +Subject: [PATCH] Build tests again + +The tests were accidentally disabled in +688095d0a7d22704b5c3282bc68b41ceca42ab7e. Since then, the code has +drifted slightly: the synergy lib has been renamed from synergy to +synlib in 4263fd17177d7717b04ac6d6ec62efa2f657ed74 and the curl +dependency was dropped in 491bb2de000245a943b8298462c4a9d8f34c9a44. + +This reenables the tests, targets the right lib and removes the +obsolete test. +--- + src/CMakeLists.txt | 2 + + src/test/integtests/CMakeLists.txt | 2 +- + .../integtests/arch/ArchInternetTests.cpp | 37 ------------------- + src/test/unittests/CMakeLists.txt | 2 +- + 4 files changed, 4 insertions(+), 39 deletions(-) + delete mode 100644 src/test/integtests/arch/ArchInternetTests.cpp + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index ab63a066..fee080ab 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -22,3 +22,5 @@ add_subdirectory(cmd) + if (SYNERGY_BUILD_LEGACY_GUI) + add_subdirectory(gui) + endif (SYNERGY_BUILD_LEGACY_GUI) ++ ++add_subdirectory(test) +diff --git a/src/test/integtests/CMakeLists.txt b/src/test/integtests/CMakeLists.txt +index f39968a3..096ba3d5 100644 +--- a/src/test/integtests/CMakeLists.txt ++++ b/src/test/integtests/CMakeLists.txt +@@ -68,4 +68,4 @@ endif() + + add_executable(integtests ${sources}) + target_link_libraries(integtests +- arch base client common io ipc mt net platform server synergy gtest gmock ${libs} ${OPENSSL_LIBS}) ++ arch base client common io ipc mt net platform server synlib gtest gmock ${libs} ${OPENSSL_LIBS}) +diff --git a/src/test/integtests/arch/ArchInternetTests.cpp b/src/test/integtests/arch/ArchInternetTests.cpp +deleted file mode 100644 +index 95823e9f..00000000 +--- a/src/test/integtests/arch/ArchInternetTests.cpp ++++ /dev/null +@@ -1,37 +0,0 @@ +-/* +- * synergy -- mouse and keyboard sharing utility +- * Copyright (C) 2014-2016 Symless Ltd. +- * +- * This package is free software; you can redistribute it and/or +- * modify it under the terms of the GNU General Public License +- * found in the file LICENSE that should have accompanied this file. +- * +- * This package is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program. If not, see . +- */ +- +-#include "arch/Arch.h" +- +-#include "test/global/gtest.h" +- +-#define TEST_URL "https://symless.com/tests/?testString" +-//#define TEST_URL "http://localhost/synergy/tests/?testString" +- +-TEST(ArchInternetTests, get) +-{ +- ARCH_INTERNET internet; +- String result = internet.get(TEST_URL); +- ASSERT_EQ("Hello world!", result); +-} +- +-TEST(ArchInternetTests, urlEncode) +-{ +- ARCH_INTERNET internet; +- String result = internet.urlEncode("hello=+&world"); +- ASSERT_EQ("hello%3D%2B%26world", result); +-} +diff --git a/src/test/unittests/CMakeLists.txt b/src/test/unittests/CMakeLists.txt +index 54131eb2..46307e90 100644 +--- a/src/test/unittests/CMakeLists.txt ++++ b/src/test/unittests/CMakeLists.txt +@@ -68,4 +68,4 @@ endif() + + add_executable(unittests ${sources}) + target_link_libraries(unittests +- arch base client server common io net platform server synergy mt ipc gtest gmock shared ${libs} ${OPENSSL_LIBS}) ++ arch base client server common io net platform server synlib mt ipc gtest gmock shared ${libs} ${OPENSSL_LIBS}) +-- +2.25.0 + diff --git a/pkgs/applications/misc/synergy/default.nix b/pkgs/applications/misc/synergy/default.nix index 377d83e59627..69c2e37e3520 100644 --- a/pkgs/applications/misc/synergy/default.nix +++ b/pkgs/applications/misc/synergy/default.nix @@ -1,81 +1,69 @@ -{ stdenv, lib, fetchFromGitHub, fetchpatch, fetchurl, cmake, xlibsWrapper +{ stdenv, lib, fetchFromGitHub, cmake, avahi-compat , ApplicationServices, Carbon, Cocoa, CoreServices, ScreenSaver -, libX11, libXi, libXtst, libXrandr, xinput, curl, openssl, unzip }: +, xlibsWrapper, libX11, libXi, libXtst, libXrandr, xinput, openssl +, withGUI ? true, wrapQtAppsHook }: stdenv.mkDerivation rec { pname = "synergy"; - version = "1.8.8"; + version = "1.11.0"; src = fetchFromGitHub { owner = "symless"; repo = "synergy-core"; - rev = "v${version}-stable"; - sha256 = "0ksgr9hkf09h54572p7k7b9zkfhcdb2g2d5x7ixxn028y8i3jyp3"; + rev = "${version}-stable"; + sha256 = "1jk60xw4h6s5crha89wk4y8rrf1f3bixgh5mzh3cq3xyrkba41gh"; }; - patches = [./openssl-1.1.patch ./update_gtest_gmock.patch - ] ++ lib.optional stdenv.isDarwin ./respect_macos_arch.patch; + patches = [ ./build-tests.patch + ] ++ lib.optional stdenv.isDarwin ./macos_build_fix.patch; - patch_gcc6 = fetchpatch { - url = https://raw.githubusercontent.com/gentoo/gentoo/20e2bff3697ebf5f291e9907b34aae3074a36b53/dev-cpp/gmock/files/gmock-1.7.0-gcc6.patch; - sha256 = "0j3f381x1lf8qci9pfv6mliggl8qs2w05v5lw3rs3gn7aibg174d"; - }; - - # Due to the included gtest and gmock not supporting clang - # we replace it with 1.7.0 for synergy-1.8.8. This should - # become unnecessary when we update to a newer version of Synergy. - gmock_zip = fetchurl { - url = https://github.com/google/googlemock/archive/release-1.7.0.zip; - sha256 = "11bd04098rzamv7f9y01zaf9c8zrmzdk6g1qrlwq780pxzlr4ya0"; - }; - - gtest_zip = fetchurl { - url = https://github.com/google/googletest/archive/release-1.7.0.zip; - sha256 = "1l5n6kzdypjzjrz2jh14ylzrx735lccfx2p3s4ccgci8g9abg35m"; + # Since the included gtest and gmock don't support clang and the + # segfault when built with gcc9, we replace it with 1.10.0 for + # synergy-1.11.0. This should become unnecessary when upstream + # updates these dependencies. + googletest = fetchFromGitHub { + owner = "google"; + repo = "googletest"; + rev = "release-1.10.0"; + sha256 = "1zbmab9295scgg4z2vclgfgjchfjailjnvzc6f5x9jvlsdi3dpwz"; }; postPatch = '' - ${unzip}/bin/unzip -d ext/ ${gmock_zip} - ${unzip}/bin/unzip -d ext/ ${gtest_zip} - mv ext/googlemock-release-1.7.0 ext/gmock-1.7.0 - mv ext/googletest-release-1.7.0 ext/gtest-1.7.0 - patch -d ext/gmock-1.7.0 -p1 -i ${patch_gcc6} - '' - # We have XRRNotifyEvent (libXrandr), but with the upstream CMakeLists.txt - # it's not able to find it (it's trying to search the store path of libX11 - # instead) and we don't get XRandR support, even though the CMake output - # _seems_ to say so: - # - # Looking for XRRQueryExtension in Xrandr - found - # - # The relevant part however is: - # - # Looking for XRRNotifyEvent - not found - # - # So let's force it: - + lib.optionalString stdenv.isLinux '' - sed -i -e '/HAVE_X11_EXTENSIONS_XRANDR_H/c \ - set(HAVE_X11_EXTENSIONS_XRANDR_H true) - ' CMakeLists.txt + rm -r ext/* + cp -r ${googletest}/googlemock ext/gmock/ + cp -r ${googletest}/googletest ext/gtest/ + chmod -R +w ext/ ''; - cmakeFlags = lib.optionals stdenv.isDarwin [ "-DOSX_TARGET_MAJOR=10" "-DOSX_TARGET_MINOR=7" ]; + cmakeFlags = lib.optionals stdenv.isDarwin [ + "-DOSX_TARGET_MAJOR=10" + "-DOSX_TARGET_MINOR=7" + ] ++ lib.optional (!withGUI) "-DSYNERGY_BUILD_LEGACY_GUI=OFF"; + + nativeBuildInputs = [ cmake ] ++ lib.optional withGUI wrapQtAppsHook; + + dontWrapQtApps = true; buildInputs = [ - cmake curl openssl + openssl avahi-compat ] ++ lib.optionals stdenv.isDarwin [ ApplicationServices Carbon Cocoa CoreServices ScreenSaver ] ++ lib.optionals stdenv.isLinux [ xlibsWrapper libX11 libXi libXtst libXrandr xinput ]; installPhase = '' mkdir -p $out/bin - cp ../bin/synergyc $out/bin - cp ../bin/synergys $out/bin - cp ../bin/synergyd $out/bin + cp bin/{synergyc,synergys,synergyd,syntool} $out/bin/ + '' + lib.optionalString withGUI '' + cp bin/synergy $out/bin/ + wrapQtApp $out/bin/synergy --prefix PATH : ${lib.makeBinPath [ openssl ]} + mkdir -p $out/share/icons/hicolor/scalable/apps + cp ../res/synergy.svg $out/share/icons/hicolor/scalable/apps/ + mkdir -p $out/share/applications + substitute ../res/synergy.desktop $out/share/applications/synergy.desktop --replace /usr/bin $out/bin ''; doCheck = true; - checkPhase = "../bin/unittests"; + checkPhase = "bin/unittests"; meta = with lib; { description = "Share one mouse and keyboard between multiple computers"; diff --git a/pkgs/applications/misc/synergy/macos_build_fix.patch b/pkgs/applications/misc/synergy/macos_build_fix.patch new file mode 100644 index 000000000000..2ce277d261b1 --- /dev/null +++ b/pkgs/applications/misc/synergy/macos_build_fix.patch @@ -0,0 +1,29 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a2297311..25a51f56 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -138,7 +138,7 @@ if (UNIX) + + + if (APPLE) +- set (CMAKE_CXX_FLAGS "--sysroot ${CMAKE_OSX_SYSROOT} ${CMAKE_CXX_FLAGS} -DGTEST_USE_OWN_TR1_TUPLE=1") ++ set (CMAKE_CXX_FLAGS "--sysroot ${CMAKE_OSX_SYSROOT} ${CMAKE_CXX_FLAGS}") + + find_library (lib_ScreenSaver ScreenSaver) + find_library (lib_IOKit IOKit) +@@ -292,14 +292,7 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") + ${OPENSSL_ROOT}/lib/libssl.lib + ${OPENSSL_ROOT}/lib/libcrypto.lib + ) +-elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") +- set (OPENSSL_ROOT /usr/local/opt/openssl) +- include_directories (BEFORE SYSTEM ${OPENSSL_ROOT}/include) +- set (OPENSSL_LIBS +- ${OPENSSL_ROOT}/lib/libssl.a +- ${OPENSSL_ROOT}/lib/libcrypto.a +- ) +-elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") ++elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set (OPENSSL_LIBS ssl crypto) + else() + message (FATAL_ERROR "Couldn't find OpenSSL") diff --git a/pkgs/applications/misc/synergy/openssl-1.1.patch b/pkgs/applications/misc/synergy/openssl-1.1.patch deleted file mode 100644 index 56dc6112844e..000000000000 --- a/pkgs/applications/misc/synergy/openssl-1.1.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/src/lib/net/SecureSocket.cpp 2017-07-22 19:33:22.442645291 +0200 -+++ b/src/lib/net/SecureSocket.cpp 2017-07-22 19:36:25.632595581 +0200 -@@ -805,9 +805,14 @@ - showCipherStackDesc(sStack); - } - -+#if OPENSSL_VERSION_NUMBER < 0x10100000L - // m_ssl->m_ssl->session->ciphers is not forward compatable, In future release -- // of OpenSSL, it's not visible, need to use SSL_get_client_ciphers() instead -+ // of OpenSSL, it's not visible - STACK_OF(SSL_CIPHER) * cStack = m_ssl->m_ssl->session->ciphers; -+#else -+ // Use SSL_get_client_ciphers() for newer versions -+ STACK_OF(SSL_CIPHER) * cStack = SSL_get_client_ciphers(m_ssl->m_ssl); -+#endif - if (cStack == NULL) { - LOG((CLOG_DEBUG1 "remote cipher list not available")); - } diff --git a/pkgs/applications/misc/synergy/respect_macos_arch.patch b/pkgs/applications/misc/synergy/respect_macos_arch.patch deleted file mode 100644 index 003d7d22421a..000000000000 --- a/pkgs/applications/misc/synergy/respect_macos_arch.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 944177c76d4c7ff5ef3460eab28286a45344a0e7 Mon Sep 17 00:00:00 2001 -From: Michael Hoang -Date: Sat, 14 Jul 2018 21:56:59 +1000 -Subject: [PATCH 2/2] Make sure CMake respects the current arch on macOS - -Only set the macOS architecture if not defined by the user. Use the -OpenSSL libraries and headers from Nix on macOS to prevent architecture -mismatches. ---- - CMakeLists.txt | 2 +- - src/CMakeLists.txt | 14 +------------- - 2 files changed, 2 insertions(+), 14 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 2f37424d..c7217e28 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -172,7 +172,7 @@ if (UNIX) - # <= 10.5: 32-bit Intel and PowerPC - set(CMAKE_OSX_ARCHITECTURES "ppc;i386" - CACHE STRING "" FORCE) -- else() -+ elseif (NOT CMAKE_OSX_ARCHITECTURES) - # >= 10.6: Intel only - set(CMAKE_OSX_ARCHITECTURES "i386" - CACHE STRING "" FORCE) -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 237ba484..04428636 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -23,11 +23,6 @@ if (WIN32) - set(OPENSSL_INCLUDE ${CMAKE_SOURCE_DIR}/ext/${OPENSSL_PLAT_DIR}/inc32) - endif() - --if (APPLE) -- set(OPENSSL_PLAT_DIR openssl-osx) -- set(OPENSSL_INCLUDE ${CMAKE_SOURCE_DIR}/ext/${OPENSSL_PLAT_DIR}/include) --endif() -- - if (WIN32) - set(OPENSSL_LIBS - ${CMAKE_SOURCE_DIR}/ext/${OPENSSL_PLAT_DIR}/out32dll/libeay32.lib -@@ -36,14 +31,7 @@ if (WIN32) - endif() - - if (UNIX) -- if (APPLE) -- set(OPENSSL_LIBS -- ${CMAKE_SOURCE_DIR}/ext/${OPENSSL_PLAT_DIR}/libssl.a -- ${CMAKE_SOURCE_DIR}/ext/${OPENSSL_PLAT_DIR}/libcrypto.a -- ) -- else() -- set(OPENSSL_LIBS ssl crypto) -- endif() -+ set(OPENSSL_LIBS ssl crypto) - endif() - - add_subdirectory(lib) --- -2.17.1 - diff --git a/pkgs/applications/misc/synergy/update_gtest_gmock.patch b/pkgs/applications/misc/synergy/update_gtest_gmock.patch deleted file mode 100644 index 87b53e78585b..000000000000 --- a/pkgs/applications/misc/synergy/update_gtest_gmock.patch +++ /dev/null @@ -1,158 +0,0 @@ -From eea85dbf4bbde545d8cb07d7ee9fbdca3dcf48fd Mon Sep 17 00:00:00 2001 -From: Michael Hoang -Date: Sat, 14 Jul 2018 22:07:39 +1000 -Subject: [PATCH 1/2] Update gtest and gmock to version 1.7.0 - -Fixes compilation under clang on macOS as is now found under -. ---- - CMakeLists.txt | 2 +- - ext/toolchain/commands1.py | 4 ++-- - src/lib/platform/CMakeLists.txt | 2 +- - src/lib/server/CMakeLists.txt | 2 +- - src/lib/shared/CMakeLists.txt | 2 +- - src/lib/synergy/CMakeLists.txt | 2 +- - src/test/CMakeLists.txt | 12 ++++++------ - src/test/integtests/CMakeLists.txt | 4 ++-- - src/test/unittests/CMakeLists.txt | 4 ++-- - 9 files changed, 17 insertions(+), 17 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 94c474e8..2f37424d 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -178,7 +178,7 @@ if (UNIX) - CACHE STRING "" FORCE) - endif() - -- set(CMAKE_CXX_FLAGS "--sysroot ${CMAKE_OSX_SYSROOT} ${CMAKE_CXX_FLAGS} -DGTEST_USE_OWN_TR1_TUPLE=1") -+ set(CMAKE_CXX_FLAGS "--sysroot ${CMAKE_OSX_SYSROOT} ${CMAKE_CXX_FLAGS}") - - find_library(lib_ScreenSaver ScreenSaver) - find_library(lib_IOKit IOKit) -diff --git a/ext/toolchain/commands1.py b/ext/toolchain/commands1.py -index f32ec483..bf997cf6 100644 ---- a/ext/toolchain/commands1.py -+++ b/ext/toolchain/commands1.py -@@ -251,10 +251,10 @@ class InternalCommands: - macIdentity = None - - # gtest dir with version number -- gtestDir = 'gtest-1.6.0' -+ gtestDir = 'gtest-1.7.0' - - # gmock dir with version number -- gmockDir = 'gmock-1.6.0' -+ gmockDir = 'gmock-1.7.0' - - win32_generators = { - 1 : VisualStudioGenerator('10'), -diff --git a/src/lib/platform/CMakeLists.txt b/src/lib/platform/CMakeLists.txt -index 481d8ef9..1ce67eca 100644 ---- a/src/lib/platform/CMakeLists.txt -+++ b/src/lib/platform/CMakeLists.txt -@@ -31,7 +31,7 @@ endif() - - include_directories( - ../ -- ../../../ext/gtest-1.6.0/include -+ ../../../ext/gtest-1.7.0/include - ) - - if (UNIX) -diff --git a/src/lib/server/CMakeLists.txt b/src/lib/server/CMakeLists.txt -index 3cb582ec..0525d627 100644 ---- a/src/lib/server/CMakeLists.txt -+++ b/src/lib/server/CMakeLists.txt -@@ -24,7 +24,7 @@ endif() - include_directories( - ../ - ../../../ext -- ../../../ext/gtest-1.6.0/include -+ ../../../ext/gtest-1.7.0/include - ) - - if (UNIX) -diff --git a/src/lib/shared/CMakeLists.txt b/src/lib/shared/CMakeLists.txt -index 891f4aa7..16c8b04a 100644 ---- a/src/lib/shared/CMakeLists.txt -+++ b/src/lib/shared/CMakeLists.txt -@@ -25,7 +25,7 @@ add_library(shared STATIC ${sources}) - include_directories( - ../ - ../../../ext -- ../../../ext/gtest-1.6.0/include -+ ../../../ext/gtest-1.7.0/include - ) - - target_link_libraries(shared arch base) -diff --git a/src/lib/synergy/CMakeLists.txt b/src/lib/synergy/CMakeLists.txt -index 0972be8c..e19fcce5 100644 ---- a/src/lib/synergy/CMakeLists.txt -+++ b/src/lib/synergy/CMakeLists.txt -@@ -36,7 +36,7 @@ endif() - include_directories( - ../ - ../../../ext -- ../../../ext/gtest-1.6.0/include -+ ../../../ext/gtest-1.7.0/include - ) - - if (UNIX) -diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt -index 8812150a..04cdfc50 100644 ---- a/src/test/CMakeLists.txt -+++ b/src/test/CMakeLists.txt -@@ -15,13 +15,13 @@ - # along with this program. If not, see . - - include_directories( -- ../../ext/gtest-1.6.0 -- ../../ext/gtest-1.6.0/include -- ../../ext/gmock-1.6.0 -- ../../ext/gmock-1.6.0/include) -+ ../../ext/gtest-1.7.0 -+ ../../ext/gtest-1.7.0/include -+ ../../ext/gmock-1.7.0 -+ ../../ext/gmock-1.7.0/include) - --add_library(gtest STATIC ../../ext/gtest-1.6.0/src/gtest-all.cc) --add_library(gmock STATIC ../../ext/gmock-1.6.0/src/gmock-all.cc) -+add_library(gtest STATIC ../../ext/gtest-1.7.0/src/gtest-all.cc) -+add_library(gmock STATIC ../../ext/gmock-1.7.0/src/gmock-all.cc) - - if (UNIX) - # ignore warnings in gtest and gmock -diff --git a/src/test/integtests/CMakeLists.txt b/src/test/integtests/CMakeLists.txt -index 2f1ca7f3..6ddbd29a 100644 ---- a/src/test/integtests/CMakeLists.txt -+++ b/src/test/integtests/CMakeLists.txt -@@ -56,8 +56,8 @@ endif() - include_directories( - ../../ - ../../lib/ -- ../../../ext/gtest-1.6.0/include -- ../../../ext/gmock-1.6.0/include -+ ../../../ext/gtest-1.7.0/include -+ ../../../ext/gmock-1.7.0/include - ) - - if (UNIX) -diff --git a/src/test/unittests/CMakeLists.txt b/src/test/unittests/CMakeLists.txt -index 3e49dc3c..5f6c4fac 100644 ---- a/src/test/unittests/CMakeLists.txt -+++ b/src/test/unittests/CMakeLists.txt -@@ -51,8 +51,8 @@ list(APPEND headers ${platform_sources}) - include_directories( - ../../ - ../../lib/ -- ../../../ext/gtest-1.6.0/include -- ../../../ext/gmock-1.6.0/include -+ ../../../ext/gtest-1.7.0/include -+ ../../../ext/gmock-1.7.0/include - ../../../ext - ) - --- -2.17.1 - diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ca3ce8928406..f768541ad806 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -21614,11 +21614,13 @@ in systemdSupport = true; }; - synergy = callPackage ../applications/misc/synergy { + synergy = libsForQt5.callPackage ../applications/misc/synergy { stdenv = if stdenv.cc.isClang then llvmPackages_5.stdenv else stdenv; inherit (darwin.apple_sdk.frameworks) ApplicationServices Carbon Cocoa CoreServices ScreenSaver; }; + synergyWithoutGUI = synergy.override { withGUI = false; }; + tabbed = callPackage ../applications/window-managers/tabbed { # if you prefer a custom config, write the config.h in tabbed.config.h # and enable