File obs-studio.spec of Package obs-studio
#
# spec file for package obs-studio
#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
# nodebuginfo
%define cef_version 5060
%define cef_version_extra _v3
%define streamfx_version 0.11.1
%define move_version 2.9.1
Name: obs-studio
Version: 30.0.2
Release: 0
Summary: Free and open source software for video recording and live streaming
License: GPL-2.0-or-later
Group: Productivity/Multimedia/Video/Editors and Convertors
URL: https://obsproject.com/
Source: %{name}-%{version}.tar.xz
Source1: cef_binary_%{cef_version}_linux_x86_64%{cef_cersion_extra}.tar.xz
Source2: obs-StreamFX-%{streamfx_version}.tar.gz
Source3: obs-move-transition-%{move_version}.tar.gz
# PATCH-FIX-UPSTREAM - fix-luajit-include-path.diff -- Fixes the FindLuaJIT CMake module so it also looks for moonjit’s include path
Patch0: linux-v4l2-device-path.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: asio-devel
BuildRequires: cmake >= 2.8.12
BuildRequires: fdk-aac-devel
BuildRequires: fdupes
%if 0%{?suse_version} <= 1500
BuildRequires: gcc12
BuildRequires: gcc12-c++
%else
BuildRequires: gcc
BuildRequires: gcc-c++
%endif
BuildRequires: git
BuildRequires: hicolor-icon-theme
BuildRequires: libuuid-devel
BuildRequires: librist-devel
BuildRequires: libva-devel
BuildRequires: libaom-devel
BuildRequires: libqt5-qtbase-devel >= 5.3
BuildRequires: libqt5-qtwayland-devel
BuildRequires: libqt5-qtx11extras-devel >= 5.3
BuildRequires: libQt5Gui-private-headers-devel
BuildRequires: libXss-devel
BuildRequires: mbedtls-devel
BuildRequires: mozilla-nss-devel
BuildRequires: nlohmann_json-devel
BuildRequires: pkgconfig
BuildRequires: sndio-devel
%if 0%{?suse_version} != 1315 || 0%{?is_opensuse}
BuildRequires: pkgconfig(speexdsp)
%endif
BuildRequires: swig
BuildRequires: srt-devel
BuildRequires: update-desktop-files
BuildRequires: vlc-devel
BuildRequires: wayland-devel
BuildRequires: libxkbcommon-devel
BuildRequires: pkgconfig(alsa)
BuildRequires: pkgconfig(fontconfig)
BuildRequires: pkgconfig(freetype2)
BuildRequires: pkgconfig(jack)
BuildRequires: pkgconfig(jansson)
BuildRequires: pkgconfig(libudev)
BuildRequires: pkgconfig(libv4l2)
BuildRequires: pkgconfig(python3)
BuildRequires: pkgconfig(Qt5Svg)
BuildRequires: pkgconfig(libavcodec)
BuildRequires: pkgconfig(libavdevice)
BuildRequires: pkgconfig(libavfilter)
BuildRequires: pkgconfig(libavformat)
BuildRequires: pkgconfig(libavutil)
BuildRequires: pkgconfig(libcurl)
BuildRequires: pkgconfig(libpipewire-0.3)
BuildRequires: pkgconfig(libpci)
BuildRequires: pkgconfig(libpulse)
BuildRequires: pkgconfig(libswresample)
BuildRequires: pkgconfig(libswscale)
BuildRequires: pkgconfig(luajit)
BuildRequires: pkgconfig(x264)
BuildRequires: pkgconfig(xcomposite)
BuildRequires: pkgconfig(xinerama)
BuildRequires: pkgconfig(xrandr)
BuildRequires: websocketpp-devel
# This is required for Virtual Camera output on Linux
Requires: v4l2loopback-kmp-default
ExclusiveArch: x86_64
%description
OBS Studio is software designed for capturing, compositing, encoding, recording, and streaming video content, efficiently.
%package devel
Summary: A recording/broadcasting program - Development Files
Group: Development/Libraries/C and C++
Requires: %{name} = %{version}
%description devel
Devel files for OBS Studio is software designed for capturing, compositing, encoding, recording, and streaming video content, efficiently.
%prep
%autosetup -p1
tar -xaf %_sourcedir/cef_binary_%{cef_version}_linux_x86_64%{cef_version_extra}.tar.xz -C %_builddir
mkdir %_builddir/%{name}-%{version}/UI/frontend-plugins/streamfx
mkdir %_builddir/%{name}-%{version}/plugins/move-transition
tar -xaf %_sourcedir/obs-move-transition-%{move_version}.tar.gz -C %_builddir/%{name}-%{version}/plugins/move-transition --strip-components=1
cd %_builddir/%{name}-%{version}/plugins
echo "add_subdirectory(move-transition)" >> CMakeLists.txt
tar -xaf %_sourcedir/obs-StreamFX-%{streamfx_version}.tar.gz -C %_builddir/%{name}-%{version}/UI/frontend-plugins/streamfx --strip-components=1
cd %_builddir/%{name}-%{version}/UI/frontend-plugins
echo "add_subdirectory(streamfx)" >> CMakeLists.txt
%build
%if 0%{?suse_version} <= 1500
export CC=gcc-12
export CXX=g++-12
%endif
mkdir -p build && cd build
# does not like cmake macro as it fails to link in math.h (-lm)
cmake \
-DUNIX_STRUCTURE=1 \
%if "%{_lib}" == "lib64"
-DOBS_MULTIARCH_SUFFIX=64 \
%endif
-DCMAKE_INSTALL_PREFIX=/usr \
-DENABLE_BROWSER=ON \
-DENABLE_JACK=ON \
-DLUAJIT_INCLUDE_DIR="$(pkg-config --cflags luajit | cut -d'I' -f2)" \
-DCEF_ROOT_DIR="../../cef_binary_%{cef_version}_linux64" \
-DOBS_VERSION_OVERRIDE="$(echo "%{version}" | grep -oE "^[^+]+")" \
-DENABLE_AJA=OFF \
-Wno-interference-size \
-Werror=interference-size \
..
%install
%cmake_install
%suse_update_desktop_file com.obsproject.Studio
%post
/sbin/ldconfig
%icon_theme_cache_postun
%postun
/sbin/ldconfig
%icon_theme_cache_postun
%files
%license COPYING COMMITMENT
%doc README.rst CONTRIBUTING.rst
%{_bindir}/obs
%{_bindir}/obs-ffmpeg-mux
# Upstream forces libs dir regardless of arch and building plugins is encumbered
# by moving them to the proper directory.
%{_libdir}/obs-plugins
%{_libdir}/libobs.so.0
%{_libdir}/libobs-frontend-api.so.*
%{_libdir}/libobs-opengl.so.*
%{_libdir}/libobs-scripting.so
%{_libdir}/obs-scripting
%{_libdir}/libobsglad.so.0
%dir %{_datadir}/metainfo
%{_datadir}/metainfo/com.obsproject.Studio.appdata.xml
%{_datadir}/applications/com.obsproject.Studio.desktop
%{_datadir}/icons/hicolor/256x256/apps/com.obsproject.Studio.png
%{_datadir}/icons/hicolor/128x128/apps/com.obsproject.Studio.png
%{_datadir}/icons/hicolor/512x512/apps/com.obsproject.Studio.png
%{_datadir}/icons/hicolor/scalable/apps/com.obsproject.Studio.svg
%{_datadir}/obs
%files devel
%{_libdir}/cmake
%{_libdir}/libobs.so
%{_libdir}/libobs-frontend-api.so
%{_libdir}/libobs-opengl.so
%{_libdir}/libobsglad.so
%{_libdir}/pkgconfig/libobs.pc
%{_includedir}/obs