%define php_inidir %(php --ini | head -n 1 | awk -F ':' '{print $2;}' | sed 's/ //g')
%define php_extdir %(php-config --extension-dir 2>/dev/null)
Name: fastdfs_client
Version: 5.0.9
Release: 1%{?dist}
Summary: The php extension of fastdfs client
License: GPL
Group: Arch/Tech
URL: 	https://github.com/happyfish100/fastdfs
Source: https://github.com/happyfish100/fastdfs/%{name}-%{version}.tar.gz

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 

BuildRequires: libfdfsclient-devel
Requires: libfdfsclient

%description
This package provides the php extension for fastdfs client

%prep
%setup -q

%build
phpize
%configure
make

%install
rm -rf %{buildroot}

mkdir -p %{buildroot}%{php_extdir}
mkdir -p %{buildroot}%{php_inidir}/php.d
cp -f .libs/fastdfs_client.so  %{buildroot}%{php_extdir}/
cp -f fastdfs_client.ini %{buildroot}%{php_inidir}/php.d/

%post

%preun

%postun

%clean
#rm -rf %{buildroot}

%files
%defattr(-,root,root,-)
%{php_extdir}/*
%{php_inidir}/php.d/*

%changelog
* Mon Jun 23 2014  Zaixue Liao <liaozaixue@yongche.com>
- first RPM release (1.0)
