#define _enable_ggzwrap --enable-ggzwrap

Summary: Client libraries for GGZ gaming zone
Name:    ggz-client-libs
Version: 0.0.14.1
Release: 3%{?_dist_release}

License: LGPLv2+ and GPLv2+
Group:   System Environment/Libraries
URL: http://www.ggzgamingzone.org/

Source0: http://ftp.belnet.be/packages/ggzgamingzone/ggz/%{version}/ggz-client-libs-%{version}.tar.gz
Source1: ggz.modules
# rpm macros, not sure how useful these will be
Source2: macros.ggz

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: expat-devel
BuildRequires: gettext
BuildRequires: libggz-devel

%description
GGZ (which is a recursive acronym for GGZ Gaming Zone) develops libraries,
games and game-related applications for client-server online gaming. Player
rankings, game spectators, AI players and a chat bot are part of this effort.

%package devel
Summary: Development files for %{name}
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
# %{_sysconfdir}/rpm ownership
Requires: rpm

%description devel
%{summary}.


%prep
%setup -q

# Avoid lib64 rpaths, FIXME better.
%if "%{_libdir}" != "/usr/lib"
sed -i -e 's|"/lib /usr/lib|"/%{_lib} %{_libdir}|' configure
%endif


%build
%configure \
  --disable-debug \
  --disable-static \
  %{?_enable_ggzwrap} %{?!_enable_ggzwrap:--disable-ggzwrap}

make %{?_smp_mflags}


%install
rm -rf %{buildroot}

make install DESTDIR=%{buildroot}

# GGZCONFDIR/ggz.modules
install -D -m644 -p %{SOURCE1} %{buildroot}%{_sysconfdir}/ggz.modules
# GGZDATADIR
mkdir -p %{buildroot}%{_datadir}/ggz
# GGZGAMEDIR
mkdir -p %{buildroot}%{_libdir}/ggz
# RPM macros
install -D -m644 -p %{SOURCE2} %{buildroot}%{_sysconfdir}/rpm/macros.ggz

%find_lang ggzcore
%find_lang ggz-config
cat ggz*.lang >> all.lang

# unpackaged files
rm -f %{buildroot}%{_libdir}/lib*.la
%{!?_enable_ggzwrap:rm -f %{buildroot}%{_mandir}/man1/ggzwrap.1*}


%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig 

%clean
rm -rf %{buildroot}

%files -f all.lang
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README
%config(noreplace) %{_sysconfdir}/ggz.modules
# GPLv2+
%{_bindir}/ggz-config
%if 0%{?_enable_ggzwrap:1}
%{_bindir}/ggz
%{_bindir}/ggz-wrapper
%{_mandir}/man1/ggzwrap.1*
%endif
%dir %{_datadir}/ggz
%dir %{_libdir}/ggz
%{_libdir}/libggzmod.so.*
%{_mandir}/man5/ggz.modules.5*
# LGPLv2+
%{_libdir}/libggzcore.so.*
%{_mandir}/man6/ggz*
%{_mandir}/man7/ggz*
%{_sysconfdir}/xdg/menus/applications-merged/ggz.merge.menu
%{_sysconfdir}/xdg/menus/ggz.menu
%{_datadir}/desktop-directories/ggz*.directory

%files devel
%defattr(-,root,root,-)
%{_sysconfdir}/rpm/macros.ggz
# GPLv2+
%{_includedir}/ggzmod.h
%{_libdir}/libggzmod.so
%{_mandir}/man3/ggzmod_h.3*
# LGPLv+
%{_includedir}/ggzcore.h
%{_libdir}/libggzcore.so
%{_mandir}/man3/ggzcore_h.3*


%changelog
* Mon Nov 17 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 0.0.14.1-3
- rebuilt on current VineSeed

* Thu Apr  7 2011 IWAI, Masaharu <iwai@alib.jp> 0.0.14.1-2vl6
- build on current VineSeed

* Sun Apr 20 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.0.14.1-1
- Initial build for Vine Linux

* Sun Feb 17 2008 Rex Dieter <rdieter@fedoraproject.org> 0.0.14.1-1
- ggz 0.0.14.1

* Fri Feb 08 2008 Rex Dieter <rdieter@fedoraproject.org> 0.0.14-6
- include %%_sysconfdir/rpm/macros.ggz

* Wed Feb 06 2008 Rex Dieter <rdieter@fedoraproject.org> 0.0.14-5
- %%config(noreplace) %%_sysconfdir/ggz.modules (#431726)
- own %%_datadir/ggz, %%_libdir/ggz

* Sat Nov 17 2007 Rex Dieter <rdieter[AT]fedoraproject.org> 0.0.14-4
- --disable-ggzwrap (for now, until multilib, licensing is sorted out)
- move ggz-config to main pkg (runtime management of ggz modules)
- clarify GPL vs. LGPL bits
- drop BR: automake libtool

* Fri Nov 09 2007 Rex Dieter <rdieter[AT]fedoraproject.org> 0.0.14-3
- try (no)rpath trick #2: modify configure

* Thu Nov 08 2007 Rex Dieter <rdieter[AT]fedoraproject.org> 0.0.14-2
- libtoolize to avoid rpaths
- -devel +%%defattr

* Thu Sep 27 2007 Rex Dieter <rdieter[AT]fedoraproject.org> 0.0.14-1
- cleanup

* Sat Apr 08 2006 Dries Verachtert <dries@ulyssis.org> - 0.0.12-1.2
- Rebuild for Fedora Core 5.

* Sat Dec 03 2005 Dries Verachtert <dries@ulyssis.org> - 0.0.12-1
- Initial package.
