1{ fetchFromGitHub, gperf, openssl, readline, zlib, cmake, lib, stdenv }:
2
3stdenv.mkDerivation rec {
4 pname = "tdlib";
5 version = "1.8.10";
6
7 src = fetchFromGitHub {
8 owner = "tdlib";
9 repo = "td";
10
11 # The tdlib authors do not set tags for minor versions, but
12 # external programs depending on tdlib constrain the minor
13 # version, hence we set a specific commit with a known version.
14 rev = "93c42f6d7c1209937431469f80427d48907f1b8d";
15 hash = "sha256-vdaVnC26txUBp8rlqx1CdLHlNlack3XXYdfFal1VLh4=";
16 };
17
18 buildInputs = [ gperf openssl readline zlib ];
19 nativeBuildInputs = [ cmake ];
20
21 # https://github.com/tdlib/td/issues/1974
22 postPatch = ''
23 substituteInPlace CMake/GeneratePkgConfig.cmake \
24 --replace 'function(generate_pkgconfig' \
25 'include(GNUInstallDirs)
26 function(generate_pkgconfig' \
27 --replace '\$'{prefix}/'$'{CMAKE_INSTALL_LIBDIR} '$'{CMAKE_INSTALL_FULL_LIBDIR} \
28 --replace '\$'{prefix}/'$'{CMAKE_INSTALL_INCLUDEDIR} '$'{CMAKE_INSTALL_FULL_INCLUDEDIR}
29 '' + lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) ''
30 sed -i "/vptr/d" test/CMakeLists.txt
31 '';
32
33 meta = with lib; {
34 description = "Cross-platform library for building Telegram clients";
35 homepage = "https://core.telegram.org/tdlib/";
36 license = [ licenses.boost ];
37 platforms = platforms.unix;
38 maintainers = [ maintainers.vyorkin ];
39 };
40}