blob: ecee631a3431558fec5f40586412e6e0b6da27d5 [file] [log] [blame]
Gavin McDonald0b75e1a2010-10-28 02:12:01 +00001#
2# Licensed to the Apache Software Foundation (ASF) under one
3# or more contributor license agreements. See the NOTICE file
4# distributed with this work for additional information
5# regarding copyright ownership. The ASF licenses this file
6# to you under the Apache License, Version 2.0 (the
7# "License"); you may not use this file except in compliance
8# with the License. You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing,
13# software distributed under the License is distributed on an
14# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15# KIND, either express or implied. See the License for the
16# specific language governing permissions and limitations
17# under the License.
18#
19
20# TODO(dreiss): Have a Python build with and without the extension.
21%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
22%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
23# TODO(dreiss): Where is this supposed to go?
24%{!?thrift_erlang_root: %define thrift_erlang_root /opt/thrift-erl}
25
26Name: thrift
27License: Apache License v2.0
28Group: Development
29Summary: RPC and serialization framework
30Version: 20080529svn
31Epoch: 1
32Release: 1
33URL: http://developers.facebook.com/thrift
34Packager: David Reiss <dreiss@facebook.com>
35Source0: %{name}-%{version}.tar.gz
36
37BuildRequires: gcc >= 3.4.6
38BuildRequires: gcc-c++
39
40# TODO(dreiss): Can these be moved into the individual packages?
41%if %{!?without_java: 1}
42BuildRequires: java-devel >= 0:1.5.0
43BuildRequires: ant >= 0:1.6.5
44%endif
45
46%if %{!?without_python: 1}
47BuildRequires: python-devel
48%endif
49
50%if %{!?without_erlang: 1}
51BuildRequires: erlang
52%endif
53
54BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
55
56%description
57Thrift is a software framework for scalable cross-language services
58development. It combines a powerful software stack with a code generation
59engine to build services that work efficiently and seamlessly between C++,
60Java, C#, Python, Ruby, Perl, PHP, Objective C/Cocoa, Smalltalk, Erlang,
61Objective Caml, and Haskell.
62
63%files
64%defattr(-,root,root)
65%{_bindir}/thrift
66
67
68%package lib-cpp
69Summary: Thrift C++ library
70Group: Libraries
71
72%description lib-cpp
73C++ libraries for Thrift.
74
75%files lib-cpp
76%defattr(-,root,root)
77%{_libdir}/libthrift*.so.*
78
79
80%package lib-cpp-devel
81Summary: Thrift C++ library development files
82Group: Libraries
83Requires: %{name} = %{version}-%{release}
84Requires: boost-devel
85%if %{!?without_libevent: 1}
86Requires: libevent-devel >= 1.2
87%endif
88%if %{!?without_zlib: 1}
89Requires: zlib-devel
90%endif
91
92%description lib-cpp-devel
93C++ static libraries and headers for Thrift.
94
95%files lib-cpp-devel
96%defattr(-,root,root)
97%{_includedir}/thrift/
98%{_libdir}/libthrift*.*a
99%{_libdir}/libthrift*.so
100%{_libdir}/pkgconfig/thrift*.pc
101
102
103%if %{!?without_java: 1}
104%package lib-java
105Summary: Thrift Java library
106Group: Libraries
107Requires: java >= 0:1.5.0
108
109%description lib-java
110Java libraries for Thrift.
111
112%files lib-java
113%defattr(-,root,root)
114%{_javadir}/*
115%endif
116
117
118%if %{!?without_python: 1}
119%package lib-python
120Summary: Thrift Python library
121Group: Libraries
122
123%description lib-python
124Python libraries for Thrift.
125
126%files lib-python
127%defattr(-,root,root)
128%{python_sitearch}/*
129%endif
130
131
132%if %{!?without_erlang: 1}
133%package lib-erlang
134Summary: Thrift Python library
135Group: Libraries
136Requires: erlang
137
138%description lib-erlang
139Erlang libraries for Thrift.
140
141%files lib-erlang
142%defattr(-,root,root)
143%{thrift_erlang_root}
144%endif
145
146
147%prep
148%setup -q
149
150%build
151# TODO(dreiss): Implement a single --without-build-kludges.
152%configure \
153 %{?without_libevent: --without-libevent } \
154 %{?without_zlib: --without-zlib } \
155 --without-java \
156 --without-csharp \
157 --without-py \
158 --without-erlang \
159
160make
161
162%if %{!?without_java: 1}
163cd lib/java
164%ant
165cd ../..
166%endif
167
168%if %{!?without_python: 1}
169cd lib/py
170CFLAGS="%{optflags}" %{__python} setup.py build
171cd ../..
172%endif
173
174%if %{!?without_erlang: 1}
175cd lib/erl
176make
177cd ../..
178%endif
179
180%install
181%makeinstall
182
183%if %{!?without_java: 1}
184mkdir -p $RPM_BUILD_ROOT%{_javadir}
185cp -p lib/java/*.jar $RPM_BUILD_ROOT%{_javadir}
186%endif
187
188%if %{!?without_python: 1}
189cd lib/py
190%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
191cd ../..
192%endif
193
194%if %{!?without_erlang: 1}
195mkdir -p ${RPM_BUILD_ROOT}%{thrift_erlang_root}
196cp -r lib/erl/ebin ${RPM_BUILD_ROOT}%{thrift_erlang_root}
197%endif
198
199
200%clean
201rm -rf ${RPM_BUILD_ROOT}
202
203
204%changelog
205* Wed May 28 2008 David Reiss <dreiss@facebook.com> - 20080529svn
206- Initial build, based on the work of Kevin Smith and Ben Maurer.