%{?optflags_lto:%global optflags_lto %optflags_lto -ffat-lto-objects}

%define commit g4204d54
%define cef_branch 5060
%define cef_obs_dir /opt/cef-obs

Name: cef-minimal-obs-bin
Version: 103.0.%cef_branch.134
Release: alt1.%commit

Summary: Fork of CEF with OBS-specific patches

License: BSD
Group: Networking/WWW
Url: https://github.com/obsproject/cef/tree/5060-shared-textures

# Source0-url: https://cdn-fastly.obsproject.com/downloads/cef_binary_%{cef_branch}_linux_x86_64.tar.xz
Source0: %name-%version.tar

BuildRequires(pre): rpm-macros-cmake
BuildRequires: cmake gcc-c++
Requires: libXext libX11 libwayland-client libxcb libdbus libXrandr libXext libnss libat-spi2-core libXdamage at-spi2-atk libdrm libatk libgbm libxkbcommon libcups libnspr libXfixes libgio libXcomposite libalsa

AutoReq: no
AutoProv: no

%description
Chromium Embedded Framework minimal release needed by OBS Studio release in /opt/cef-obs

%prep
%setup

# Remove pre-built wrapper
rm -rv build

%build
%cmake_insource \
  -DCMAKE_BUILD_TYPE=Release
%make libcef_dll_wrapper

# Remove unneeded files
rm -v README.txt CMakeLists.txt cmake_install.cmake Makefile CMakeCache.txt
rm -v libcef_dll/CMakeLists.txt
rm -v libcef_dll_wrapper/Makefile libcef_dll_wrapper/cmake_install.cmake
rm -rv cmake/ CMakeFiles/ libcef_dll_wrapper/CMakeFiles


%install
install -Dm644 LICENSE.txt %buildroot%_licensedir/%name/LICENSE
mkdir -p %buildroot%cef_obs_dir/
cp -rv * %buildroot%cef_obs_dir/

%files
%_licensedir/%name/LICENSE
%cef_obs_dir/

%changelog
* Tue Aug 15 2023 Mikhail Tergoev <fidel@altlinux.org> 103.0.5060.134-alt1.g4204d54
- initial build for ALT Sisyphus
