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