summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dev-cpp/pwxlib/metadata.xml3
-rw-r--r--dev-cpp/pwxlib/pwxlib-9999.ebuild101
2 files changed, 104 insertions, 0 deletions
diff --git a/dev-cpp/pwxlib/metadata.xml b/dev-cpp/pwxlib/metadata.xml
index 0b39e77..ebc381e 100644
--- a/dev-cpp/pwxlib/metadata.xml
+++ b/dev-cpp/pwxlib/metadata.xml
@@ -6,6 +6,7 @@
<name>Sven Eden</name>
</maintainer>
<use>
+ <flag name="asan">Enable address sanitizer</flag>
<flag name="annotations">
Annotate inter thread synchronization for debugging with
valgrind.
@@ -13,6 +14,7 @@
<flag name="debug-thread">
Produce massive debugging output. Do not enable lightly!
</flag>
+ <flag name="lsan">Enable leak sanitizer</flag>
<flag name="spinlocks">
Use spinlocks instead of mutexes. Improves performance.
</flag>
@@ -20,6 +22,7 @@
<flag name="torture">
Build and install torture, the multi-threaded container
burner.</flag>
+ <flag name="tsan">Enable thread sanitizer</flag>
<flag name="yielding">
Let spinlocks yield when they can not lock. Improves
performance.
diff --git a/dev-cpp/pwxlib/pwxlib-9999.ebuild b/dev-cpp/pwxlib/pwxlib-9999.ebuild
new file mode 100644
index 0000000..336849e
--- /dev/null
+++ b/dev-cpp/pwxlib/pwxlib-9999.ebuild
@@ -0,0 +1,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
+}