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