aboutsummaryrefslogtreecommitdiff
blob: 9b7c1b56f22112a37540e1c4daa603049ae32185 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Copyright 2019-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

# distcc is known to fail compiling boost and will fallback
# to local processing; Even when using distcc pump mode.
DISABLE_DISTCC=yes

create_user-config.jam() {
	local user_config_jam="${S}"/user-config.jam
	if [[ -s ${user_config_jam} ]]; then
		return
	fi

	local compiler compiler_version compiler_executable="$(tc-getCXX)"
	compiler="gcc"
	compiler_version="$(gcc-version)"

	cat > "${user_config_jam}" <<- __EOF__ || die
		using ${compiler} : ${compiler_version} : ${compiler_executable} : <cflags>"${CFLAGS}" <cxxflags>"${CXXFLAGS}" <linkflags>"${LDFLAGS}" ;
	__EOF__

	# Boost.Build does not allow for disabling of numpy
	# extensions, thereby leading to automagic numpy
	# https://github.com/boostorg/python/issues/111#issuecomment-280447482
	sed \
		-e 's/\[ unless \[ python\.numpy \] : <build>no \]/<build>no/g' \
		-i "${S}"/libs/python/build/Jamfile \
		|| die
}

ejam() {
	create_user-config.jam

	local myargs=(
		b2
		"--user-config=${S}/user-config.jam"
		--without-python
		"$@"
	)

	gkexec "${myargs[*]}"
}

src_configure() {
	# Workaround for too many parallel processes requested, bug #506064
	[[ "$(makeopts_jobs)" -gt 64 ]] && MAKEOPTS="${MAKEOPTS} -j64"

	OPTIONS=(
		gentoorelease
		"-j$(makeopts_jobs)"
		-q
		-d+2
		pch=off
		--disable-icu boost.locale.icu=off
		--without-mpi
		--without-locale
		--without-context --without-coroutine --without-fiber
		--without-stacktrace
		--boost-build="${BROOT}"/usr/share/boost-build
		--prefix="/usr"
		--layout=system
		--no-cmake-config
		threading=multi
		link=shared,static
		# this seems to be the only way to disable compression algorithms
		# https://www.boost.org/doc/libs/1_70_0/libs/iostreams/doc/installation.html#boost-build
		-sNO_BZIP2=1
		-sNO_LZMA=1
		-sNO_ZLIB=1
		-sNO_ZSTD=1
	)

	# bug 298489
	if [[ "${CHOST}" == powerpc* ]]; then
		[[ $(gcc-version) > 4.3 ]] && append-flags -mno-altivec
	fi

	# Use C++14 globally as of 1.62
	append-cxxflags -std=c++14
}

src_compile() {
	ejam "${OPTIONS[@]}" || die "Compilation of Boot libraries failed!"
}

src_install() {
	ejam \
		"${OPTIONS[@]}" \
		--includedir="${D}/usr/include" \
		--libdir="${D}/usr/lib" \
		install || die "Installation of Boost libraries failed!"
}