Skip to content

Instantly share code, notes, and snippets.

@jasonhancock
Created July 20, 2012 15:28
Show Gist options
  • Save jasonhancock/3151334 to your computer and use it in GitHub Desktop.
Save jasonhancock/3151334 to your computer and use it in GitHub Desktop.
A .spec file for the AWS PHP SDK
%{!?__pear: %{expand: %%global __pear %{_bindir}/pear}}
%define pear_name AWSSDKforPHP
Name: php-pear-AWSSDKforPHP
Version: 1.5.10
Release: 1%{?dist}
Summary: AWS SDK for PHP
Group: Development/Libraries
License: Apache-2.0
URL: http://aws.amazon.com/sdkforphp/
Source0: http://pear.amazonwebservices.com/get/sdk-%{version}.tgz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: php-pear >= 1:1.4.9-1.2
Provides: php-pear(%{pear_name}) = %{version}
Requires(post): %{__pear}
Requires(postun): %{__pear}
Requires: php >= 5.2.0
%description
Using the SDK, developers can build solutions for Amazon Simple Storage Service
(Amazon S3), Amazon Elastic Compute Cloud (Amazon EC2), Amazon SimpleDB, and
more. With the AWS SDK for PHP, developers can get started in minutes with a
single, downloadable package.
%prep
%setup -q -c
# If you don't do this, then you'll get an unknown channel warning even if you
# have the channel installed.
sed -i 's/pear.amazonwebservices.com/pear.php.net/' package.xml
# It has a default name of 'sdk' which is pretty generic. Tune it up so that
# the postun script works correctly
sed -i 's/<name>sdk<\/name>/<name>AWSSDKforPHP<\/name>/' package.xml
mv package.xml sdk-%{version}/%{pear_name}.xml
%build
%install
rm -rf $RPM_BUILD_ROOT
cd sdk-%{version}
%{__pear} install --offline --nodeps --installroot $RPM_BUILD_ROOT %{pear_name}.xml
# Clean up the documentation
rm -rf $RPM_BUILD_ROOT%{pear_phpdir}/%{pear_name}/{_docs,_compatibility_test,_samples,README.md}
# Clean up unnecessary files
rm -rf $RPM_BUILD_ROOT%{pear_phpdir}/.??*
# Install XML package description
mkdir -p $RPM_BUILD_ROOT%{pear_xmldir}
install -pm 644 %{pear_name}.xml $RPM_BUILD_ROOT%{pear_xmldir}
%clean
rm -rf $RPM_BUILD_ROOT
%post
%{__pear} install --nodeps --soft --force --register-only \
%{pear_xmldir}/%{pear_name}.xml >/dev/null || :
%postun
if [ $1 -eq 0 ] ; then
%{__pear} uninstall --nodeps --ignore-errors --register-only \
%{pear_name} >/dev/null || :
fi
%files
%defattr(-,root,root,-)
%doc sdk-%{version}/_docs/*
%doc sdk-%{version}/_compatibility_test
%doc sdk-%{version}/_samples
%doc sdk-%{version}/README.md
%{pear_xmldir}/%{pear_name}.xml
%{pear_phpdir}/%{pear_name}/*
%changelog
* Fri Jul 20 2012 Jason Hancock <[email protected]> 1.5.10-1
- Initial revision
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment