summaryrefslogtreecommitdiffstats
path: root/php-code-lts-u2f-php-server.spec
blob: dd1a5c07f84a0b8bd6c1b740a4fa8fe909a3d3c2 (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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# remirepo/fedora spec file for php-code-lts-u2f-php-server
#
# Copyright (c) 2022 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#

%bcond_without tests

# Github
%global gh_commit    59b3b28185e7fa255180a61278f6f65739082771
%global gh_short     %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner     code-lts
%global gh_project   U2F-php-server
# Packagist
%global pk_vendor    code-lts
%global pk_project   u2f-php-server
# Namespace
%global ns_vendor    CodeLts
%global ns_project   U2F
%global ns_library   U2FServer

Name:           php-%{pk_vendor}-%{pk_project}
Version:        1.2.0
Release:        1%{?gh_date?%{gh_date}git%{gh_short}}%{?dist}
Summary:        Server side handling class for FIDO U2F registration and authentication

License:        BSD
URL:            https://github.com/%{gh_owner}/%{gh_project}
# Git snapshot to retrieve tests
Source0:        %{name}-%{version}-%{?gh_short}.tgz
Source1:        makesrc.sh

BuildArch:      noarch
%if %{with tests}
BuildRequires:  php(language) >= 7.1
BuildRequires:  php-hash
BuildRequires:  php-json
BuildRequires:  php-openssl
BuildRequires:  php-reflection
BuildRequires:  php-spl
# From composer.json, "require-dev": {
#        "phpunit/phpunit": "^7 || ^8 || ^9"
BuildRequires:  phpunit9
# For autoloader
BuildRequires:  php-fedora-autoloader-devel
%endif

# From composer.json, "require": {
#        "php": "^7.1 || ^8.0",
#        "ext-openssl":"*"
Requires:       php(language) >= 7.1
Requires:       php-openssl
# From phpcompatinfo report for 1.2.0
Requires:       php-hash
Requires:       php-json
Requires:       php-spl
# For generated autoloader
Requires:       php-composer(fedora/autoloader)

# Composer
Provides:       php-composer(%{pk_vendor}/%{pk_project}) = %{version}


%description
Server-side handling of FIDO U2F registration and authentication for PHP.

Securing your online accounts and doing your bit to protect your data is
extremely important and increasingly more so as hackers get more sophisticated.
FIDO's U2F enables you to add a simple unobtrusive method of 2nd factor
authentication, allowing users of your service and/or application to link
a hardware key to their account.

This project is a fork of unmaintained samyoul/u2f-php-server.

Autoloader: %{_datadir}/php/%{ns_vendor}/%{ns_project}/%{ns_library}/autoload.php


%prep
%setup -q -n %{gh_project}-%{gh_commit}


%build
: Create autoloader
%{_bindir}/phpab --template fedora --output src/autoload.php src


%install
: Library
mkdir -p      %{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}
cp -pr src    %{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}/%{ns_library}


%check
%if %{with tests}
: Tests autoloader
mkdir vendor
ln -s %{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}/%{ns_library}/autoload.php vendor/autoload.php

: Upstream test suite
for cmd in php php74 php80 php81; do
  if which $cmd
  then
    $cmd %{_bindir}/phpunit9 --verbose
  fi
done  
%endif


%files
# remirepo:1
%{!?_licensedir:%global license %%doc}
%license LICENCE
%doc composer.json
%doc *.md
%dir %{_datadir}/php/%{ns_vendor}
%dir %{_datadir}/php/%{ns_vendor}/%{ns_project}
     %{_datadir}/php/%{ns_vendor}/%{ns_project}/%{ns_library}


%changelog
* Mon Jan 24 2022 Remi Collet <remi@remirepo.net> - 1.2.0-1
- initial package (from php-samyoul-u2f-php-server)