File FlightGear.spec of Package FlightGear

# spec file for package FlightGear
# 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

%define main_version 2017.3
Name:           FlightGear
Version:        %{main_version}.1
Release:        0
Summary:        Flight Simulator
License:        GPL-2.0
Group:          Amusements/Games/3D/Simulation
Source1:        %{name}.desktop

BuildRequires:  SimGear-devel = %{version}
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  hicolor-icon-theme
BuildRequires:  pkgconfig
# Required for screensaver inhibition
BuildRequires:  freeglut-devel
BuildRequires:  plib-devel
BuildRequires:  sqlite3-devel
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(dbus-1)
BuildRequires:  pkgconfig(freetype2)
BuildRequires:  pkgconfig(glew)
BuildRequires:  pkgconfig(libcurl)
BuildRequires:  pkgconfig(libpng)
BuildRequires:  pkgconfig(libudev)
BuildRequires:  pkgconfig(xi)
BuildRequires:  pkgconfig(xmu)

# Additional dependencies to enable FlightGear's new Qt launcher interface
BuildRequires:  libQt5Network-devel
BuildRequires:  libQt5Widgets-devel
BuildRequires:  libqt5-qtdeclarative-devel

Requires:       FlightGear-data = %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

The FlightGear project is working to create a sophisticated flight
simulator framework for the development and pursuit of interesting
flight simulator ideas. We are developing a solid basic sim that can be
expanded and improved upon by anyone interested in contributing

%setup -q -n flightgear-%{version}

# remove some unneeded doc files
for ext in Cygwin IRIX Joystick Linux MSVC MSVC8 MacOS SimGear Unix Win32-X autoconf mingw plib src xmlsyntax; do
  rm -f docs-mini/README.${ext}

modified="$(sed -n '/^----/n;s/ - .*$//;p;q' "%{_sourcedir}/%{name}.changes")"
DATE="\"$(date -d "${modified}" "+%%b %%e %%Y")\""
TIME="\"$(date -d "${modified}" "+%%R")\""
sed -i -e "s@__DATE__@$DATE@g" -e "s@__TIME__@$TIME@g" utils/fgcom/fgcom.cxx src/FDM/JSBSim/FGJSBBase.cpp

# remove FlightGear's default .desktop file (we ship our own)
rm package/org.flightgear.FlightGear.desktop
echo "# .desktop file removed for openSUSE" > package/CMakeLists.txt

%cmake \
    -DFG_DATA_DIR:STRING="%{_datadir}/flightgear" \
make %{?_smp_mflags}

# install icons
install -m 0755 -d %{buildroot}%{_datadir}/icons/hicolor/
pushd icons
cp -r -t %{buildroot}%{_datadir}/icons/hicolor/ 16x16 32x32 48x48 64x64 128x128 scalable
# install desktop file
%suse_update_desktop_file -i %{name}
# remove obsolete utilities
cd %{buildroot}%{_bindir} && rm -f GPSsmooth MIDGsmooth UGsmooth metar yasim yasim-proptest

%doc AUTHORS COPYING ChangeLog NEWS README Thanks docs-mini/*
# Workaround for Leap 42.2
%if 0%{?sle_version} == 120200 && 0%{?is_opensuse}
%dir %{_datadir}/bash-completion
%dir %{_datadir}/zsh
%dir %{_datadir}/zsh/site-functions