1 { lib, stdenv, fetchFromGitHub, cmake
2 , zlib, boost, openssl, python, ncurses, SystemConfiguration
8 # Make sure we override python, so the correct version is chosen
9 boostPython = boost.override { enablePython = true; inherit python; };
11 in stdenv.mkDerivation {
12 pname = "libtorrent-rasterbar";
15 src = fetchFromGitHub {
19 sha256 = "sha256-mMY3NiSL/lYuYmV/KWgfKbs8XukSV4PvQ87tpgBid6M=";
20 fetchSubmodules = true;
23 nativeBuildInputs = [ cmake ];
25 buildInputs = [ boostPython openssl zlib python ncurses ]
26 ++ lib.optionals stdenv.isDarwin [ SystemConfiguration ];
28 # https://github.com/arvidn/libtorrent/issues/6865
30 substituteInPlace cmake/Modules/GeneratePkgConfig.cmake \
31 --replace @CMAKE_INSTALL_PREFIX@/'$<'1: '$<'1:
32 substituteInPlace cmake/Modules/GeneratePkgConfig/target-compile-settings.cmake.in \
33 --replace 'set(_INSTALL_LIBDIR "@CMAKE_INSTALL_LIBDIR@")' \
34 'set(_INSTALL_LIBDIR "@CMAKE_INSTALL_LIBDIR@")
35 set(_INSTALL_FULL_LIBDIR "@CMAKE_INSTALL_FULL_LIBDIR@")'
36 substituteInPlace cmake/Modules/GeneratePkgConfig/pkg-config.cmake.in \
37 --replace '$'{prefix}/@_INSTALL_LIBDIR@ @_INSTALL_FULL_LIBDIR@
41 moveToOutput "include" "$dev"
42 moveToOutput "lib/${python.libPrefix}" "$python"
45 outputs = [ "out" "dev" "python" ];
48 "-Dpython-bindings=on"
52 broken = stdenv.isDarwin;
53 homepage = "https://libtorrent.org/";
54 description = "A C++ BitTorrent implementation focusing on efficiency and scalability";
55 license = licenses.bsd3;
57 platforms = platforms.unix;