Skip to content

Instantly share code, notes, and snippets.

@kjdev
Created May 22, 2015 00:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kjdev/fe162f2b576529c50df6 to your computer and use it in GitHub Desktop.
Save kjdev/fe162f2b576529c50df6 to your computer and use it in GitHub Desktop.
Phalcon 2.0.1 SPEC
%global proj_name cphalcon
%global pecl_name phalcon
%global pecl_version 2.0.1
%{!?__pecl: %{expand: %%global __pecl %{_bindir}/pecl}}
%global php_apiver %((echo 0; php -i 2>/dev/null | sed -n 's/^PHP API => //p') | tail -1)
%{!?php_extdir: %{expand: %%global php_extdir %(php-config --extension-dir)}}
%{?filter_provides_in: %filter_provides_in %{php_extdir}/.*\.so$}
%{?filter_setup}
%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}%{php_extdir}/.*\\.so$
%if "%{php_version}" < "5.6"
%global ini_name %{pecl_name}.ini
%else
%global ini_name 50-%{pecl_name}.ini
%endif
Summary: Phalcon Framework
Name: php-pecl-%{pecl_name}
Version: %{pecl_version}
Release: 0%{?dist}
License: new BSD
Group: Development/Languages
URL: https://github.com/phalcon/%{proj_name}
Source: %{pecl_name}-v%{pecl_version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: php-devel >= 5.1.0
%if 0%{?php_zend_api:1}
Requires: php(zend-abi) = %{php_zend_api}
Requires: php(api) = %{php_core_api}
Requires: php(pdo-abi) = %{php_pdo_api}
%else
Requires: php-api = %{php_apiver}
%endif
BuildRequires: gcc make
BuildRequires: php-devel php-pdo php-mbstring
Requires: php-pdo php-mbstring
Provides: php-pecl(%{pecl_name}) = %{version}-%{release}
%description
Phalcon is a web framework implemented as a C extension offering
high performance and lower resource consumption.
%prep
%setup -qn %{proj_name}-%{pecl_name}-v%{pecl_version}
%if 0%{?__ztsphp:1}
%{__cp} -r ext ext-zts
%endif
%build
cd ext
phpize
%configure --with-php-config=%{_bindir}/php-config
%{__make} %{?_smp_mflags}
%if 0%{?__ztsphp:1}
cd ../ext-zts
%{_bindir}/zts-phpize
%configure --with-php-config=%{_bindir}/zts-php-config
%{__make} %{?_smp_mflags}
%endif
%install
cd ext
%{__rm} -rf %{buildroot}
%{__make} install INSTALL_ROOT=%{buildroot}
%{__mkdir_p} %{buildroot}%{_sysconfdir}/php.d
%{__cat} > %{buildroot}%{_sysconfdir}/php.d/%{ini_name} << 'EOF'
; Enable %{pecl_name} extension module
extension=%{pecl_name}.so
EOF
%if 0%{?__ztsphp:1}
cd ../ext-zts
%{__make} install INSTALL_ROOT=%{buildroot}
%{__install} -d %{buildroot}%{php_ztsinidir}
%{__cp} %{buildroot}%{_sysconfdir}/php.d/%{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name}
%endif
%clean
%{__rm} -rf %{buildroot}
%files
%defattr(-, root, root, -)
%config(noreplace) %{_sysconfdir}/php.d/%{ini_name}
%{php_extdir}/%{pecl_name}.so
%if 0%{?__ztsphp:1}
%config(noreplace) %{php_ztsinidir}/%{ini_name}
%{php_ztsextdir}/%{pecl_name}.so
%endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment