# ----------------------------------------------------------
# (1) Data definition
# ----------------------------------------------------------

%define _mandir	%{_datadir}/man
%define _source_dir stone-2.3d-2.3.2.7

Summary: The stone is TCP and UDP packet repeater.
Summary(ja): TCP & UDP パケットリピータ stone
Name: stone
Version: 2.3e
Release: 1%{_dist_release}
URL: http://www.gcd.org/sengoku/stone/
Source0: http://www.gcd.org/sengoku/stone/%{name}-%{version}.tar.gz
# 'rfc1321.txt', 'global.h', 'md5.h', and 'md5c.c'
Source1: stone-Source1.tar.gz
Source2: stone.init
Source3: stone.conf
Source4: stone.1.gz
Source5: stone.1.ja.gz
# adapted for Vine Linux
Patch0: stone-%{version}-Makefile.patch
License: GPL
Group: Applications/Internet

BuildRoot: %{_tmppath}/%{name}-%{version}-root
Prefix: %{_prefix}

Requires: openssl
BuildPrereq: openssl-devel


%description
Stone is a TCP/IP packet repeater in the application layer.  It
repeats TCP and UDP packets from inside to outside of a firewall, or
from outside to inside.

%description -l ja
stone は、アプリケーションレベルの TCP & UDP パケットリピーターです。
ファイアウォールの内から外へ、あるいは外から内へ、TCP パケットあるいは 
UDP パケットを中継します。



# ----------------------------------------------------------
# (2) Scripts
# ----------------------------------------------------------

# --- prep
%prep
rm -rf ${RPM_BUILD_ROOT}
# %setup -a 1 -n ${RPM_PACKAGE_NAME}-${RPM_PACKAGE_VERSION}
%setup -a 1 -n %{_source_dir}
%patch0 -p0 -b .vine

# --- build
%build
make linux-ssl SSL_FLAGS='-DUSE_SSL' SSL_LIBS='-lssl -lcrypto'


# --- install
%install
install -d --mode=0755 ${RPM_BUILD_ROOT}%{_bindir}
install -d --mode=0755 ${RPM_BUILD_ROOT}%{_mandir}/man1
install -d --mode=0755 ${RPM_BUILD_ROOT}%{_mandir}/ja/man1
install --mode=0755 stone ${RPM_BUILD_ROOT}%{_bindir}/stone
install --mode=0644 %{SOURCE4} ${RPM_BUILD_ROOT}%{_mandir}/man1/stone.1.gz
install --mode=0644 %{SOURCE5} ${RPM_BUILD_ROOT}%{_mandir}/ja/man1/stone.1.gz
mkdir -p %{buildroot}/etc/rc.d/init.d
install --mode=0755 %{SOURCE2} ${RPM_BUILD_ROOT}/etc/rc.d/init.d/stone
install --mode=0644 %{SOURCE3} ${RPM_BUILD_ROOT}/etc/stone.conf

# --- clean
%clean
rm -rf ${RPM_BUILD_ROOT}



# ----------------------------------------------------------
# (3) File Lists
# ----------------------------------------------------------

%files
%defattr(-,root,root)
%doc README.txt README.en.txt GPL.txt rfc1321.txt
%{_bindir}/stone
%{_mandir}/man1/stone.1*
%{_mandir}/ja/man1/stone.1*
%config /etc/rc.d/init.d/stone
%config(noreplace) /etc/stone.conf



# ----------------------------------------------------------
# (4) Change Log
# ----------------------------------------------------------

%changelog
* Mon Jun 22 2009 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2.3e-1
- new upstream release
- new versioning policy and spec in UTF-8
- update patch0 (_GNU_SOURCE macro is required glibc >= 2.8)

* Sat May 19 2007 Daisuke SUZUKI <daisuke@linux.or.jp> 2.3c-0vl4
- rebuild with new environment

* Wed Oct 11 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.3c-0vl3
- rebuilt for Vine Linux 4.0

* Fri Oct  6 2006 Takeru INOUE <takeru.inoue@ieee.org>
- 2.3c-0vl1
- Updated

* Sun Jul 16 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.3b-0vl2
- rebuilt for VineSeed (4.0)

* Sun Jul 16 2006 Takeru INOUE <takeru.inoue@ieee.org>
- 2.3b-0vl1
- Build for Vine 3.2

* Sat Jul  8 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.3-0vl2
- rebuilt for VineSeed
- changed Group to Applications/Internet

* Mon Mar 27 2006 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 
- 2.3-0vl1
- new upstream release
- update Patch0
- Build for Vine 3.2

* Sun Mar 23 2003 Takeru INOUE <takeru.inoue@gamma.ocn.ne.jp>
- 2.1x-0vl0
- updated
- add /etc/rc.d/init.d/stone and /etc/stone.conf

* Fri Dec  6 2002 Takashi `Muneharu' Sugimoto <muneharu@raug.net>
- 2.1w-0vl1
- change the file list
* Thu Oct 31 2002 Takashi Sugimoto
- 2.1w-0vl0
- updated
* Mon Aug 19 2002 Takashi Sugimoto
- 2.1v-0vl0
- updated
* Wed Apr 10 2002 Takashi Sugimoto
- 2.1r-0.1vl3

