3p/nixpkgs: add OBS Studio bits to make things work

This commit is contained in:
Luke Granger-Brown 2023-07-11 12:01:25 +01:00
parent 528ed1debc
commit becf0d9fd6
5 changed files with 125 additions and 25 deletions

View file

@ -1,26 +1,41 @@
From e8c4b54f753e57382ec756f07c114202bd9a19b8 Mon Sep 17 00:00:00 2001
From: Luke Granger-Brown <git@lukegb.com>
Date: Thu, 6 Jul 2023 15:30:49 +0100
Subject: [PATCH] Provide runtime plugin destination as relative path
---
libobs/CMakeLists.txt | 2 ++
libobs/obsconfig.h.in | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/libobs/CMakeLists.txt b/libobs/CMakeLists.txt
index 790583cd5..763cf3548 100644
index 1c092e1b8..3916a6216 100644
--- a/libobs/CMakeLists.txt
+++ b/libobs/CMakeLists.txt
@@ -455,6 +455,8 @@ elseif(OS_POSIX)
libobs PROPERTIES BUILD_RPATH "$<TARGET_FILE_DIR:OBS::libobs-opengl>")
@@ -253,6 +253,8 @@ elseif(OS_FREEBSD)
include(cmake/os-freebsd.cmake)
endif()
+string(REGEX REPLACE "^${OBS_INSTALL_PREFIX}" "" OBS_PLUGIN_DESTINATION_RELATIVE ${OBS_PLUGIN_DESTINATION})
+set(OBS_PLUGIN_DESTINATION_RELATIVE "lib/obs-plugins")
+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/obsconfig.h.in
${CMAKE_BINARY_DIR}/config/obsconfig.h)
configure_file(obsconfig.h.in "${CMAKE_BINARY_DIR}/config/obsconfig.h" @ONLY)
target_include_directories(libobs PUBLIC "$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/config>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>")
diff --git a/libobs/obsconfig.h.in b/libobs/obsconfig.h.in
index 4a664285a..5cff2ca53 100644
index b4de06623..c6dd9aba8 100644
--- a/libobs/obsconfig.h.in
+++ b/libobs/obsconfig.h.in
@@ -13,7 +13,7 @@
#define OBS_VERSION_CANONICAL "@OBS_VERSION_CANONICAL@"
#define OBS_DATA_PATH "@OBS_DATA_PATH@"
#define OBS_INSTALL_PREFIX "@OBS_INSTALL_PREFIX@"
-#define OBS_PLUGIN_DESTINATION "@OBS_PLUGIN_DESTINATION@"
+#define OBS_PLUGIN_DESTINATION "@OBS_PLUGIN_DESTINATION_RELATIVE@"
#define OBS_QT_VERSION @_QT_VERSION@
@@ -2,7 +2,9 @@
#cmakedefine LINUX_PORTABLE
#cmakedefine OBS_DATA_PATH "@OBS_DATA_PATH@"
#cmakedefine OBS_PLUGIN_PATH "@OBS_PLUGIN_PATH@"
-#cmakedefine OBS_PLUGIN_DESTINATION "@OBS_PLUGIN_DESTINATION@"
+#define OBS_PLUGIN_DESTINATION "lib/obs-plugins"
+#cmakedefine OBS_PLUGIN_DESTINATION_ORIG "@OBS_PLUGIN_DESTINATION@"
+#cmakedefine OBS_INSTALL_PREFIX "@OBS_INSTALL_PREFIX@"
#cmakedefine GIO_FOUND
#cmakedefine PULSEAUDIO_FOUND
--
2.40.1

View file

@ -25,7 +25,7 @@
, wrapGAppsHook
, scriptingSupport ? true
, luajit
, swig
, swig4
, python3
, alsaSupport ? stdenv.isLinux
, alsa-lib
@ -42,6 +42,10 @@
, srt
, qtwayland
, wrapQtAppsHook
, nlohmann_json
, websocketpp
, asio
, libdatachannel
}:
let
@ -50,19 +54,17 @@ let
in
stdenv.mkDerivation rec {
pname = "obs-studio";
version = "29.0.2";
version = "unstable-2023-07-06";
src = fetchFromGitHub {
owner = "obsproject";
repo = "obs-studio";
rev = version;
sha256 = "sha256-TIUSjyPEsKRNTSLQXuLJGEgD989hJ5GhOsqJ4nkKVsY=";
rev = "e4a3f80f9fc90b0c9a65c96d343322ba3f1e6bcd";
sha256 = "sha256:0gs44bqvz776jw7kl8r59y6n392rhmgznhzwv5ap9y8gc3nggvga";
fetchSubmodules = true;
};
patches = [
# Lets obs-browser build against CEF 90.1.0+
./Enable-file-access-and-universal-access-for-file-URL.patch
./Provide-runtime-plugin-destination-as-relative-path.patch
];
@ -73,7 +75,7 @@ stdenv.mkDerivation rec {
wrapGAppsHook
wrapQtAppsHook
]
++ optional scriptingSupport swig;
++ optional scriptingSupport swig4;
buildInputs = [
curl
@ -99,6 +101,10 @@ stdenv.mkDerivation rec {
libva
srt
qtwayland
nlohmann_json
websocketpp
asio
libdatachannel
]
++ optionals scriptingSupport [ luajit python3 ]
++ optional alsaSupport alsa-lib
@ -121,14 +127,16 @@ stdenv.mkDerivation rec {
# DL_OPENGL is an explicit path. Not sure if there's a better way
# to handle this.
cmakeFlags = [
"-DCMAKE_CXX_FLAGS=-DDL_OPENGL=\\\"$(out)/lib/libobs-opengl.so\\\""
"-DOBS_VERSION_OVERRIDE=${version}"
"-DOBS_VERSION_OVERRIDE=30.0.0"
"-Wno-dev" # kill dev warnings that are useless for packaging
# Add support for browser source
"-DBUILD_BROWSER=ON"
"-DCEF_ROOT_DIR=../../cef"
"-DENABLE_JACK=ON"
];
preConfigure = ''
cmakeFlagsArray+=("-DCMAKE_CXX_FLAGS=-UDL_OPENGL -DDL_OPENGL=\\\"$out/lib/libobs-opengl.so\\\"")
'';
dontWrapGApps = true;
preFixup = ''

View file

@ -0,0 +1,43 @@
{ stdenv
, lib
, fetchFromGitHub
, cmake
, openssl
, srtp
, usrsctp
, plog
, nlohmann_json
, libnice
}:
stdenv.mkDerivation rec {
pname = "libdatachannel";
version = "0.19.0-alpha.4";
src = fetchFromGitHub {
owner = "paullouisageneau";
repo = "libdatachannel";
rev = "v${version}";
sha256 = "sha256-PRH0XfO+nr6KQfWmeV5S7VsWF6HxFB44DSrO1I9CI6g=";
};
nativeBuildInputs = [ cmake ];
buildInputs = [
openssl srtp usrsctp plog nlohmann_json libnice
];
cmakeFlags = [
"-DPREFER_SYSTEM_LIB=ON"
"-DUSE_NICE=ON"
"-DNO_EXAMPLES=ON"
"-DNO_TESTS=ON" # wants ICE/STUN server on the internet
];
meta = with lib; {
description = "C/C++ WebRTC network library";
maintainers = with maintainers; [ lukegb ];
platforms = platforms.all;
license = with licenses; [ mpl20 ];
};
}

View file

@ -0,0 +1,31 @@
{ stdenv
, lib
, fetchFromGitHub
, cmake
, openssl
, srtp
, usrsctp
, plog # todo
, nlohmann_json
}:
stdenv.mkDerivation rec {
pname = "plog";
version = "1.1.9";
src = fetchFromGitHub {
owner = "SergiusTheBest";
repo = "plog";
rev = version;
sha256 = "sha256-CARTr1EEqXNJtp6XwHhr7aiRBiYR0cClzexpNCMaQJc=";
};
nativeBuildInputs = [ cmake ];
meta = with lib; {
description = "Portable, simple and extensible C++ logging library";
maintainers = with maintainers; [ lukegb ];
platforms = platforms.all;
license = with licenses; [ mit ];
};
}

View file

@ -33136,6 +33136,9 @@ with pkgs;
inherit (darwin.apple_sdk.frameworks) Foundation;
};
plog = callPackage ../development/libraries/plog { };
libdatachannel = callPackage ../development/libraries/libdatachannel { };
obs-studio = qt6Packages.callPackage ../applications/video/obs-studio {
ffmpeg_4 = ffmpeg-full;
};