Sophie

Sophie

distrib > Mageia > 2 > x86_64 > by-pkgid > b95743a0c6b01130d04b6cc212a2083e > files > 6

thrift-0.6.1-2.mga2.src.rpm

%define major 0
%define libname %mklibname thrift %major
%define libname_devel %mklibname -d thrift

%define with_php 0

Name:          thrift
Version:       0.6.1
Release:       %mkrel 2
Summary:       Multi-language RPC and serialization framework
Group:         Development/Java
License:       ASL 2.0
Url:           http://thrift.apache.org/
Source0:       ftp://ftp.gbnet.net/pub/apache/dist/thrift/0.6.1/thrift-0.6.1.tar.gz
# http://svn.apache.org/repos/asf/thrift/tags/thrift-0.6.1/bootstrap.sh
# http://svn.apache.org/repos/asf/thrift/tags/thrift-0.6.1/cleanup.sh
Source1:       thrift-0.6.1-bootstrap.sh
Source2:       thrift-0.6.1-cleanup.sh
#Source3:       http://repo1.maven.org/maven2/org/apache/thrift/libthrift/0.6.1/
Source3:       libthrift-0.6.1.pom
Patch0:        thrift-0.6.1-lib-java-build.patch

BuildRequires: byacc
BuildRequires: flex
BuildRequires: gcc-c++
BuildRequires: boost-devel 
BuildRequires: libevent-devel
BuildRequires: openssl-devel
BuildRequires: zlib-devel

# TODO FlexAntTasks

%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.

This package contains the Thrift compiler that is used for translating from
.thrift files (containing the definitions) to the language binding for the
supported languages.

%package -n %libname
Summary:          Thrift C++ library
Group:            System/Libraries
Requires:         %{name} = %{version}-%{release}
Provides:         %libname = %version

%description -n %libname
Thrift is a software framework for scalable cross-language services
development.

This package contains the runtime libraries needed for C++ applications.

%package -n %libname_devel
Group:         Development/C
Summary:       Thrift C++ library (development headers)
Requires:      %{name} = %{version}-%{release}
Requires:      %libname = %{version}-%{release}
Provides:      lib%{name}-devel = %{version}

%description -n %libname_devel
Thrift is a software framework for scalable cross-language services
development.

This package contains the development libraries required for writing C++
applications.

%package -n lib%{name}-java
Group:         Development/Java
Summary:       Java bindings for the Apache Thrift RPC system
BuildRequires: java-devel
BuildRequires: jpackage-utils
BuildRequires: ant
BuildRequires: apache-commons-codec
BuildRequires: apache-commons-lang
BuildRequires: apache-commons-logging
BuildRequires: httpcomponents-client
BuildRequires: httpcomponents-core
BuildRequires: junit4
BuildRequires: liblog4j-java
#BuildRequires: maven-ant-tasks
BuildRequires: slf4j
BuildRequires: tomcat6-servlet-2.5-api
Requires:      apache-commons-lang
Requires:      apache-commons-logging
Requires:      httpcomponents-client
Requires:      slf4j
Requires:      tomcat6-servlet-2.5-api
Requires:      jpackage-utils
Requires(post): jpackage-utils
Requires(postun): jpackage-utils
Requires:      java
BuildArch:     noarch

%description -n lib%{name}-java
Thrift is a software framework for scalable cross-language services
development.

This package contains the Java bindings for Thrift. You will need the thrift
tool (in the thrift-compiler package) to compile your definition to Java
classes, and then the modules in this package will allow you to use those
classes in your programs.

%package -n lib%{name}-javadoc
Summary:       Javadocs for lib%{name}-java
Group:         Development/Java
Requires:      jpackage-utils
BuildArch:     noarch

%description -n lib%{name}-javadoc
Thrift is a software framework for scalable cross-language services
development.

This package contains the API documentation for lib%{name}-java

%package -n mono-%{name}
Group:         Development/Other
Summary:       C# bindings for the Apache Thrift RPC system
BuildRequires: mono-devel

%description -n mono-%{name}
Thrift is a software framework for scalable cross-language services
development.

This package contains the C# bindings for Thrift. You will need the thrift
tool (in the thrift-compiler package) to compile your definition to C#
classes, and then the modules in this package will allow you to use those
classes in your programs.

%package -n perl-%{name}
Group:         Development/Perl
Summary:       Perl bindings for the Apache Thrift RPC system
BuildRequires: perl-devel
BuildRequires: perl-Bit-Vector
Provides:      perl(Thrift) = %version-%release

%description -n perl-%{name}
Thrift is a software framework for scalable cross-language services
development.

This package contains the Perl bindings for Thrift. You will need the thrift
tool (in the thrift-compiler package) to compile your definition to Perl
classes, and then the modules in this package will allow you to use those
classes in your programs.

%if %with_php
%package -n php-%{name}
Group:         Development/PHP
Summary:       PHP bindings for the Apache Thrift RPC system
BuildRequires: php-cli
BuildRequires: php-devel

%description -n php-%{name}
Thrift is a software framework for scalable cross-language services
development.

This package contains the PHP bindings for Thrift. You will need the thrift
tool (in the thrift-compiler package) to compile your definition to Perl
classes, and then the modules in this package will allow you to use those
classes in your programs.
%endif

%package -n python-%{name}
Group:         Development/Python
Summary:       Python bindings for the Apache Thrift RPC system
BuildRequires: python-devel
Requires:      python-twisted-core

%description -n python-%{name}
Thrift is a software framework for scalable cross-language services
development.

This package contains the Python bindings for Thrift. You will need the thrift
tool (in the thrift-compiler package) to compile your definition to Python
classes, and then the modules in this package will allow you to use those
classes in your programs.


%prep
%setup -q -n thrift-%{version}
%patch0 -p0

find -name "*.bat" -exec rm -f {} \;
find -name "*.class" -exec rm -f {} \;
find -name "*.dll" -exec rm -f {} \;
find -name "*.exe" -exec rm -f {} \;
find -name "*.jar" -exec rm -f {} \;
find -name "*.jnilib" -exec rm -f {} \;
find -name "*.so" -exec rm -f {} \;


%build

cp %SOURCE1 bootstrap.sh
cp %SOURCE2 cleanup.sh
chmod 755 bootstrap.sh cleanup.sh
sh ./bootstrap.sh
export JAVA_HOME=%{_jvmdir}/java
%configure2_5x \
  --without-ruby \
  --without-perl \
  --without-csharp \
%if !%with_php
  --without-php \
%endif
  JAVA_PREFIX=%{_javadir} 
make LIBS='-lrt -lpthread -lssl ' LDFLAGS='-lssl'

(
  cd lib/perl
  %{__perl} Makefile.PL PREFIX=%{_prefix} INSTALLDIRS=vendor
  %make
)

(
  cd lib/csharp
  %make
)

%install
[ %{buildroot} != / ] && rm -rf %{buildroot}

make DESTDIR=%{buildroot} install

rm -rf %{buildroot}%{_libdir}/perl5
make -C lib/perl install PREFIX=%{buildroot}%{_prefix}
find %{buildroot} -type f -name .packlist -exec rm -f {} ';'
find %{buildroot} -depth -type d -exec rmdir {} 2>/dev/null ';'

mkdir -p %{buildroot}%{_libdir}/cli/thrift/
install -pm 755 lib/csharp/Thrift.dll %{buildroot}%{_libdir}/cli/thrift/Thrift.dll

mkdir -p %{buildroot}%{_javadocdir}/%{name}
cp -pr lib/java/build/javadoc/* %{buildroot}%{_javadocdir}/%{name}
rm -rf %{buildroot}%{_javadir}/lib%{name}-%{version}-javadoc.jar

mkdir -p %{buildroot}%{_javadir}
install -pm 644 lib/java/build/lib%{name}-%{version}-snapshot.jar %{buildroot}%{_javadir}/lib%{name}.jar

#(
#  cd %{buildroot}%{_javadir}
#  for jar in *-%{version}.jar; do
#    ln -sf ${jar} `echo $jar| sed "s|-%{version}||g"`
#  done
#  mv lib%{name}-%{version}.jar lib%{name}.jar
#)

install -d -m 755 %{buildroot}%{_mavenpomdir}
install -pm 644 %SOURCE3 %{buildroot}%{_mavenpomdir}/JPP-lib%{name}.pom
%add_maven_depmap JPP-lib%{name}.pom lib%{name}.jar
mv %{buildroot}%{_mavendepmapfragdir}/%{name} %{buildroot}%{_mavendepmapfragdir}/lib%{name}

# TODO
%if %with_php
# for cassandra
install -d %{buildroot}%{_usrsrc}/php-devel/thrift
cp -dpR lib/php/src/* %{buildroot}%{_usrsrc}/php-devel/thrift
rm -rf lib/php/src/ext/thrift_protocol/modules/thrift_protocol.la
rm -rf lib/php/src/ext/thrift_protocol/modules/thrift_protocol.so
rm -rf lib/php/src/ext/thrift_protocol/php_thrift_protocol.lo
rm -rf lib/php/src/ext/thrift_protocol/thrift_protocol.la
rm -rf lib/php/src/ext/thrift_protocol/.libs/*

ln -snf %{_libdir}/php/extensions/thrift_protocol.so %{buildroot}%{_usrsrc}/php-devel/thrift/lib/php/src/ext/thrift_protocol/.libs/
ln -snf %{_libdir}/php/extensions/thrift_protocol.so %{buildroot}%{_usrsrc}/php-devel/thrift/lib/php/src/ext/thrift_protocol/modules/thrift_protocol.so

rm -rf %{_libdir}/php/Thrift.php
rm -rf %{_libdir}/php/autoload.php
rm -rf %{_libdir}/php/protocol/TBinaryProtocol.php
rm -rf %{_libdir}/php/protocol/TBinarySerializer.php
rm -rf %{_libdir}/php/protocol/TProtocol.php
rm -rf %{_libdir}/php/transport/TBufferedTransport.php
rm -rf %{_libdir}/php/transport/TFramedTransport.php
rm -rf %{_libdir}/php/transport/THttpClient.php
rm -rf %{_libdir}/php/transport/TMemoryBuffer.php
rm -rf %{_libdir}/php/transport/TNullTransport.php
rm -rf %{_libdir}/php/transport/TPhpStream.php
rm -rf %{_libdir}/php/transport/TSocket.php
rm -rf %{_libdir}/php/transport/TSocketPool.php
rm -rf %{_libdir}/php/transport/TTransport.php
%endif

%files
%{_bindir}/thrift
%doc CHANGES CONTRIBUTORS DISCLAIMER LICENSE NEWS NOTICE README

%files -n %libname
%{_libdir}/libthrift*.so.*

%files -n %libname_devel
%dir %{_includedir}/thrift
%{_includedir}/thrift/*
%{_libdir}/libthrift*.*a
%{_libdir}/libthrift*.so
%{_libdir}/pkgconfig/thrift*.pc

%post -n lib%{name}-java
%update_maven_depmap

%postun -n lib%{name}-java
%update_maven_depmap

%files  -n lib%{name}-java
%{_javadir}/lib%{name}.jar
%{_mavenpomdir}/JPP-lib%{name}.pom
%{_mavendepmapfragdir}/lib%{name}

%files  -n lib%{name}-javadoc
%{_javadocdir}/%{name}

%files  -n mono-%{name}
%{_libdir}/cli/thrift/Thrift.dll

%files  -n perl-%{name}
%{perl_vendorlib}/Thrift.pm
%dir %{perl_vendorlib}/Thrift
%{perl_vendorlib}/Thrift/*.pm

# TODO
%if %with_php
%post -n php-%{name}
if [ -f /var/lock/subsys/httpd ]; then
    %{_initrddir}/httpd restart >/dev/null || :
fi

%postun -n php-%{name}
if [ "$1" = "0" ]; then
    if [ -f /var/lock/subsys/httpd ]; then
        %{_initrddir}/httpd restart >/dev/null || :
    fi
fi

%files  -n php-%{name}
%{_sysconfdir}/php.d/thrift_protocol.ini
%{_libdir}/php/extensions/thrift_protocol.so
%{_usrsrc}/php-devel/thrift/*
%endif

%files  -n python-%{name}
%{python_sitearch}/Thrift-%{version}-py%{python_version}.egg-info
%dir %{python_sitearch}/thrift
%{python_sitearch}/thrift/*.py*
%dir %{python_sitearch}/thrift/protocol
%{python_sitearch}/thrift/protocol/*.py*
%{python_sitearch}/thrift/protocol/fastbinary.so
%dir %{python_sitearch}/thrift/server
%{python_sitearch}/thrift/server/*.py
%dir %{python_sitearch}/thrift/transport
%{python_sitearch}/thrift/transport/*.py*

%changelog

* Sun Dec 04 2011 dmorgan <dmorgan> 0.6.1-2.mga2
+ Revision: 176601
- Fix provides

* Thu Dec 01 2011 gil <gil> 0.6.1-1.mga2
+ Revision: 174921
- disable for now php sub package
- disable for now php sub package
- fix javadoc arch
- build fix
  used proper tomcat servlet-api
- Revert to 0.6.1
- imported package thrift

  + dmorgan <dmorgan>
    - Adapt to mageia guidelines