]>
Commit | Line | Data |
---|---|---|
2a0e5705 JR |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without tests # do not perform "make test" | |
4 | # | |
5 | %define pdir JSON | |
6 | %define pnam MaybeXS | |
7 | %include /usr/lib/rpm/macros.perl | |
8 | Summary: JSON::MaybeXS - Use Cpanel::JSON::XS with a fallback to JSON::XS and JSON::PP | |
9 | Name: perl-JSON-MaybeXS | |
968c8630 | 10 | Version: 1.004000 |
2a0e5705 JR |
11 | Release: 1 |
12 | # same as perl | |
13 | License: GPL v1+ or Artistic | |
14 | Group: Development/Languages/Perl | |
15 | Source0: http://www.cpan.org/modules/by-module/JSON/%{pdir}-%{pnam}-%{version}.tar.gz | |
968c8630 | 16 | # Source0-md5: db61fb5515f8e2f19709a317e26dde42 |
2a0e5705 JR |
17 | URL: http://search.cpan.org/dist/JSON-MaybeXS/ |
18 | BuildRequires: perl-devel >= 1:5.8.0 | |
19 | BuildRequires: rpm-perlprov >= 4.1-13 | |
20 | BuildArch: noarch | |
21 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
22 | ||
23 | %description | |
24 | This module first checks to see if either Cpanel::JSON::XS or JSON::XS | |
25 | is already loaded, in which case it uses that module. Otherwise it | |
26 | tries to load Cpanel::JSON::XS, then JSON::XS, then JSON::PP in order, | |
27 | and either uses the first module it finds or throws an error. | |
28 | ||
29 | It then exports the encode_json and decode_json functions from the | |
30 | loaded module, along with a JSON constant that returns the class name | |
31 | for calling new on. | |
32 | ||
33 | If you're writing fresh code rather than replacing JSON.pm usage, you | |
34 | might want to pass options as constructor args rather than calling | |
35 | mutators, so we provide our own new method that supports that. | |
36 | ||
37 | %prep | |
38 | %setup -q -n %{pdir}-%{pnam}-%{version} | |
39 | ||
40 | %build | |
41 | %{__perl} Makefile.PL \ | |
42 | INSTALLDIRS=vendor | |
43 | %{__make} | |
44 | ||
45 | %{?with_tests:%{__make} test} | |
46 | ||
47 | %install | |
48 | rm -rf $RPM_BUILD_ROOT | |
49 | ||
50 | %{__make} pure_install \ | |
51 | DESTDIR=$RPM_BUILD_ROOT | |
52 | ||
53 | %clean | |
54 | rm -rf $RPM_BUILD_ROOT | |
55 | ||
56 | %files | |
57 | %defattr(644,root,root,755) | |
58 | %doc Changes README | |
59 | %{perl_vendorlib}/JSON/*.pm | |
60 | %{_mandir}/man3/* |