File celestia.spec of Package celestia
#
# spec file for package celestia
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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/
#
%bcond_with glut
%bcond_without spice
Name: celestia
Version: 1.7.0
Release: 0
Summary: Real-time 3D visualization of space
License: GPL-2.0-or-later
Group: Productivity/Scientific/Astronomy
URL: https://celestia.space/
Source0: %{name}-%{version}.tar.xz
Source1: %{name}-rpmlintrc
Source2: %{name}.changes
Source3: %{name}.desktop
Source4: %{name}.appdata.xml
Source5: x-%{name}-script.xml
Patch0: fix-celestia_cfg.patch
Patch1: fix-manual-file-url.patch
Patch2: fix-splash-screen.patch
Patch3: fix-GIT_COMMIT.patch
Patch4: fix-spice-setup.patch
Patch5: fix-dont-install-static-libraries.patch
Patch6: fix-install-scripts.patch
BuildRequires: cmake
BuildRequires: fdupes
BuildRequires: hicolor-icon-theme
BuildRequires: pkgconfig
BuildRequires: update-desktop-files
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Gui)
BuildRequires: pkgconfig(Qt5OpenGL)
BuildRequires: pkgconfig(Qt5Widgets)
BuildRequires: pkgconfig(Qt5Xml)
BuildRequires: pkgconfig(eigen3)
BuildRequires: pkgconfig(fmt)
BuildRequires: pkgconfig(glew)
BuildRequires: pkgconfig(glu)
BuildRequires: pkgconfig(libjpeg)
BuildRequires: pkgconfig(libpng)
BuildRequires: pkgconfig(lua) >= 5.3
BuildRequires: pkgconfig(theora)
BuildRequires: pkgconfig(zlib)
Requires: %{name}-data = %{version}
Recommends: %{name}-lang = %{version}
Suggests: %{name}-tools = %{version}
%if 0%{?suse_version} < 1500
BuildRequires: gcc7
BuildRequires: gcc7-c++
%else
BuildRequires: gcc-c++
%endif
%if %{with glut}
%if 0%{?suse_version} < 1500
BuildRequires: freeglut-devel
%else
BuildRequires: pkgconfig(freeglut)
%endif
BuildRequires: pkgconfig(xi)
BuildRequires: pkgconfig(xmu)
%endif
%if %{with spice}
BuildRequires: pkgconfig(cspice)
%endif
%description
Unlike most planetarium software, Celestia doesn't confine you to the
surface of the Earth. You can travel throughout the solar system, to
any of over 100,000 stars, or even beyond the galaxy.
All movement in Celestia is seamless; the exponential zoom feature lets
you explore space across a huge range of scales, from galaxy clusters
down to spacecraft only a few meters across. A 'point-and-goto'
interface makes it simple to navigate through the universe to the
object you want to visit.
%package data
Summary: Real-time 3D visualization of space
Group: Productivity/Scientific/Astronomy
Requires: %{name} = %{version}
BuildArch: noarch
%description data
Unlike most planetarium software, Celestia doesn't confine you to the
surface of the Earth. You can travel throughout the solar system, to
any of over 100,000 stars, or even beyond the galaxy.
All movement in Celestia is seamless; the exponential zoom feature lets
you explore space across a huge range of scales, from galaxy clusters
down to spacecraft only a few meters across. A 'point-and-goto'
interface makes it simple to navigate through the universe to the
object you want to visit.
This package contains the data files required by Celestia.
%package tools
Summary: Real-time 3D visualization of space
Group: Productivity/Scientific/Astronomy
Suggests: %{name} = %{version}
%description tools
Unlike most planetarium software, Celestia doesn't confine you to the
surface of the Earth. You can travel throughout the solar system, to
any of over 100,000 stars, or even beyond the galaxy.
All movement in Celestia is seamless; the exponential zoom feature lets
you explore space across a huge range of scales, from galaxy clusters
down to spacecraft only a few meters across. A 'point-and-goto'
interface makes it simple to navigate through the universe to the
object you want to visit.
This package contains some tools for Celestia.
%lang_package
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
# fix script-without-shebang
chmod 644 extras-standard/iss/iss.ssc
# fix wrong-file-end-of-line-encoding
sed -i 's/\r$//' README src/tools/stardb/buildstardb.pl
%build
%if 0%{?suse_version} < 1500
export CC=%{_bindir}/gcc-7
export CXX=%{_bindir}/g++-7
%endif
if [ -f "$RPM_SOURCE_DIR/%{name}.obsinfo" ] ; then
_commit_hash=$(sed -n -e 's,^commit: \(.\{9\}\).*,\1,p' "$RPM_SOURCE_DIR/%{name}.obsinfo")
else
if [ -z "$SOURCE_DATE_EPOCH" ] ; then
export SOURCE_DATE_EPOCH=$(stat -c '%%Y' %{SOURCE2})
fi
_commit_hash=$(date -u -d@$SOURCE_DATE_EPOCH '+%%F')
fi
%cmake \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DENABLE_GTK:BOOL=OFF \
-DENABLE_QT:BOOL=ON \
-DENABLE_WIN:BOOL=OFF \
-DGIT_COMMIT="$_commit_hash" \
%if %{with glut}
-DENABLE_GLUT:BOOL=ON \
%else
-DENABLE_GLUT:BOOL=OFF \
%endif
%if %{with spice}
-DENABLE_SPICE:BOOL=ON \
%else
-DENABLE_SPICE:BOOL=OFF \
%endif
%{nil}
%make_jobs
%install
%cmake_install
# some additional tools
install -D -m 0755 -t %{buildroot}%{_libdir}/%{name}-tools/ build/src/buildstardb
install -D -m 0755 -t %{buildroot}%{_libdir}/%{name}-tools/stardb/ src/tools/stardb/buildstardb.pl
install -D -m 0644 -t %{buildroot}%{_datadir}/icons/hicolor/128x128/apps/ src/celestia/qt/data/%{name}.png
install -D -m 0644 -t %{buildroot}%{_datadir}/applications/ %{SOURCE3}
install -D -m 0644 -t %{buildroot}%{_datadir}/metainfo/ %{SOURCE4}
install -D -m 0644 -t %{buildroot}%{_datadir}/mime/packages/ %{SOURCE5}
%suse_update_desktop_file -G "Space Simulator" %{name} Education Astronomy
%find_lang %{name}
%find_lang %{name}_constellations
cat %{name}_constellations.lang >> %{name}.lang
%fdupes -s %{buildroot}%{_datadir}
%if 0%{?suse_version} < 1500
%post
%mime_database_post
%desktop_database_post
%icon_theme_cache_post
%postun
%icon_theme_cache_postun
%desktop_database_postun
%mime_database_postun
%endif
%files
%license COPYING
%doc README README.md
%{_bindir}/%{name}-qt
%if %{with glut}
%{_bindir}/%{name}-glut
%endif
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.png
%if 0%{?suse_version} < 1500
%dir %{_datadir}/metainfo
%endif
%{_datadir}/metainfo/%{name}.appdata.xml
%{_datadir}/mime/packages/x-%{name}-script.xml
%dir %{_datadir}/%{name}
%config(noreplace) %{_datadir}/%{name}/%{name}.cfg
%files data
%{_datadir}/%{name}
%exclude %{_datadir}/%{name}/%{name}.cfg
%files tools
%license COPYING
%doc src/tools/stardb/readme.txt
%{_bindir}/makestardb
%{_bindir}/makexindex
%{_bindir}/startextdump
%{_libdir}/%{name}-tools
%files lang -f %{name}.lang
%changelog