663da18
# Spec file for php-sabre-dav
663da18
#
663da18
# Copyright (c) 2013-2014 Remi Collet
663da18
# License: CC-BY-SA
663da18
# http://creativecommons.org/licenses/by-sa/3.0/
663da18
#
663da18
# Please, preserve the changelog entries
663da18
#
663da18
%global gh_commit    41c750da3c60a427cdd847df090ef0fc7e8f1076
663da18
%global gh_short     %(c=%{gh_commit}; echo ${c:0:7})
663da18
%global gh_owner     fruux
663da18
%global gh_project   sabre-dav
663da18
%global with_tests   %{?_without_tests:0}%{!?_without_tests:1}
663da18
663da18
Name:           php-%{gh_project}
663da18
Summary:        WebDAV Framework for PHP
663da18
Version:        1.8.7
663da18
Release:        1%{?dist}
663da18
663da18
URL:            https://github.com/%{gh_owner}/%{gh_project}
663da18
Source0:        https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}.tar.gz
663da18
License:        BSD
663da18
Group:          Development/Libraries
663da18
663da18
# replace composer autoloader with trivial PSR-0 one
663da18
Patch0:         %{gh_project}-autoload.patch
663da18
663da18
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
663da18
BuildArch:      noarch
663da18
%if %{with_tests}
663da18
BuildRequires:  php(language) >= 5.3.1
663da18
BuildRequires:  php-pear(pear.phpunit.de/PHPUnit) > 3.7
663da18
BuildRequires:  php-sabre-vobject > 2.1
663da18
Requires:       php-pdo
663da18
%endif
663da18
663da18
# From composer.json
663da18
Requires:       php(language) >= 5.3.1
663da18
Requires:       php-ctype
663da18
Requires:       php-date
663da18
Requires:       php-dom
663da18
Requires:       php-iconv
663da18
Requires:       php-libxml
663da18
Requires:       php-mbstring
663da18
Requires:       php-pcre
663da18
Requires:       php-simplexml
663da18
Requires:       php-spl
663da18
Requires:       php-sabre-vobject > 2.1
663da18
Requires:       php-sabre-vobject < 2.2
663da18
# From phpcompatinfo report for version 1.8.7
663da18
Requires:       php-curl
663da18
Requires:       php-pdo
663da18
Requires:       php-xml
663da18
663da18
663da18
%description
663da18
What is SabreDAV
663da18
663da18
SabreDAV allows you to easily add WebDAV support to a PHP application.
663da18
SabreDAV is meant to cover the entire standard, and attempts to allow
663da18
integration using an easy to understand API.
663da18
663da18
Feature list:
663da18
* Fully WebDAV compliant
663da18
* Supports Windows XP, Windows Vista, Mac OS/X, DavFSv2, Cadaver, Netdrive,
663da18
  Open Office, and probably more.
663da18
* Passing all Litmus tests.
663da18
* Supporting class 1, 2 and 3 Webdav servers.
663da18
* Locking support.
663da18
* Custom property support.
663da18
* CalDAV (tested with Evolution, iCal, iPhone and Lightning).
663da18
* CardDAV (tested with OS/X addressbook, the iOS addressbook and Evolution).
663da18
* Over 97% unittest code coverage.
663da18
663da18
663da18
%prep
663da18
%setup -q -n %{gh_project}-%{gh_commit}
663da18
663da18
%patch0 -p0
663da18
663da18
: Create trivial PSR0 autoloader for tests
663da18
cat <
663da18
663da18
define('SABRE_HASSQLITE', 1);
663da18
define('SABRE_HASMYSQL', 0);
663da18
define("SABRE_TEMPDIR", __DIR__ . '/temp/');
663da18
663da18
spl_autoload_register(function (\$class) {
663da18
    \$file = str_replace('\\\\', '/', \$class).'.php';
663da18
    @include \$file;
663da18
});
663da18
EOF
663da18
663da18
# drop executable as only provided as doc
663da18
chmod -x bin/*
663da18
663da18
663da18
%build
663da18
# nothing to build
663da18
663da18
663da18
%install
663da18
# Install as a PSR-0 library
663da18
mkdir -p %{buildroot}%{_datadir}/php
663da18
cp -pr lib/Sabre %{buildroot}%{_datadir}/php/Sabre
663da18
663da18
663da18
663da18
%check
663da18
: Check that our autoloader is working
663da18
php -d include_path=%{buildroot}%{_datadir}/php \
663da18
    -r 'include "Sabre/autoload.php"; echo Sabre\DAV\Version::VERSION."\n";' \
663da18
    | grep %{version}
663da18
663da18
%if %{with_tests}
663da18
: Run upstream test suite against installed library
663da18
mkdir temp
663da18
cd tests
663da18
phpunit \
663da18
  --bootstrap=../psr0.php \
663da18
  --include-path=%{buildroot}%{_datadir}/php \
663da18
  -d date.timezone=UTC
663da18
%else
663da18
: Skip upstream test suite
663da18
%endif
663da18
663da18
663da18
%files
663da18
%defattr(-,root,root,-)
663da18
%doc ChangeLog composer.json LICENSE README.md
663da18
%doc docs examples bin
663da18
%{_datadir}/php/Sabre
663da18
663da18
663da18
%changelog
663da18
* Tue Dec 31 2013 Remi Collet <remi@fedoraproject.org> - 1.8.7-1
663da18
- Initial packaging