summaryrefslogtreecommitdiff
blob: 336849e11a36dfa7a1c19368868e9bda4f15722c (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
93
94
95
96
97
98
99
100
101
# Copyright 1999-2018 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=6

inherit flag-o-matic git-r3 meson

DESCRIPTION="The PrydeWorX library of C++ workers, tools and utilities"
HOMEPAGE="https://pwxlib.prydeworx.com"
EGIT_REPO_URI="https://github.com/Yamakuzure/pwxlib.git"
EGIT_BRANCH="master"
EGIT_SUBMODULES=()

LICENSE="MIT"
SLOT="0"
KEYWORDS=""
IUSE="annotations asan debug debug-thread doc lsan profile +spinlocks test
torture tsan +yielding"

REQUIRED_USE="
	?? ( annotations debug-thread )
	?? ( asan lsan tsan )
	annotations? ( !spinlocks !yielding )
	asan? ( debug )
	lsan? ( debug )
	profile? ( !debug !debug-thread )
	tsan? ( debug )
	yielding? ( spinlocks )
"
COMMON_DEPEND="
	debug-thread? ( dev-util/valgrind )
"
DEPEND="${COMMON_DEPEND}
	doc? ( app-doc/doxygen )
	>=sys-devel/gcc-8.2.0
	virtual/pkgconfig
"
RDEPEND="${COMMON_DEPEND}"

src_configure() {
	local b_san

	# Duplicating C[XX]FLAGS in LDFLAGS is deprecated and will become
	# a hard error in future meson versions:
	filter-ldflags $CFLAGS $CXXFLAGS

	# See what kind of sanitization is wanted
	if use asan; then
		export ASAN_OPTIONS=detect_leaks=0
		b_san="-Db_sanitize=address"
	elif use lsan; then
		export ASAN_OPTIONS=detect_leaks=1
		b_san="-Db_sanitize=address"
	elif use tsan; then
		b_san="-Db_sanitize=thread"
	fi

	local emesonargs=(
		-Ddocdir="${EPREFIX}/usr/share/doc/${PF}"
		--buildtype $(usex debug debug release)
		--libdir="${EPREFIX}"/usr/$(get_libdir)
		-Dannotations=$(usex annotations true false)
		-Ddebug-extra=$(usex debug true false)
		-Ddebug-thread=$(usex debug-thread true false)
		-Dhtml=$(usex doc true false)
		-Dinstall-tests=$(usex test true false)
		-Dprofile=$(usex profile true false)
		-Dspinlocks=$(usex spinlocks true false)
		-Dtests=$(usex test true false)
		-Dtorture=$(usex torture true false)
		-Dyielding=$(usex yielding true false)
		$b_san
	)

	meson_src_configure
}

src_install() {
	DOCS=(
		AUTHORS
		ChangeLog
		code_of_conduct.md
		CONTRIBUTING.md
		INSTALL.md
		LICENSE
		NEWS.md
		README.md
		TODO.md
	)

	meson_src_install
}

pkg_postinst() {
	if use debug-thread; then
		ewarn "You have enabled USE=\"debug-thread\""
		ewarn "This flag enables an excessive amount of debug"
		ewarn "messages, which are only useful if you work on"
		ewarn "the multi-threading code of pwxlib itself."
	fi
}