File celestia.spec of Package celestia
#
# spec file for package celestia
#
# 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/
#
%define sovers 1_7
%ifarch %{arm} aarch64
# Qt uses GLES backend
%bcond_without GLES
%else
%bcond_with GLES
%endif
Name: celestia
Summary: OpenGL Space Simulator
Version: 1.7.0~git20241012.40c92c6
Release: 0
License: GPL-2.0-or-later AND MIT AND Zlib
Group: Productivity/Scientific/Astronomy
URL: https://celestiaproject.space/
Source0: Celestia-%{version}.tar.xz
Source1: https://data.iana.org/time-zones/data/leap-seconds.list
Source2: x-%{name}-script.xml
Source40: baselibs.conf
Patch0: fix-appimage_dir.patch
Patch1: fix-leap-seconds.patch
Patch2: fix-spice-call-to-mktemp.patch
BuildRequires: boost-devel
BuildRequires: cmake
BuildRequires: cmake(fmt)
BuildRequires: cmake(Qt6OpenGLWidgets)
BuildRequires: cmake(Qt6Widgets)
BuildRequires: desktop-file-utils
BuildRequires: dejavu-fonts
BuildRequires: eigen3-devel
BuildRequires: fdupes
BuildRequires: freetype2-devel
%if 0%{?suse_version} < 1600
BuildRequires: gcc10-PIE
BuildRequires: gcc10-c++
%else
BuildRequires: gcc-c++
%endif
BuildRequires: gettext-tools
BuildRequires: gperf
BuildRequires: ninja
BuildRequires: hicolor-icon-theme
BuildRequires: libjpeg8-devel
BuildRequires: libqt5-qtbase-private-headers-devel
BuildRequires: libpng16-devel
BuildRequires: pkgconfig
BuildRequires: pkgconfig(cairo)
BuildRequires: pkgconfig(egl)
BuildRequires: pkgconfig(eigen3)
BuildRequires: pkgconfig(epoxy)
BuildRequires: pkgconfig(fmt) >= 8
BuildRequires: pkgconfig(freetype2)
%if %{with GLES}
BuildRequires: pkgconfig(glesv2)
%endif
BuildRequires: pkgconfig(glu)
BuildRequires: pkgconfig(gtk+-3.0)
BuildRequires: pkgconfig(icu-uc)
BuildRequires: pkgconfig(libavcodec)
BuildRequires: pkgconfig(libavformat)
BuildRequires: pkgconfig(libavif)
BuildRequires: pkgconfig(libavutil)
BuildRequires: pkgconfig(libjpeg)
BuildRequires: pkgconfig(libpng)
BuildRequires: pkgconfig(libswscale)
%ifarch ppc64 ppc64le
BuildRequires: pkgconfig(lua5.1)
%else
BuildRequires: pkgconfig(luajit)
%endif
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Gui)
BuildRequires: pkgconfig(Qt5OpenGL)
BuildRequires: pkgconfig(Qt5Widgets)
BuildRequires: pkgconfig(sdl2)
BuildRequires: pkgconfig(wayland-client)
BuildRequires: pkgconfig(wayland-protocols)
BuildRequires: pkgconfig(wayland-scanner)
BuildRequires: pkgconfig(zlib)
BuildRequires: qt6-base-private-devel
BuildRequires: update-desktop-files
Requires: dejavu-fonts
Suggests: %{name}-tools
Requires: %{name}-ui = %{version}
Recommends: %{name}-qt5 = %{version}
%description
Celestia is a free real-time space simulation that lets you experience
our universe in three dimensions. Unlike most planetarium software,
Celestia does not 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 travel 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.
%define add_optflags(a:f:t:p:w:W:d:g:O:A:C:D:E:H:i:M:n:P:U:u:l:s:X:B:I:L:b:V:m:x:c:S:E:o:v:) \
%global optflags %{optflags} %{**}
%package qt5
Summary: Real-time visual space simulation (Qt 5 frontend)
Requires: %{name} = %{version}
Provides: %{name}-ui = %{version}
Provides: %{name}-qt = %{version}
Obsoletes: %{name}-qt < %{version}
%description qt5
The celestia-qt5 binary for the Qt 5 frontend
%package tools-qt5
Summary: Tools for Celestia data file creation (Qt 5 frontend)
Provides: %{name}-tools-qt = %{version}
Obsoletes: %{name}-tools-qt < %{version}
Suggests: %{name}-tools
%description tools-qt5
This package contains various tools for creating data files for the
Celestia real-time space simulator for the Qt 5 frontend.
%package qt6
Summary: Real-time visual space simulation (Qt 6 frontend)
BuildRequires: qt6-base-private-devel
BuildRequires: cmake(Qt6OpenGLWidgets)
BuildRequires: cmake(Qt6Widgets)
Requires: %{name} = %{version}
Provides: %{name}-ui = %{version}
%description qt6
The celestia-qt6 binary for the Qt 6 frontend
%package tools-qt6
Summary: Real-time visual space simulation (Qt 6 frontend)
Suggests: %{name}-tools
%description tools-qt6
This package contains various tools for creating data files for the
Celestia real-time space simulator for the Qt 6 frontend.
%package tools
Summary: Tools for Celestia data file creation
Group: Productivity/Scientific/Astronomy
Provides: celestia:%{_bindir}/makestardb
Conflicts: celestia < %{version}
%package gtk
Summary: Real-time visual space simulation (GTK+ 3 frontend)
Requires: %{name} = %{version}
Provides: %{name}-ui = %{version}
%description gtk
The celestia-gtk binary for the GTK+ 3 frontend.
%package sdl
Summary: Real-time visual space simulation (SDL frontend)
Requires: %{name} = %{version}
Provides: %{name}-ui = %{version}
%description sdl
The celestia-sdl binary for the SDL frontend.
%description tools
This package contains various tools for creating data files for the
Celestia real-time space simulator.
%package -n lib%{name}%{sovers}
Group: System/Libraries
Summary: Celestia shared library
%description -n lib%{name}%{sovers}
Shared library used by the Celestia tools and the main GUI.
%prep
%autosetup -p1 -n Celestia-%{version}
%build
%add_optflags -I%(pkg-config --variable=includedir wayland-client)
%add_optflags -fno-strict-aliasing
%define __builder ninja
export LD_LIBRARY_PATH=${PWD}/build/src/%{name}:${LD_LIBRARY_PATH}
%cmake \
%if 0%{?suse_version} < 1600
-DCMAKE_C_COMPILER=gcc-10 \
-DCMAKE_CXX_COMPILER=g++-10 \
%endif
-DCELCFG_EXTRAS_DIRS:STRING="\"~/.celestia\"" \
-DCMAKE_SKIP_RPATH:BOOL=ON \
-DENABLE_GTK:BOOL=ON \
-DENABLE_QT:BOOL=ON \
-DENABLE_GLUT:BOOL=OFF \
-DENABLE_LIBAVIF:BOOL=ON \
-DENABLE_LTO:BOOL=ON \
-DENABLE_MINIAUDIO:BOOL=ON \
-DENABLE_QT5:BOOL=ON \
-DENABLE_QT6:BOOL=ON \
-DENABLE_SDL:BOOL=ON \
-DENABLE_SPICE:BOOL=ON \
-DENABLE_TESTS:BOOL=ON \
-DENABLE_TOOLS:BOOL=ON \
-DENABLE_WIN:BOOL=OFF \
-DENABLE_TOOLS:BOOL=ON \
-DENABLE_FFMPEG:BOOL=ON \
-DENABLE_GLES:BOOLS=%{?with_GLES:ON}%{!?with_GLES:OFF} \
-DGIT_COMMIT:STRING=%{version} \
%ifarch ppc64 ppc64le
-DLUA_INCLUDE_DIR:STRING="$(pkg-config --variable=includedir lua5.1)" \
%else
-DLUA_INCLUDE_DIR:STRING="$(pkg-config --variable=includedir luajit)" \
%endif
-DSPICE_BUILD_SHARED_LIBRARY=OFF \
-DUSE_GTK3:BOOL=ON \
-DUSE_ICU:BOOL=ON \
-DUSE_WAYLAND:BOOL=ON \
%{nil}
%cmake_build
%install
%cmake_install
mkdir -p %{buildroot}%{_datadir}/doc/packages/%{name}
install -D -m644 src/celestia/gtk/data/celestia.png %{buildroot}%{_datadir}/icons/hicolor/48x48/celestia.png
install -D -m644 src/celestia/gtk/data/celestia.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/celestia.svg
install -D -m644 src/celestia/qt/data/celestia.png %{buildroot}%{_datadir}/icons/hicolor/128x128/celestia.png
mkdir -p %{buildroot}%{_datadir}/%{name}
install -D -m644 %{S:1} %{buildroot}%{_datadir}/%{name}/
if -s %{_datadir}/zoneinfo/leap-seconds.list
then
mv -v %{buildroot}%{_datadir}/%{name}/leap-seconds.{list,%{name}}
ln -sfv %{_datadir}/zoneinfo/leap-seconds.list %{buildroot}%{_datadir}/%{name}/
fi
# celestia.cfg in /etc
mkdir -p %{buildroot}%{_sysconfdir}
install -D -m644 %{buildroot}%{_datadir}/%{name}/%{name}.cfg %{buildroot}%{_sysconfdir}/
ln -sfv %{_sysconfdir}/%{name}.cfg %{buildroot}%{_datadir}/%{name}/
# Unbundle DejaVu fonts
for font in %buildroot/%{_datadir}/celestia/fonts/*.ttf
do
rm $font
ln -s %{_datadir}/fonts/truetype/${font##*/} $font
done
mkdir -p %{buildroot}%{_datadir}/mime/packages
install -D -m644 %{S:2} %{buildroot}%{_datadir}/mime/packages/
# miniaudio
install -m 0644 thirdparty/miniaudio/LICENSE LICENSE.miniaudio
%find_lang %name
mkdir -p %{buildroot}%{_defaultlicensedir}/%{name}/locale
%fdupes %buildroot/%{_datadir}/celestia
%check
export LD_LIBRARY_PATH=%{buildroot}%{_libdir}:$LD_LIBRARY_PATH
%ctest --parallel 1 --timeout 60 --verbose
%ldconfig_scriptlets -n lib%{name}%{sovers}
%files -f %name.lang
%license COPYING locale/COPYING_* LICENSE.miniaudio
%doc AUTHORS README README.md TRANSLATORS
%config(noreplace) %{_sysconfdir}/%{name}.cfg
%{_datadir}/%{name}
%{_datadir}/icons/hicolor/48x48/*
%{_datadir}/icons/hicolor/128x128/*
%{_datadir}/icons/hicolor/scalable/*
%{_datadir}/mime/packages/x-%{name}-script.xml
%{_datadir}/pixmaps/%{name}.png
%{_mandir}/man1/celestia*
%exclude %{_datadir}/%{name}/%{name}ui.xml
%exclude %{_mandir}/man1/%{name}-qt5.1%{?ext_man}
%exclude %{_mandir}/man1/%{name}-qt6.1%{?ext_man}
%exclude %{_mandir}/man1/%{name}-gtk.1%{?ext_man}
%exclude %{_mandir}/man1/%{name}-sdl.1%{?ext_man}
%files qt5
%{_bindir}/%{name}-qt5
%{_datadir}/applications/space.%{name}project.%{name}_qt5.desktop
%{_datadir}/metainfo/space.%{name}project.%{name}_qt5.metainfo.xml
%{_mandir}/man1/%{name}-qt5.1%{?ext_man}
%files qt6
%{_bindir}/%{name}-qt6
%{_datadir}/applications/space.%{name}project.%{name}_qt6.desktop
%{_datadir}/metainfo/space.%{name}project.%{name}_qt6.metainfo.xml
%{_mandir}/man1/%{name}-qt6.1%{?ext_man}
%files gtk
%{_bindir}/%{name}-gtk
%{_datadir}/%{name}/%{name}ui.xml
%{_datadir}/applications/space.%{name}project.%{name}_gtk.desktop
%{_datadir}/metainfo/space.%{name}project.%{name}_gtk.metainfo.xml
%{_mandir}/man1/%{name}-gtk.1%{?ext_man}
%files sdl
%{_bindir}/%{name}-sdl
%{_datadir}/applications/space.%{name}project.%{name}_sdl.desktop
%{_datadir}/metainfo/space.%{name}project.%{name}_sdl.metainfo.xml
%{_mandir}/man1/%{name}-sdl.1%{?ext_man}
%files tools
%license COPYING
%{_bindir}/*
%exclude %{_bindir}/%{name}-qt5
%exclude %{_bindir}/%{name}-qt6
%exclude %{_bindir}/%{name}-gtk
%exclude %{_bindir}/%{name}-sdl
%exclude %{_bindir}/cmodview-qt5
%exclude %{_bindir}/cmodview-qt6
%files tools-qt5
%license COPYING
%{_bindir}/cmodview-qt5
%files tools-qt6
%license COPYING
%{_bindir}/cmodview-qt6
%files -n lib%{name}%{sovers}
%{_libdir}/libcelestia.so.1.7*
%changelog