File wings.spec of Package wings

#
# spec file for package wings
#
# Copyright (c) 2012 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/
#

%define erlangdir %{_libdir}/erlang

Name:           wings
Version:        2.1.5
Release:        1
License:        SUSE-Permissive
Summary:        3D Subdivision Modeler
Url:            http://www.wings3d.com
Group:          Productivity/Graphics/3D Editors
Source0:        %{name}-%{version}.tar.bz2
Source1:        wings.png
Patch0:         wings-2.1.5-makefiles.patch
BuildRequires:  Mesa-devel
BuildRequires:  erlang-esdl-devel
BuildRequires:	erlang-wx
BuildRequires:	erlang-opencl-devel
BuildRequires:  gcc
BuildRequires:  libSDL-devel
BuildRequires:  update-desktop-files
# might be that the automatic dependency resolving does not work correctly?
# => please see bnc #750318 - so we require libSDL_sound here to be sure
# Requires:       libSDL_sound
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Wings 3D is a subdivision modeler with an user interface that is easy
to use for both beginners and advanced users (inspired by Nendo and
Mirai from Izware).

%prep
%setup -q

# link is for include statement to find wings/.. directories
(cd .. && ln -s %{name}-%{version} %{name})
%patch0 -p1

# remove -Werror, since erlc 20+ warns on export_all
find . -name Makefile -exec sed -i .bak -e 's/-Werror//' {} \;

# add 

%build
export ESDL_PATH=
PATH=%{erlangdir}/bin:$PATH make %{?_smp_mflags} TYPE=wx 

%install
%define wingsdir %{_libdir}/%{name}-%{version}

mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{wingsdir}

# copy the wings binaries
cp -rf ebin %{buildroot}%{wingsdir}
cp -rf textures %{buildroot}%{wingsdir}
cp -rf shaders %{buildroot}%{wingsdir}
cp -rf plugins %{buildroot}%{wingsdir}
cp -rf vsn.mk %{buildroot}%{wingsdir}

mkdir -p %{buildroot}%{_datadir}/pixmaps
cp %{SOURCE1} %{buildroot}%{_datadir}/pixmaps/

cat > %{buildroot}%{_bindir}/wings <<EOF
#!/bin/sh
ROOTDIR=%{wingsdir}/ebin
exec %{_bindir}/erl -smp -pa ${ROOTDIR} -run wings_start start_halt \$*
EOF
chmod 0755 %{buildroot}%{_bindir}/wings

cat > wings.desktop <<EOF
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=Wings 3D
GenericName=Wings 3D
Comment=Wings 3D polygon mesh modeler
Exec=wings
Icon=wings
Type=Application
StartupNotify=true
StartupWMClass=Wings 3D
Categories=Graphics;3DGraphics;
EOF

%suse_update_desktop_file -n -i %{name}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%clean
rm -rf '%{buildroot}'

%files
%defattr(-,root,root,-)
%doc AUTHORS CodingGuidelines license.terms README OLD-NOTES README-20.txt
%{_bindir}/%{name}
%{wingsdir}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png

%changelog
openSUSE Build Service is sponsored by