forked from hookbot/File-NFSLock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFile-NFSLock.spec.PL
115 lines (99 loc) · 3.03 KB
/
File-NFSLock.spec.PL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Copyright (C) 2002 Rob Brown ([email protected])
# Generic rpm SPEC file generator.
use strict;
my $p = $1 if $0 =~ m%([^/]*)$%;
my $output = shift or die "create what?";
### Extract $VERSION from VERSION_FROM
my $name;
my $version;
$INC{"ExtUtils/MakeMaker.pm"} = 1;
sub WriteMakefile {
my %props = @_;
$name = $props{NAME} || die "Makefile.PL: Missing NAME";
if ($version = $props{VERSION}) {
# done
} elsif (my $version_from = $props{VERSION_FROM}) {
$@ = "";
$version = eval qq{
do "$version_from";
\$$name\::VERSION || die "$version_from: Missing VERSION";
};
die $@ if $@;
if (!defined $version) {
die "$version_from: Missing VERSION";
}
} else {
die "Makefile.PL: Could not determine version!";
}
}
do "Makefile.PL";
if ($name) {
$name =~ s/::/-/g;
} else {
die "Makefile.PL: Missing WriteMakefile";
}
$version || die "No version!";
my ($class,$subclass) = split(/\-/,$name,2);
local $/ = undef;
$_ = <DATA>;
s/\@CLASS\@/$class/g;
s/\@SUBCLASS\@/$subclass/g;
s/\@VERSION\@/$version/g;
open SPEC, ">$output" or die "$output: $!";
print SPEC "# Automatically generated by $p\n";
print SPEC $_;
close SPEC;
__DATA__
%define class @CLASS@
%define subclass @SUBCLASS@
%define version @VERSION@
%define release 1
%define defperlver 5.6.1
# Derived values
%define real_name %{class}-%{subclass}
%define name perl-%{real_name}
%define perlver %(rpm -q perl --queryformat '%%{version}' 2> /dev/null || echo %{defperlver})
# Provide perl-specific find-{provides,requires}.
%define __find_provides %( echo -n /usr/lib/rpm/find-provides && [ -x /usr/lib/rpm/find-provides.perl ] && echo .perl )
%define __find_requires %( echo -n /usr/lib/rpm/find-requires && [ -x /usr/lib/rpm/find-requires.perl ] && echo .perl )
Summary: Perl module %{class}::%{subclass}
Name: %{name}
Version: %{version}
Release: %{release}
Group: Development/Perl
License: Artistic
Source: http://www.cpan.org./modules/by-module/%{class}/%{real_name}-%{version}.tar.gz
URL: http://search.cpan.org/search?dist=%{real_name}
Vendor: Rob Brown <[email protected]>
Packager: Rob Brown <[email protected]>
BuildRequires: perl
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot-%(id -u -n)
Requires: perl = %{perlver}
Provides: %{real_name} = %{version}
%description
%{class}::%{subclass} Perl Module
%prep
%setup -q -n %{real_name}-%{version}
%build
%{__perl} Makefile.PL
%{__make} OPTIMIZE="$RPM_OPT_FLAGS"
%install
rm -rf $RPM_BUILD_ROOT
%{makeinstall} PREFIX=$RPM_BUILD_ROOT%{_prefix}
[ -x /usr/lib/rpm/brp-compress ] && /usr/lib/rpm/brp-compress
# Clean up some files we don't want/need
rm -rf `find $RPM_BUILD_ROOT -name "perllocal.pod" -o -name ".packlist" -o -name "*.bs"`
find $RPM_BUILD_ROOT%{_prefix} -type d | tac | xargs rmdir --ign
%clean
rm -rf $RPM_BUILD_ROOT
HERE=`pwd`
cd ..
rm -rf $HERE
%files
%defattr(-,root,root)
%doc README Changes examples
%{_prefix}
%changelog
* Thu May 30 2002 Rob Brown <[email protected]>
- initial creation