/[gentoo-x86]/dev-libs/boost/boost-1.49.0-r1.ebuild
Gentoo

Contents of /dev-libs/boost/boost-1.49.0-r1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.13 - (show annotations) (download)
Wed Oct 31 21:36:31 2012 UTC (21 months, 2 weeks ago) by flameeyes
Branch: MAIN
CVS Tags: HEAD
Changes since 1.12: +1 -1 lines
FILE REMOVED
Force a rebuild for everybodu and get rid of eselect boost altogether. This is unfortunate but eselect boost behaves differently depending on whether boost was already installed or if it's a fresh install.

(Portage version: 2.2.0_alpha142/cvs/Linux x86_64, RepoMan options: --force, signed Manifest commit with key 1CD13C8AD4301342)

1 # Copyright 1999-2012 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.49.0-r1.ebuild,v 1.12 2012/10/31 18:27:00 flameeyes Exp $
4
5 EAPI="4"
6 PYTHON_DEPEND="python? *"
7 SUPPORT_PYTHON_ABIS="1"
8 RESTRICT_PYTHON_ABIS="*-jython *-pypy-*"
9
10 inherit flag-o-matic multilib python toolchain-funcs versionator
11
12 MY_P=${PN}_$(replace_all_version_separators _)
13
14 DESCRIPTION="Boost Libraries for C++"
15 HOMEPAGE="http://www.boost.org/"
16 SRC_URI="mirror://sourceforge/boost/${MY_P}.tar.bz2"
17
18 LICENSE="Boost-1.0"
19 SLOT=0
20 MAJOR_V="$(get_version_component_range 1-2)"
21 KEYWORDS="~alpha amd64 arm hppa ~ia64 ~mips ppc ppc64 ~s390 ~sh ~sparc x86 ~amd64-fbsd ~x86-fbsd"
22 IUSE="debug doc +eselect icu mpi python static-libs tools"
23
24 RDEPEND="icu? ( >=dev-libs/icu-3.3 )
25 mpi? ( || ( sys-cluster/openmpi[cxx] sys-cluster/mpich2[cxx,threads] ) )
26 sys-libs/zlib
27 !!<=dev-libs/boost-1.35.0-r2
28 >=app-admin/eselect-boost-0.4"
29 DEPEND="${RDEPEND}
30 =dev-util/boost-build-${MAJOR_V}*"
31
32 S=${WORKDIR}/${MY_P}
33
34 MAJOR_PV=$(replace_all_version_separators _ ${MAJOR_V})
35 BJAM="b2-${MAJOR_PV}"
36
37 # Usage:
38 # _add_line <line-to-add> <profile>
39 # ... to add to specific profile
40 # or
41 # _add_line <line-to-add>
42 # ... to add to all profiles for which the use flag set
43
44 _add_line() {
45 if [[ -z "$2" ]]; then
46 echo "${1}" >> "${D}usr/share/boost-eselect/profiles/${SLOT}/default"
47 if use debug; then
48 echo "${1}" >> "${D}usr/share/boost-eselect/profiles/${SLOT}/debug"
49 fi
50 else
51 echo "${1}" >> "${D}usr/share/boost-eselect/profiles/${SLOT}/${2}"
52 fi
53 }
54
55 create_user-config.jam() {
56 local compiler compiler_version compiler_executable
57
58 if [[ ${CHOST} == *-darwin* ]]; then
59 compiler="darwin"
60 compiler_version="$(gcc-fullversion)"
61 compiler_executable="$(tc-getCXX)"
62 else
63 compiler="gcc"
64 compiler_version="$(gcc-version)"
65 compiler_executable="$(tc-getCXX)"
66 fi
67 local mpi_configuration python_configuration
68
69 if use mpi; then
70 mpi_configuration="using mpi ;"
71 fi
72
73 if use python; then
74 python_configuration="using python : $(python_get_version) : /usr : $(python_get_includedir) : /usr/$(get_libdir) ;"
75 fi
76
77 # The debug-symbols=none and optimization=none are not official upstream flags but a Gentoo
78 # specific patch to make sure that all our CFLAGS/CXXFLAGS/LDFLAGS are being respected.
79 # Using optimization=off would for example add "-O0" and override "-O2" set by the user.
80 # Please take a look at the boost-build ebuild for more information.
81 cat > user-config.jam << __EOF__
82 variant gentoorelease : release : <optimization>none <debug-symbols>none ;
83 variant gentoodebug : debug : <optimization>none ;
84
85 using ${compiler} : ${compiler_version} : ${compiler_executable} : <cflags>"${CFLAGS}" <cxxflags>"${CXXFLAGS}" <linkflags>"${LDFLAGS}" ;
86 ${mpi_configuration}
87 ${python_configuration}
88 __EOF__
89 }
90
91 pkg_setup() {
92 if use python; then
93 python_pkg_setup
94 fi
95
96 if use debug; then
97 ewarn "The debug USE flag means that a second set of the boost libraries"
98 ewarn "will be built containing debug symbols. You'll be able to select them"
99 ewarn "using the boost-eselect module. But even though the optimization flags"
100 ewarn "you might have set are not stripped, there will be a performance"
101 ewarn "penalty and linking other packages against the debug version"
102 ewarn "of boost is _not_ recommended."
103 fi
104 }
105
106 src_prepare() {
107 epatch "${FILESDIR}/${PN}-1.48.0-mpi_python3.patch"
108 epatch "${FILESDIR}/${PN}-1.48.0-respect_python-buildid.patch"
109 epatch "${FILESDIR}/${PN}-1.48.0-support_dots_in_python-buildid.patch"
110 epatch "${FILESDIR}/${PN}-1.48.0-no_strict_aliasing_python2.patch"
111 epatch "${FILESDIR}/${PN}-1.48.0-disable_libboost_python3.patch"
112 epatch "${FILESDIR}/${PN}-1.48.0-python_linking.patch"
113 epatch "${FILESDIR}/${PN}-1.48.0-disable_icu_rpath.patch"
114 epatch "${FILESDIR}/remove-toolset-1.48.0.patch"
115 }
116
117 src_configure() {
118 OPTIONS=""
119
120 if [[ ${CHOST} == *-darwin* ]]; then
121 # We need to add the prefix, and in two cases this exceeds, so prepare
122 # for the largest possible space allocation.
123 append-ldflags -Wl,-headerpad_max_install_names
124 fi
125
126 # bug 298489
127 if use ppc || use ppc64; then
128 [[ $(gcc-version) > 4.3 ]] && append-flags -mno-altivec
129 fi
130
131 use icu && OPTIONS+=" -sICU_PATH=/usr"
132 use icu || OPTIONS+=" --disable-icu boost.locale.icu=off"
133 use mpi || OPTIONS+=" --without-mpi"
134 use python || OPTIONS+=" --without-python"
135
136 # https://svn.boost.org/trac/boost/attachment/ticket/2597/add-disable-long-double.patch
137 if use sparc || { use mips && [[ ${ABI} = "o32" ]]; } || use hppa || use arm || use x86-fbsd || use sh; then
138 OPTIONS+=" --disable-long-double"
139 fi
140
141 OPTIONS+=" pch=off --boost-build=/usr/share/boost-build-${MAJOR_PV} --prefix=\"${D}usr\" --layout=versioned"
142
143 if use static-libs; then
144 LINK_OPTS="link=shared,static"
145 LIBRARY_TARGETS="*.a *$(get_libname)"
146 else
147 LINK_OPTS="link=shared"
148 # There is no dynamically linked version of libboost_test_exec_monitor and libboost_exception.
149 LIBRARY_TARGETS="libboost_test_exec_monitor*.a libboost_exception*.a *$(get_libname)"
150 fi
151 }
152
153 src_compile() {
154 local jobs
155 jobs=$( echo " ${MAKEOPTS} " | \
156 sed -e 's/ --jobs[= ]/ -j /g' \
157 -e 's/ -j \([1-9][0-9]*\)/ -j\1/g' \
158 -e 's/ -j\>/ -j1/g' | \
159 ( while read -d ' ' j; do if [[ "${j#-j}" = "$j" ]]; then continue; fi; jobs="${j#-j}"; done; echo ${jobs} ) )
160 if [[ "${jobs}" != "" ]]; then NUMJOBS="-j"${jobs}; fi
161
162 export BOOST_ROOT="${S}"
163 PYTHON_DIRS=""
164 MPI_PYTHON_MODULE=""
165
166 building() {
167 create_user-config.jam
168
169 einfo "Using the following command to build:"
170 einfo "${BJAM} ${NUMJOBS} -q -d+2 gentoorelease --user-config=user-config.jam ${OPTIONS} threading=single,multi ${LINK_OPTS} runtime-link=shared $(use python && echo --python-buildid=${PYTHON_ABI})"
171
172 ${BJAM} ${NUMJOBS} -q -d+2 \
173 gentoorelease \
174 --user-config=user-config.jam \
175 ${OPTIONS} \
176 threading=single,multi ${LINK_OPTS} runtime-link=shared \
177 $(use python && echo --python-buildid=${PYTHON_ABI}) \
178 || die "Building of Boost libraries failed"
179
180 # ... and do the whole thing one more time to get the debug libs
181 if use debug; then
182 einfo "Using the following command to build:"
183 einfo "${BJAM} ${NUMJOBS} -q -d+2 gentoodebug --user-config=user-config.jam ${OPTIONS} threading=single,multi ${LINK_OPTS} runtime-link=shared --buildid=debug $(use python && echo --python-buildid=${PYTHON_ABI})"
184
185 ${BJAM} ${NUMJOBS} -q -d+2 \
186 gentoodebug \
187 --user-config=user-config.jam \
188 ${OPTIONS} \
189 threading=single,multi ${LINK_OPTS} runtime-link=shared \
190 --buildid=debug \
191 $(use python && echo --python-buildid=${PYTHON_ABI}) \
192 || die "Building of Boost debug libraries failed"
193 fi
194
195 if use python; then
196 if [[ -z "${PYTHON_DIRS}" ]]; then
197 PYTHON_DIRS="$(find bin.v2/libs -name python | sort)"
198 else
199 if [[ "${PYTHON_DIRS}" != "$(find bin.v2/libs -name python | sort)" ]]; then
200 die "Inconsistent structure of build directories"
201 fi
202 fi
203
204 local dir
205 for dir in ${PYTHON_DIRS}; do
206 mv ${dir} ${dir}-${PYTHON_ABI} || die "Renaming of '${dir}' to '${dir}-${PYTHON_ABI}' failed"
207 done
208
209 if use mpi; then
210 if [[ -z "${MPI_PYTHON_MODULE}" ]]; then
211 MPI_PYTHON_MODULE="$(find bin.v2/libs/mpi/build/*/gentoorelease -name mpi.so)"
212 if [[ "$(echo "${MPI_PYTHON_MODULE}" | wc -l)" -ne 1 ]]; then
213 die "Multiple mpi.so files found"
214 fi
215 else
216 if [[ "${MPI_PYTHON_MODULE}" != "$(find bin.v2/libs/mpi/build/*/gentoorelease -name mpi.so)" ]]; then
217 die "Inconsistent structure of build directories"
218 fi
219 fi
220
221 mv stage/lib/mpi.so stage/lib/mpi.so-${PYTHON_ABI} || die "Renaming of 'stage/lib/mpi.so' to 'stage/lib/mpi.so-${PYTHON_ABI}' failed"
222 fi
223 fi
224 }
225 if use python; then
226 python_execute_function building
227 else
228 building
229 fi
230
231 if use tools; then
232 pushd tools > /dev/null || die
233 einfo "Using the following command to build the tools:"
234 einfo "${BJAM} ${NUMJOBS} -q -d+2 gentoorelease --user-config=../user-config.jam ${OPTIONS}"
235
236 ${BJAM} ${NUMJOBS} -q -d+2\
237 gentoorelease \
238 --user-config=../user-config.jam \
239 ${OPTIONS} \
240 || die "Building of Boost tools failed"
241 popd > /dev/null || die
242 fi
243 }
244
245 src_install () {
246 dodir /usr/share/boost-eselect/profiles/${SLOT}
247 touch "${D}usr/share/boost-eselect/profiles/${SLOT}/default" || die
248 if use debug; then
249 touch "${D}usr/share/boost-eselect/profiles/${SLOT}/debug" || die
250 fi
251
252 if use mpi && use python; then
253 _add_line "python_modules=\""
254 fi
255
256 installation() {
257 create_user-config.jam
258
259 if use python; then
260 local dir
261 for dir in ${PYTHON_DIRS}; do
262 cp -pr ${dir}-${PYTHON_ABI} ${dir} || die "Copying of '${dir}-${PYTHON_ABI}' to '${dir}' failed"
263 done
264
265 if use mpi; then
266 cp -p stage/lib/mpi.so-${PYTHON_ABI} "${MPI_PYTHON_MODULE}" || die "Copying of 'stage/lib/mpi.so-${PYTHON_ABI}' to '${MPI_PYTHON_MODULE}' failed"
267 cp -p stage/lib/mpi.so-${PYTHON_ABI} stage/lib/mpi.so || die "Copying of 'stage/lib/mpi.so-${PYTHON_ABI}' to 'stage/lib/mpi.so' failed"
268 fi
269 fi
270
271 einfo "Using the following command to install:"
272 einfo "${BJAM} -q -d+2 gentoorelease --user-config=user-config.jam ${OPTIONS} threading=single,multi ${LINK_OPTS} runtime-link=shared --includedir=\"${D}usr/include\" --libdir=\"${D}usr/$(get_libdir)\" $(use python && echo --python-buildid=${PYTHON_ABI}) install"
273
274 ${BJAM} -q -d+2 \
275 gentoorelease \
276 --user-config=user-config.jam \
277 ${OPTIONS} \
278 threading=single,multi ${LINK_OPTS} runtime-link=shared \
279 --includedir="${D}usr/include" \
280 --libdir="${D}usr/$(get_libdir)" \
281 $(use python && echo --python-buildid=${PYTHON_ABI}) \
282 install || die "Installation of Boost libraries failed"
283
284 if use debug; then
285 einfo "Using the following command to install:"
286 einfo "${BJAM} -q -d+2 gentoodebug --user-config=user-config.jam ${OPTIONS} threading=single,multi ${LINK_OPTS} runtime-link=shared --includedir=\"${D}usr/include\" --libdir=\"${D}usr/$(get_libdir)\" --buildid=debug $(use python && echo --python-buildid=${PYTHON_ABI})"
287
288 ${BJAM} -q -d+2 \
289 gentoodebug \
290 --user-config=user-config.jam \
291 ${OPTIONS} \
292 threading=single,multi ${LINK_OPTS} runtime-link=shared \
293 --includedir="${D}usr/include" \
294 --libdir="${D}usr/$(get_libdir)" \
295 --buildid=debug \
296 $(use python && echo --python-buildid=${PYTHON_ABI}) \
297 install || die "Installation of Boost debug libraries failed"
298 fi
299
300 if use python; then
301 rm -r ${PYTHON_DIRS} || die
302
303 # Move mpi.so Python module to Python site-packages directory and make sure it is slotted.
304 if use mpi; then
305 mkdir -p "${D}$(python_get_sitedir)/boost_${MAJOR_PV}" || die
306 mv "${D}usr/$(get_libdir)/mpi.so" "${D}$(python_get_sitedir)/boost_${MAJOR_PV}" || die
307 cat << EOF > "${D}$(python_get_sitedir)/boost_${MAJOR_PV}/__init__.py" || die
308 import sys
309 if sys.platform.startswith('linux'):
310 import DLFCN
311 flags = sys.getdlopenflags()
312 sys.setdlopenflags(DLFCN.RTLD_NOW | DLFCN.RTLD_GLOBAL)
313 from . import mpi
314 sys.setdlopenflags(flags)
315 del DLFCN, flags
316 else:
317 from . import mpi
318 del sys
319 EOF
320 _add_line "$(python_get_sitedir)/mpi.py:boost_${MAJOR_PV}.mpi"
321 fi
322 fi
323 }
324 if use python; then
325 python_execute_function installation
326 else
327 installation
328 fi
329
330 if use mpi && use python; then
331 _add_line "\""
332 fi
333
334 use python || rm -rf "${D}usr/include/boost-${MAJOR_PV}/boost"/python* || die
335
336 if use doc; then
337 find libs/*/* -iname "test" -or -iname "src" | xargs rm -rf
338 dohtml \
339 -A pdf,txt,cpp,hpp \
340 *.{htm,html,png,css} \
341 -r doc
342 dohtml \
343 -A pdf,txt \
344 -r tools
345 insinto /usr/share/doc/${PF}/html
346 doins -r libs
347 doins -r more
348
349 # To avoid broken links
350 insinto /usr/share/doc/${PF}/html
351 doins LICENSE_1_0.txt
352
353 dosym /usr/include/boost-${MAJOR_PV}/boost /usr/share/doc/${PF}/html/boost
354 fi
355
356 pushd "${D}usr/$(get_libdir)" > /dev/null || die
357
358 # Remove (unversioned) symlinks
359 # And check for what we remove to catch bugs
360 # got a better idea how to do it? tell me!
361 local f
362 for f in $(ls -1 ${LIBRARY_TARGETS} | grep -v "${MAJOR_PV}"); do
363 if [[ ! -h "${f}" ]]; then
364 eerror "Tried to remove '${f}' which is a regular file instead of a symlink"
365 die "Slotting/naming of the libraries broken!"
366 fi
367 rm "${f}" || die
368 done
369
370 # The threading libs obviously always gets the "-mt" (multithreading) tag
371 # some packages seem to have a problem with it. Creating symlinks...
372
373 if use static-libs; then
374 THREAD_LIBS="libboost_thread-mt-${MAJOR_PV}.a libboost_thread-mt-${MAJOR_PV}$(get_libname)"
375 else
376 THREAD_LIBS="libboost_thread-mt-${MAJOR_PV}$(get_libname)"
377 fi
378 local lib
379 for lib in ${THREAD_LIBS}; do
380 dosym ${lib} "/usr/$(get_libdir)/$(sed -e 's/-mt//' <<< ${lib})"
381 done
382
383 # The same goes for the mpi libs
384 if use mpi; then
385 if use static-libs; then
386 MPI_LIBS="libboost_mpi-mt-${MAJOR_PV}.a libboost_mpi-mt-${MAJOR_PV}$(get_libname)"
387 else
388 MPI_LIBS="libboost_mpi-mt-${MAJOR_PV}$(get_libname)"
389 fi
390 local lib
391 for lib in ${MPI_LIBS}; do
392 dosym ${lib} "/usr/$(get_libdir)/$(sed -e 's/-mt//' <<< ${lib})"
393 done
394 fi
395
396 if use debug; then
397 if use static-libs; then
398 THREAD_DEBUG_LIBS="libboost_thread-mt-${MAJOR_PV}-debug$(get_libname) libboost_thread-mt-${MAJOR_PV}-debug.a"
399 else
400 THREAD_DEBUG_LIBS="libboost_thread-mt-${MAJOR_PV}-debug$(get_libname)"
401 fi
402
403 local lib
404 for lib in ${THREAD_DEBUG_LIBS}; do
405 dosym ${lib} "/usr/$(get_libdir)/$(sed -e 's/-mt//' <<< ${lib})"
406 done
407
408 if use mpi; then
409 if use static-libs; then
410 MPI_DEBUG_LIBS="libboost_mpi-mt-${MAJOR_PV}-debug.a libboost_mpi-mt-${MAJOR_PV}-debug$(get_libname)"
411 else
412 MPI_DEBUG_LIBS="libboost_mpi-mt-${MAJOR_PV}-debug$(get_libname)"
413 fi
414
415 local lib
416 for lib in ${MPI_DEBUG_LIBS}; do
417 dosym ${lib} "/usr/$(get_libdir)/$(sed -e 's/-mt//' <<< ${lib})"
418 done
419 fi
420 fi
421
422 # Create a subdirectory with completely unversioned symlinks
423 # and store the names in the profiles-file for eselect
424 dodir /usr/$(get_libdir)/boost-${MAJOR_PV}
425
426 _add_line "libs=\"" default
427 local f
428 for f in $(ls -1 ${LIBRARY_TARGETS} | grep -v debug); do
429 dosym ../${f} /usr/$(get_libdir)/boost-${MAJOR_PV}/${f/-${MAJOR_PV}}
430 _add_line "/usr/$(get_libdir)/${f}" default
431 done
432 _add_line "\"" default
433
434 if use debug; then
435 _add_line "libs=\"" debug
436 dodir /usr/$(get_libdir)/boost-${MAJOR_PV}-debug
437 local f
438 for f in $(ls -1 ${LIBRARY_TARGETS} | grep debug); do
439 dosym ../${f} /usr/$(get_libdir)/boost-${MAJOR_PV}-debug/${f/-${MAJOR_PV}-debug}
440 _add_line "/usr/$(get_libdir)/${f}" debug
441 done
442 _add_line "\"" debug
443
444 _add_line "includes=\"/usr/include/boost-${MAJOR_PV}/boost\"" debug
445 _add_line "suffix=\"-debug\"" debug
446 fi
447
448 _add_line "includes=\"/usr/include/boost-${MAJOR_PV}/boost\"" default
449
450 popd > /dev/null || die
451
452 if use tools; then
453 pushd dist/bin > /dev/null || die
454 # Append version postfix to binaries for slotting
455 _add_line "bins=\""
456 local b
457 for b in *; do
458 newbin "${b}" "${b}-${MAJOR_PV}"
459 _add_line "/usr/bin/${b}-${MAJOR_PV}"
460 done
461 _add_line "\""
462 popd > /dev/null || die
463
464 pushd dist > /dev/null || die
465 insinto /usr/share
466 doins -r share/boostbook
467 # Append version postfix for slotting
468 mv "${D}usr/share/boostbook" "${D}usr/share/boostbook-${MAJOR_PV}" || die
469 _add_line "dirs=\"/usr/share/boostbook-${MAJOR_PV}\""
470 popd > /dev/null || die
471 fi
472
473 pushd status > /dev/null || die
474 if [[ -f regress.log ]]; then
475 docinto status
476 dohtml *.html ../boost.png
477 dodoc regress.log
478 fi
479 popd > /dev/null || die
480
481 # boost's build system truely sucks for not having a destdir. Because for
482 # this reason we are forced to build with a prefix that includes the
483 # DESTROOT, dynamic libraries on Darwin end messed up, referencing the
484 # DESTROOT instread of the actual EPREFIX. There is no way out of here
485 # but to do it the dirty way of manually setting the right install_names.
486 if [[ ${CHOST} == *-darwin* ]]; then
487 einfo "Working around completely broken build-system(tm)"
488 local d
489 for d in "${ED}"usr/lib/*.dylib; do
490 if [[ -f ${d} ]]; then
491 # fix the "soname"
492 ebegin " correcting install_name of ${d#${ED}}"
493 install_name_tool -id "/${d#${D}}" "${d}"
494 eend $?
495 # fix references to other libs
496 refs=$(otool -XL "${d}" | \
497 sed -e '1d' -e 's/^\t//' | \
498 grep "^libboost_" | \
499 cut -f1 -d' ')
500 local r
501 for r in ${refs}; do
502 ebegin " correcting reference to ${r}"
503 install_name_tool -change \
504 "${r}" \
505 "${EPREFIX}/usr/lib/${r}" \
506 "${d}"
507 eend $?
508 done
509 fi
510 done
511 fi
512 }
513
514 # the tests will never fail because these are not intended as sanity
515 # tests at all. They are more a way for upstream to check their own code
516 # on new compilers. Since they would either be completely unreliable
517 # (failing for no good reason) or completely useless (never failing)
518 # there is no point in having them in the ebuild to begin with.
519 src_test() { :; }
520
521 pkg_postinst() {
522 if use eselect; then
523 eselect boost update || ewarn "eselect boost update failed."
524 fi
525
526 if [[ ! -h "${ROOT}etc/eselect/boost/active" ]]; then
527 elog "No active boost version found. Calling eselect to select one..."
528 eselect boost update || ewarn "eselect boost update failed."
529 fi
530 }

  ViewVC Help
Powered by ViewVC 1.1.20