diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/mtxclient')
-rw-r--r-- | nixpkgs/pkgs/development/libraries/mtxclient/default.nix | 62 | ||||
-rw-r--r-- | nixpkgs/pkgs/development/libraries/mtxclient/fix-compilation-with-olm-3.2.5.patch | 22 |
2 files changed, 84 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/mtxclient/default.nix b/nixpkgs/pkgs/development/libraries/mtxclient/default.nix new file mode 100644 index 000000000000..81b84e1a11fe --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/mtxclient/default.nix @@ -0,0 +1,62 @@ +{ lib, stdenv +, fetchFromGitHub +, fetchpatch +, cmake +, pkg-config +, openssl +, olm +, spdlog +, nlohmann_json +, coeurl +, libevent +, curl +}: + +stdenv.mkDerivation rec { + pname = "mtxclient"; + version = "0.8.0"; + + src = fetchFromGitHub { + owner = "Nheko-Reborn"; + repo = "mtxclient"; + rev = "v${version}"; + sha256 = "sha256-SQoPeUdDNQU4qYDd8udQnIJ6PrZFtEOmf9uqnw1+fz4="; + }; + + postPatch = '' + # See https://github.com/gabime/spdlog/issues/1897 + sed -i '1a add_compile_definitions(SPDLOG_FMT_EXTERNAL)' CMakeLists.txt + ''; + + cmakeFlags = [ + # Network requiring tests can't be disabled individually: + # https://github.com/Nheko-Reborn/mtxclient/issues/22 + "-DBUILD_LIB_TESTS=OFF" + "-DBUILD_LIB_EXAMPLES=OFF" + ]; + + nativeBuildInputs = [ + cmake + pkg-config + ]; + buildInputs = [ + spdlog + nlohmann_json + openssl + olm + coeurl + libevent + curl + ]; + + meta = with lib; { + description = "Client API library for the Matrix protocol."; + homepage = "https://github.com/Nheko-Reborn/mtxclient"; + license = licenses.mit; + maintainers = with maintainers; [ fpletz pstn ]; + platforms = platforms.all; + # Should be fixable if a higher clang version is used, see: + # https://github.com/NixOS/nixpkgs/pull/85922#issuecomment-619287177 + broken = stdenv.targetPlatform.isDarwin; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/mtxclient/fix-compilation-with-olm-3.2.5.patch b/nixpkgs/pkgs/development/libraries/mtxclient/fix-compilation-with-olm-3.2.5.patch new file mode 100644 index 000000000000..02337d56f1ff --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/mtxclient/fix-compilation-with-olm-3.2.5.patch @@ -0,0 +1,22 @@ +diff -Naur old/lib/crypto/client.cpp c5pf6ygk9v9rdwwr3dyd24wghflp0vmx-source/lib/crypto/client.cpp +--- old/lib/crypto/client.cpp 2021-10-22 19:31:52.159836190 +0300 ++++ c5pf6ygk9v9rdwwr3dyd24wghflp0vmx-source/lib/crypto/client.cpp 2021-10-22 19:30:42.882010441 +0300 +@@ -37,15 +37,15 @@ + + }; + +-OlmErrorCode ++mtx::crypto::OlmErrorCode + olm_exception::ec_from_string(std::string_view error) + { + for (size_t i = 0; i < olmErrorStrings.size(); i++) { + if (olmErrorStrings[i] == error) +- return static_cast<OlmErrorCode>(i); ++ return static_cast<mtx::crypto::OlmErrorCode>(i); + } + +- return OlmErrorCode::UNKNOWN_ERROR; ++ return mtx::crypto::OlmErrorCode::UNKNOWN_ERROR; + } + + void |