File torcs-car-setup-editor.spec of Package torcs-car-setup-editor

#
# spec file for package torcs-car-setup-editor
#
# Copyright (c) 2013 SUSE LINUX Products 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/
#


Name:           torcs-car-setup-editor
Version:        0.11
Release:        0
Summary:        Torcs Car Setup Editor
License:        GPL-2.0+
Group:          Amusements/Games/Action/Race
Url:            http://usuarios.multimania.es/f1torcs/tcse/torcs_car_setup_editor.html
Source0:        %{name}-v01.zip
Source1:        %{name}.png
Source2:        http://prdownloads.sourceforge.net/glui/glui-2.35.tgz
# PATCH-MISSING-TAG -- See http://en.opensuse.org/openSUSE:Packaging_Patches_guidelines
Patch0:         %{name}-gcc43.patch
# PATCH-MISSING-TAG -- See http://en.opensuse.org/openSUSE:Packaging_Patches_guidelines
Patch1:         %{name}-gcc44.patch
# PATCH-MISSING-TAG -- See http://en.opensuse.org/openSUSE:Packaging_Patches_guidelines
Patch2:         %{name}-no-return-in-nonvoid-function.patch
# PATCH-FIX-UPSTREAM torcs-car-setup-editor-gcc47.patch
Patch3:         %{name}-gcc47.patch
BuildRequires:  dos2unix
BuildRequires:  freeglut-devel
BuildRequires:  gcc-c++
BuildRequires:  unzip
BuildRequires:  update-desktop-files
%if 0%{?suse_version} > 1230
BuildRequires:  libXi-devel
BuildRequires:  libXmu-devel
%endif
Requires:       torcs
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Torcs Car Setup Editor is an Open Source program with the
GNU GENERAL PUBLIC LICENSE designed to edit the physics of cars
for TORCS (The Open Racing Car Simulator).

Torcs Car Setup Editor will help you in the setup of cars, the
main features are:

* You don't need to edit the xml files in a text editor.
  You can edit all with the program.
* Real time display of the engine curve and calculation of the
  power of the car in the same graph.
* Symmetrical edit option. You can edit left and right at the
  same time.
* Calculation of the max speed of the car for every gear at
  revs limiter.
* Calculation of the revs, torque and power when you change
  the gear up at max revs.
* View of the ac file in a 3D window.
* Edit some parameters of the car (wheel position, axle position,
  driver position, bonnet position...) in the 3D window.
* Display of the acceleration, grip, speed and braking of the
  car. This is useful to see how affects the modification of a
  parameter in the car.

%prep
%setup -q -n torcs-car-setup-editor -a2
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
rm    *.exe *.dll
rm -r lib

for i in car-setups data documentation; do
	find $i -type f -exec dos2unix {} \;
	find $i -type f -exec chmod 644 {} \;
done
dos2unix     COPYING_GPL_LICENSE.txt
chmod 644 COPYING_GPL_LICENSE.txt

%build
#export SUSE_ASNEEDED=0

# build libglui.a
pushd glui-2.35/src
	make OPTS="%{optflags}" %{?_smp_mflags}
popd
mv glui-2.35/src/lib/libglui.a lib_linux

sed -i -e 's|-lglui -lglut|-lglui -lglut -lGLU -lGL|g' Makefile

make CPP="g++ %{optflags}" %{?_smp_mflags}

%install
install -D -m 755 %{name} %{buildroot}%{_bindir}/tcse-bin

# data
install -dm 755 %{buildroot}%{_datadir}/torcs/tcse
for i in car-setups data; do
	cp -r ./$i %{buildroot}%{_datadir}/torcs/tcse
done
install -dm 755 %{buildroot}%{_datadir}/torcs/tcse/ac3dLoader
install -m 644 ./ac3dLoader/*.rgb %{buildroot}%{_datadir}/torcs/tcse/ac3dLoader
install -m 644 ./ac3dLoader/*.ac %{buildroot}%{_datadir}/torcs/tcse/ac3dLoader
# docs
install -dm 755 %{buildroot}%{_docdir}/%{name}/documentation
pushd %{buildroot}%{_datadir}/torcs/tcse
	ln -s %{_docdir}/%{name}/documentation .
popd

# startscript
install -dm 755 %{buildroot}%{_bindir}
cat > %{name} <<EOF
#! /bin/bash
cd /usr/share/torcs/tcse
%{_bindir}/tcse-bin "\$@"
EOF
install -m 755 %{name} %{buildroot}%{_bindir}

# icons
install -dm 755 %{buildroot}%{_datadir}/pixmaps
install -m 644 %{SOURCE1} %{buildroot}%{_datadir}/pixmaps

# menu
install -dm 755 %{buildroot}%{_datadir}/applications
cat > %{buildroot}%{_datadir}/applications/%{name}.desktop <<EOF
[Desktop Entry]
#Encoding=UTF-8
Type=Application
Exec=%{name}
Icon=%{name}
Terminal=false
Name=Torcs Car Setup Editor
GenericName=Torcs Car Setup Editor
Comment=Torcs Car Setup Editor
#Categories=Game;SportsGame;
EOF
%suse_update_desktop_file %{name} Game SportsGame

%files
%defattr(-,root,root)
%doc COPYING_GPL_LICENSE.txt
%doc documentation
%{_bindir}/%{name}
%{_bindir}/tcse-bin
%dir %{_datadir}/torcs
%{_datadir}/torcs/tcse/
%{_datadir}/pixmaps/*.png
%{_datadir}/applications/*.desktop

%changelog
openSUSE Build Service is sponsored by