Shawn Iwinski 2394a88
#
Shawn Iwinski f02e511
# Fedora spec file for php-masterminds-html5
Shawn Iwinski 2394a88
#
cc96d93
# Copyright (c) 2015-2019 Shawn Iwinski <shawn.iwinski@gmail.com>
Shawn Iwinski 2394a88
#
Shawn Iwinski 2394a88
# License: MIT
Shawn Iwinski 2394a88
# http://opensource.org/licenses/MIT
Shawn Iwinski 2394a88
#
Shawn Iwinski 2394a88
# Please preserve changelog entries
Shawn Iwinski 2394a88
#
Shawn Iwinski 2394a88
Shawn Iwinski 2394a88
%global github_owner     Masterminds
Shawn Iwinski 2394a88
%global github_name      html5-php
4780c77
%global github_version   2.7.0
4780c77
%global github_commit    104443ad663d15981225f99532ba73c2f1d6b6f2
Shawn Iwinski 2394a88
Shawn Iwinski 2394a88
%global composer_vendor  masterminds
Shawn Iwinski 2394a88
%global composer_project html5
Shawn Iwinski 2394a88
Shawn Iwinski 2394a88
# "php" : ">=5.3.0"
Shawn Iwinski 2394a88
%global php_min_ver 5.3.0
Shawn Iwinski 2394a88
Shawn Iwinski 2394a88
# Build using "--without tests" to disable tests
Shawn Iwinski f02e511
%global with_tests 0%{!?_without_tests:1}
Shawn Iwinski 2394a88
Shawn Iwinski 2394a88
%{!?phpdir:  %global phpdir  %{_datadir}/php}
Shawn Iwinski 2394a88
Shawn Iwinski 2394a88
Name:          php-%{composer_vendor}-%{composer_project}
Shawn Iwinski 2394a88
Version:       %{github_version}
3e47b3d
Release:       2%{?dist}
Shawn Iwinski 2394a88
Summary:       An HTML5 parser and serializer
Shawn Iwinski 2394a88
Shawn Iwinski 2394a88
License:       MIT
Shawn Iwinski 2394a88
URL:           http://masterminds.github.io/html5-php
Shawn Iwinski 2394a88
Source0:       https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz
Shawn Iwinski 2394a88
4780c77
Patch0:        https://patch-diff.githubusercontent.com/raw/Masterminds/html5-php/pull/170.patch
4780c77
Shawn Iwinski 2394a88
BuildArch:     noarch
Shawn Iwinski 2394a88
# Autoload generation
Shawn Iwinski 2394a88
BuildRequires: %{_bindir}/phpab
Shawn Iwinski 2394a88
# Tests
Shawn Iwinski 2394a88
%if %{with_tests}
Shawn Iwinski 2394a88
## composer.json
Shawn Iwinski 2394a88
BuildRequires: php(language) >= %{php_min_ver}
cc96d93
BuildRequires: php-composer(phpunit/phpunit) >= 4.8.35
Shawn Iwinski 2394a88
BuildRequires: php-ctype
Shawn Iwinski 2394a88
BuildRequires: php-dom
4780c77
## phpcompatinfo (computed from version 2.7.0)
Shawn Iwinski 2394a88
BuildRequires: php-iconv
Shawn Iwinski 2394a88
BuildRequires: php-json
Shawn Iwinski 2394a88
BuildRequires: php-mbstring
Shawn Iwinski 2394a88
BuildRequires: php-pcre
Shawn Iwinski 2394a88
BuildRequires: php-reflection
Shawn Iwinski 2394a88
BuildRequires: php-spl
Shawn Iwinski 2394a88
%endif
Shawn Iwinski 2394a88
Shawn Iwinski 2394a88
# composer.json
Shawn Iwinski 2394a88
Requires:      php(language) >= %{php_min_ver}
Shawn Iwinski 2394a88
Requires:      php-ctype
Shawn Iwinski 2394a88
Requires:      php-dom
4780c77
# phpcompatinfo (computed from version 2.7.0)
Shawn Iwinski 2394a88
Requires:      php-iconv
Shawn Iwinski 2394a88
Requires:      php-mbstring
Shawn Iwinski 2394a88
Requires:      php-pcre
Shawn Iwinski 2394a88
Requires:      php-spl
4780c77
# notice: xml only detected for utf8_decode
Shawn Iwinski 2394a88
Shawn Iwinski 2394a88
# Composer
Shawn Iwinski 2394a88
Provides:      php-composer(%{composer_vendor}/%{composer_project}) = %{version}
Shawn Iwinski 2394a88
Shawn Iwinski 2394a88
%description
Shawn Iwinski 2394a88
The need for an HTML5 parser in PHP is clear. This project initially began with
Shawn Iwinski 2394a88
the seemingly abandoned html5lib project original source. But after some initial
Shawn Iwinski 2394a88
refactoring work, we began a new parser.
Shawn Iwinski 2394a88
Shawn Iwinski 2394a88
* An HTML5 serializer
Shawn Iwinski 2394a88
* Support for PHP namespaces
Shawn Iwinski 2394a88
* Composer support
Shawn Iwinski 2394a88
* Event-based (SAX-like) parser
Shawn Iwinski 2394a88
* DOM tree builder
Shawn Iwinski 2394a88
* Interoperability with QueryPath
Shawn Iwinski 2394a88
Shawn Iwinski 2394a88
Shawn Iwinski 2394a88
%prep
Shawn Iwinski 2394a88
%setup -qn %{github_name}-%{github_commit}
4780c77
%patch0 -p1 -b .pr170
Shawn Iwinski 2394a88
0405be6
: Docs
Shawn Iwinski 2394a88
mkdir -p docs/{Parser,Serializer}
Shawn Iwinski 2394a88
mv composer.json *.md docs/
Shawn Iwinski 2394a88
mv src/HTML5/Parser/*.md docs/Parser/
Shawn Iwinski 2394a88
mv src/HTML5/Serializer/*.md docs/Serializer/
Shawn Iwinski 2394a88
Shawn Iwinski 2394a88
Shawn Iwinski 2394a88
%build
Shawn Iwinski 2394a88
: Generate autoloader
Shawn Iwinski 2394a88
# Vendor-level autoloader to pick up "Masterminds/HTML5" class
Shawn Iwinski 2394a88
%{_bindir}/phpab --nolower --output src/autoload-html5.php src
Shawn Iwinski 2394a88
Shawn Iwinski 2394a88
Shawn Iwinski 2394a88
%install
Shawn Iwinski 2394a88
mkdir -p  %{buildroot}%{phpdir}/Masterminds
Shawn Iwinski 2394a88
cp -pr src/* %{buildroot}%{phpdir}/Masterminds/
Shawn Iwinski 2394a88
# Project-level autoloader for consistency with other pkgs
Shawn Iwinski 2394a88
ln -s ../autoload-html5.php %{buildroot}%{phpdir}/Masterminds/HTML5/autoload.php
Shawn Iwinski 2394a88
Shawn Iwinski 2394a88
Shawn Iwinski 2394a88
%check
Shawn Iwinski 2394a88
%if %{with_tests}
Shawn Iwinski 2394a88
: Generate test autoloader
Shawn Iwinski 2394a88
%{_bindir}/phpab --nolower --output test/autoload.php test
Shawn Iwinski 2394a88
Shawn Iwinski 2394a88
: Create mock Composer autoloader
Shawn Iwinski 2394a88
mkdir vendor
Shawn Iwinski 2394a88
cat > vendor/autoload.php <<'AUTOLOAD'
Shawn Iwinski 2394a88
Shawn Iwinski 2394a88
Shawn Iwinski 2394a88
require '%{buildroot}%{phpdir}/Masterminds/HTML5/autoload.php';
Shawn Iwinski 2394a88
require __DIR__ . '/../test/autoload.php';
Shawn Iwinski 2394a88
AUTOLOAD
Shawn Iwinski 2394a88
ef0c942
: Upstream tests
ef0c942
RETURN_CODE=0
ef0c942
PHPUNIT=$(which phpunit)
4780c77
for PHP_EXEC in "" %{?rhel:php54 php55 php56 php70} php71 php72 php73 php74; do
ef0c942
    if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then
ef0c942
        $PHP_EXEC $PHPUNIT --verbose || RETURN_CODE=1
ef0c942
    fi
ef0c942
done
ef0c942
exit $RETURN_CODE
Shawn Iwinski 2394a88
%else
Shawn Iwinski 2394a88
: Tests skipped
Shawn Iwinski 2394a88
%endif
Shawn Iwinski 2394a88
Shawn Iwinski 2394a88
Shawn Iwinski 2394a88
%files
Shawn Iwinski 2394a88
%{!?_licensedir:%global license %%doc}
Shawn Iwinski 2394a88
%license LICENSE.txt
Shawn Iwinski 2394a88
%doc docs/*
Shawn Iwinski 2394a88
%{phpdir}/Masterminds
Shawn Iwinski 2394a88
Shawn Iwinski 2394a88
Shawn Iwinski 2394a88
%changelog
3e47b3d
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.7.0-2
3e47b3d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
3e47b3d
4780c77
* Fri Oct 11 2019 Remi Collet <remi@remirepo.net> - 2.7.0-1
4780c77
- update to 2.7.0
4780c77
- add patch for PHP 7.4 from
4780c77
  https://github.com/Masterminds/html5-php/pull/170
4780c77
c49569e
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.6.0-2
c49569e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
c49569e
cc96d93
* Sat May 25 2019 Shawn Iwinski <shawn.iwinski@gmail.com> - 2.6.0-1
cc96d93
- Update to 2.6.0 (RHBZ #1687215)
cc96d93
7bf8213
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.3.0-4
7bf8213
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
7bf8213
aa1d8f0
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.3.0-3
aa1d8f0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
aa1d8f0
b25af9b
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.3.0-2
b25af9b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
b25af9b
ef0c942
* Fri Sep 08 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 2.3.0-1
ef0c942
- Update to 2.3.0 (RHBZ #1488271)
ef0c942
- Test with SCLs if available
ef0c942
e9ea48f
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.2-3
e9ea48f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
e9ea48f
12ffb08
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.2-2
12ffb08
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
12ffb08
0405be6
* Sun Sep 25 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 2.2.2-1
0405be6
- Updated to 2.2.2 (RHBZ #1378444)
0405be6
7e2318a
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.2-2
7e2318a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
7e2318a
Shawn Iwinski f02e511
* Sun Jun 28 2015 Shawn Iwinski <shawn.iwinski@gmail.com> - 2.1.2-1
Shawn Iwinski f02e511
- Updated to 2.1.2 (RHBZ #1229011)
Shawn Iwinski f02e511
b32db55
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1.1-2
b32db55
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
b32db55
Shawn Iwinski 2394a88
* Fri May 22 2015 Shawn Iwinski <shawn.iwinski@gmail.com> - 2.1.1-1
Shawn Iwinski 2394a88
- Initial package