summaryrefslogtreecommitdiffstats
path: root/php-paragonie-random-compat.spec
blob: a4179e22f945063f8670dd3a18c26dbaca39d3cb (plain)
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
#
# Fedora spec file for php-paragonie-random-compat
#
# Copyright (c) 2015 Shawn Iwinski <shawn@iwin.ski>
#
# License: MIT
# http://opensource.org/licenses/MIT
#
# Please preserve changelog entries
#

%global github_owner     paragonie
%global github_name      random_compat
%global github_version   1.1.0
%global github_commit    19f765b66c6fbb56ee3b11bc16d52e38eebdc295

%global composer_vendor  paragonie
%global composer_project random_compat

# "php": ">=5.2.0"
%global php_min_ver 5.2.0

# Build using "--without tests" to disable tests
%global with_tests 0%{!?_without_tests:1}

%{!?phpdir:  %global phpdir  %{_datadir}/php}

Name:          php-%{composer_vendor}-random-compat
Version:       %{github_version}
Release:       2%{?github_release}%{?dist}
Summary:       PHP 5.x polyfill for random_bytes() and random_int() from PHP 7

Group:         Development/Libraries
License:       MIT
URL:           https://github.com/%{github_owner}/%{github_name}
Source0:       %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz

BuildArch:     noarch
# Tests
%if %{with_tests}
## composer.json
BuildRequires: php(language) >= %{php_min_ver}
BuildRequires: php-composer(phpunit/phpunit)
## phpcompatinfo (computed from version 1.1.0)
##     <none except weak dependencies>
%endif

# composer.json
Requires:      php(language) >= %{php_min_ver}
# phpcompatinfo (computed from version 1.1.0)
#     <none except weak dependencies>
# Weak dependencies
%if 0%{?fedora} > 21
Suggests:      php-mbstring
Suggests:      php-openssl
Suggests:      php-pecl(libsodium)
%endif

# php-{COMPOSER_VENDOR}-{COMPOSER_PROJECT}
Provides:      php-%{composer_vendor}-%{composer_project}           = %{version}-%{release}
# Composer
Provides:      php-composer(%{composer_vendor}/%{composer_project}) = %{version}

%description
%{summary}.

Autoloader: %{phpdir}/random_compat/autoload.php


%prep
%setup -qn %{github_name}-%{github_commit}

: Autoloader compat
ln -s random.php lib/autoload.php


%build
# Empty build section, nothing to build


%install
mkdir -p %{buildroot}%{phpdir}/random_compat
cp -rp lib/* %{buildroot}%{phpdir}/random_compat/


%check
%if %{with_tests}
%{_bindir}/phpunit --verbose \
    --bootstrap %{buildroot}%{phpdir}/random_compat/autoload.php
%else
: Tests skipped
%endif


%files
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc *.md
%doc composer.json
%{phpdir}/random_compat


%changelog
* Tue Dec 01 2015 Shawn Iwinski <shawn@iwin.ski> - 1.1.0-2
- Renamed from "php-paragonie-random_compat" ("_" => "-")
- Removed php-mcrypt suggest
- Added php-pecl(libsodium) suggest

* Wed Nov 25 2015 Shawn Iwinski <shawn@iwin.ski> - 1.1.0-1
- Initial package