File prismlauncher.spec of Package prismlauncher

#
# spec file for package prismlauncher
#
# Copyright (c) 2024 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 BUILD_JAVA_VERSION 11

Name:           prismlauncher
Version:        8.0
Release:        0
Summary:        A custom launcher for Minecraft
License:        Apache-2.0 AND GPL-3.0-only AND LGPL-3.0-or-later AND LGPL-2.0-or-later AND MIT AND BSD-2-Clause AND BSD-3-Clause AND OFL-1.1
URL:            https://github.com/PrismLauncher/PrismLauncher
Group:          Amusements/Games/3D/Simulation
Source:         %{name}-%{version}.tar.gz
BuildRequires:  cmake
BuildRequires:  cmark
BuildRequires:  extra-cmake-modules
BuildRequires:  java-%{BUILD_JAVA_VERSION}-openjdk-devel
BuildRequires:  update-desktop-files
BuildRequires:  cmake(Qt6Concurrent)
BuildRequires:  cmake(Qt6Core)
BuildRequires:  cmake(Qt6Core5Compat)
BuildRequires:  cmake(Qt6CoreTools)
BuildRequires:  cmake(Qt6Network)
BuildRequires:  cmake(Qt6NetworkAuth)
BuildRequires:  cmake(Qt6Test)
BuildRequires:  cmake(Qt6Widgets)
BuildRequires:  cmake(Qt6Xml)
# Leap 15.5 Not quazip-qt6-devel
%if ( 0%{?suse_version} > 1600 ) || ( 0%{?sle_version} == 150600 && 0%{?is_opensuse} )
BuildRequires:  cmake(QuaZip-Qt6)
%else
BuildRequires:  quazip-devel
%endif

Requires:       (java-21-openjdk or java-17-openjdk or java-11-openjdk)

# TW does not need to specify GCC and G++ version
# Leap 15.6 and Leap 15.5
%if ( 0%{?sle_version} == 150600 && 0%{?is_opensuse} ) || ( 0%{?sle_version} == 150500 && 0%{?is_opensuse} )
%define BUILD_GCC_VERSION 10
%define BUILD_GXX_VERSION 10
############################## Don't edit #####################################
%define _BUILD_GCC_VERSION -%{BUILD_GCC_VERSION}
%define _BUILD_GXX_VERSION -%{BUILD_GXX_VERSION}
BuildRequires:  gcc%{BUILD_GCC_VERSION}
BuildRequires:  gcc%{BUILD_GXX_VERSION}-c++
%endif
###############################################################################

Patch0:         desktopFile.patch

%description
Prism Launcher is a custom launcher for Minecraft
that allows you to easily manage multiple installations of Minecraft at once

%prep
%autosetup -p1

%build
# Disabled Binary RPATH
sed -i "s|\$ORIGIN/||" CMakeLists.txt

export JAVA_HOME=%{_jvmdir}/java-%{BUILD_JAVA_VERSION}-openjdk-%{BUILD_JAVA_VERSION}
export PATH=$JAVA_HOME/bin:$PATH

# Set build flags
# Enable PIE and unstripped binary or object
%global optflags -s -fPIE %{optflags}
%global build_ldflags -pie %{?build_ldflags}

%cmake \
    -DCMAKE_C_COMPILER=/usr/bin/gcc%{?_BUILD_GCC_VERSION} \
    -DCMAKE_CXX_COMPILER=/usr/bin/g++%{?_BUILD_GXX_VERSION} \
    -DCMAKE_INSTALL_PREFIX=%{_prefix} \
    -DLauncher_BUILD_PLATFORM=%{_target_platform} \
    -DLauncher_QT_VERSION_MAJOR="6" 

%make_build

%install
cd build
%make_install
%suse_update_desktop_file org.prismlauncher.PrismLauncher

%check
cd build
%make_build test

%files
%license COPYING.md LICENSE
%doc README.md
%{_bindir}/%{name}
%dir %{_datadir}/PrismLauncher
%{_datadir}/PrismLauncher/*
%{_datadir}/applications/org.%{name}.PrismLauncher.desktop
%{_datadir}/icons/hicolor/scalable/apps/org.%{name}.PrismLauncher.svg
%dir %{_datadir}/metainfo
%{_datadir}/metainfo/org.%{name}.PrismLauncher.metainfo.xml
%{_datadir}/mime/packages/modrinth-mrpack-mime.xml
%dir %{_datadir}/qlogging-categories6
%{_datadir}/qlogging-categories6/%{name}.categories

%changelog
openSUSE Build Service is sponsored by