File thrift.spec of Package thrift

#
# spec file for package thrift
#
# Copyright (c) 2017 SUSE LINUX 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 libversion 0_10_0
%define libname    %{version}
%bcond_without perl
%bcond_without c
%bcond_without python2
%bcond_without python3
%bcond_with java
%bcond_with ruby
%bcond_with qt5
Name:           thrift
Version:        0.10.0
Release:        0
Summary:        Framework for scalable cross-language services development
License:        Apache-2.0
Group:          Development/Libraries/C and C++
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
BuildRequires:  automake
BuildRequires:  bison
BuildRequires:  fdupes
BuildRequires:  flex
BuildRequires:  gcc-c++
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(libevent)
BuildRequires:  pkgconfig(openssl)
BuildRequires:  pkgconfig(zlib)
%if 0%{?suse_version} > 1325
BuildRequires:  libboost_headers-devel
%else
BuildRequires:  boost-devel
%endif
%if %{with qt5}
BuildRequires:  pkgconfig(Qt5Core)
BuildRequires:  pkgconfig(Qt5Network)
%endif
%if %{with python2}
BuildRequires:  python-rpm-macros
BuildRequires:  pkgconfig(python2)
%endif
%if %{with python3}
BuildRequires:  python-rpm-macros
BuildRequires:  pkgconfig(python3)
%endif
%if %{with c}
BuildRequires:  pkgconfig(glib-2.0)
%endif
%if %{with java}
BuildRequires:  ant
BuildRequires:  java-devel
%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

%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/C and C++
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 python2}
%package -n python2-thrift
Summary:        Thrift python library
Group:          Development/Libraries/Python
Provides:       python-thrift = %{version}-%{release}
Obsoletes:      python-thrift < %{version}-%{release}

%description -n python2-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

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

%description -n python3-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 -q

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

# tests require static boost library
%configure \
	--disable-tests \
	--enable-static=no
make %{?_smp_mflags}

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

%if %{with python2}
pushd lib/py
make clean
%python2_install
%fdupes %{buildroot}%{python_sitearch}
popd
%endif

%if %{with python3}
pushd lib/py
make clean
%python3_install
%fdupes %{buildroot}%{python_sitearch}
popd
%endif

%if %{with perl}
pushd lib/perl
perl Makefile.PL
%perl_make_install
%perl_process_packlist
mv %{buildroot}%{_prefix}/local/lib/perl5 \
  %{buildroot}%{_perl_vendorlib}
popd
%endif

find %{buildroot} -type f -name "*.la" -delete -print

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

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

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

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

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

%if %{with python3}
%files -n python3-thrift
%defattr(-,root,root)
%{python3_sitearch}/*
%endif

%changelog
openSUSE Build Service is sponsored by