File glnemo2.spec of Package glnemo2

#
# spec file for package glnemo2
#
# Copyright (c) 2023 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/
#


# Missing tag for 1.20.1 release
%define tag_1_20_1 863030cbbe3bc249e23eabd4187a2ac81f367a16

Name:           glnemo2
Version:        1.20.1
Release:        0
Summary:        Interactive 3D OpenGL visualization program for Nemo snapshots
License:        CECILL-2.0
Group:          Productivity/Graphics/Visualization/Graph
URL:            https://projets.lam.fr/projects/glnemo2/wiki
Source0:        https://gitlab.lam.fr/jclamber/glnemo2/-/archive/%{tag_1_20_1}/glnemo2-1.20.1.tar.bz2#/glnemo2-%{version}.tar.bz2
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  hicolor-icon-theme
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(CCfits)
BuildRequires:  pkgconfig(Qt5Core)
BuildRequires:  pkgconfig(Qt5Gui)
BuildRequires:  pkgconfig(Qt5Network)
BuildRequires:  pkgconfig(Qt5OpenGL)
BuildRequires:  pkgconfig(Qt5PrintSupport)
BuildRequires:  pkgconfig(Qt5Widgets)
BuildRequires:  pkgconfig(glew)
BuildRequires:  pkgconfig(glm)
BuildRequires:  pkgconfig(glu)
BuildRequires:  pkgconfig(libtirpc)
BuildRequires:  pkgconfig(zlib)
BuildRequires:  hdf5-devel

%description
Glnemo2 is an interactive 3D visualization program which displays
particles positions of the different components (gas, stars, disk,
dark mater halo, bulge) of an N-body snapshot.

%prep
%setup -q -n %{name}-%{tag_1_20_1}
# Fix build with current HDF5, remove optional default value
sed -i -e '/read/ s/,H5P_DEFAULT//' plugins/gadgeth5/gadgeth5.cc
# Fixup binary install
sed -i -e '/DO_STRIP/ d' \
       -e 's/INSTALL(PROGRAMS.*glnemo2 .*)/install(TARGETS glnemo2 DESTINATION ${CMAKE_INSTALL_BINDIR})/' \
       -e '/link_directories/ d' \
       CMakeLists.txt
# unbundle glew
sed -i -e 's/set *(glew.*)/set(glew )\nfind_package(GLEW REQUIRED)\n/' \
       -e '/target_link_libraries/ s/glnemo2 /glnemo2 GLEW::GLEW/' \
       CMakeLists.txt
rm src/glew/*.c       

sed -i -e 's/\r//' MANUAL

%build
%global optflags %{optflags} -Wno-error=return-type
%cmake \
  -DCMAKE_SKIP_INSTALL_RPATH:BOOL=ON
%cmake_build

%install
%cmake_install

install -Dm 0644 res/images/%{name}.png %{buildroot}%{_datadir}/icons/hicolor/192x192/apps/%{name}.png
%suse_update_desktop_file -c %{name} GLnemo2 "3D OpenGL visualization for Nemo snapshots" %{name} %{name} Qt Graphics 3DGraphics

%files
%license LICENSE
%doc ChangeLog MANUAL 
%{_bindir}/%{name}
%{_datadir}/icons/hicolor/192x192/apps/%{name}.png
%{_datadir}/applications/%{name}.desktop
%{_mandir}/man?/%{name}.1*

%changelog
openSUSE Build Service is sponsored by