summaryrefslogtreecommitdiffstats
path: root/php-lessphp.spec
blob: 31349d9b6d85ce676c505bcac7ea041ffb77017e (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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# remirepo spec file for php-lessphp, from:
#
# Fedora spec file for php-lessphp
#
# Copyright (c) 2012-2015 Shawn Iwinski <shawn.iwinski@gmail.com>
#
# License: MIT
# http://opensource.org/licenses/MIT
#
# Please preserve changelog entries
#

%global github_owner     leafo
%global github_name      lessphp
%global github_version   0.5.0
%global github_commit    0f5a7f5545d2bcf4e9fad9a228c8ad89cc9aa283

%global composer_vendor  leafo
%global composer_project lessphp

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

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

Name:          php-%{composer_project}
Version:       %{github_version}
Release:       4%{?dist}
Summary:       A compiler for LESS written in PHP

Group:         Development/Libraries
License:       MIT or GPLv3
URL:           http://leafo.net/lessphp
Source0:       https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz

# https://github.com/leafo/lessphp/pull/626
Patch0:        %{name}-pr626.patch

BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch:     noarch
# Tests
%if %{with_tests}
BuildRequires: %{_bindir}/phpunit
## phpcompatinfo (computed from version 0.5.0)
BuildRequires: php(language) >= 5.3.0
BuildRequires: php-ctype
BuildRequires: php-date
BuildRequires: php-fileinfo
BuildRequires: php-pcre
%endif

Requires:      php-cli
# phpcompatinfo (computed from version 0.5.0)
Requires:      php(language) >= 5.3.0
Requires:      php-ctype
Requires:      php-date
Requires:      php-fileinfo
Requires:      php-pcre

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

%description
lessphp is a compiler that generates CSS from a superset language which
adds a collection of convenient features often seen in other languages.
All CSS is compatible with LESS, so you can start using new features
with your existing CSS.

It is designed to be compatible with less.js (http://lesscss.org/), and
suitable as a drop in replacement for PHP projects.


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

: Update bin requires and shebang
sed 's#$path\s*=.*#$path = "%{phpdir}/%{composer_project}/";#' \
    -i plessc


%build
# Empty build section, nothing required


%install
rm -rf %{buildroot}
: Lib
mkdir -p %{buildroot}%{phpdir}/%{composer_project}
cp -p lessc.inc.php %{buildroot}%{phpdir}/%{composer_project}/

: Bin
mkdir -p %{buildroot}%{_bindir}
cp -p plessc %{buildroot}%{_bindir}/


%check
%if %{with_tests}
# remirepo:11
run=0
ret=0
if which php56; then
   php56 %{_bindir}/phpunit tests || ret=1
   run=1
fi
if which php71; then
   php71 %{_bindir}/phpunit tests || ret=1
   run=1
fi
if [ $run -eq 0 ]; then
%{_bindir}/phpunit --verbose tests
# remirepo:2
fi
exit $ret
%else
: Tests skipped
%endif


%clean
rm -rf %{buildroot}


%files
%defattr(-,root,root,-)
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc README.md
%doc composer.json
%doc docs/*
%{phpdir}/%{composer_project}
%{_bindir}/plessc


%changelog
* Wed Nov 23 2016 Remi Collet <remi@fedoraproject.org> - 0.5.0-4
- add patch for lib_luma and fix FTBFS with PHP 7.1
  https://github.com/leafo/lessphp/pull/626

* Sun Jun 28 2015 Shawn Iwinski <shawn.iwinski@gmail.com> - 0.5.0-2
- Added php-composer(leafo/lessphp) virtual provide

* Sun Jun 28 2015 Shawn Iwinski <shawn.iwinski@gmail.com> - 0.5.0-1
- Updated to 0.5.0 (RHBZ #1211066)
- %%license usage
- Unpackaged tests
- Removed bin manpage
- Spec cleanup

* Tue Aug 20 2013 Remi Collet <RPMS@famillecollet.com> 0.4.0-1
- backport 0.4.0 for remi repo

* Sun Aug 11 2013 Shawn Iwinski <shawn.iwinski@gmail.com> 0.4.0-1
- Updated to 0.4.0

* Thu Mar 07 2013 Remi Collet <RPMS@famillecollet.com> 0.3.9-1
- backport 0.3.9 for remi repo

* Sun Mar 03 2013 Shawn Iwinski <shawn.iwinski@gmail.com> 0.3.9-1
- Updated to upstream version 0.3.9
- Added php_min_ver global

* Sun Nov 25 2012 Remi Collet <RPMS@famillecollet.com> 0.3.8-3
- backport 0.3.8 for remi repo

* Sun Nov 18 2012 Shawn Iwinski <shawn.iwinski@gmail.com> 0.3.8-3
- Fixed man page creation
- Added tests directory ownership

* Sat Nov 17 2012 Shawn Iwinski <shawn.iwinski@gmail.com> 0.3.8-2
- Added phpci requires to build requires
- Simplified %%prep and updated %%install and %%check
- Moved tests to %%{_datadir}/tests/%%{name}

* Wed Nov  7 2012 Shawn Iwinski <shawn.iwinski@gmail.com> 0.3.8-1
- Updated to upstream version 0.3.8
- Removed adding of shebang to bootstrap script (fixed upstream)
- Fixed man file creation and removed manual gzip

* Mon Aug 13 2012 Shawn Iwinski <shawn.iwinski@gmail.com> 0.3.6-1
- Updated to upstream version 0.3.6

* Thu Jul 12 2012 Shawn Iwinski <shawn.iwinski@gmail.com> 0.3.5-1
- Initial package