live555: build dynamic, add check (#396471)

authored by

lassulus and committed by
GitHub
9b1b5679 b53c0d27

+36 -8
+36 -8
pkgs/by-name/li/live555/package.nix
··· 1 1 { 2 - lib, 2 + buildPackages, 3 3 cctools, 4 4 fetchpatch, 5 5 fetchurl, 6 + lib, 7 + live555, 6 8 openssl, 9 + runCommand, 7 10 stdenv, 8 - vlc, 9 11 }: 12 + let 13 + isStatic = stdenv.hostPlatform.isStatic; 14 + in 10 15 11 16 stdenv.mkDerivation (finalAttrs: { 12 17 pname = "live555"; ··· 42 47 "PREFIX=${placeholder "out"}" 43 48 "C_COMPILER=$(CC)" 44 49 "CPLUSPLUS_COMPILER=$(CXX)" 45 - "LIBRARY_LINK=$(AR) cr " 46 50 "LINK=$(CXX) -o " 51 + "LIBRARY_LINK=${if isStatic then "$(AR) cr " else "$(CC) -o "}" 47 52 ]; 48 53 49 54 # Since NIX_CFLAGS_COMPILE affects both C and C++ toolchains, we set CXXFLAGS ··· 83 88 let 84 89 platform = 85 90 if stdenv.hostPlatform.isLinux then 86 - "linux" 91 + if isStatic then "linux" else "linux-with-shared-libraries" 87 92 else if stdenv.hostPlatform.isDarwin then 88 93 "macosx-catalina" 89 94 else ··· 97 102 runHook postConfigure 98 103 ''; 99 104 100 - passthru.tests = { 101 - # Downstream dependency 102 - inherit vlc; 103 - }; 105 + doInstallCheck = true; 106 + installCheckPhase = '' 107 + if ! ($out/bin/openRTSP || :) 2>&1 | grep -q "Usage: "; then 108 + echo "Executing example program failed" >&2 109 + exit 1 110 + else 111 + echo "Example program executed successfully" 112 + fi 113 + ''; 114 + 115 + passthru.tests = 116 + let 117 + emulator = stdenv.hostPlatform.emulator buildPackages; 118 + in 119 + { 120 + # The installCheck phase above cannot be ran in cross-compilation scenarios, 121 + # therefore the passthru test 122 + run-test-prog = runCommand "live555-run-test-prog" { } '' 123 + if ! (${emulator} ${live555}/bin/openRTSP || :) 2>&1 | grep -q "Usage: "; then 124 + echo "Executing example program failed" >&2 125 + exit 1 126 + else 127 + echo "Example program executed successfully" 128 + touch $out 129 + fi 130 + ''; 131 + }; 104 132 105 133 meta = { 106 134 homepage = "http://www.live555.com/liveMedia/";