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