summaryrefslogtreecommitdiffstats
path: root/php-iamcal-lib-autolink.spec
blob: 355e70aed428d2d093f43074ede4ef537079167d (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
# spec file for php-iamcal-lib-autolink
#
# Copyright (c) 2016-2023 Remi Collet
# License: CC-BY-SA-4.0
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#
%global gh_commit    6a9e44d17f836806301b40723af673971a1a5112
%global gh_short     %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner     iamcal
%global gh_project   lib_autolink
%global with_tests   0%{!?_without_tests:1}


Name:           php-iamcal-lib-autolink
Version:        1.9
Release:        1%{?dist}
Summary:        Adds anchors to urls in a text

Group:          Development/Libraries
License:        MIT
URL:            https://github.com/%{gh_owner}/%{gh_project}
Source0:        %{name}-%{version}-%{gh_short}.tgz
# Used to retrieve a git snapshot with test suite
Source1:        makesrc.sh

BuildArch:      noarch
# For tests
%if %{with_tests}
BuildRequires:  php-cli
BuildRequires:  php-pcre
%endif

# From composer.json, nothing
# From phpcompatinfo report for 1.7
Requires:       php-pcre

Provides:       php-composer(%{gh_owner}/%{gh_project}) = %{version}


%description
Find URLs in HTML that are not already links, and make them into links.

Autoloader: %{_datadir}/php/%{name}/autoload.php


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


%build
: Nothing


%install
: Single file, only functions
install -Dpm 0644 lib_autolink.php %{buildroot}%{_datadir}/php/%{name}/lib_autolink.php

# from composer.json, "autoload": {
#    "files": ["lib_autolink.php"]
ln -s lib_autolink.php %{buildroot}%{_datadir}/php/%{name}/autoload.php


%check
%if %{with_tests}
sed -e 's/\$this/$thiz/' -i t/testmore.php

>tests.log
for cmd in php php80 php81 php82 php83; do
  if which $cmd; then
    for unit in t/*.t; do
      $cmd $unit | tee -a tests.log
    done
  fi
done

grep '^not ok' tests.log && exit 1 || exit 0
%else
: Test suite disabled
%endif


%files
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc *.md
%doc composer.json
%{_datadir}/php/%{name}


%changelog
* Fri Oct  6 2023 Remi Collet <remi@remirepo.net> - 1.9-1
- update to 1.9

* Thu Oct  5 2017 Remi Collet <remi@fedoraproject.org> - 1.7-4
- fix tests for recent PHP, FTBFS from Koschei

* Tue Apr 26 2016 Remi Collet <remi@fedoraproject.org> - 1.7-1
- initial package, version 1.7