File frozen-bubble.spec of Package frozen-bubble

#
# spec file for package frozen-bubble (Version 2.2.0)
#
# Copyright (c) 2010 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/
#

# norootforbuild


Name:           frozen-bubble
Summary:        Puzzle with Bubbles
Version:        2.2.0
Release:        9
Url:            http://www.frozen-bubble.org/
License:        GPLv2+
Group:          Amusements/Games/Action/Arcade
Source:         %{name}-%{version}.tar.bz2
Source1:        %{name}.desktop
Source2:        %{name}.png
Source3:        suse_frozen2.png
Source4:        fb-server
Patch1:         frozen-bubble-2.2.0-keys.patch
Patch2:         frozen-bubble-2.2.0-german.patch
Patch3:         frozen-bubble-2.2.0-total_launched_bubbles.patch
BuildRequires:  Mesa-devel pango-devel
BuildRequires:  SDL_Pango-devel SDL_image-devel SDL_mixer-devel
%if 0%{?suse_version} && 0%{?suse_version} > 1010
PreReq:         %insserv_prereq  %fillup_prereq net-tools
Requires:       perl-SDL_Perl >= 2.1.3
BuildRequires:  fdupes perl-SDL_Perl >= 2.1.3 update-desktop-files
%endif
%if 0%{?fedora_version}
Requires:       perl-SDL >= 2.1.3
BuildRequires:  gettext glib2-devel perl-SDL >= 2.1.3
%endif
Requires:       perl = %{perl_version}
Requires:       %{name}-server = %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Shoot up bubbles. Similar to the console game Puzzle-Bobble.

Colorful 3D rendered penguin animations, 100 levels of 1p game, hours and
hours of 2p game, nights and nights of 2p/3p/4p/5p game over LAN or Internet,
a level-editor, 3 professional quality digital soundtracks, 15 stereo sound
effects, 8 unique graphical transition effects, 8 unique logo eye-candies.

Authors:
--------
    Guillaume Cottenceau <guillaume.cottenceau at free.fr>

%package server
License:        GPLv2+
Summary:        Puzzle with Bubbles - Server
Group:          Amusements/Games/Action/Arcade

%description server
Server for frozen-bubble.

Colorful 3D rendered penguin animations, 100 levels of 1p game, hours and
hours of 2p game, nights and nights of 2p/3p/4p/5p game over LAN or Internet,
a level-editor, 3 professional quality digital soundtracks, 15 stereo sound
effects, 8 unique graphical transition effects, 8 unique logo eye-candies.


Authors:
--------
    Guillaume Cottenceau <guillaume.cottenceau at free.fr>

%prep
%setup -q
cp server/init/README server/README.init
%patch1 -p1
%patch2 -p1
%patch3 -p1

%build
export CPPFLAGS="%{optflags}"
export CFLAGS="%{optflags}"
%if 0%{?suse_version} <= 1010
pushd server
%endif
make OPTIMIZE="$RPM_OPT_FLAGS" PREFIX=%{_prefix} INSTALLDIRS=vendor DATADIR=%{_datadir} LIBDIR=%{_libdir}
%if 0%{?suse_version} <= 1010
popd
%endif

%install
%if 0%{?suse_version} <= 1010
pushd server
%endif
make install DESTDIR=$RPM_BUILD_ROOT PREFIX=/usr DATADIR=/usr/share LIBDIR=%{_libdir}
%if 0%{?suse_version} <= 1010
popd
%endif
# install server part
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/init.d $RPM_BUILD_ROOT/%{_sbindir}
sed "s+\(FB_SERVER_BIN=\).*+\1%{_libdir}/frozen-bubble/fb-server+" %{SOURCE4} >$RPM_BUILD_ROOT/%{_sysconfdir}/init.d/frozen-bubble-server
sed "s+\(FLPATH = '\).*'+\1%{_libdir}/frozen-bubble'+" c_stuff/lib/fb_stuff.pm >c_stuff/lib/fb_stuff.pm_
ln -s /etc/init.d/frozen-bubble-server $RPM_BUILD_ROOT/usr/sbin/rcfb-server
ln -s /etc/init.d/frozen-bubble-server $RPM_BUILD_ROOT/usr/sbin/rcfrozen-bubble-server
touch $RPM_BUILD_ROOT/%{_sysconfdir}/fb-server.conf
mkdir -p $RPM_BUILD_ROOT/var/run/fb-server
%if 0%{?suse_version} <= 1010
exit 0
%endif
%if 0%{?suse_version} > 1010
%perl_process_packlist
%endif
%if 0%{?suse_version} < 1140
rm $RPM_BUILD_ROOT%{perl_vendorarch}/auto/fb_c_stuff/.packlist
rm $RPM_BUILD_ROOT/var/adm/perl-modules/frozen-bubble
%endif
mv c_stuff/lib/fb_stuff.pm_ c_stuff/lib/fb_stuff.pm
mkdir -p $RPM_BUILD_ROOT/usr/share/pixmaps/
install -m 644 $RPM_SOURCE_DIR/%name.png $RPM_BUILD_ROOT/usr/share/pixmaps
%if 0%{?suse_version}
%suse_update_desktop_file -i %name Game ArcadeGame
%fdupes -s $RPM_BUILD_ROOT
%endif
chmod 644 $RPM_BUILD_ROOT/usr/share/man/man6/frozen-bubble.6 \
          $RPM_BUILD_ROOT/usr/share/man/man6/frozen-bubble-editor.6
%find_lang %{name}

%clean
rm -rf %{buildroot}
%if 0%{?suse_version}

%post server
%{fillup_and_insserv -f frozen-bubble-server}
if [ ! -f "%{_sysconfdir}/fb-server.conf" ]; then
  if [ -f "%{_sysconfdir}/language" ]; then
	. %{_sysconfdir}/language
	lang=$(echo ${RC_LANG%*_*})
  fi
  if [ -n "$lang" -o "$lang" = "" ]; then
	lang="en"
  fi
  if [ -x /bin/hostname ]; then
	servername=$(hostname -s)
  else 
	servername="testserver"
  fi
  cat > %{_sysconfdir}/fb-server.conf << EOF
# Specify the desired language of the server below (it is just an
# indication used by players when choosing a server, so that
# they can chat using their native language). You can specify none
# with the parameterless option 'z'.
# Name of the server as seen by FB players
n $servername
# Preferred language of players
a $lang
EOF
fi

%preun server
%stop_on_removal frozen-bubble-server

%postun server
%restart_on_update frozen-bubble-server
%insserv_cleanup
%endif
%if ! 0%{?suse_version} || 0%{?suse_version} > 1010

%files -f %{name}.lang
%defattr(-, root, root)
%doc AUTHORS COPYING README
%dir %{perl_vendorarch}/auto/fb_c_stuff
%dir %{_libdir}/frozen-bubble
%{perl_vendorarch}/FBLE.pm
%{perl_vendorarch}/auto/fb_c_stuff/fb_c_stuff.bs
%{perl_vendorarch}/auto/fb_c_stuff/fb_c_stuff.so
%{perl_vendorarch}/fb_c_stuff.pm
%{perl_vendorarch}/fb_config.pm
%{perl_vendorarch}/fb_net.pm
%{perl_vendorarch}/fb_stuff.pm
%{perl_vendorarch}/fbsyms.pm
%{perl_vendorarch}/fb_net_discover.pm
%{_bindir}/frozen-bubble
%{_bindir}/frozen-bubble-editor
%{_datadir}/frozen-bubble/
%attr (644,root,root) %{_mandir}/man6/frozen-bubble.6.gz
%attr (644,root,root) %{_mandir}/man6/frozen-bubble-editor.6.gz
%{_datadir}/applications/%name.desktop
%{_datadir}/pixmaps/%name.png
%exclude %{_datadir}/frozen-bubble/gfx/gen
%endif

%files server
%defattr(-, root, root)
%doc server/AUTHORS COPYING server/README* server/init/fb-server.conf
%ghost %config(noreplace) %{_sysconfdir}/fb-server.conf
%defattr(755, root, root)
%{_libdir}/frozen-bubble/fb-server
%{_sysconfdir}/init.d/frozen-bubble-server
%{_sbindir}/rcfb-server
%{_sbindir}/rcfrozen-bubble-server
%dir /var/run/fb-server

%changelog