live555: build dynamic, add check (#396471)

This commit is contained in:
lassulus
2025-04-25 17:05:40 +09:00
committed by GitHub
+36 -8
View File
@@ -1,12 +1,17 @@
{
lib,
buildPackages,
cctools,
fetchpatch,
fetchurl,
lib,
live555,
openssl,
runCommand,
stdenv,
vlc,
}:
let
isStatic = stdenv.hostPlatform.isStatic;
in
stdenv.mkDerivation (finalAttrs: {
pname = "live555";
@@ -42,8 +47,8 @@ stdenv.mkDerivation (finalAttrs: {
"PREFIX=${placeholder "out"}"
"C_COMPILER=$(CC)"
"CPLUSPLUS_COMPILER=$(CXX)"
"LIBRARY_LINK=$(AR) cr "
"LINK=$(CXX) -o "
"LIBRARY_LINK=${if isStatic then "$(AR) cr " else "$(CC) -o "}"
];
# Since NIX_CFLAGS_COMPILE affects both C and C++ toolchains, we set CXXFLAGS
@@ -83,7 +88,7 @@ stdenv.mkDerivation (finalAttrs: {
let
platform =
if stdenv.hostPlatform.isLinux then
"linux"
if isStatic then "linux" else "linux-with-shared-libraries"
else if stdenv.hostPlatform.isDarwin then
"macosx-catalina"
else
@@ -97,10 +102,33 @@ stdenv.mkDerivation (finalAttrs: {
runHook postConfigure
'';
passthru.tests = {
# Downstream dependency
inherit vlc;
};
doInstallCheck = true;
installCheckPhase = ''
if ! ($out/bin/openRTSP || :) 2>&1 | grep -q "Usage: "; then
echo "Executing example program failed" >&2
exit 1
else
echo "Example program executed successfully"
fi
'';
passthru.tests =
let
emulator = stdenv.hostPlatform.emulator buildPackages;
in
{
# The installCheck phase above cannot be ran in cross-compilation scenarios,
# therefore the passthru test
run-test-prog = runCommand "live555-run-test-prog" { } ''
if ! (${emulator} ${live555}/bin/openRTSP || :) 2>&1 | grep -q "Usage: "; then
echo "Executing example program failed" >&2
exit 1
else
echo "Example program executed successfully"
touch $out
fi
'';
};
meta = {
homepage = "http://www.live555.com/liveMedia/";