David Reiss | 710440f | 2008-06-11 01:19:12 +0000 | [diff] [blame] | 1 | # 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 | |
| 7 | Name: thrift |
| 8 | License: Thrift Software License |
| 9 | Group: Development |
| 10 | Summary: RPC and serialization framework |
| 11 | Version: 20080529svn |
| 12 | Epoch: 1 |
| 13 | Release: 1 |
| 14 | URL: http://developers.facebook.com/thrift |
| 15 | Packager: David Reiss <dreiss@facebook.com> |
| 16 | Source0: %{name}-%{version}.tar.gz |
| 17 | |
| 18 | BuildRequires: gcc >= 3.4.6 |
| 19 | BuildRequires: gcc-c++ |
| 20 | |
| 21 | # TODO(dreiss): Can these be moved into the individual packages? |
| 22 | %if %{!?without_java: 1} |
| 23 | BuildRequires: java-devel >= 0:1.5.0 |
| 24 | BuildRequires: ant >= 0:1.6.5 |
| 25 | %endif |
| 26 | |
| 27 | %if %{!?without_python: 1} |
| 28 | BuildRequires: python-devel |
| 29 | %endif |
| 30 | |
| 31 | %if %{!?without_erlang: 1} |
| 32 | BuildRequires: erlang |
| 33 | %endif |
| 34 | |
| 35 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) |
| 36 | |
| 37 | %description |
| 38 | Thrift is a software framework for scalable cross-language services |
| 39 | development. It combines a powerful software stack with a code generation |
| 40 | engine to build services that work efficiently and seamlessly between C++, |
| 41 | Java, C#, Python, Ruby, Perl, PHP, Objective C/Cocoa, Smalltalk, Erlang, |
| 42 | Objective 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 |
| 51 | Summary: Thrift C++ library |
| 52 | Group: Libraries |
| 53 | |
| 54 | %description lib-cpp |
| 55 | C++ libraries for Thrift. |
| 56 | |
| 57 | %files lib-cpp |
| 58 | %defattr(-,root,root) |
| 59 | %{_libdir}/libthrift*.so.* |
| 60 | |
| 61 | |
| 62 | %package lib-cpp-devel |
| 63 | Summary: Thrift C++ library development files |
| 64 | Group: Libraries |
| 65 | Requires: %{name} = %{version}-%{release} |
| 66 | Requires: boost-devel |
| 67 | %if %{!?without_libevent: 1} |
| 68 | Requires: libevent-devel >= 1.2 |
| 69 | %endif |
| 70 | %if %{!?without_zlib: 1} |
| 71 | Requires: zlib-devel |
| 72 | %endif |
| 73 | |
| 74 | %description lib-cpp-devel |
| 75 | C++ 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 |
| 87 | Summary: Thrift Java library |
| 88 | Group: Libraries |
| 89 | Requires: java >= 0:1.5.0 |
| 90 | |
| 91 | %description lib-java |
| 92 | Java 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 |
| 102 | Summary: Thrift Python library |
| 103 | Group: Libraries |
| 104 | |
| 105 | %description lib-python |
| 106 | Python 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 |
| 116 | Summary: Thrift Python library |
| 117 | Group: Libraries |
| 118 | Requires: erlang |
| 119 | |
| 120 | %description lib-erlang |
| 121 | Erlang 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 | |
| 142 | make |
| 143 | |
| 144 | %if %{!?without_java: 1} |
| 145 | cd lib/java |
| 146 | %ant |
| 147 | cd ../.. |
| 148 | %endif |
| 149 | |
| 150 | %if %{!?without_python: 1} |
| 151 | cd lib/py |
| 152 | CFLAGS="%{optflags}" %{__python} setup.py build |
| 153 | cd ../.. |
| 154 | %endif |
| 155 | |
| 156 | %if %{!?without_erlang: 1} |
| 157 | cd lib/erl |
| 158 | make |
| 159 | cd ../.. |
| 160 | %endif |
| 161 | |
| 162 | %install |
| 163 | %makeinstall |
| 164 | |
| 165 | %if %{!?without_java: 1} |
| 166 | mkdir -p $RPM_BUILD_ROOT%{_javadir} |
| 167 | cp -p lib/java/*.jar $RPM_BUILD_ROOT%{_javadir} |
| 168 | %endif |
| 169 | |
| 170 | %if %{!?without_python: 1} |
| 171 | cd lib/py |
| 172 | %{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT |
| 173 | cd ../.. |
| 174 | %endif |
| 175 | |
| 176 | %if %{!?without_erlang: 1} |
| 177 | mkdir -p ${RPM_BUILD_ROOT}%{thrift_erlang_root} |
| 178 | cp -r lib/erl/ebin ${RPM_BUILD_ROOT}%{thrift_erlang_root} |
| 179 | %endif |
| 180 | |
| 181 | |
| 182 | %clean |
| 183 | rm -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. |