File obs-studio.spec of Package obs-studio

# Chromium Embedded Framework
%ifarch x86_64
%bcond_without cef
%define cef_binary cef_binary_4638_linux64
%else
%bcond_with cef
%endif

Name:           obs-studio
Version:        29.0.0
Release:        0
Summary:        A recording/broadcasting program
Group:          Productivity/Multimedia/Video/Editors and Convertors
License:        GPL-2.0
URL:            https://obsproject.com/
Source:         %{name}-%{version}.tar.xz
%if %{with cef}
Source17:       %{cef_binary}.tar.bz2
%endif
Patch0:         0002-Include-diverse-luajit.patch
Patch1:         0001-Prefix-modinfo-with-sbin-since-not-in-normal-path.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  update-desktop-files
BuildRequires:  cmake >= 2.8.12
BuildRequires:  fdk-aac-devel
BuildRequires:  fdupes
BuildRequires:  fontconfig-devel
BuildRequires:  freetype2-devel
BuildRequires:  gcc
BuildRequires:  gcc-c++
BuildRequires:  hicolor-icon-theme
BuildRequires:  libXcomposite-devel
BuildRequires:  libXinerama-devel
BuildRequires:  libXrandr-devel
BuildRequires:  libcurl-devel
BuildRequires:  libjansson-devel
BuildRequires:  pciutils-devel
BuildRequires:  pipewire-devel
BuildRequires:  libpulse-devel
BuildRequires:  libqt5-qtbase-devel >= 5.3
BuildRequires:  libqt5-qtbase-private-headers-devel
BuildRequires:  libqt5-qtsvg-devel
BuildRequires:  libqt5-qtx11extras-devel >= 5.3
BuildRequires:  libudev-devel
BuildRequires:  libv4l-devel
BuildRequires:  libx264-devel
BuildRequires:  mbedtls-devel
BuildRequires:  pipewire-devel
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(alsa)
BuildRequires:  pkgconfig(jack)
BuildRequires:  pkgconfig(libavcodec)
BuildRequires:  pkgconfig(libavdevice)
BuildRequires:  pkgconfig(libavfilter)
BuildRequires:  pkgconfig(libavformat)
BuildRequires:  pkgconfig(libavutil)
BuildRequires:  pkgconfig(librist)
BuildRequires:  pkgconfig(libswresample)
BuildRequires:  pkgconfig(libswscale)
BuildRequires:  pkgconfig(libva)
BuildRequires:  pkgconfig(lua)
BuildRequires:  pkgconfig(luajit)
BuildRequires:  pkgconfig(srt) >= 1.4
BuildRequires:  python3-devel
%if 0%{?suse_version} != 1315 || 0%{?is_opensuse}
BuildRequires:  speexdsp-devel
%endif
BuildRequires:  swig
BuildRequires:  vlc-devel
%if %{with cef}
BuildRequires:  mozilla-nss
BuildRequires:  mozilla-nspr
%endif
# these are dlopen'ed
Requires:       librist4
Requires:       libsrt1_5
ExclusiveArch:  x86_64 aarch64

# these are plugins, built as libs and as such should not be mixed up with their originals
%global __provides_exclude_from ^(%{_libdir}/obs-plugins/.*\\.so.*|%{_libdir}/obs-scripting/.*\\.so.*)$
%global __requires_exclude_from ^(%{_libdir}/obs-plugins/.*|%{_libdir}/obs-scripting/.*)$
%global __requires_exclude ^libcef\\.so$

%description
Open Broadcaster Software is free and open source software for video recording and live streaming.

%package devel
Summary:        A recording/broadcasting program - Development Files
Group:          Development/Multimedia
Requires:       %{name} = %{version}

%description devel
Open Broadcaster Software is free and open source software for video recording and live streaming.

%prep
%autosetup -p1
%if %{with cef}
tar xvf %{SOURCE17} -C %{_builddir}
%endif

%build
mkdir -p build && cd build
# does not like cmake macro as it fails to link in math.h (-lm)
cmake \
  -DCMAKE_CXX_STANDARD=17 \
  -DCMAKE_INSTALL_PREFIX=/usr \
  -DUNIX_STRUCTURE=1 \
%if "%{_lib}" == "lib64"
  -DOBS_MULTIARCH_SUFFIX=64 \
%endif
  -DOBS_VERSION_OVERRIDE="$(echo "%{version}" | grep -oE "^[^+]+")" \
  -DENABLE_AJA=OFF \
%if 0%{?sle_version} > 150000 && 0%{?sle_version} < 150500 && 0%{?is_opensuse}
  -DENABLE_PIPEWIRE=OFF \
%endif
  -DENABLE_JACK=ON \
%if %{with cef}
  -DBUILD_BROWSER=ON \
  -DCEF_ROOT_DIR="%{_builddir}/%{cef_binary}" \
%else
  -DBUILD_BROWSER=OFF \
%endif
  ..

%install
%cmake_install
%suse_update_desktop_file com.obsproject.Studio
%fdupes %{buildroot}%{_datadir}/obs/

%post
/sbin/ldconfig
%icon_theme_cache_postun

%postun
/sbin/ldconfig
%icon_theme_cache_postun

%files
%{_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.*
%{_libdir}/libobsglad.so.*
%{_libdir}/libobs-frontend-api.so.*
%{_libdir}/libobs-opengl.so.*
%{_libdir}/libobs-scripting.so.*
%{_libdir}/obs-scripting
%dir %{_datadir}/metainfo
%{_datadir}/metainfo/com.obsproject.Studio.appdata.xml
%{_datadir}/applications/com.obsproject.Studio.desktop
%{_datadir}/icons/hicolor
%{_datadir}/obs

%files devel
%{_libdir}/libobs.so
%{_libdir}/libobsglad.so
%{_libdir}/libobs-frontend-api.so
%{_libdir}/libobs-opengl.so
%{_libdir}/libobs-scripting.so
%{_libdir}/cmake
%{_libdir}/pkgconfig/libobs.pc
%{_includedir}/obs
%changelog