File FlightGear-data.spec of Package FlightGear-data

#
# spec file for package FlightGear-data
#
# Copyright (c) 2017 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 http://bugs.opensuse.org/
#


%define main_version 2017.3
Name:           FlightGear-data
Version:        %{main_version}.1
Release:        0
Summary:        FlightGear base scenery and data files
License:        GPL-2.0
Group:          Amusements/Games/3D/Simulation
Url:            http://www.flightgear.org/
Source0:        https://sourceforge.net/projects/flightgear/files/release-%{main_version}/FlightGear-%{version}-data.tar.bz2
# Remove warnings about hidden files to make other rpmlint warnings readable.
Source1:        FlightGear-data-rpmlintrc
NoSource:       0
BuildRequires:  dos2unix
BuildRequires:  fdupes
BuildRequires:  python-xml
BuildRequires:  texlive-latex-bin-bin
BuildRequires:  xz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
Recommends:     FlightGear-docs-%{version}

%description
This package contains the base scenery and aircraft for FlightGear.
It must be installed together with the FlightGear flight simulator package.

%package -n FlightGear-docs
Summary:        FlightGear Documentation
Group:          Documentation
Requires:       %{name} = %{version}

%description -n FlightGear-docs
This package contains pdf, text and html documentation for the
FlightGear flight simulator package.

%prep

%build

%install
install -d %{buildroot}%{_datadir}/flightgear
cd %{buildroot}%{_datadir}/flightgear
tar -jxf %{SOURCE0} --strip-components 1

# cleanup temporary files and fix permissions
find %{buildroot}%{_datadir}/flightgear -name '.git*' -print -delete -name '*#*' -print -delete -name "*.bak" -print -delete
dos2unix -c ascii Docs/model-combined.eff/README.model-combined.eff
# fix files not in utf-8
for path in Thanks Docs/README.xmlparticles ; do
  iconv -f iso-8859-1 -t utf-8 -o "$path.utf8" "$path"
  mv -f "$path.utf8" "$path"
done

# Create html documentation and remove executable
cd Docs
%if 0%{?suse_version} > 1320 || 0%{?sle_version} >= 120200
./compile_docs.py
%endif
rm -f compile_docs.py
cd ../
# Move docs to default docdir
mkdir -p %{buildroot}%{_defaultdocdir}/%{name}
find %{buildroot}%{_datadir}/flightgear/Docs/ -name \*.log -print0 | xargs -0 rm # drop unneccesary TeX logs
mv %{buildroot}%{_datadir}/flightgear/Docs %{buildroot}%{_defaultdocdir}/%{name}/

find %{buildroot}%{_datadir}/flightgear -type f -exec chmod 0644 "{}" "+"
#Change permissions back for executable scripts
chmod -f 0755 `find %{buildroot}%{_datadir}/flightgear -type f -perm 0644 -print0|xargs -0r grep -l '#!/usr'`
chmod -f 0755 `find %{buildroot}%{_datadir}/flightgear -type f -perm 0644 -print0|xargs -0r grep -l '#!/bin'`

# put documentation and license in the proper location
for f in COPYING AUTHORS NEWS README Thanks; do
  mv "$f" "%{buildroot}%{_defaultdocdir}/%{name}"
done
# Move additional license files to docs See boo#987206
mv %{buildroot}%{_datadir}/flightgear/Fonts/LiberationFonts/COPYING %{buildroot}%{_defaultdocdir}/%{name}/COPYING-LiberationFonts
mv %{buildroot}%{_datadir}/flightgear/AI/Aircraft/A330-MRTT/COPYING %{buildroot}%{_defaultdocdir}/%{name}/COPYING-A330-MRTT

# Zero length files in docs can be deleted
find %{buildroot}%{_defaultdocdir}/%{name} -type f -empty -print -delete

%fdupes -s %{buildroot}/%{_datadir}/flightgear
%fdupes -s %{buildroot}%{_defaultdocdir}/%{name}

%files
%defattr(-,root,root,-)
%{_datadir}/flightgear/

%files -n FlightGear-docs
%defattr(-,root,root,-)
%doc %{_defaultdocdir}/%{name}

%changelog
openSUSE Build Service is sponsored by