LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File php5-phalcon.spec of Package php5-phalcon (Project home:smarty12)

#
# spec file for package 
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define pkg_name phalcon
%define _major_version 2.0
%define devtools phalcon-devtools-%{_major_version}.x
%ifarch x86_64
%define build_dir build/64bits/
%else
%define build_dir build/32bits/
%endif

Name:           php5-%{pkg_name}
Version:        %{_major_version}.5
Release:        0
License:        BSD-3-Clause
Summary:        Framework for PHP 5 written as a C-extension
Url:            http://phalconphp.com/
Group:          Productivity/Networking/Web/Servers
Source0:        https://github.com/phalcon/cphalcon/archive/%{pkg_name}-v%{version}.tar.gz
Source1:        https://github.com/phalcon/phalcon-devtools/archive/%{_major_version}.x.tar.gz
Source2:        %{pkg_name}.ini
BuildRequires:	gcc
BuildRequires:  php5-devel >= 5.3
BuildRequires:  php5-json
BuildRequires:  php5-mbstring
BuildRequires:  php5-openssl
BuildRequires:  php5-pdo
BuildRequires:  php5-sqlite
Recommends:     php5-igbinary
Recommends:     php5-json
Recommends:     php5-mbstring
Recommends:     php5-mcrypt
Recommends:     php5-openssl
Recommends:     php5-pdo
Recommends:     php5-sqlite
%if %{?php_zend_api}0
Requires:       php(api) = %{php_core_api}
Requires:       php(zend-abi) = %{php_zend_api}
%else
%requires_eq    php5
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Phalcon is a web framework implemented as a C extension offering
high performance and lower resource consumption.

%package devtools
Summary:        Framework for PHP 5 written as a C-extension
Group:          Productivity/Networking/Web/Servers
Requires:       %{name} = %{version}
Requires:       php5-pdo
%if 0%{?suse_version} > 1120
BuildArch:      noarch
%endif

%description devtools
This tools provide you useful scripts to generate code helping to develop
faster and easy applications that use with Phalcon framework.

%package devel
Summary:        Development files for %{name}
Group:          Development/Libraries
Requires:       %{name} = %{version}

%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.

%prep
%setup -qn c%{pkg_name}-%{pkg_name}-v%{version}

%build
CPPFLAGS="-DPHALCON_RELEASE"
CFLAGS="%{optflags}"
%ifarch ! %arm
CFLAGS="$CFLAGS -march=native -mtune=native -O2"
%endif
CFLAGS="$CFLAGS -fno-delete-null-pointer-checks -finline-functions -fomit-frame-pointer -fno-builtin-memcmp"
CFLAGS="$CFLAGS -fvisibility=hidden"
export CPPFLAGS
export CFLAGS

pushd %{build_dir}
%{_bindir}/phpize
%configure --enable-phalcon
make %{?_smp_mflags}
popd

%install
%{__mkdir_p} %{buildroot}%{_libdir}/php5/extensions
%{__mkdir_p} %{buildroot}%{_sysconfdir}/php5/conf.d
pushd %{build_dir}
make INSTALL_ROOT=%{buildroot} install
popd
install -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/php5/conf.d/

tar -xf %{SOURCE1}
rm -f %{devtools}/.gitignore %{devtools}/resources/codemirror/*/.DS_Store
chmod 755  %{devtools}/%{pkg_name}.php %{devtools}/templates/project/cli/launcher
install -d -m 0755 %{buildroot}%{_datadir}/php5/%{pkg_name}/
cp -a %{devtools} %{buildroot}%{_datadir}/php5/%{pkg_name}/devtools
install -d -m 0755 %{buildroot}%{_bindir}/
ln -s %{_datadir}/php5/%{pkg_name}/devtools/%{pkg_name}.php %{buildroot}%{_bindir}/%{pkg_name}
install -D -m 0644 %{devtools}/%{pkg_name}-completion.bash %{buildroot}/%{_sysconfdir}/bash_completion.d/%{pkg_name}-completion.bash

%check
mkdir -p -m 777 /tmp/php5
rm -rf %{build_dir}/tests
cp -a ext/tests %{build_dir}
pushd %{build_dir}
TEST_PHP_ARGS="-d extension=`php-config --extension-dir`/json.so"
TEST_PHP_ARGS="$TEST_PHP_ARGS -d extension=`php-config --extension-dir`/mbstring.so"
TEST_PHP_ARGS="$TEST_PHP_ARGS -d extension=`php-config --extension-dir`/openssl.so"
TEST_PHP_ARGS="$TEST_PHP_ARGS -d extension=`php-config --extension-dir`/pdo_sqlite.so"
TEST_PHP_ARGS="$TEST_PHP_ARGS -d extension=`php-config --extension-dir`/pdo.so"
TEST_PHP_ARGS="$TEST_PHP_ARGS -d session.save_path=/tmp/php5"
export TEST_PHP_ARGS
make PHP_EXECUTABLE=%{_bindir}/php NO_INTERACTION=1 test
popd

%files
%defattr(-,root,root)
%{_libdir}/php5/extensions/%{pkg_name}.so
%config(noreplace) %{_sysconfdir}/php5/conf.d/%{pkg_name}.ini
%doc CHANGELOG.md CONTRIBUTING.md README.md docs/*

%files devtools
%defattr(-,root,root,-)
%{_bindir}/%{pkg_name}
%config %{_sysconfdir}/bash_completion.d/%{pkg_name}-completion.bash
%dir %{_datadir}/php5/%{pkg_name}
%{_datadir}/php5/%{pkg_name}/

%changelog