blob: 3568739d42761af0dbfd7ba6a3cb6e4b6d487abf [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
David Reiss710440f2008-06-11 01:19:12 +000047
48
49%package lib-cpp
50Summary: Thrift C++ library
51Group: Libraries
52
53%description lib-cpp
54C++ libraries for Thrift.
55
56%files lib-cpp
57%defattr(-,root,root)
58%{_libdir}/libthrift*.so.*
59
60
61%package lib-cpp-devel
62Summary: Thrift C++ library development files
63Group: Libraries
64Requires: %{name} = %{version}-%{release}
65Requires: boost-devel
66%if %{!?without_libevent: 1}
67Requires: libevent-devel >= 1.2
68%endif
69%if %{!?without_zlib: 1}
70Requires: zlib-devel
71%endif
72
73%description lib-cpp-devel
74C++ static libraries and headers for Thrift.
75
76%files lib-cpp-devel
77%defattr(-,root,root)
78%{_includedir}/thrift/
79%{_libdir}/libthrift*.*a
80%{_libdir}/libthrift*.so
81%{_libdir}/pkgconfig/thrift*.pc
82
83
84%if %{!?without_java: 1}
85%package lib-java
86Summary: Thrift Java library
87Group: Libraries
88Requires: java >= 0:1.5.0
89
90%description lib-java
91Java libraries for Thrift.
92
93%files lib-java
94%defattr(-,root,root)
95%{_javadir}/*
96%endif
97
98
99%if %{!?without_python: 1}
100%package lib-python
101Summary: Thrift Python library
102Group: Libraries
103
104%description lib-python
105Python libraries for Thrift.
106
107%files lib-python
108%defattr(-,root,root)
109%{python_sitearch}/*
110%endif
111
112
113%if %{!?without_erlang: 1}
114%package lib-erlang
115Summary: Thrift Python library
116Group: Libraries
117Requires: erlang
118
119%description lib-erlang
120Erlang libraries for Thrift.
121
122%files lib-erlang
123%defattr(-,root,root)
124%{thrift_erlang_root}
125%endif
126
127
128%prep
129%setup -q
130
131%build
132# TODO(dreiss): Implement a single --without-build-kludges.
133%configure \
134 %{?without_libevent: --without-libevent } \
135 %{?without_zlib: --without-zlib } \
136 --without-java \
137 --without-csharp \
138 --without-py \
139 --without-erlang \
140
141make
142
143%if %{!?without_java: 1}
144cd lib/java
145%ant
146cd ../..
147%endif
148
149%if %{!?without_python: 1}
150cd lib/py
151CFLAGS="%{optflags}" %{__python} setup.py build
152cd ../..
153%endif
154
155%if %{!?without_erlang: 1}
156cd lib/erl
157make
158cd ../..
159%endif
160
161%install
162%makeinstall
163
164%if %{!?without_java: 1}
165mkdir -p $RPM_BUILD_ROOT%{_javadir}
166cp -p lib/java/*.jar $RPM_BUILD_ROOT%{_javadir}
167%endif
168
169%if %{!?without_python: 1}
170cd lib/py
171%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
172cd ../..
173%endif
174
175%if %{!?without_erlang: 1}
176mkdir -p ${RPM_BUILD_ROOT}%{thrift_erlang_root}
177cp -r lib/erl/ebin ${RPM_BUILD_ROOT}%{thrift_erlang_root}
178%endif
179
180
181%clean
182rm -rf ${RPM_BUILD_ROOT}
183
184
185%changelog
186* Wed May 28 2008 David Reiss <dreiss@facebook.com> - 20080529svn
187- Initial build, based on the work of Kevin Smith and Ben Maurer.