about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/tdlib
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/tdlib')
-rw-r--r--nixpkgs/pkgs/development/libraries/tdlib/default.nix40
1 files changed, 40 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/tdlib/default.nix b/nixpkgs/pkgs/development/libraries/tdlib/default.nix
new file mode 100644
index 000000000000..b3802c3a4514
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/tdlib/default.nix
@@ -0,0 +1,40 @@
+{ fetchFromGitHub, gperf, openssl, readline, zlib, cmake, lib, stdenv }:
+
+stdenv.mkDerivation rec {
+  pname = "tdlib";
+  version = "1.8.16";
+
+  src = fetchFromGitHub {
+    owner = "tdlib";
+    repo = "td";
+
+    # The tdlib authors do not set tags for minor versions, but
+    # external programs depending on tdlib constrain the minor
+    # version, hence we set a specific commit with a known version.
+    rev = "cde095db6c75827fe4bd237039574aad373ad96b";
+    hash = "sha256-m/RN6g0GxPiSvDZbiOaJFcT2j0K7sIaVGaxKWMVn6v8=";
+  };
+
+  buildInputs = [ gperf openssl readline zlib ];
+  nativeBuildInputs = [ cmake ];
+
+  # https://github.com/tdlib/td/issues/1974
+  postPatch = ''
+    substituteInPlace CMake/GeneratePkgConfig.cmake \
+      --replace 'function(generate_pkgconfig' \
+                'include(GNUInstallDirs)
+                 function(generate_pkgconfig' \
+      --replace '\$'{prefix}/'$'{CMAKE_INSTALL_LIBDIR} '$'{CMAKE_INSTALL_FULL_LIBDIR} \
+      --replace '\$'{prefix}/'$'{CMAKE_INSTALL_INCLUDEDIR} '$'{CMAKE_INSTALL_FULL_INCLUDEDIR}
+  '' + lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) ''
+    sed -i "/vptr/d" test/CMakeLists.txt
+  '';
+
+  meta = with lib; {
+    description = "Cross-platform library for building Telegram clients";
+    homepage = "https://core.telegram.org/tdlib/";
+    license = [ licenses.boost ];
+    platforms = platforms.unix;
+    maintainers = [ maintainers.vyorkin ];
+  };
+}