live555: refactor

- finalAttrs design pattern
- new download stream
- strictDeps
- get rid of nested with
This commit is contained in:
Anderson Torres 2024-01-14 12:59:32 -03:00
parent 8a05729f0b
commit 11e9dd4d26

View file

@ -1,29 +1,34 @@
{ lib { lib
, stdenv
, fetchurl
, darwin , darwin
, fetchurl
, openssl , openssl
, stdenv
# major and only downstream dependency
, vlc , vlc
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation (finalAttrs: {
pname = "live555"; pname = "live555";
version = "2023.05.10"; version = "2023.05.10";
src = fetchurl { src = fetchurl {
urls = [ urls = [
"http://www.live555.com/liveMedia/public/live.${version}.tar.gz" "http://www.live555.com/liveMedia/public/live.${finalAttrs.version}.tar.gz"
"https://download.videolan.org/contrib/live555/live.${version}.tar.gz" "https://src.rrz.uni-hamburg.de/files/src/live555/live.${finalAttrs.version}.tar.gz"
"mirror://sourceforge/slackbuildsdirectlinks/live.${version}.tar.gz" "https://download.videolan.org/contrib/live555/live.${finalAttrs.version}.tar.gz"
"mirror://sourceforge/slackbuildsdirectlinks/live.${finalAttrs.version}.tar.gz"
]; ];
sha256 = "sha256-6ph9x4UYELkkJVIE9r25ycc5NOYbPcgAy9LRZebvGFY="; hash = "sha256-6ph9x4UYELkkJVIE9r25ycc5NOYbPcgAy9LRZebvGFY=";
}; };
nativeBuildInputs = lib.optional stdenv.isDarwin darwin.cctools; nativeBuildInputs = lib.optionals stdenv.isDarwin [
darwin.cctools
];
buildInputs = [ openssl ]; buildInputs = [
openssl
];
strictDeps = true;
postPatch = '' postPatch = ''
substituteInPlace config.macosx-catalina \ substituteInPlace config.macosx-catalina \
@ -33,43 +38,45 @@ stdenv.mkDerivation rec {
sed -i \ sed -i \
-e 's/$(INCLUDES) -I. -O2 -DSOCKLEN_T/$(INCLUDES) -I. -O2 -I. -fPIC -DRTSPCLIENT_SYNCHRONOUS_INTERFACE=1 -DSOCKLEN_T/g' \ -e 's/$(INCLUDES) -I. -O2 -DSOCKLEN_T/$(INCLUDES) -I. -O2 -I. -fPIC -DRTSPCLIENT_SYNCHRONOUS_INTERFACE=1 -DSOCKLEN_T/g' \
config.linux config.linux
'' # condition from icu/base.nix ''
+ lib.optionalString (stdenv.hostPlatform.libc == "glibc" || stdenv.hostPlatform.libc == "musl") '' # condition from icu/base.nix
+ lib.optionalString (stdenv.hostPlatform.libc == "glibc"
|| stdenv.hostPlatform.libc == "musl") ''
substituteInPlace liveMedia/include/Locale.hh \ substituteInPlace liveMedia/include/Locale.hh \
--replace '<xlocale.h>' '<locale.h>' --replace '<xlocale.h>' '<locale.h>'
''; '';
configurePhase = '' configurePhase = let
platform = if stdenv.isLinux
then "linux"
else if stdenv.isDarwin
then "macosx-catalina"
else throw "Unsupported platform: ${stdenv.hostPlatform.system}";
in ''
runHook preConfigure runHook preConfigure
./genMakefiles ${ ./genMakefiles ${platform}
if stdenv.isLinux then
"linux"
else if stdenv.isDarwin then
"macosx-catalina"
else
throw "Unsupported platform ${stdenv.hostPlatform.system}"}
runHook postConfigure runHook postConfigure
''; '';
makeFlags = [ makeFlags = [
"DESTDIR=${placeholder "out"}" "PREFIX=${placeholder "out"}"
"PREFIX="
]; ];
enableParallelBuilding = true; enableParallelBuilding = true;
passthru.tests = { passthru.tests = {
# Downstream dependency
inherit vlc; inherit vlc;
}; };
meta = with lib; { meta = {
homepage = "http://www.live555.com/liveMedia/"; homepage = "http://www.live555.com/liveMedia/";
description = "Set of C++ libraries for multimedia streaming, using open standard protocols (RTP/RTCP, RTSP, SIP)"; description = "Set of C++ libraries for multimedia streaming, using open standard protocols (RTP/RTCP, RTSP, SIP)";
changelog = "http://www.live555.com/liveMedia/public/changelog.txt"; changelog = "http://www.live555.com/liveMedia/public/changelog.txt";
license = licenses.lgpl21Plus; license = with lib.licenses; [ lgpl21Plus ];
maintainers = with maintainers; [ AndersonTorres ]; maintainers = with lib.maintainers; [ AndersonTorres ];
platforms = platforms.unix; platforms = lib.platforms.unix;
}; };
} })