File thrift.spec of Package thrift

#
# spec file for package thrift
#
# 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/
#



%bcond_without perl
%bcond_without c
%bcond_without python
%bcond_with java
%bcond_with ruby
%bcond_without qt

Name:           thrift
Version:        0.9.2
Release:        0
%define libversion 0_9_2
%define libname    %{version}
Url:            https://thrift.apache.org
Source0:        https://www.apache.org/dist/thrift/%{version}/%{name}-%{version}.tar.gz
Source1:        https://www.apache.org/dist/thrift/%{version}/%{name}-%{version}.tar.gz.asc
Source2:        %{name}.keyring
Summary:        Framework for scalable cross-language services development
License:        Apache-2.0
Group:          Development/Libraries/C and C++
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  boost-devel
BuildRequires:  fdupes
BuildRequires:  gcc-c++

%if %{with qt}
BuildRequires:  qt-devel
%endif

%if %{with python}
BuildRequires:  python-devel
%endif

%if %{with c}
BuildRequires:  glib2-devel
%endif

%if %{with java}
BuildRequires:  java-devel
BuildRequires:	ant
%endif

%if %{with ruby}
BuildRequires:  ruby-devel
BuildRequires:	rubygem(bundler)
%endif

%if %{with perl}
BuildRequires:  perl
BuildRequires:  perl(Bit::Vector)
BuildRequires:  perl(Class::Accessor)
%endif

BuildRequires:  bison
BuildRequires:  flex
BuildRequires:  libevent-devel
BuildRequires:  openssl-devel
BuildRequires:  automake
BuildRequires:  pkg-config

%description
Thrift is a software framework for scalable cross-language services
development. It combines a powerful software stack with a code generation
engine to build services that work efficiently and seamlessly between C++,
Java, C#, Python, Ruby, Perl, PHP, Objective C/Cocoa, Smalltalk, Erlang,
Objective Caml, and Haskell.

%package -n libthrift-%{libversion}
Summary:        Thrift shared library
Group:          System/Libraries

%description -n libthrift-%{libversion}
Thrift shared library

Thrift is a software framework for scalable cross-language services
development. It combines a powerful software stack with a code generation
engine to build services that work efficiently and seamlessly between C++,
Java, C#, Python, Ruby, Perl, PHP, Objective C/Cocoa, Smalltalk, Erlang,
Objective Caml, and Haskell.

%post -n libthrift-%{libversion} -p /sbin/ldconfig
%postun -n libthrift-%{libversion} -p /sbin/ldconfig

%package -n libthrift-devel
Summary:        Thrift C++ library development files
Group:          Development/Libraries
Requires:       libthrift-%{libversion} = %{version}

%description -n libthrift-devel
Thrift C++ library development files

Thrift is a software framework for scalable cross-language services
development. It combines a powerful software stack with a code generation
engine to build services that work efficiently and seamlessly between C++,
Java, C#, Python, Ruby, Perl, PHP, Objective C/Cocoa, Smalltalk, Erlang,
Objective Caml, and Haskell.

%if %{with perl}
%package -n perl-thrift
Summary:        Thrift perl library
Group:          Development/Libraries/Perl
%{perl_requires}

%description -n perl-thrift
Thrift perl library

Thrift is a software framework for scalable cross-language services
development. It combines a powerful software stack with a code generation
engine to build services that work efficiently and seamlessly between C++,
Java, C#, Python, Ruby, Perl, PHP, Objective C/Cocoa, Smalltalk, Erlang,
Objective Caml, and Haskell.
%endif

%if %{with python}
%package -n python-thrift
Summary:        Thrift python library
Group:          Development/Libraries/Python

%description -n python-thrift
Thrift python library

Thrift is a software framework for scalable cross-language services
development. It combines a powerful software stack with a code generation
engine to build services that work efficiently and seamlessly between C++,
Java, C#, Python, Ruby, Perl, PHP, Objective C/Cocoa, Smalltalk, Erlang,
Objective Caml, and Haskell.
%endif

%prep

%setup

%build
export CXXFLAGS="%{optflags} -fPIC"

# tests require static boost library
%configure \
	--disable-tests \
	--enable-static=no

%install
pushd compiler/cpp
%make_install
popd
pushd lib/cpp
%make_install
popd

%if %{with python}
pushd lib/py
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
%fdupes %{buildroot}%{python_sitearch}
popd
%endif

%if %{with perl}
pushd lib/perl
perl Makefile.PL
%perl_make_install
%perl_process_packlist
popd
%endif

rm %{buildroot}%{_libdir}/*.la

%files
%defattr(-,root,root)
%doc CHANGES LICENSE NOTICE
%{_bindir}/thrift

%files -n libthrift-%{libversion}
%defattr(-,root,root)
%{_libdir}/libthrift-*.so
%{_libdir}/libthriftnb-*.so
%{_libdir}/libthriftqt-*.so
%{_libdir}/libthriftz-*.so

%files -n libthrift-devel
%defattr(-,root,root)
%{_includedir}/thrift
%{_libdir}/libthrift.so
%{_libdir}/libthriftnb.so
%{_libdir}/libthriftqt.so
%{_libdir}/libthriftz.so
%{_libdir}/pkgconfig/*.pc

%if %{with perl}
%files -n perl-thrift
%defattr(-,root,root)
%{perl_vendorlib}/Thrift.pm
%{perl_vendorlib}/Thrift
%endif

%if %{with python}
%files -n python-thrift
%defattr(-,root,root)
%{py_sitedir}/*
%{python_sitearch}/*
%endif

%changelog
openSUSE Build Service is sponsored by