]> git.pld-linux.org Git - packages/perl-Readonly-XS.git/blob - perl-Readonly-XS.spec
- release 7 (by relup.sh)
[packages/perl-Readonly-XS.git] / perl-Readonly-XS.spec
1 #
2 # Conditional build:
3 %bcond_without  tests           # do not perform "make test"
4 #
5 %define         pdir    Readonly
6 %define         pnam    XS
7 %include        /usr/lib/rpm/macros.perl
8 Summary:        Readonly::XS - Companion module for Readonly.pm, to speed up read-only scalar variables
9 Name:           perl-Readonly-XS
10 Version:        1.05
11 Release:        7
12 # same as perl
13 License:        GPL v1+ or Artistic
14 Group:          Development/Languages/Perl
15 Source0:        http://www.cpan.org/modules/by-module/Readonly/%{pdir}-%{pnam}-%{version}.tar.gz
16 # Source0-md5:  df71f29abfcbd14c963f912d6d6ded6b
17 URL:            http://search.cpan.org/dist/Readonly-XS/
18 BuildRequires:  perl-devel >= 1:5.8.0
19 BuildRequires:  rpm-perlprov >= 4.1-13
20 %if %{with tests}
21 BuildRequires:  perl-Readonly >= 1.02
22 %endif
23 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
24
25 %description
26 The Readonly module (q.v.) is an effective way to create
27 non-modifiable variables. However, it's relatively slow.
28
29 The reason it's slow is that is implements the read-only-ness of
30 variables via tied objects. This mechanism is inherently slow. Perl
31 simply has to do a lot of work under the hood to make tied variables
32 work.
33
34 This module corrects the speed problem, at least with respect to
35 scalar variables. When Readonly::XS is installed, Readonly uses it to
36 access the internals of scalar variables. Instead of creating a scalar
37 variable object and tying it, Readonly simply flips the SvREADONLY bit
38 in the scalar's FLAGS structure.
39
40 Readonly arrays and hashes are not sped up by this, since the
41 SvREADONLY flag only works for scalars. Arrays and hashes always use
42 the tie interface.
43
44 Why implement this as a separate module? Because not everyone can use
45 XS. Not everyone has a C compiler. Also, installations with a
46 statically-linked perl may not want to recompile their perl binary
47 just for this module. Rather than render Readonly.pm useless for these
48 people, the XS portion was put into a separate module.
49
50 %prep
51 %setup -q -n %{pdir}-%{pnam}-%{version}
52
53 %build
54 %{__perl} Makefile.PL \
55         INSTALLDIRS=vendor
56 %{__make} \
57         CC="%{__cc}" \
58         OPTIMIZE="%{rpmcflags}"
59
60 %{?with_tests:%{__make} test}
61
62 %install
63 rm -rf $RPM_BUILD_ROOT
64
65 %{__make} pure_install \
66         DESTDIR=$RPM_BUILD_ROOT
67
68 %clean
69 rm -rf $RPM_BUILD_ROOT
70
71 %files
72 %defattr(644,root,root,755)
73 %doc Changes README
74 %dir %{perl_vendorarch}/Readonly/
75 %{perl_vendorarch}/Readonly/*.pm
76 %dir %{perl_vendorarch}/auto/Readonly
77 %dir %{perl_vendorarch}/auto/Readonly/XS
78 %attr(755,root,root) %{perl_vendorarch}/auto/Readonly/XS/*.so
79 %{_mandir}/man3/*
This page took 0.061754 seconds and 3 git commands to generate.