summaryrefslogtreecommitdiff
path: root/eclass/bjam.eclass
blob: c9d384e13a9f0d966b74a601f508a561218418d3 (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
# Distributed under the terms of the GNU General Public License v2

# @ECLASS: bjam.eclass
# @MAINTAINER:
# randomdan
# @AUTHOR:
# randomdan
# @BLURB: 
# @DESCRIPTION:

inherit eutils

src_prepare() {
	ebegin "Setting portage CXX and LD flags"
	sed -i "s|^using gcc .*|using gcc : : : <compileflags>\"${CXXFLAGS}\" <linkflags>\"${LDFLAGS}\" ;|" ${S}/Jamroot.jam
	eend $?
}

src_test() {
	bjambuild
}

bjambuild() {
	setarch $(uname -m) -RL b2 ${BJAMOPTS} variant=release -q $@ || die
}

bjaminstall() {
	local -a other
	local include
	include=${PN}
	while [[ $# -gt 0 ]] ; do
		case "$1" in
			-i|--include)
				include=$2
				shift
				;;
			*)
				other+=( $1 )
				;;
		esac
		shift
	done

	bjambuild \
		--prefix="${D}/usr" \
		--libdir="${D}/usr/$(get_libdir)" \
		--includedir="${D}/usr/include/$include" \
		${other[@]}
}

doxygenbuild() {
	mkdir -p ${D}/usr/share/man
	find ${S} -name Doxyfile -printf '%h %p\n' | while read d p ; do
		ebegin "Building documentation in $d"
		sed -i 's/^\(GENERATE_\w*\).*/\1 = NO/' "$p"
		echo OUTPUT_DIRECTORY = ${D}/usr/share >> "$p"
		echo PROJECT_NUMBER = ${PV} >> "$p"
		echo GENERATE_MAN = YES >> "$p"
		( cd "$d" && doxygen )
		eend 0
	done
}