Gavin McDonald | 0b75e1a | 2010-10-28 02:12:01 +0000 | [diff] [blame] | 1 | # |
| 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 | |
| 26 | Name: thrift |
| 27 | License: Apache License v2.0 |
| 28 | Group: Development |
| 29 | Summary: RPC and serialization framework |
| 30 | Version: 20080529svn |
| 31 | Epoch: 1 |
| 32 | Release: 1 |
| 33 | URL: http://developers.facebook.com/thrift |
| 34 | Packager: David Reiss <dreiss@facebook.com> |
| 35 | Source0: %{name}-%{version}.tar.gz |
| 36 | |
| 37 | BuildRequires: gcc >= 3.4.6 |
| 38 | BuildRequires: gcc-c++ |
| 39 | |
| 40 | # TODO(dreiss): Can these be moved into the individual packages? |
| 41 | %if %{!?without_java: 1} |
| 42 | BuildRequires: java-devel >= 0:1.5.0 |
| 43 | BuildRequires: ant >= 0:1.6.5 |
| 44 | %endif |
| 45 | |
| 46 | %if %{!?without_python: 1} |
| 47 | BuildRequires: python-devel |
| 48 | %endif |
| 49 | |
| 50 | %if %{!?without_erlang: 1} |
| 51 | BuildRequires: erlang |
| 52 | %endif |
| 53 | |
| 54 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) |
| 55 | |
| 56 | %description |
| 57 | Thrift is a software framework for scalable cross-language services |
| 58 | development. It combines a powerful software stack with a code generation |
| 59 | engine to build services that work efficiently and seamlessly between C++, |
| 60 | Java, C#, Python, Ruby, Perl, PHP, Objective C/Cocoa, Smalltalk, Erlang, |
| 61 | Objective Caml, and Haskell. |
| 62 | |
| 63 | %files |
| 64 | %defattr(-,root,root) |
| 65 | %{_bindir}/thrift |
| 66 | |
| 67 | |
| 68 | %package lib-cpp |
| 69 | Summary: Thrift C++ library |
| 70 | Group: Libraries |
| 71 | |
| 72 | %description lib-cpp |
| 73 | C++ libraries for Thrift. |
| 74 | |
| 75 | %files lib-cpp |
| 76 | %defattr(-,root,root) |
| 77 | %{_libdir}/libthrift*.so.* |
| 78 | |
| 79 | |
| 80 | %package lib-cpp-devel |
| 81 | Summary: Thrift C++ library development files |
| 82 | Group: Libraries |
| 83 | Requires: %{name} = %{version}-%{release} |
| 84 | Requires: boost-devel |
| 85 | %if %{!?without_libevent: 1} |
| 86 | Requires: libevent-devel >= 1.2 |
| 87 | %endif |
| 88 | %if %{!?without_zlib: 1} |
| 89 | Requires: zlib-devel |
| 90 | %endif |
| 91 | |
| 92 | %description lib-cpp-devel |
| 93 | C++ 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 |
| 105 | Summary: Thrift Java library |
| 106 | Group: Libraries |
| 107 | Requires: java >= 0:1.5.0 |
| 108 | |
| 109 | %description lib-java |
| 110 | Java 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 |
| 120 | Summary: Thrift Python library |
| 121 | Group: Libraries |
| 122 | |
| 123 | %description lib-python |
| 124 | Python 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 |
| 134 | Summary: Thrift Python library |
| 135 | Group: Libraries |
| 136 | Requires: erlang |
| 137 | |
| 138 | %description lib-erlang |
| 139 | Erlang 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 | |
| 160 | make |
| 161 | |
| 162 | %if %{!?without_java: 1} |
| 163 | cd lib/java |
| 164 | %ant |
| 165 | cd ../.. |
| 166 | %endif |
| 167 | |
| 168 | %if %{!?without_python: 1} |
| 169 | cd lib/py |
| 170 | CFLAGS="%{optflags}" %{__python} setup.py build |
| 171 | cd ../.. |
| 172 | %endif |
| 173 | |
| 174 | %if %{!?without_erlang: 1} |
| 175 | cd lib/erl |
| 176 | make |
| 177 | cd ../.. |
| 178 | %endif |
| 179 | |
| 180 | %install |
| 181 | %makeinstall |
| 182 | |
| 183 | %if %{!?without_java: 1} |
| 184 | mkdir -p $RPM_BUILD_ROOT%{_javadir} |
| 185 | cp -p lib/java/*.jar $RPM_BUILD_ROOT%{_javadir} |
| 186 | %endif |
| 187 | |
| 188 | %if %{!?without_python: 1} |
| 189 | cd lib/py |
| 190 | %{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT |
| 191 | cd ../.. |
| 192 | %endif |
| 193 | |
| 194 | %if %{!?without_erlang: 1} |
| 195 | mkdir -p ${RPM_BUILD_ROOT}%{thrift_erlang_root} |
| 196 | cp -r lib/erl/ebin ${RPM_BUILD_ROOT}%{thrift_erlang_root} |
| 197 | %endif |
| 198 | |
| 199 | |
| 200 | %clean |
| 201 | rm -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. |