gnome-podcasts: 0.7.1 -> 0.7.2 (#373846)
[NixPkgs.git] / pkgs / by-name / li / live555 / package.nix
blob2b24804cb33a21f11fa4910b51c8dc892b26cb95
2   lib,
3   cctools,
4   fetchpatch,
5   fetchurl,
6   openssl,
7   stdenv,
8   vlc,
9 }:
11 stdenv.mkDerivation (finalAttrs: {
12   pname = "live555";
13   version = "2024.09.20";
15   src = fetchurl {
16     urls = [
17       "http://www.live555.com/liveMedia/public/live.${finalAttrs.version}.tar.gz"
18       "https://src.rrz.uni-hamburg.de/files/src/live555/live.${finalAttrs.version}.tar.gz"
19       "https://download.videolan.org/contrib/live555/live.${finalAttrs.version}.tar.gz"
20       "mirror://sourceforge/slackbuildsdirectlinks/live.${finalAttrs.version}.tar.gz"
21     ];
22     hash = "sha256-TrUneCGaJJxC+GgL1ZZ/ZcONeqDH05Bp44/3lkCs9tg=";
23   };
25   patches = [
26     (fetchpatch {
27       name = "0000-cflags-when-darwin.patch";
28       url = "https://github.com/rgaufman/live555/commit/16701af5486bb3a2d25a28edaab07789c8a9ce57.patch?full_index=1";
29       hash = "sha256-IDSdByBu/EBLsUTBe538rWsDwH61RJfAEhvT68Nb9rU=";
30     })
31   ];
33   nativeBuildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
34     cctools
35   ];
37   buildInputs = [
38     openssl
39   ];
41   makeFlags = [
42     "PREFIX=${placeholder "out"}"
43     "C_COMPILER=$(CC)"
44     "CPLUSPLUS_COMPILER=$(CXX)"
45     "LIBRARY_LINK=$(AR) cr "
46     "LINK=$(CXX) -o "
47   ];
49   # Since NIX_CFLAGS_COMPILE affects both C and C++ toolchains, we set CXXFLAGS
50   # directly
51   env.CXXFLAGS = "-std=c++20";
53   strictDeps = true;
55   enableParallelBuilding = true;
57   # required for whitespaces in makeFlags
58   __structuredAttrs = true;
60   postPatch =
61     ''
62       substituteInPlace config.macosx-catalina \
63         --replace '/usr/lib/libssl.46.dylib' "${lib.getLib openssl}/lib/libssl.dylib" \
64         --replace '/usr/lib/libcrypto.44.dylib' "${lib.getLib openssl}/lib/libcrypto.dylib"
65       sed -i -e 's|/bin/rm|rm|g' genMakefiles
66       sed -i \
67         -e 's/$(INCLUDES) -I. -O2 -DSOCKLEN_T/$(INCLUDES) -I. -O2 -I. -fPIC -DRTSPCLIENT_SYNCHRONOUS_INTERFACE=1 -DSOCKLEN_T/g' \
68         config.linux
69     ''
70     # condition from icu/base.nix
71     +
72       lib.optionalString
73         (lib.elem stdenv.hostPlatform.libc [
74           "glibc"
75           "musl"
76         ])
77         ''
78           substituteInPlace liveMedia/include/Locale.hh \
79             --replace '<xlocale.h>' '<locale.h>'
80         '';
82   configurePhase =
83     let
84       platform =
85         if stdenv.hostPlatform.isLinux then
86           "linux"
87         else if stdenv.hostPlatform.isDarwin then
88           "macosx-catalina"
89         else
90           throw "Unsupported platform: ${stdenv.hostPlatform.system}";
91     in
92     ''
93       runHook preConfigure
95       ./genMakefiles ${platform}
97       runHook postConfigure
98     '';
100   passthru.tests = {
101     # Downstream dependency
102     inherit vlc;
103   };
105   meta = {
106     homepage = "http://www.live555.com/liveMedia/";
107     description = "Set of C++ libraries for multimedia streaming, using open standard protocols (RTP/RTCP, RTSP, SIP)";
108     changelog = "http://www.live555.com/liveMedia/public/changelog.txt";
109     license = with lib.licenses; [ lgpl21Plus ];
110     maintainers = with lib.maintainers; [ AndersonTorres ];
111     platforms = lib.platforms.unix;
112   };