1 { lib, stdenv, fetchFromGitHub, cmake
2 , zlib, boost, openssl, python3, ncurses, darwin
8 # Make sure we override python, so the correct version is chosen
9 boostPython = boost.override { enablePython = true; python = python3; };
11 in stdenv.mkDerivation {
12 pname = "libtorrent-rasterbar";
15 src = fetchFromGitHub {
19 hash = "sha256-JrAYtoS8wNmmhbgnprD7vNz1N64ekIryjK77rAKTyaQ=";
20 fetchSubmodules = true;
23 nativeBuildInputs = [ cmake ];
25 buildInputs = [ boostPython openssl zlib python3 ncurses ]
26 ++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.SystemConfiguration ];
29 # provide distutils alternative for python 3.12
33 # https://github.com/arvidn/libtorrent/issues/6865
35 substituteInPlace cmake/Modules/GeneratePkgConfig/target-compile-settings.cmake.in \
36 --replace 'set(_INSTALL_LIBDIR "@CMAKE_INSTALL_LIBDIR@")' \
37 'set(_INSTALL_LIBDIR "@CMAKE_INSTALL_LIBDIR@")
38 set(_INSTALL_FULL_LIBDIR "@CMAKE_INSTALL_FULL_LIBDIR@")'
39 substituteInPlace cmake/Modules/GeneratePkgConfig/pkg-config.cmake.in \
40 --replace '$'{prefix}/@_INSTALL_LIBDIR@ @_INSTALL_FULL_LIBDIR@
44 moveToOutput "include" "$dev"
45 moveToOutput "lib/${python3.libPrefix}" "$python"
49 substituteInPlace "$dev/lib/cmake/LibtorrentRasterbar/LibtorrentRasterbarTargets-release.cmake" \
50 --replace "\''${_IMPORT_PREFIX}/lib" "$out/lib"
53 outputs = [ "out" "dev" "python" ];
56 "-Dpython-bindings=on"
60 homepage = "https://libtorrent.org/";
61 description = "C++ BitTorrent implementation focusing on efficiency and scalability";
62 license = licenses.bsd3;
64 platforms = platforms.unix;