2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, cmake
|
2020-12-25 13:55:36 +00:00
|
|
|
, zlib, boost, openssl, python, ncurses, SystemConfiguration
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "2.0.10";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# Make sure we override python, so the correct version is chosen
|
|
|
|
boostPython = boost.override { enablePython = true; inherit python; };
|
|
|
|
|
|
|
|
in stdenv.mkDerivation {
|
|
|
|
pname = "libtorrent-rasterbar";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "arvidn";
|
|
|
|
repo = "libtorrent";
|
2020-12-25 13:55:36 +00:00
|
|
|
rev = "v${version}";
|
2024-04-21 15:54:59 +00:00
|
|
|
sha256 = "sha256-JrAYtoS8wNmmhbgnprD7vNz1N64ekIryjK77rAKTyaQ=";
|
2020-12-25 13:55:36 +00:00
|
|
|
fetchSubmodules = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2020-12-25 13:55:36 +00:00
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
|
|
|
|
buildInputs = [ boostPython openssl zlib python ncurses ]
|
2021-02-05 17:12:51 +00:00
|
|
|
++ lib.optionals stdenv.isDarwin [ SystemConfiguration ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
# https://github.com/arvidn/libtorrent/issues/6865
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace cmake/Modules/GeneratePkgConfig.cmake \
|
|
|
|
--replace @CMAKE_INSTALL_PREFIX@/'$<'1: '$<'1:
|
|
|
|
substituteInPlace cmake/Modules/GeneratePkgConfig/target-compile-settings.cmake.in \
|
|
|
|
--replace 'set(_INSTALL_LIBDIR "@CMAKE_INSTALL_LIBDIR@")' \
|
|
|
|
'set(_INSTALL_LIBDIR "@CMAKE_INSTALL_LIBDIR@")
|
|
|
|
set(_INSTALL_FULL_LIBDIR "@CMAKE_INSTALL_FULL_LIBDIR@")'
|
|
|
|
substituteInPlace cmake/Modules/GeneratePkgConfig/pkg-config.cmake.in \
|
|
|
|
--replace '$'{prefix}/@_INSTALL_LIBDIR@ @_INSTALL_FULL_LIBDIR@
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postInstall = ''
|
|
|
|
moveToOutput "include" "$dev"
|
|
|
|
moveToOutput "lib/${python.libPrefix}" "$python"
|
|
|
|
'';
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
postFixup = ''
|
|
|
|
substituteInPlace "$dev/lib/cmake/LibtorrentRasterbar/LibtorrentRasterbarTargets-release.cmake" \
|
|
|
|
--replace "\''${_IMPORT_PREFIX}/lib" "$out/lib"
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
outputs = [ "out" "dev" "python" ];
|
|
|
|
|
2020-12-25 13:55:36 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
"-Dpython-bindings=on"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://libtorrent.org/";
|
|
|
|
description = "A C++ BitTorrent implementation focusing on efficiency and scalability";
|
|
|
|
license = licenses.bsd3;
|
2021-12-21 02:18:32 +00:00
|
|
|
maintainers = [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|