From 9f7914afa2cd3ddf95621731e486eff2d3993c14 Mon Sep 17 00:00:00 2001 From: Sebastian Sellmeier Date: Wed, 5 Oct 2022 12:36:25 +0200 Subject: [PATCH] obs-studio: add 28.0.3 (parallel to 27.x) --- pkgs/applications/video/obs-studio/27.nix | 7 +++ pkgs/applications/video/obs-studio/28.nix | 22 +++++++ ...-plugin-destination-as-relative-path.patch | 26 ++++++++ .../obs-studio/{default.nix => generic.nix} | 24 ++++--- .../video/obs-studio/plugins/default.nix | 2 +- .../obs-studio/plugins/obs-websocket.nix | 63 ------------------- pkgs/top-level/all-packages.nix | 9 ++- 7 files changed, 79 insertions(+), 74 deletions(-) create mode 100644 pkgs/applications/video/obs-studio/27.nix create mode 100644 pkgs/applications/video/obs-studio/28.nix create mode 100644 pkgs/applications/video/obs-studio/Provide-runtime-plugin-destination-as-relative-path.patch rename pkgs/applications/video/obs-studio/{default.nix => generic.nix} (91%) delete mode 100644 pkgs/applications/video/obs-studio/plugins/obs-websocket.nix diff --git a/pkgs/applications/video/obs-studio/27.nix b/pkgs/applications/video/obs-studio/27.nix new file mode 100644 index 000000000000..7be6f46b9d9d --- /dev/null +++ b/pkgs/applications/video/obs-studio/27.nix @@ -0,0 +1,7 @@ +{ callPackage, qtx11extras, ... } @ args: + +callPackage ./generic.nix (args // { + version = "27.2.4"; + sha256 = "sha256-OiSejQovSmhItrnrQlcVp9PCDRgAhuxTinSpXbH8bo0="; + extraBuildInputs = [ qtx11extras ]; +}) diff --git a/pkgs/applications/video/obs-studio/28.nix b/pkgs/applications/video/obs-studio/28.nix new file mode 100644 index 000000000000..edf40b14879c --- /dev/null +++ b/pkgs/applications/video/obs-studio/28.nix @@ -0,0 +1,22 @@ +{ callPackage +, libajantv2 +, librist +, srt +, qtwayland +, ... +} @ args: + +callPackage ./generic.nix (args // { + version = "28.0.3"; + sha256 = "sha256-+4H1BjEgxqkAEvRyr2Tg3wXutnMvlYQEdT5jz644fMA="; + extraPatches = [ ./Provide-runtime-plugin-destination-as-relative-path.patch ]; + extraBuildInputs = [ + libajantv2 + librist + srt + qtwayland + ]; + extraCMakeFlags = [ + "-DENABLE_JACK=ON" + ]; +}) diff --git a/pkgs/applications/video/obs-studio/Provide-runtime-plugin-destination-as-relative-path.patch b/pkgs/applications/video/obs-studio/Provide-runtime-plugin-destination-as-relative-path.patch new file mode 100644 index 000000000000..b39cb04a899c --- /dev/null +++ b/pkgs/applications/video/obs-studio/Provide-runtime-plugin-destination-as-relative-path.patch @@ -0,0 +1,26 @@ +diff --git a/libobs/CMakeLists.txt b/libobs/CMakeLists.txt +index 790583cd5..763cf3548 100644 +--- a/libobs/CMakeLists.txt ++++ b/libobs/CMakeLists.txt +@@ -455,6 +455,8 @@ elseif(OS_POSIX) + libobs PROPERTIES BUILD_RPATH "$") + endif() + ++string(REGEX REPLACE "^${OBS_INSTALL_PREFIX}" "" OBS_PLUGIN_DESTINATION_RELATIVE ${OBS_PLUGIN_DESTINATION}) ++ + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/obsconfig.h.in + ${CMAKE_BINARY_DIR}/config/obsconfig.h) + +diff --git a/libobs/obsconfig.h.in b/libobs/obsconfig.h.in +index 4a664285a..5cff2ca53 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@ + + #cmakedefine LINUX_PORTABLE diff --git a/pkgs/applications/video/obs-studio/default.nix b/pkgs/applications/video/obs-studio/generic.nix similarity index 91% rename from pkgs/applications/video/obs-studio/default.nix rename to pkgs/applications/video/obs-studio/generic.nix index 044967b2e526..e638cacd06d9 100644 --- a/pkgs/applications/video/obs-studio/default.nix +++ b/pkgs/applications/video/obs-studio/generic.nix @@ -1,7 +1,11 @@ -{ config +{ version +, sha256 +, extraPatches ? [ ] +, extraBuildInputs ? [ ] +, extraCMakeFlags ? [ ] +, config , lib , stdenv -, mkDerivation , fetchFromGitHub , addOpenGLRunpath , cmake @@ -13,7 +17,6 @@ , libpthreadstubs , libXdmcp , qtbase -, qtx11extras , qtsvg , speex , libv4l @@ -38,34 +41,37 @@ , pipewireSupport ? stdenv.isLinux , pipewire , libdrm +, wrapQtAppsHook +, ... }: let inherit (lib) optional optionals; in -mkDerivation rec { +stdenv.mkDerivation rec { pname = "obs-studio"; - version = "27.2.4"; + inherit version; src = fetchFromGitHub { owner = "obsproject"; repo = "obs-studio"; rev = version; - sha256 = "sha256-OiSejQovSmhItrnrQlcVp9PCDRgAhuxTinSpXbH8bo0="; + inherit sha256; fetchSubmodules = true; }; patches = [ # Lets obs-browser build against CEF 90.1.0+ ./Enable-file-access-and-universal-access-for-file-URL.patch - ]; + ] ++ extraPatches; nativeBuildInputs = [ addOpenGLRunpath cmake pkg-config wrapGAppsHook + wrapQtAppsHook ] ++ optional scriptingSupport swig; @@ -81,7 +87,6 @@ mkDerivation rec { libpthreadstubs libXdmcp qtbase - qtx11extras qtsvg speex wayland @@ -90,6 +95,7 @@ mkDerivation rec { mbedtls pciutils ] + ++ extraBuildInputs ++ optionals scriptingSupport [ luajit python3 ] ++ optional alsaSupport alsa-lib ++ optional pulseaudioSupport libpulseaudio @@ -117,7 +123,7 @@ mkDerivation rec { # Add support for browser source "-DBUILD_BROWSER=ON" "-DCEF_ROOT_DIR=../../cef" - ]; + ] ++ extraCMakeFlags; dontWrapGApps = true; preFixup = '' diff --git a/pkgs/applications/video/obs-studio/plugins/default.nix b/pkgs/applications/video/obs-studio/plugins/default.nix index b9be0a2b6eb1..a661ce0b9a3c 100644 --- a/pkgs/applications/video/obs-studio/plugins/default.nix +++ b/pkgs/applications/video/obs-studio/plugins/default.nix @@ -28,7 +28,7 @@ obs-vkcapture32 = pkgsi686Linux.obs-studio-plugins.obs-vkcapture; }; - obs-websocket = libsForQt5.callPackage ./obs-websocket.nix { }; + obs-websocket = throw "obs-websocket has been removed: Functionality has been integrated into obs-studio itself."; wlrobs = callPackage ./wlrobs.nix { }; } diff --git a/pkgs/applications/video/obs-studio/plugins/obs-websocket.nix b/pkgs/applications/video/obs-studio/plugins/obs-websocket.nix deleted file mode 100644 index d747268cc556..000000000000 --- a/pkgs/applications/video/obs-studio/plugins/obs-websocket.nix +++ /dev/null @@ -1,63 +0,0 @@ -{ lib -, stdenv -, fetchFromGitHub -, fetchpatch -, cmake -, qtbase -, qtsvg -, obs-studio -, asio_1_10 -, websocketpp -, nlohmann_json -}: - -stdenv.mkDerivation rec { - pname = "obs-websocket"; - - # We have updated to the alpha version when OBS Studio 27.2 was - # released, because this is the only version of obs-websocket that - # builds against the new OBS Studio. - version = "5.0.0-alpha3"; - - src = fetchFromGitHub { - owner = "Palakis"; - repo = "obs-websocket"; - rev = version; - sha256 = "Lr6SBj5rRTAWmn9Tnlu4Sl7SAkOCRCTP6sFWSp4xB+I="; - fetchSubmodules = true; - }; - - patches = [ - # This patch can be dropped when obs-websocket is updated to the - # next version. - (fetchpatch { - url = "https://github.com/obsproject/obs-websocket/commit/13c7b83c34eb67b2ee80af05071d81f10d0d2997.patch"; - sha256 = "TNap/T8+058vhfWzRRr4vmlblFk9tHMUNyG6Ob5PwiM="; - name = "obs-addref-werror-fix.patch"; - }) - ]; - - nativeBuildInputs = [ cmake ]; - buildInputs = [ - qtbase - qtsvg - obs-studio - asio_1_10 - websocketpp - nlohmann_json - ]; - - dontWrapQtApps = true; - - cmakeFlags = [ - "-DLIBOBS_INCLUDE_DIR=${obs-studio.src}/libobs" - ]; - - meta = with lib; { - description = "Remote-control OBS Studio through WebSockets"; - homepage = "https://github.com/Palakis/obs-websocket"; - maintainers = with maintainers; [ erdnaxe ]; - license = licenses.gpl2Plus; - platforms = [ "x86_64-linux" "i686-linux" ]; - }; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 59b9934a95e0..dee5ec62db31 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -30768,9 +30768,16 @@ with pkgs; gnome-obfuscate = callPackage ../applications/graphics/gnome-obfuscate { }; - obs-studio = libsForQt5.callPackage ../applications/video/obs-studio { + obs-studio27 = libsForQt5.callPackage ../applications/video/obs-studio/27.nix { ffmpeg_4 = ffmpeg-full; }; + + obs-studio28 = qt6Packages.callPackage ../applications/video/obs-studio/28.nix { + ffmpeg_4 = ffmpeg-full; + }; + + obs-studio = obs-studio28; + obs-studio-plugins = recurseIntoAttrs (callPackage ../applications/video/obs-studio/plugins {}); wrapOBS = callPackage ../applications/video/obs-studio/wrapper.nix {};