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