File frozen-bubble.spec of Package frozen-bubble

#
# spec file for package frozen-bubble
#
# 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/
#


Name:           frozen-bubble
Version:        2.2.0
Release:        0
Summary:        Puzzle with Bubbles
License:        GPL-2.0+
Group:          Amusements/Games/Action/Arcade
Url:            http://www.frozen-bubble.org/
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
BuildRequires:  SDL_Pango-devel
BuildRequires:  SDL_image-devel
BuildRequires:  SDL_mixer-devel
BuildRequires:  pango-devel
%if 0%{?suse_version} && 0%{?suse_version} > 1010
BuildRequires:  fdupes
BuildRequires:  perl-SDL_Perl >= 2.1.3
BuildRequires:  update-desktop-files
Requires(pre):  %fillup_prereq
Requires(pre):  %insserv_prereq
Requires(pre):  net-tools
Requires:       perl-SDL_Perl >= 2.1.3
%endif
%if 0%{?fedora_version}
BuildRequires:  gettext
BuildRequires:  perl-SDL >= 2.1.3
BuildRequires:  glib2-devel
Requires:       perl-SDL >= 2.1.3
%endif
Requires:       %{name}-server = %{version}
Requires:       perl = %{perl_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.

%package server
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.

%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="%{optflags}" 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=%{buildroot} PREFIX=/usr DATADIR=/usr/share LIBDIR=%{_libdir}
%if 0%{?suse_version} <= 1010
popd
%endif
# install server part
mkdir -p %{buildroot}/%{_sysconfdir}/init.d %{buildroot}/%{_sbindir}
sed "s+\(FB_SERVER_BIN=\).*+\1%{_libdir}/frozen-bubble/fb-server+" %{SOURCE4} >%{buildroot}/%{_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 %{buildroot}%{_sbindir}/rcfb-server
ln -s /etc/init.d/frozen-bubble-server %{buildroot}%{_sbindir}/rcfrozen-bubble-server
install -d -m 1755 %{buildroot}%{_localstatedir}/run/fb-server
touch %{buildroot}/%{_sysconfdir}/fb-server.conf
%if 0%{?suse_version} <= 1010
exit 0
%endif
%if 0%{?suse_version} > 1010
%perl_process_packlist
%endif
%if 0%{?suse_version} < 1140
rm %{buildroot}%{perl_vendorarch}/auto/fb_c_stuff/.packlist
rm %{buildroot}%{_localstatedir}/adm/perl-modules/frozen-bubble
%endif
mv c_stuff/lib/fb_stuff.pm_ c_stuff/lib/fb_stuff.pm
mkdir -p %{buildroot}%{_datadir}/pixmaps/
install -m 644 $RPM_SOURCE_DIR/%{name}.png %{buildroot}%{_datadir}/pixmaps
%if 0%{?suse_version}
%suse_update_desktop_file -i %{name} Game ArcadeGame
%fdupes %{buildroot}${_datadir}
%endif
chmod 644 %{buildroot}%{_mandir}/man6/frozen-bubble.6 \
          %{buildroot}%{_mandir}/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
%ghost %attr(755,root,root) %dir %{_localstatedir}/run/fb-server

%changelog
openSUSE Build Service is sponsored by