base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / li / libtorrent-rasterbar-2_0_x / package.nix
blob3f85048e4eb715ea9f085e4c0e2cf2b7c2e06f61
1 { lib, stdenv, fetchFromGitHub, cmake
2 , zlib, boost, openssl, python3, ncurses, darwin
3 }:
5 let
6   version = "2.0.10";
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";
13   inherit version;
15   src = fetchFromGitHub {
16     owner = "arvidn";
17     repo = "libtorrent";
18     rev = "v${version}";
19     hash = "sha256-JrAYtoS8wNmmhbgnprD7vNz1N64ekIryjK77rAKTyaQ=";
20     fetchSubmodules = true;
21   };
23   nativeBuildInputs = [ cmake ];
25   buildInputs = [ boostPython openssl zlib python3 ncurses ]
26     ++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.SystemConfiguration ];
28   patches = [
29     # provide distutils alternative for python 3.12
30     ./distutils.patch
31   ];
33   # https://github.com/arvidn/libtorrent/issues/6865
34   postPatch = ''
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@
41   '';
43   postInstall = ''
44     moveToOutput "include" "$dev"
45     moveToOutput "lib/${python3.libPrefix}" "$python"
46   '';
48   postFixup = ''
49     substituteInPlace "$dev/lib/cmake/LibtorrentRasterbar/LibtorrentRasterbarTargets-release.cmake" \
50       --replace "\''${_IMPORT_PREFIX}/lib" "$out/lib"
51   '';
53   outputs = [ "out" "dev" "python" ];
55   cmakeFlags = [
56     "-Dpython-bindings=on"
57   ];
59   meta = with lib; {
60     homepage = "https://libtorrent.org/";
61     description = "C++ BitTorrent implementation focusing on efficiency and scalability";
62     license = licenses.bsd3;
63     maintainers = [ ];
64     platforms = platforms.unix;
65   };