File xephem.spec of Package xephem

#
# spec file for package xephem
#
# Copyright (c) 2019 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Lots of modifications since then (c) M.Homann <Mathias.Homann@opensuse.org>
#
# 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 http://bugs.opensuse.org/
#

Name:           xephem
Url:            https://github.com/XEphem/XEphem
Version:        4.2.0
Release:        0
Summary:        A complete planetarium/observatory package for X11/Motif
License:        MIT
Group:          Productivity/Graphics/Visualization/Other

Source0:        xephem-%{version}.tar.xz
# the next 7 files replace fixed Makefile's of the github version by automake variants.
Source1:	configure.ac.1
Source2:	Makefile.am.GUI
Source3:	Makefile.am.libastro
Source4:	Makefile.am.libip
Source5:	Makefile.am.liblilxml
Source6:	Makefile.am
Source7:	Makefile.am.fifo
Source8:	xephem_sites

Patch0:         xephem-4.2.0.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-build

BuildRequires:  xz
BuildRequires:  groff
BuildRequires:  motif-devel
BuildRequires:  libtool
BuildRequires:  automake
BuildRequires:  autoconf

%if 0%{?suse_version}
BuildRequires:  freetype2-devel
BuildRequires:  xorg-x11
%if 0%{?suse_version} > 1600
# for Tumbleweed: these 2 meta-packages don't exist anymore and are actually not needed
%else
BuildRequires:  xorg-x11-devel
BuildRequires:  xorg-x11-libs
%endif
BuildRequires:  libopenssl-devel
BuildRequires:  libjpeg-turbo
BuildRequires:  libjpeg8-devel
BuildRequires:  libpng16-devel
%endif

%if 0%{?fedora} 
BuildRequires:  freetype-devel
%if 0%{?fedora} < 35
BuildRequires:  xorg-x11-server-utils
%endif
BuildRequires:  openssl-devel
BuildRequires:  libjpeg-turbo-devel
%global debug_package %{nil}
%endif

%if 0%{?centos_version}
BuildRequires:  openssl-devel
%global debug_package %{nil}
%endif

%description
XEphem is an interactive astronomy program for all UNIX platforms. Originally
written by Elwood Downey in the 1990s, it has graciously been released under the
MIT License. It is now maintained by an "XEphem" organization, with its source
code residing at https://github.com/XEphem/XEphem.

%prep
%setup -n %{name}-%{version} -T -b 0

%patch -P 0 -p1

%build

#----------------------------------------
# remove private/obsolete versions of public libs
# (we shall link to the versions of the operating system)
#----------------------------------------

rm -rf ${RPM_BUILD_DIR}/%{name}-%{version}/libXm
rm -rf ${RPM_BUILD_DIR}/%{name}-%{version}/libjpegd
rm -rf ${RPM_BUILD_DIR}/%{name}-%{version}/libpng
rm -rf ${RPM_BUILD_DIR}/%{name}-%{version}/libz

#----------------------------------------
# remove C-soure files that trigger error in rpm lint (non-devel package here)
#----------------------------------------
find ${RPM_BUILD_DIR}/%{name}-%{version}/GUI/xephem/tools -name "*.c" -delete

#--------------
# build xephem with autotools 
#-------------

cp %{SOURCE1} configure.ac
cp %{SOURCE2} GUI/xephem/Makefile.am
cp %{SOURCE3} libastro/Makefile.am
cp %{SOURCE4} libip/Makefile.am
cp %{SOURCE5} liblilxml/Makefile.am
cp %{SOURCE6} Makefile.am
cp %{SOURCE7} GUI/xephem/fifos/Makefile.am
cp %{SOURCE8} GUI/xephem/auxil/xephem_sites
autoreconf -i -f -s

%configure


make %{?_smp_mflags}

%install

%make_install 

# avoid "installed but unpackaged" errors from RPM
find %{buildroot} -iname \*.man -delete

# avoid "devel-file-in-non-devel-package" errors from RPM
find %{buildroot} -iname \*.h -delete

#--------------------------
#  make perl and awk scripts executable
#--------------------------
find %{buildroot} -iname \*.pl -exec chmod a+x {} \;
find %{buildroot} -iname \*.awk -exec chmod a+x {} \;

%files
%defattr(-,root,root,-)
%doc LICENSE README.md
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/catalogs
%{_bindir}/%{name}
%{_datadir}/%{name}/auxil
%{_datadir}/%{name}/catalogs/SKY2k65.edb
%{_datadir}/%{name}/catalogs/Messier.edb
%{_datadir}/%{name}/fits
%{_datadir}/%{name}/gallery
%{_datadir}/%{name}/help
%{_datadir}/%{name}/lo
%{_datadir}/%{name}/tools
%{_mandir}/man1/xephem.1.gz
%{_datadir}/X11/app-defaults/XEphem
%{_datadir}/%{name}/fifos

%changelog
openSUSE Build Service is sponsored by