8f9bbd0
%global pecl_name yaml
8f9bbd0
8f9bbd0
%{!?__pecl:     %{expand: %%global __pecl     %{_bindir}/pecl}}
8f9bbd0
%{!?php_extdir: %{expand: %%global php_extdir %(php-config --extension-dir)}}
8f9bbd0
8f9bbd0
Name:           php-pecl-yaml
8f9bbd0
Version:        1.0.1
8f9bbd0
Release:        4%{?dist}
8f9bbd0
Summary:        Support for YAML 1.1 serialization using the LibYAML library
8f9bbd0
Group:          Development/Languages
8f9bbd0
8f9bbd0
License:        MIT
8f9bbd0
URL:            http://code.google.com/p/php-yaml/
8f9bbd0
Source0:        http://pecl.php.net/get/%{pecl_name}-%{version}.tgz
8f9bbd0
# Makes compiling with Fedora-specific CFLAGS work
8f9bbd0
# http://pecl.php.net/bugs/bug.php?id=22703
8f9bbd0
Patch0:         php-pecl-yaml-1.0.1-cflags.patch
8f9bbd0
8f9bbd0
BuildRequires:      php-devel >= 5.2.0
8f9bbd0
BuildRequires:      php-pear libyaml-devel
8f9bbd0
Requires:           php(zend-abi) = %{php_zend_api}
8f9bbd0
Requires:           php(api) = %{php_core_api}
8f9bbd0
Requires(post):     %{__pecl}
8f9bbd0
Requires(postun):   %{__pecl}
8f9bbd0
8f9bbd0
Provides:       php-pecl(%{pecl_name}) = %{version}
8f9bbd0
8f9bbd0
%{?filter_setup:
8f9bbd0
%filter_provides_in %{php_extdir}/.*\.so$
8f9bbd0
%filter_setup
8f9bbd0
}
8f9bbd0
8f9bbd0
%description
8f9bbd0
The YAML PHP Extension provides a wrapper to the LibYAML library. It gives the
8f9bbd0
user the ability to parse YAML document streams into PHP constructs and emit PHP
8f9bbd0
constructs as valid YAML 1.1 documents.
8f9bbd0
8f9bbd0
%prep
8f9bbd0
%setup -q -c
8f9bbd0
%patch0 -p0 -b .cflags
8f9bbd0
mv package.xml %{pecl_name}-%{version}/package.xml
8f9bbd0
8f9bbd0
8f9bbd0
%build
8f9bbd0
cd %{pecl_name}-%{version}
8f9bbd0
phpize
8f9bbd0
%configure
8f9bbd0
make %{?_smp_mflags}
8f9bbd0
8f9bbd0
8f9bbd0
%check
8f9bbd0
cd %{pecl_name}-%{version}
8f9bbd0
make test NO_INTERACTION=1 | tee ../rpmtests.log
8f9bbd0
if grep -q "FAILED TEST" ../rpmtests.log; then
8f9bbd0
  exit 1
8f9bbd0
fi
8f9bbd0
8f9bbd0
8f9bbd0
%install
8f9bbd0
rm -rf %{buildroot}
8f9bbd0
cd %{pecl_name}-%{version}
8f9bbd0
make install INSTALL_ROOT=%{buildroot}
8f9bbd0
8f9bbd0
# Basic configuration
8f9bbd0
mkdir -p %{buildroot}%{_sysconfdir}/php.d
8f9bbd0
cat > %{buildroot}%{_sysconfdir}/php.d/%{pecl_name}.ini << 'EOF'
8f9bbd0
; Enable %{pecl_name} extension module
8f9bbd0
extension=%{pecl_name}.so
8f9bbd0
8f9bbd0
; %{pecl_name} extension configuration
8f9bbd0
; see http://www.php.net/manual/en/yaml.configuration.php
8f9bbd0
8f9bbd0
; Decode entities which have the explicit tag "tag:yaml.org,2002:binary"
8f9bbd0
yaml.decode_binary = 0
8f9bbd0
; Controls the decoding of "tag:yaml.org,2002:timestamp"
8f9bbd0
; 0 will not apply any decoding.
8f9bbd0
; 1 will use strtotime().
8f9bbd0
; 2 will use date_create().
8f9bbd0
yaml.decode_timestamp = 0
8f9bbd0
; Cause canonical form output.
8f9bbd0
yaml.output_canonical = 0
8f9bbd0
; Number of spaces to indent sections. Value should be between 1 and 10.
8f9bbd0
yaml.output_indent = 2
8f9bbd0
; Set the preferred line width. -1 means unlimited.
8f9bbd0
yaml.output_width = 80
8f9bbd0
EOF
8f9bbd0
8f9bbd0
# Package info
8f9bbd0
mkdir -p %{buildroot}%{pecl_xmldir}
8f9bbd0
install -p -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml
8f9bbd0
8f9bbd0
8f9bbd0
%post
8f9bbd0
%{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || :
8f9bbd0
8f9bbd0
8f9bbd0
%postun
8f9bbd0
if [ $1 -eq 0 ]  ; then
8f9bbd0
%{pecl_uninstall} %{pecl_name} >/dev/null || :
8f9bbd0
fi
8f9bbd0
8f9bbd0
8f9bbd0
%files
8f9bbd0
%defattr(-,root,root,-)
8f9bbd0
%doc %{pecl_name}-%{version}/CREDITS %{pecl_name}-%{version}/LICENSE
8f9bbd0
%doc %{pecl_name}-%{version}/README
8f9bbd0
%config(noreplace) %{_sysconfdir}/php.d/%{pecl_name}.ini
8f9bbd0
%{php_extdir}/%{pecl_name}.so
8f9bbd0
%{pecl_xmldir}/%{name}.xml
8f9bbd0
8f9bbd0
8f9bbd0
%changelog
8f9bbd0
* Fri May 13 2011 Theodore Lee <theo148@gmail.com> - 1.0.1-4
8f9bbd0
- Fix commenting in module configuration
8f9bbd0
8f9bbd0
* Thu May 12 2011 Theodore Lee <theo148@gmail.com> - 1.0.1-3
8f9bbd0
- Remove unused php_apiver macro
8f9bbd0
- Specify version in php-devel requires
8f9bbd0
- Note upstream report for CFLAGS patch
8f9bbd0
- Add check section
8f9bbd0
- Document options in default config file
8f9bbd0
8f9bbd0
* Wed May 04 2011 Theodore Lee <theo148@gmail.com> - 1.0.1-2
8f9bbd0
- Update patch to preserve original compiler flags
8f9bbd0
8f9bbd0
* Tue May 03 2011 Theodore Lee <theo148@gmail.com> - 1.0.1-1
8f9bbd0
- Initial package