/[gentoo-x86]/dev-libs/boost/boost-1.55.0-r2.ebuild
Gentoo

Contents of /dev-libs/boost/boost-1.55.0-r2.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.16 - (show annotations) (download)
Mon Jul 27 13:06:41 2015 UTC (3 years, 10 months ago) by pinkbyte
Branch: MAIN
CVS Tags: HEAD
Changes since 1.15: +3 -2 lines
Fix building with USE=context and GCC 5.1 and higher, wrt bugs #546882 and #555580

(Portage version: 2.2.20/cvs/Linux x86_64, signed Manifest commit with key 0x60C0742D1F357D42)

1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/dev-libs/boost/boost-1.55.0-r2.ebuild,v 1.15 2015/04/16 12:55:41 zlogene Exp $
4
5 EAPI="5"
6 PYTHON_COMPAT=( python{2_7,3_3,3_4} )
7
8 inherit eutils flag-o-matic multilib multiprocessing python-r1 toolchain-funcs versionator multilib-minimal
9
10 MY_P="${PN}_$(replace_all_version_separators _)"
11 MAJOR_V="$(get_version_component_range 1-2)"
12
13 DESCRIPTION="Boost Libraries for C++"
14 HOMEPAGE="http://www.boost.org/"
15 SRC_URI="mirror://sourceforge/boost/${MY_P}.tar.bz2"
16
17 LICENSE="Boost-1.0"
18 SLOT="0/${PV}" # ${PV} instead ${MAJOR_V} due to bug 486122
19 KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux"
20
21 IUSE="context debug doc icu +nls mpi python static-libs +threads tools"
22
23 RDEPEND="abi_x86_32? ( !app-emulation/emul-linux-x86-cpplibs[-abi_x86_32(-)] )
24 icu? ( >=dev-libs/icu-3.6:=[${MULTILIB_USEDEP}] )
25 !icu? ( virtual/libiconv[${MULTILIB_USEDEP}] )
26 mpi? ( virtual/mpi[cxx,threads] )
27 python? ( ${PYTHON_DEPS} )
28 app-arch/bzip2[${MULTILIB_USEDEP}]
29 sys-libs/zlib[${MULTILIB_USEDEP}]
30 !app-admin/eselect-boost"
31 DEPEND="${RDEPEND}
32 =dev-util/boost-build-${MAJOR_V}*"
33 REQUIRED_USE="
34 mpi? ( threads )
35 python? ( ${PYTHON_REQUIRED_USE} )"
36
37 S="${WORKDIR}/${MY_P}"
38
39 # the tests will never fail because these are not intended as sanity
40 # tests at all. They are more a way for upstream to check their own code
41 # on new compilers. Since they would either be completely unreliable
42 # (failing for no good reason) or completely useless (never failing)
43 # there is no point in having them in the ebuild to begin with.
44 RESTRICT="test"
45
46 python_bindings_needed() {
47 multilib_is_native_abi && use python
48 }
49
50 tools_needed() {
51 multilib_is_native_abi && use tools
52 }
53
54 # MPI stuff is not ported on multilib yet, disabling it for non-native ABIs
55 mpi_needed() {
56 multilib_is_native_abi && use mpi
57 }
58
59 create_user-config.jam() {
60 local compiler compiler_version compiler_executable
61
62 if [[ ${CHOST} == *-darwin* ]]; then
63 compiler="darwin"
64 compiler_version="$(gcc-fullversion)"
65 compiler_executable="$(tc-getCXX)"
66 else
67 compiler="gcc"
68 compiler_version="$(gcc-version)"
69 compiler_executable="$(tc-getCXX)"
70 fi
71 local mpi_configuration python_configuration
72
73 if mpi_needed; then
74 mpi_configuration="using mpi ;"
75 fi
76
77 if python_bindings_needed; then
78 python_configuration="using python : : ${PYTHON} ;"
79 fi
80
81 cat > "${BOOST_ROOT}/user-config.jam" << __EOF__
82 using ${compiler} : ${compiler_version} : ${compiler_executable} : <cflags>"${CFLAGS}" <cxxflags>"${CXXFLAGS}" <linkflags>"${LDFLAGS}" ;
83 ${mpi_configuration}
84 ${python_configuration}
85 __EOF__
86 }
87
88 pkg_setup() {
89 # Bail out on unsupported build configuration, bug #456792
90 if [[ -f "${EROOT}etc/site-config.jam" ]]; then
91 grep -q gentoorelease "${EROOT}etc/site-config.jam" && grep -q gentoodebug "${EROOT}etc/site-config.jam" ||
92 (
93 eerror "You are using custom ${EROOT}etc/site-config.jam without defined gentoorelease/gentoodebug targets."
94 eerror "Boost can not be built in such configuration."
95 eerror "Please, either remove this file or add targets from ${EROOT}usr/share/boost-build/site-config.jam to it."
96 die
97 )
98 fi
99 }
100
101 src_prepare() {
102 epatch \
103 "${FILESDIR}/${PN}-1.51.0-respect_python-buildid.patch" \
104 "${FILESDIR}/${PN}-1.51.0-support_dots_in_python-buildid.patch" \
105 "${FILESDIR}/${PN}-1.48.0-no_strict_aliasing_python2.patch" \
106 "${FILESDIR}/${PN}-1.48.0-disable_libboost_python3.patch" \
107 "${FILESDIR}/${PN}-1.48.0-python_linking.patch" \
108 "${FILESDIR}/${PN}-1.48.0-disable_icu_rpath.patch" \
109 "${FILESDIR}/${PN}-1.55.0-context-x32.patch" \
110 "${FILESDIR}/${PN}-1.55.0-tools-c98-compat.patch" \
111 "${FILESDIR}/${PN}-1.52.0-threads.patch" \
112 "${FILESDIR}/${PN}-1.55.0-variadic-templates.patch"
113
114 epatch_user
115
116 multilib_copy_sources
117 }
118
119 ejam() {
120 local b2_opts="--user-config=${BOOST_ROOT}/user-config.jam $@"
121 echo b2 ${b2_opts}
122 b2 ${b2_opts}
123 }
124
125 src_configure() {
126 # Workaround for too many parallel processes requested, bug #506064
127 [ "$(makeopts_jobs)" -gt 64 ] && MAKEOPTS="${MAKEOPTS} -j64"
128
129 OPTIONS="$(usex debug gentoodebug gentoorelease) -j$(makeopts_jobs) -q -d+2"
130
131 if [[ ${CHOST} == *-darwin* ]]; then
132 # We need to add the prefix, and in two cases this exceeds, so prepare
133 # for the largest possible space allocation.
134 append-ldflags -Wl,-headerpad_max_install_names
135 elif [[ ${CHOST} == *-winnt* ]]; then
136 compiler=parity
137 if [[ $($(tc-getCXX) -v) == *trunk* ]]; then
138 compilerVersion=trunk
139 else
140 compilerVersion=$($(tc-getCXX) -v | sed '1q' \
141 | sed -e 's,\([a-z]*\) \([0-9]\.[0-9]\.[0-9][^ \t]*\) .*,\2,')
142 fi
143 compilerExecutable=$(tc-getCXX)
144 fi
145
146 # bug 298489
147 if use ppc || use ppc64; then
148 [[ $(gcc-version) > 4.3 ]] && append-flags -mno-altivec
149 fi
150
151 # Do _not_ use C++11 yet, make sure to force GNU C++ 98 standard.
152 append-cxxflags -std=gnu++98
153
154 use icu && OPTIONS+=" -sICU_PATH=${EPREFIX}/usr"
155 use icu || OPTIONS+=" --disable-icu boost.locale.icu=off"
156 mpi_needed || OPTIONS+=" --without-mpi"
157 use nls || OPTIONS+=" --without-locale"
158 use context || OPTIONS+=" --without-context --without-coroutine"
159
160 OPTIONS+=" pch=off"
161 OPTIONS+=" --boost-build=${EPREFIX}/usr/share/boost-build --prefix=\"${ED}usr\""
162 OPTIONS+=" --layout=system"
163 OPTIONS+=" threading=$(usex threads multi single) link=$(usex static-libs shared,static shared)"
164
165 [[ ${CHOST} == *-winnt* ]] && OPTIONS+=" -sNO_BZIP2=1"
166 }
167
168 multilib_src_compile() {
169 local -x BOOST_ROOT="${BUILD_DIR}"
170 PYTHON_DIRS=""
171 MPI_PYTHON_MODULE=""
172
173 building() {
174 create_user-config.jam
175
176 local PYTHON_OPTIONS
177 if python_bindings_needed; then
178 PYTHON_OPTIONS=" --python-buildid=${EPYTHON#python}"
179 else
180 PYTHON_OPTIONS=" --without-python"
181 fi
182
183 ejam \
184 ${OPTIONS} \
185 ${PYTHON_OPTIONS} \
186 || die "Building of Boost libraries failed"
187
188 if python_bindings_needed; then
189 if [[ -z "${PYTHON_DIRS}" ]]; then
190 PYTHON_DIRS="$(find bin.v2/libs -name python | sort)"
191 else
192 if [[ "${PYTHON_DIRS}" != "$(find bin.v2/libs -name python | sort)" ]]; then
193 die "Inconsistent structure of build directories"
194 fi
195 fi
196
197 local dir
198 for dir in ${PYTHON_DIRS}; do
199 mv ${dir} ${dir}-${EPYTHON} \
200 || die "Renaming of '${dir}' to '${dir}-${EPYTHON}' failed"
201 done
202
203 if mpi_needed; then
204 if [[ -z "${MPI_PYTHON_MODULE}" ]]; then
205 MPI_PYTHON_MODULE="$(find bin.v2/libs/mpi/build/*/gentoo* -name mpi.so)"
206 if [[ "$(echo "${MPI_PYTHON_MODULE}" | wc -l)" -ne 1 ]]; then
207 die "Multiple mpi.so files found"
208 fi
209 else
210 if [[ "${MPI_PYTHON_MODULE}" != "$(find bin.v2/libs/mpi/build/*/gentoo* -name mpi.so)" ]]; then
211 die "Inconsistent structure of build directories"
212 fi
213 fi
214
215 mv stage/lib/mpi.so stage/lib/mpi.so-${EPYTHON} \
216 || die "Renaming of 'stage/lib/mpi.so' to 'stage/lib/mpi.so-${EPYTHON}' failed"
217 fi
218 fi
219 }
220 if python_bindings_needed; then
221 python_foreach_impl building
222 else
223 building
224 fi
225
226 if tools_needed; then
227 pushd tools > /dev/null || die
228
229 ejam \
230 ${OPTIONS} \
231 ${PYTHON_OPTIONS} \
232 || die "Building of Boost tools failed"
233 popd > /dev/null || die
234 fi
235 }
236
237 multilib_src_install_all() {
238 if ! use python; then
239 rm -r "${ED}"/usr/include/boost/python* || die
240 fi
241
242 if ! use nls; then
243 rm -r "${ED}"/usr/include/boost/locale || die
244 fi
245
246 if ! use context; then
247 rm -r "${ED}"/usr/include/boost/context || die
248 rm -r "${ED}"/usr/include/boost/coroutine || die
249 fi
250
251 if use doc; then
252 find libs/*/* -iname "test" -or -iname "src" | xargs rm -rf
253 dohtml \
254 -A pdf,txt,cpp,hpp \
255 *.{htm,html,png,css} \
256 -r doc
257 dohtml -A pdf,txt -r tools
258 insinto /usr/share/doc/${PF}/html
259 doins -r libs
260 doins -r more
261
262 # To avoid broken links
263 insinto /usr/share/doc/${PF}/html
264 doins LICENSE_1_0.txt
265
266 dosym /usr/include/boost /usr/share/doc/${PF}/html/boost
267 fi
268 }
269
270 multilib_src_install() {
271 local -x BOOST_ROOT="${BUILD_DIR}"
272 installation() {
273 create_user-config.jam
274
275 local PYTHON_OPTIONS
276 if python_bindings_needed; then
277 local dir
278 for dir in ${PYTHON_DIRS}; do
279 cp -pr ${dir}-${EPYTHON} ${dir} \
280 || die "Copying of '${dir}-${EPYTHON}' to '${dir}' failed"
281 done
282
283 if mpi_needed; then
284 cp -p stage/lib/mpi.so-${EPYTHON} "${MPI_PYTHON_MODULE}" \
285 || die "Copying of 'stage/lib/mpi.so-${EPYTHON}' to '${MPI_PYTHON_MODULE}' failed"
286 cp -p stage/lib/mpi.so-${EPYTHON} stage/lib/mpi.so \
287 || die "Copying of 'stage/lib/mpi.so-${EPYTHON}' to 'stage/lib/mpi.so' failed"
288 fi
289 PYTHON_OPTIONS=" --python-buildid=${EPYTHON#python}"
290 else
291 PYTHON_OPTIONS=" --without-python"
292 fi
293
294 ejam \
295 ${OPTIONS} \
296 ${PYTHON_OPTIONS} \
297 --includedir="${ED}usr/include" \
298 --libdir="${ED}usr/$(get_libdir)" \
299 install || die "Installation of Boost libraries failed"
300
301 if python_bindings_needed; then
302 rm -r ${PYTHON_DIRS} || die
303
304 # Move mpi.so Python module to Python site-packages directory.
305 # https://svn.boost.org/trac/boost/ticket/2838
306 if mpi_needed; then
307 local moddir=$(python_get_sitedir)/boost
308 # moddir already includes eprefix
309 mkdir -p "${D}${moddir}" || die
310 mv "${ED}usr/$(get_libdir)/mpi.so" "${D}${moddir}" || die
311 cat << EOF > "${D}${moddir}/__init__.py" || die
312 import sys
313 if sys.platform.startswith('linux'):
314 import DLFCN
315 flags = sys.getdlopenflags()
316 sys.setdlopenflags(DLFCN.RTLD_NOW | DLFCN.RTLD_GLOBAL)
317 from . import mpi
318 sys.setdlopenflags(flags)
319 del DLFCN, flags
320 else:
321 from . import mpi
322 del sys
323 EOF
324 fi
325
326 python_optimize
327 fi
328 }
329 if python_bindings_needed; then
330 python_foreach_impl installation
331 else
332 installation
333 fi
334
335 pushd "${ED}usr/$(get_libdir)" > /dev/null || die
336
337 local ext=$(get_libname)
338 if use threads; then
339 local f
340 for f in *${ext}; do
341 dosym ${f} /usr/$(get_libdir)/${f/${ext}/-mt${ext}}
342 done
343 fi
344
345 popd > /dev/null || die
346
347 if tools_needed; then
348 dobin dist/bin/*
349
350 insinto /usr/share
351 doins -r dist/share/boostbook
352 fi
353
354 # boost's build system truely sucks for not having a destdir. Because for
355 # this reason we are forced to build with a prefix that includes the
356 # DESTROOT, dynamic libraries on Darwin end messed up, referencing the
357 # DESTROOT instread of the actual EPREFIX. There is no way out of here
358 # but to do it the dirty way of manually setting the right install_names.
359 if [[ ${CHOST} == *-darwin* ]]; then
360 einfo "Working around completely broken build-system(tm)"
361 local d
362 for d in "${ED}"usr/lib/*.dylib; do
363 if [[ -f ${d} ]]; then
364 # fix the "soname"
365 ebegin " correcting install_name of ${d#${ED}}"
366 install_name_tool -id "/${d#${D}}" "${d}"
367 eend $?
368 # fix references to other libs
369 refs=$(otool -XL "${d}" | \
370 sed -e '1d' -e 's/^\t//' | \
371 grep "^libboost_" | \
372 cut -f1 -d' ')
373 local r
374 for r in ${refs}; do
375 ebegin " correcting reference to ${r}"
376 install_name_tool -change \
377 "${r}" \
378 "${EPREFIX}/usr/lib/${r}" \
379 "${d}"
380 eend $?
381 done
382 fi
383 done
384 fi
385 }
386
387 pkg_preinst() {
388 # Yai for having symlinks that are nigh-impossible to remove without
389 # resorting to dirty hacks like these. Removes lingering symlinks
390 # from the slotted versions.
391 local symlink
392 for symlink in "${EROOT}usr/include/boost" "${EROOT}usr/share/boostbook"; do
393 [[ -L ${symlink} ]] && rm -f "${symlink}"
394 done
395 }

  ViewVC Help
Powered by ViewVC 1.1.20