File celestia-data-alt.spec of Package celestia-data-alt
#
# spec file for package celestia-data-alt
#
# copyright (c) 2026 munix9@googlemail.com
#
%define pkg_ver %(rpm -q --qf "%%{VERSION}" celestia-data-common)
%define pkg_log %(rpm -q --changelog celestia-data-common | iconv -f UTF-8 -t ASCII//IGNORE >> %{_sourcedir}/celestia-data-alt.spec)
%define flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == ""
ExclusiveArch: do-not-build
%endif
%define _desc Celestia is a free 3D astronomy program. Based on the Hipparcos\
Catalogue, it allows users to display objects ranging in scale from\
artificial satellites to entire galaxies in three dimensions using\
OpenGL. Unlike most planetarium software, the user is free to travel\
about the Universe.
#%%ifarch x86_64
#%%bcond_without upstream_avif_tools
#%%else
%bcond_with upstream_avif_tools
#%%endif
Name: celestia-data-%{flavor}
#Version: %%{pkg_ver}
Version: 1.7.0~git20260306
Release: 0
Summary: Data files for Celestia, a real-time visual space simulation
License: GPL-2.0-or-later AND CC0-1.0 AND CC-BY-3.0 AND CC-BY-4.0 AND CC-BY-NC-SA-3.0 AND CC-BY-SA-3.0 AND CC-BY-SA-4.0
URL: https://celestiaproject.space/
Source99: celestia-data-alt.rpmlintrc
#BuildRequires: celestia-data-common >= 1.7.0~
BuildRequires: celestia-textures-hires >= 1.7.0~
BuildRequires: celestia-textures-lores >= 1.7.0~
BuildRequires: celestia-textures-medres >= 1.7.0~
BuildRequires: gnu_parallel
%if "%{flavor}" == "avif"
%if %{with upstream_avif_tools}
#Source10: https://github.com/AOMediaCodec/libavif/releases/download/v1.2.1/linux-artifacts.zip
BuildRequires: unzip
%else
BuildRequires: avif-tools
%endif
%endif
%if "%{flavor}" == "dds"
BuildRequires: ImageMagick
%endif
%description
%{_desc}
This package contains the data files for Celestia.
%package -n celestia-textures-hires-%{flavor}
Summary: Data files for Celestia, a real-time visual space simulation
Requires: celestia-data-common >= 1.7.0~
Conflicts: celestia-textures-hires
Provides: celestia-textures-hires = %{version}
Provides: celestia-textures = %{version}
BuildArch: noarch
%description -n celestia-textures-hires-%{flavor}
%{_desc}
This package contains the high resolution textures for Celestia.
Selected images have been converted to "%{flavor}" to save space.
Celestia must support this format to display them.
%package -n celestia-textures-lores-%{flavor}
Summary: Data files for Celestia, a real-time visual space simulation
Requires: celestia-data-common >= 1.7.0~
Conflicts: celestia-textures-lores
Provides: celestia-textures-lores = %{version}
Provides: celestia-textures = %{version}
BuildArch: noarch
%description -n celestia-textures-lores-%{flavor}
%{_desc}
This package contains the low resolution textures for Celestia.
Selected images have been converted to "%{flavor}" to save space.
Celestia must support this format to display them.
%package -n celestia-textures-medres-%{flavor}
Summary: Data files for Celestia, a real-time visual space simulation
Requires: celestia-data-common >= 1.7.0~
Conflicts: celestia-textures-medres
Provides: celestia-textures-medres = %{version}
Provides: celestia-textures = %{version}
BuildArch: noarch
%description -n celestia-textures-medres-%{flavor}
%{_desc}
This package contains the medium resolution textures for Celestia.
Selected images have been converted to "%{flavor}" to save space.
Celestia must support this format to display them.
%prep
%autosetup -c -T -p1
mkdir .bin
%if "%{flavor}" == "avif"
%if %{with upstream_avif_tools}
unzip %{SOURCE10} avifenc -d .bin
%endif
%endif
install -d -m 0755 celestia/textures
cp -a %{_datadir}/celestia/textures/{hi,lo,med}res celestia/textures
# hack: copy changelog from celestia-data-common package
echo %{pkg_log} >/dev/null
%build
export PATH=$PWD/.bin:$PATH
%if "%{flavor}" == "avif"
avifenc -V | tee .avifenc
_ver="cat .avifenc | head -1 | awk -F'[ ]' '{print $2}'"
_par="--ignore-icc "
if echo -e "1.2\n$_ver" | sort -C -V ; then
_par+="--qcolor 90 --qalpha 90"
else
_par+="--min 0 --max 14 --minalpha 0 --maxalpha 14"
fi
if grep -qw "aom" .avifenc ; then
_aom="-a end-usage=q -a color:cq-level=18 -a alpha:cq-level=10 -a tune=ssim"
else
_aom=""
fi
conv_prog="avifenc $_par $_aom -s 4 -j all"
%endif
%if "%{flavor}" == "dds"
conv_prog="magick -verbose -define dds:mipmaps=1 -define dds:compression=dxt1"
%endif
# for tests
#conv_prog="cp -p"
test -n "$conv_prog" || exit 1
find celestia/textures/*res -type f \( -name "*.jpg" -o -name "*.png" \) \
! -name "*-rings.*" | sort | \
parallel --plus --tagstring "({0#}/{##}) " -j 1 -k \
$conv_prog {} {.}.%{flavor} \; rm -v {}
%install
install -d -m 0755 %{buildroot}%{_datadir}
mv -v celestia %{buildroot}%{_datadir}
%files -n celestia-textures-hires-%{flavor}
%{_datadir}/celestia/textures/hires
%files -n celestia-textures-lores-%{flavor}
%{_datadir}/celestia/textures/lores
%files -n celestia-textures-medres-%{flavor}
%{_datadir}/celestia/textures/medres
%changelog