Blob Blame History Raw
Name:          crrcsim
Version:       0.9.12
Release:       11%{?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


%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}/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
* 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.