Blob Blame History Raw
Name:          crrcsim
Version:       0.9.12
Release:       17%{?dist}
Group:         Amusements/Games
Summary:       Model-Airplane Flight Simulation Program
License:       GPLv2
URL:           http://sourceforge.net/apps/mediawiki/crrcsim/
Source0:       http://prdownloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
# upstream report: http://preview.tinyurl.com/bnryakb
Patch0:        %{name}-0.9.12-no-io-h.patch
# aarch64 support added
# upstream report: http://preview.tinyurl.com/cass62h
Patch1:        %{name}-0.9.12-aarch64-support.patch


# It is only meant for development purposes.
%global build_with_cmake %{?_with_cmake:1}%{!?_with_cmake:0}

%global the_desktop_file packages/Fedora/CRRCsim.desktop
%global the_icon_file %{_datadir}/%{name}/icons/%{name}.png


%if %{build_with_cmake}
BuildRequires: cmake
%endif
BuildRequires: portaudio-devel
BuildRequires: SDL-devel
BuildRequires: freeglut-devel
BuildRequires: plib-devel
BuildRequires: libjpeg-turbo-devel
BuildRequires: CGAL-devel
BuildRequires: desktop-file-utils


%description
Crrcsim is a model-airplane flight simulation program.
Using it, you can learn how to fly model aircraft, test new aircraft designs,
and improve your skills by practicing on your computer.

The flight model is very realistic.
The flight model parameters are calculated based on a 3D representation
of the aircraft. Stalls are properly modeled as well.
Model control is possible with your own RC transmitter, or any input device
such as joystick, mouse, keyboard.


%package doc
Group:         Documentation
Summary:       Documentation for %{name}
BuildArch:     noarch


%description doc
Documentation for %{name} package.


%prep
%setup -q
%patch0 -p1 -b .no-io-h
%patch1 -p1 -b .aarch64

# Correct EOL.
for i in \
    documentation/input_method/PARALLEL_1_to_3/crrcsim_at90s1200.hex \
    documentation/models/Readmefirst_Crossfire.txt \
    documentation/models/Readmefirst_Erwin.txt \
    documentation/Install_Win32.txt \
    documentation/dlportio.txt; do
        sed -i 's#\r##g' $i;
done

# Remove executable permission.
chmod a-x src/mod_landscape/heightdata.h

# Correct file encoding.
for i in documentation/thermals/table*.cpp; do
  iconv -f iso-8859-1 -t utf-8 -o $i{.utf8,} && mv $i{.utf8,}
done

# Desktop file: correct the icon file location.
sed -i 's#^\(Icon.*=\).*#\1%{the_icon_file}#g' %{the_desktop_file}

# Desktop file: correct categories.
# Reported upstream: http://preview.tinyurl.com/cep8rvp
sed -i 's#^\(Categories=\).*#\1Game;Simulation;#g' %{the_desktop_file}

# Desktop file: remove deprecated "Encoding" key.
# Reported upstream: http://preview.tinyurl.com/cep8rvp
sed -i 's#^Encoding=.*##g' %{the_desktop_file}

# Minimal approach to satisfy the linker.
# Reported upstream: http://preview.tinyurl.com/d3cg4s2
sed -i 's#\($(GLU_LIBS)\)#\1\ -lgmp\ -lboost_thread#' Makefile.in

%if %{build_with_cmake}
# Remove reference to not existing file.
sed -i 's#\(.*m44_test.*\)#\#\1#g' src/mod_math/CMakeLists.txt
%endif


%build
%if %{build_with_cmake}
 mkdir -p build
 pushd build
 %cmake ..
 make %{?_smp_mflags}
 popd
%else
 %configure
 make %{?_smp_mflags}
%endif


%install
make DESTDIR=%{buildroot} install
desktop-file-install \
    --dir=%{buildroot}%{_datadir}/applications \
    %{the_desktop_file}
rm -f %{buildroot}%{_datadir}/%{name}/icons/%{name}.{ico,xpm}
%find_lang %{name} --with-man

# adding to installed docs in order to avoid using %%doc magic
for f in AUTHORS COPYING HISTORY ; do
    cp -p $f %{buildroot}%{_docdir}/%{name}/${f}
done

# Register as an application to be visible in the software center
#
# NOTE: It would be *awesome* if this file was maintained by the upstream
# project, translated and installed into the right place during `make install`.
#
# See http://www.freedesktop.org/software/appstream/docs/ for more details.
#
mkdir -p $RPM_BUILD_ROOT%{_datadir}/appdata
cat > $RPM_BUILD_ROOT%{_datadir}/appdata/CRRCsim.appdata.xml <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2014 Ryan Lerch <rlerch@redhat.com> -->
<!--
BugReportURL: https://sourceforge.net/p/crrcsim/feature-requests/37/
SentUpstream: 2014-07-11
-->
<application>
  <id type="desktop">CRRCsim.desktop</id>
  <metadata_license>CC0-1.0</metadata_license>
  <name>Charles River RC Flight Simulator</name>
  <summary>Flight simulator for model remote controlled aircraft</summary>
  <description>
    <p>
      The Charles River RC Flight Simulator (CRRCSim) is a flight simulator to
      test fly model aircraft.
      CRRCSim comes with over 15 different types of model gliders and planes, and
      lets you fly in 3 different locations.
    </p>
  </description>
  <url type="homepage">https://sourceforge.net/projects/crrcsim/</url>
  <screenshots>
    <screenshot type="default">https://raw.githubusercontent.com/hughsie/fedora-appstream/master/screenshots-extra/CRRCsim/a.png</screenshot>
    <screenshot>https://raw.githubusercontent.com/hughsie/fedora-appstream/master/screenshots-extra/CRRCsim/b.png</screenshot>
  </screenshots>
  <!-- FIXME: change this to an upstream email address for spec updates
  <updatecontact>someone_who_cares@upstream_project.org</updatecontact>
   -->
</application>
EOF

%post
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :


%postun
if [ $1 -eq 0 ] ; then
    /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null
    /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi


%posttrans
/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :


%files -f %{name}.lang
%{_bindir}/crrcsim
%{_datadir}/appdata/*.appdata.xml
%{_datadir}/applications/CRRCsim.desktop
%{_datadir}/%{name}/
%{_mandir}/man1/%{name}.1*
%dir %{_docdir}/%{name}/
%{_docdir}/%{name}/AUTHORS
%{_docdir}/%{name}/COPYING
%{_docdir}/%{name}/HISTORY


%files doc
# all documentation in this package (including the license)
%{_docdir}/%{name}/


%changelog
* Wed Aug 05 2015 Jonathan Wakely <jwakely@redhat.com> 0.9.12-17
- Rebuilt for Boost 1.58

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.12-16
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Sat May 02 2015 Kalev Lember <kalevlember@gmail.com> - 0.9.12-15
- Rebuilt for GCC 5 C++11 ABI change

* Thu Mar 26 2015 Richard Hughes <rhughes@redhat.com> - 0.9.12-14
- Add an AppData file for the software center

* Fri Mar 06 2015 Damian Wrobel <dwrobel@ertelnet.rybnik.pl> - 0.9.12-13
- Rebuild for libCGAL.so.11.

* Mon Feb 09 2015 Ralf Corsépius <corsepiu@fedoraproject.org> - 0.9.12-12
- Rebuild for boost-1.57.

* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.12-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.12-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Fri May 23 2014 David Tardon <dtardon@redhat.com> - 0.9.12-9
- rebuild for boost 1.55.0

* Mon Apr 28 2014 Damian Wrobel <dwrobel@ertelnet.rybnik.pl> - 0.9.12-8
- BR corrected.

* Sat Dec 14 2013 Michael Schwendt <mschwendt@fedoraproject.org>
- Fix duplicate documentation (#1001277)
- Simplify the %%files list
- Drop base package dependency from -doc subpackage

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.12-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Sun Jul 28 2013 Petr Machata <pmachata@redhat.com> - 0.9.12-6
- Rebuild for boost 1.54.0
- Link against -lboost_thread, the -mt variant is not shipped anymore.

* Sat Mar 23 2013 Damian Wrobel <dwrobel@ertelnet.rybnik.pl> - 0.9.12-5
- aarch64 support added, fixes #925200
- updating icon cache scriplets added

* Sun Feb 10 2013 Denis Arnaud <denis.arnaud_fedora@m4x.org> - 0.9.12-4
- Rebuild for Boost-1.53.0

* Fri Feb 01 2013 Dan Horák <dan[at]danny.cz> - 0.9.12-3
- fix build on platforms without io.h

* Tue Jan 29 2013 Damian Wrobel <dwrobel@ertelnet.rybnik.pl> - 0.9.12-2
- doc subpackage BuildArch adn Requires corrected.

* Tue Jun 12 2012 Damian Wrobel <dwrobel@ertelnet.rybnik.pl> - 0.9.12-1
- initial RPM release.