#%define mirror_dir %{_prefix}/lib/mirror
%define mirror_dir %{perl_vendorlib}/mirror
Summary:     Perl program to mirror FTP sites
Summary(ja): FTP サイトをミラーする Perl のプログラム
Name:        mirror
Version:     2.9
Release:     7%{?_dist_release}
Group:       Applications/Internet
License:     distributable
Source:      mirror-%{version}.tar.gz
Patch0:      mirror-2.9.patch
Patch1:      mirror-get-older.patch
Patch2:      ftp.pl_wupatch
BuildRoot:   %{_tmppath}/%{name}-%{version}-root
BuildArch:   noarch
URL:         http://sunsite.org.uk/packages/mirror/
Provides: perl(dateconv.pl) perl(lsparse.pl)

%description 
Mirror was designed to duplicate a directory hierarchy between two
machines. It avoids copying files unnecessarily by comparing the file
time-stamps and file sizes before transferring.  Mirror was writen by
Lee McLoughlin <lmjm@icparc.ic.ac.uk>.


%prep
%setup -c -q
%patch0
%patch1 -b .older~ -p1
%patch2


%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_bindir}
mkdir -p $RPM_BUILD_ROOT%{mirror_dir}
mkdir -p $RPM_BUILD_ROOT%{_mandir}
mkdir -p $RPM_BUILD_ROOT/etc
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1

make \
	"PLDIR=$RPM_BUILD_ROOT%{mirror_dir}" \
	"BINDIR=$RPM_BUILD_ROOT%{_bindir}" \
	"MANDIR=$RPM_BUILD_ROOT%{_mandir}/man1" \
	install

install -m 644 mirror.defaults $RPM_BUILD_ROOT/etc
ln -sf ../../../etc/mirror.defaults $RPM_BUILD_ROOT%{mirror_dir}/mirror.defaults
ln -sf %{mirror_dir}/mirror.pl $RPM_BUILD_ROOT%{_bindir}/mirror
ln -sf mm $RPM_BUILD_ROOT%{_bindir}/mirror-master
ln -sf mm.1 $RPM_BUILD_ROOT%{_mandir}/man1/mirror-master.1


%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root)
%doc *.txt *.html mmin mirror.nightly *.class
%doc support/cyber-patches support/lstest.pl
%config /etc/mirror.defaults
%{_bindir}/do_unlinks
%{_bindir}/mirror
%{_bindir}/mm
%{_bindir}/mirror-master
%{_bindir}/pkgs_to_mmin
%{mirror_dir}/dateconv.pl
%{mirror_dir}/ftp.pl
%{mirror_dir}/lchat.pl
%{mirror_dir}/lsparse.pl
%{mirror_dir}/mirror.defaults
%{mirror_dir}/mirror.pl
%{_mandir}/man1/mirror.1*
%{_mandir}/man1/mm.1*
%{_mandir}/man1/mirror-master.1*


%changelog
* Sat Oct 04 2008 Shu KONNO <owa@bg.wakwak.com> 2.9-7vl5
- applied new versioning policy, spec in utf-8
- added macro %%mirror_dir

* Sat Nov 12 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 2.9-6vl4
- rebuild with new toolchains
- s/Copyright/License/
- changed Group:

* Mon Jun 11 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@vinelinux.org>
- 2.9-6vl2
- use better macros

* Fri Sep 22 2000 MACHINO, Satoshi <mac@netfort.gr.jp> 2.9-6vl1
- modified %files section to handle compressed man pages

* Wed Nov 10 1999 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rins.st.ryukoku.ac.jp>
- added a patch to fix problems when connecting to wu-ftpd-2.6 server

* Sat Dec  5 1998 David Fox <dsf@tp560.net>
- Added the get_older option, set to false to avoid overwriting newer files.

* Mon Sep 14 1998 root <dsf@pipeline.ucsd.edu>
- Fixed code that put double slash at start of paths when recursing, this
  confuses the War FTP daemon.

* Tue Jun 23 1998 Peter Soos <sp@osb.hu>
- Using %attr

* Tue Jun 2 1998 Anthony Rumble <anthony@infotainment.com.au>
- Updated to Mirror v2.9

* Tue Dec 9 1997 Peter Soos <sp@osb.hu>
- Moved to noarch architecture
- Using BuildRoot
