File trenchbroom.spec of Package trenchbroom
#
# spec file for package trenchbroom
#
# Copyright (c) 2022 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/
#
%define version_year 2022
%define version_num 2
Name: trenchbroom
Version: %{version_year}.%{version_num}
Release: 0
Summary: A level editor for Quake-engine based games
License: GPL-3.0-only
URL: https://trenchbroom.github.io/
Source: TrenchBroom-%{version}.tar.gz
Patch0: cmake-install.patch
Patch1: remove-vcpkg.patch
%if 0%{?suse_version} < 1550
BuildRequires: Catch2-devel
%else
BuildRequires: Catch2-2-devel
%endif
BuildRequires: cmake
BuildRequires: fdupes
BuildRequires: freeimage-devel
BuildRequires: gcc-c++
BuildRequires: git
BuildRequires: hicolor-icon-theme
BuildRequires: shared-mime-info
BuildRequires: ninja
BuildRequires: pandoc
BuildRequires: pkgconfig
BuildRequires: update-desktop-files
BuildRequires: xvfb-run
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Svg)
BuildRequires: pkgconfig(assimp)
BuildRequires: pkgconfig(fmt)
BuildRequires: pkgconfig(freetype2)
BuildRequires: pkgconfig(gl)
BuildRequires: pkgconfig(glew)
BuildRequires: pkgconfig(glm)
BuildRequires: pkgconfig(glu)
BuildRequires: pkgconfig(glut)
BuildRequires: pkgconfig(miniz)
BuildRequires: pkgconfig(tinyxml2)
BuildRequires: pkgconfig(xi)
BuildRequires: pkgconfig(xrandr)
BuildRequires: pkgconfig(xxf86vm)
%description
TrenchBroom is a modern cross-platform level editor for Quake-engine based games.
%prep
%autosetup -p1 -n TrenchBroom-%{version}
# Replace falltrough versions in GET_APP_VERSION and GET_GIT_DESCRIBE CMake macros
sed -i -E 's/(set\(\$\{VERSION_YEAR\} ")0("\))/\1%{version_year}\2/g' "cmake/Utils.cmake"
sed -i -E 's/(set\(\$\{VERSION_NUMBER\} ")0("\))/\1%{version_num}\2/g' "cmake/Utils.cmake"
sed -i -E 's/(set\(\$\{GIT_DESCRIBE\} ")unknown("\))/\1v%{version}\2/g' "cmake/Utils.cmake"
%build
%cmake -DCMAKE_PREFIX_PATH="cmake/packages"
%cmake_build
%install
%cmake_install
for size in 8 16 22 24 32 36 42 48 64 72 96 128 192 256 512; do
install -Dpm 644 "app/resources/linux/icons/icon_${size}.png" "%{buildroot}%{_datadir}/icons/hicolor/${size}x${size}/apps/%{name}.png"
done
install -Dpm 644 "app/resources/linux/%{name}.desktop" "%{buildroot}%{_datadir}/applications/%{name}.desktop"
%fdupes -s %{buildroot}
%files
%license LICENSE.txt
%doc README.md
%{_bindir}/%{name}
%{_datadir}/TrenchBroom
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/
%{_datadir}/mime/packages/trenchbroom.xml
%changelog