obs-studio: package the missing ndi library to make the obs-ndi plug-in actually work

This commit is contained in:
Peter Simons 2019-11-18 10:15:52 +01:00
parent 2a7f05f9be
commit c95664665d
4 changed files with 87 additions and 6 deletions

View File

@ -0,0 +1,17 @@
diff --git a/src/obs-ndi.cpp b/src/obs-ndi.cpp
index 493831c..7b0f8db 100644
--- a/src/obs-ndi.cpp
+++ b/src/obs-ndi.cpp
@@ -197,11 +197,7 @@ const char* obs_module_description()
const NDIlib_v4* load_ndilib()
{
QStringList locations;
- locations << QString(qgetenv(NDILIB_REDIST_FOLDER));
-#if defined(__linux__) || defined(__APPLE__)
- locations << "/usr/lib";
- locations << "/usr/local/lib";
-#endif
+ locations << "@NDI@/lib";
for (QString path : locations) {
blog(LOG_INFO, "Trying '%s'", path.toUtf8().constData());

View File

@ -2,15 +2,18 @@
# somewhat manually install this:
# nix-env -f "<nixpkgs>" -iA obs-ndi
# mkdir -p ~/.config/obs-studio/plugins
# ln -s ~/.nix-profile/share/obs/obs-plugins/obs-ndi ~/.config/obs-studio/plugins/
# mkdir -p ~/.config/obs-studio/plugins/bin
# ln -s ~/.nix-profile/lib/obs-plugins/obs-ndi.so ~/.config/obs-studio/plugins/bin/
{ stdenv, fetchFromGitHub, obs-studio, cmake, qt5 }:
{ stdenv, fetchFromGitHub, obs-studio, cmake, qt5, ndi }:
stdenv.mkDerivation rec {
pname = "obs-ndi";
version = "4.7.1";
nativeBuildInputs = [ cmake ];
buildInputs = [ obs-studio qt5.qtbase ndi ];
src = fetchFromGitHub {
owner = "Palakis";
repo = "obs-ndi";
@ -18,10 +21,9 @@ stdenv.mkDerivation rec {
sha256 = "040fkbf3f3qgqcrd3072y3zrjb4fwga8zr10jym744xd7bgyylqh";
};
patches = [ ./fix-search-path.patch ];
patches = [ ./fix-search-path.patch ./hardcode-ndi-path.patch ];
nativeBuildInputs = [ cmake ];
buildInputs = [ obs-studio qt5.qtbase ];
postPatch = "sed -i -e s,@NDI@,${ndi},g src/obs-ndi.cpp";
cmakeFlags = [
"-DLIBOBS_INCLUDE_DIR=${obs-studio}/include/obs"

View File

@ -0,0 +1,60 @@
{ stdenv, requireFile, avahi }:
stdenv.mkDerivation rec {
pname = "ndi";
version = "4";
src = requireFile rec {
name = "InstallNDISDK_v${version}_Linux.tar.gz";
sha256 = "1hac5npyg8nifs9ipj34pkn0zjyx8774x3i3h8znhmijx2j2982p";
message = ''
In order to use the NDI SDK, you need to comply with NewTek's license and
download the Linux version ${version} tarball from:
${meta.homepage}
Once you have downloaded the file, please use the following command and
re-run the installation:
nix-prefetch-url file://\$PWD/${name}
'';
};
buildInputs = [ avahi ];
unpackPhase = ''
unpackFile ${src}
echo y | ./InstallNDISDK_v4_Linux.sh
sourceRoot="NDI SDK for Linux";
'';
installPhase = ''
mkdir $out
mv bin/x86_64-linux-gnu $out/bin
for i in $out/bin/*; do
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$i"
done
patchelf --set-rpath "${avahi}/lib:${stdenv.cc.libc}/lib" $out/bin/ndi-record
mv lib/x86_64-linux-gnu $out/lib
for i in $out/lib/*; do
if [ -L "$i" ]; then continue; fi
patchelf --set-rpath "${avahi}/lib:${stdenv.cc.libc}/lib" "$i"
done
mv include examples $out/
mkdir -p $out/share/doc/${pname}-${version}
mv licenses $out/share/doc/${pname}-${version}/licenses
mv logos $out/share/doc/${pname}-${version}/logos
mv documentation/* $out/share/doc/${pname}-${version}/
'';
# Stripping breaks ndi-record.
dontStrip = true;
meta = with stdenv.lib; {
homepage = "https://ndi.tv/sdk/";
description = "NDI Software Developer Kit";
platforms = ["x86_64-linux"];
hydraPlatforms = [];
license = licenses.unfree;
};
}

View File

@ -13181,6 +13181,8 @@ in
then null
else callPackage ../development/libraries/ncurses { };
ndi = callPackage ../development/libraries/ndi { };
neardal = callPackage ../development/libraries/neardal { };
neon = callPackage ../development/libraries/neon { };