1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 openssl,
7 windows,
8}:
9
10stdenv.mkDerivation rec {
11 pname = "srt";
12 version = "1.5.4";
13
14 src = fetchFromGitHub {
15 owner = "Haivision";
16 repo = "srt";
17 rev = "v${version}";
18 sha256 = "sha256-NLy9GuP4OT/kKAIIDXSHtsmaBzXRuFohFM/aM+46cao=";
19 };
20
21 nativeBuildInputs = [ cmake ];
22
23 buildInputs = [
24 openssl
25 ]
26 ++ lib.optionals stdenv.hostPlatform.isMinGW [
27 windows.pthreads
28 ];
29
30 patches = lib.optionals stdenv.hostPlatform.isMinGW [
31 ./no-msvc-compat-headers.patch
32 ];
33
34 cmakeFlags = [
35 # the cmake package does not handle absolute CMAKE_INSTALL_INCLUDEDIR correctly
36 # (setting it to an absolute path causes include files to go to $out/$out/include,
37 # because the absolute path is interpreted with root at $out).
38 "-DCMAKE_INSTALL_INCLUDEDIR=include"
39 "-DENABLE_SHARED=${if stdenv.hostPlatform.isStatic then "OFF" else "ON"}"
40 # TODO Remove this when https://github.com/Haivision/srt/issues/538 is fixed and available to nixpkgs
41 # Workaround for the fact that srt incorrectly disables GNUInstallDirs when LIBDIR is specified,
42 # see https://github.com/NixOS/nixpkgs/pull/54463#discussion_r249878330
43 "-UCMAKE_INSTALL_LIBDIR"
44 ];
45
46 meta = with lib; {
47 description = "Secure, Reliable, Transport";
48 homepage = "https://github.com/Haivision/srt";
49 license = licenses.mpl20;
50 maintainers = with maintainers; [ nh2 ];
51 platforms = platforms.all;
52 };
53}