1#
2#   - HandlerSocket -
3#   This spec file was automatically generated by cpan2rpm [ver: 2.027]
4#   The following arguments were used:
5#       --no-sign perl-Net-HandlerSocket.tar.gz
6#   For more information on cpan2rpm please visit: http://perl.arix.com/
7#
8
9%define pkgname perl-Net-HandlerSocket
10%define filelist %{pkgname}-%{version}-filelist
11%define NVR %{pkgname}-%{version}-%{release}
12%define maketest 1
13
14name:      perl-Net-HandlerSocket
15summary:   HandlerSocket - Perl extension for handlersocket
16version:   HANDLERSOCKET_VERSION
17release:   1%{?dist}
18packager:  Akira Higuchi <higuchi dot akira at dena dot jp>
19license:   BSD
20group:     Applications/CPAN
21group:     System Environment/Libraries
22buildroot: %{_tmppath}/%{name}-%{version}-%(id -u -n)
23prefix:    %(echo %{_prefix})
24source:    perl-Net-HandlerSocket.tar.gz
25BuildRequires: libhsclient perl-Test-Simple
26Requires: libhsclient
27Obsoletes: perl-DB-HandlerSocket
28
29%description
30Stub documentation for HandlerSocket, created by h2xs. It looks like the
31author of the extension was negligent enough to leave the stub
32unedited.
33
34#
35# This package was generated automatically with the cpan2rpm
36# utility.  To get this software or for more information
37# please visit: http://perl.arix.com/
38#
39
40%prep
41%setup -q -n %{pkgname}
42chmod -R u+w %{_builddir}/%{pkgname}
43
44%build
45grep -rsl '^#!.*perl' . |
46grep -v '.bak$' |xargs --no-run-if-empty \
47%__perl -MExtUtils::MakeMaker -e 'MY->fixin(@ARGV)'
48CFLAGS="$RPM_OPT_FLAGS"
49%{__perl} Makefile.PL.installed `%{__perl} -MExtUtils::MakeMaker -e ' print qq|PREFIX=%{buildroot}%{_prefix}| if \$ExtUtils::MakeMaker::VERSION =~ /5\.9[1-6]|6\.0[0-5]/ '`
50%{__make}
51%if %maketest
52%{__make} test
53%endif
54
55%install
56[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
57
58%{makeinstall} `%{__perl} -MExtUtils::MakeMaker -e ' print \$ExtUtils::MakeMaker::VERSION <= 6.05 ? qq|PREFIX=%{buildroot}%{_prefix}| : qq|DESTDIR=%{buildroot}| '`
59
60cmd=/usr/share/spec-helper/compress_files
61[ -x $cmd ] || cmd=/usr/lib/rpm/brp-compress
62[ -x $cmd ] && $cmd
63
64# SuSE Linux
65if [ -e /etc/SuSE-release -o -e /etc/UnitedLinux-release ]
66then
67    %{__mkdir_p} %{buildroot}/var/adm/perl-modules
68    %{__cat} `find %{buildroot} -name "perllocal.pod"`  \
69        | %{__sed} -e s+%{buildroot}++g                 \
70        > %{buildroot}/var/adm/perl-modules/%{name}
71fi
72
73# remove special files
74find %{buildroot} -name "perllocal.pod" \
75    -o -name ".packlist"                \
76    -o -name "*.bs"                     \
77    |xargs -i rm -f {}
78
79# no empty directories
80find %{buildroot}%{_prefix}             \
81    -type d -depth                      \
82    -exec rmdir {} \; 2>/dev/null
83
84%{__perl} -MFile::Find -le '
85    find({ wanted => \&wanted, no_chdir => 1}, "%{buildroot}");
86    print "%doc  Changes README";
87    for my $x (sort @dirs, @files) {
88        push @ret, $x unless indirs($x);
89        }
90    print join "\n", sort @ret;
91
92    sub wanted {
93        return if /auto$/;
94
95        local $_ = $File::Find::name;
96        my $f = $_; s|^\Q%{buildroot}\E||;
97        return unless length;
98        return $files[@files] = $_ if -f $f;
99
100        $d = $_;
101        /\Q$d\E/ && return for reverse sort @INC;
102        $d =~ /\Q$_\E/ && return
103            for qw|/etc %_prefix/man %_prefix/bin %_prefix/share|;
104
105        $dirs[@dirs] = $_;
106        }
107
108    sub indirs {
109        my $x = shift;
110        $x =~ /^\Q$_\E\// && $x ne $_ && return 1 for @dirs;
111        }
112    ' > %filelist
113
114[ -z %filelist ] && {
115    echo "ERROR: empty %files listing"
116    exit -1
117    }
118
119%clean
120[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
121
122%files -f %filelist
123%defattr(-,root,root)
124
125%changelog
126* Thu Apr 1 2010 a@localhost.localdomain
127- Initial build.
128