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

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

inherit eutils

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

	ebegin "Applying macro replacements"
	env | sed "s/^/-D'/;s/$/'/" | xargs m4 /dev/null -F "${TMPDIR}/m4.env"
	find "${S}" -name "*.in" | while read infile ; do
		m4 -R "${TMPDIR}/m4.env" "${infile}" > "${infile%.in}"
	done
	eend $?
}

src_test() {
	bjambuild
}

bjambuild() {
	setarch $(uname -m) -RL b2 -l600 ${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[@]}

	insinto ${PKG_CONFIG_PATH}
	find "${S}" -name "*.pc" | while read infile ; do
		doins ${infile}
	done
}

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
}