%define real_name Net-SSLeay

Summary: Perl module for using OpenSSL via Network
Summary(ja): OpenSSL を Network にて用いる為の perl モジュール
Name: perl-Net-SSLeay
Version: 1.64
Release: 1%{?_dist_release}
License: BSDish
Group: Development/Libraries
Source0: ftp://ftp.cpan.org/pub/CPAN/modules/by-module/Net/%{real_name}-%{version}.tar.gz
Source1: COPYRIGHT.SSLeay-0.9.0
BuildRequires: perl, openssl-devel >= 0.9.6b
BuildRequires: zlib-devel
Requires: perl, openssl >= 0.9.6b
Buildroot: %{_tmppath}/%{name}-%{version}-root

Obsoletes: perl-Net_SSLeay < 1.64
Provides: perl-Net_SSLeay

%description
Perl module for using OpenSSL via Network, Net::SSLeay.

%description -l ja
OpenSSL を Network にて用いる為の perl モジュール, Net::SSLeay

%prep
%setup -q -n %{real_name}-%{version}
cp -p %{SOURCE1} .

# openssl_path is /usr here, therefore don't -I/usr/include and
# especially don't (badly) hardcode standard library search path
# /usr/lib
if [[ "%{_prefix}" = "/usr" ]]; then
  perl -pi -e "s@-[LI]\\\$openssl_path[^\s\"]*@@g" Makefile.PL INSTALLDIRS=vendor
fi

%build
# note the %{_prefix} which must passed to Makefile.PL, weird but necessary :-(
perl Makefile.PL %{_prefix} INSTALLDIRS=vendor << EOI
n
EOI
make OPTIMIZE="$RPM_OPT_FLAGS" PREFIX=%{_prefix}
perl -p -i -e 's|/usr/local/bin|/usr/bin|g;' *.pm examples/*

%install
rm -rf %{buildroot}
#mkdir -p %{buildroot}%{perl_archlib}
#make install PREFIX=%{buildroot}%{_prefix} \
#	SITEPREFIX=%{buildroot}%{_prefix} \
#	VENDORPREFIX=%{buildroot}%{_prefix} \
#	INSTALLPRIVLIB=%{buildroot}%{perl_privlib} \
#	INSTALLSITELIB=%{buildroot}%{perl_sitelib} \
#	INSTALLVENDORLIB=%{buildroot}%{perl_vendorlib} \
#	INSTALLARCHLIB=%{buildroot}%{perl_archlib} \
#	INSTALLSITEARCH=%{buildroot}%{perl_sitearch} \
#	INSTALLVENDORARCH=%{buildroot}%{perl_vendorarch} \
#	INSTALLBIN=%{buildroot}%{_bindir} \
#	INSTALLSITEBIN=%{buildroot}%{_bindir} \
#	INSTALLVENDORBIN=%{buildroot}%{_bindir} \
#	INSTALLSCRIPT=%{buildroot}%{_bindir} \
#	INSTALLMAN1DIR=%{buildroot}%{_mandir}/man1 \
#	INSTALLSITEMAN1DIR=%{buildroot}%{_mandir}/man1 \
#	INSTALLVENDORMAN1DIR=%{buildroot}%{_mandir}/man1 \
#	INSTALLMAN3DIR=%{buildroot}%{_mandir}/man3 \
#	INSTALLSITEMAN3DIR=%{buildroot}%{_mandir}/man3 \
#	INSTALLVENDORMAN3DIR=%{buildroot}%{_mandir}/man3 
make install DESTDIR=%{buildroot}

sed -e "s@^%{buildroot}@@g" < %{buildroot}/%{perl_vendorarch}/auto/Net/SSLeay/.packlist > .packlist
mv -f .packlist %{buildroot}/%{perl_vendorarch}/auto/Net/SSLeay/.packlist

#if [ -f %{buildroot}%{perl_archlib}/perllocal.pod ] ; then
#    mv %{buildroot}%{perl_archlib}/perllocal.pod .
#else
#    touch perllocal.pod
#fi

perllocalfile=`find %{buildroot} -name perllocal.pod`
echo "mv $perllocalfile ."
mv $perllocalfile .

{
find %{buildroot}  \
  -type f -o -type l | sed -e "s@^%{buildroot}@@g" -e 's@^\(.*/man/.*\)$@\1*@g'
} > %{name}.files

%clean 
rm -rf %{buildroot}

#check
#make test

%files -f %{name}.files
%defattr(-,root,root)
%doc Changes Credits QuickRef README COPYRIGHT.SSLeay-0.9.0 perllocal.pod
#%dir %{perl_vendorarch}/auto/Net
#%dir %{perl_vendorarch}/auto/Net/SSLeay
#%dir %{perl_vendorarch}/Net
#%dir %{perl_vendorarch}/Net/SSLeay

%changelog
* Mon Jun 30 2014 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.64-1
- new upstream release.
- renamed from "perl-Net_SSLeay".
- added "Obsoletes: perl-Net_SSLeay" and "Provides: perl-Net_SSLeay".

* Sun Feb 26 2012 Yasumichi Akahoshi <yasumichi@vinelinux.org> 1.42-1
- new upstream release

* Sat Apr 30 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.36-2
- rebuild with perl-5.12.3

* Sun Feb 06 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.36-1
- new upstream release
- change BuildRequires: openssl-devel instead of openssl
- add BuildRequires: zlib-devel

* Wed Jul  8 2009 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 1.35-1
- new upstream release

* Wed Apr 08 2009 Shu KONNO <owa@bg.wakwak.com> 1.30-2
- spec in utf-8

* Tue Apr 29 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.30-1
- rebuilt with perl-5.10.0
- applied new versioning policy

* Sun Jun  3 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.30-0vl2
- rebuilt with openssl-0.9.8e

* Mon Dec 25 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.30-0vl1
- updated to 1.30

* Sat Sep  9 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.25-0vl4
- installed files to vendor_perl
- changed Group to Development/Libraries

* Mon Nov 29 2004 IWAI, Masaharu <iwai@alib.jp> 1.25-0vl3
- build on perl-5.8.6-0vl1

* Wed Dec 10 2003 IWAI, Masaharu <iwai@alib.jp> 1.25-0vl2
- build with perl-5.8.2
- add %%{perl_sitearch}/{Net,Net/SSLeay} directories in %%files

* Thu Nov 06 2003 Satoshi MACHINO <machino@vinelinux.org> 1.25-0vl1
- new upstream version
- built on perl-5.8.1

* Thu May 08 2003 Tomoya TAKA <taka@vinelinux.org> 1.22-0vl5
- fixed install man dir, again

* Tue May 06 2003 KOBAYASHI R. Taizo <tkoba@vinelinux.org> 1.22-0vl4
- fixed install dir of perllocal.pod

* Mon May 05 2003 KOBAYASHI R. Taizo <tkoba@vinelinux.org> 1.22-0vl3
- fixed install man dir

* Thu May 01 2003 KOBAYASHI R. Taizo <tkoba@vinelinux.org> 1.22-0vl2
- comment out "make test"

* Thu May 01 2003 KOBAYASHI R. Taizo <tkoba@vinelinux.org> 1.22-0vl1
- updated to 1.22

* Fri Feb 15 2002 Toru Sagami <sagami@vinelinux.org> 1.13-0vl1
- updated to 1.13
- BuildPreReq/Requires: perl, openssl-0.9.6b
- rewrite a better spec with License/Group

* Mon Jul 16 2001 <sagami@vinelinux.org>
- 1.07-0vl3: rebuilt with openssl-0.9.6b
- erase unneeeded files from %%doc
- use _prefix, not prefix

* Thu Jul 05 2001 <sagami@vinelinux.org>
- 1.07-0vl2: built with perl-5.6.1

* Thu Jun  7 2001 Yasuhide OMORI <omori@m-t.com>
- 1.07

* Fri Sep 1 2000 Yoshishiro Kajiki <kajiki@ylug.org>
- first version of rpm.
