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 |
David Reiss | 710440f | 2008-06-11 01:19:12 +0000 | [diff] [blame] | 47 | |
| 48 | |
| 49 | %package lib-cpp |
| 50 | Summary: Thrift C++ library |
| 51 | Group: Libraries |
| 52 | |
| 53 | %description lib-cpp |
| 54 | C++ libraries for Thrift. |
| 55 | |
| 56 | %files lib-cpp |
| 57 | %defattr(-,root,root) |
| 58 | %{_libdir}/libthrift*.so.* |
| 59 | |
| 60 | |
| 61 | %package lib-cpp-devel |
| 62 | Summary: Thrift C++ library development files |
| 63 | Group: Libraries |
| 64 | Requires: %{name} = %{version}-%{release} |
| 65 | Requires: boost-devel |
| 66 | %if %{!?without_libevent: 1} |
| 67 | Requires: libevent-devel >= 1.2 |
| 68 | %endif |
| 69 | %if %{!?without_zlib: 1} |
| 70 | Requires: zlib-devel |
| 71 | %endif |
| 72 | |
| 73 | %description lib-cpp-devel |
| 74 | C++ 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 |
| 86 | Summary: Thrift Java library |
| 87 | Group: Libraries |
| 88 | Requires: java >= 0:1.5.0 |
| 89 | |
| 90 | %description lib-java |
| 91 | Java 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 |
| 101 | Summary: Thrift Python library |
| 102 | Group: Libraries |
| 103 | |
| 104 | %description lib-python |
| 105 | Python 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 |
| 115 | Summary: Thrift Python library |
| 116 | Group: Libraries |
| 117 | Requires: erlang |
| 118 | |
| 119 | %description lib-erlang |
| 120 | Erlang 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 | |
| 141 | make |
| 142 | |
| 143 | %if %{!?without_java: 1} |
| 144 | cd lib/java |
| 145 | %ant |
| 146 | cd ../.. |
| 147 | %endif |
| 148 | |
| 149 | %if %{!?without_python: 1} |
| 150 | cd lib/py |
| 151 | CFLAGS="%{optflags}" %{__python} setup.py build |
| 152 | cd ../.. |
| 153 | %endif |
| 154 | |
| 155 | %if %{!?without_erlang: 1} |
| 156 | cd lib/erl |
| 157 | make |
| 158 | cd ../.. |
| 159 | %endif |
| 160 | |
| 161 | %install |
| 162 | %makeinstall |
| 163 | |
| 164 | %if %{!?without_java: 1} |
| 165 | mkdir -p $RPM_BUILD_ROOT%{_javadir} |
| 166 | cp -p lib/java/*.jar $RPM_BUILD_ROOT%{_javadir} |
| 167 | %endif |
| 168 | |
| 169 | %if %{!?without_python: 1} |
| 170 | cd lib/py |
| 171 | %{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT |
| 172 | cd ../.. |
| 173 | %endif |
| 174 | |
| 175 | %if %{!?without_erlang: 1} |
| 176 | mkdir -p ${RPM_BUILD_ROOT}%{thrift_erlang_root} |
| 177 | cp -r lib/erl/ebin ${RPM_BUILD_ROOT}%{thrift_erlang_root} |
| 178 | %endif |
| 179 | |
| 180 | |
| 181 | %clean |
| 182 | rm -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. |