dev-libs/criterion: improve ebuild
authorTomáš Mózes <hydrapolic@gmail.com>
Sun, 5 Jan 2020 03:38:45 +0000 (03:38 +0000)
committerJoonas Niilola <juippis@gentoo.org>
Sun, 5 Jan 2020 20:18:29 +0000 (22:18 +0200)
Signed-off-by: Tomáš Mózes <hydrapolic@gmail.com>
Closes: https://bugs.gentoo.org/703530
Closes: https://github.com/gentoo/gentoo/pull/14093
Signed-off-by: Joonas Niilola <juippis@gentoo.org>
dev-libs/criterion/criterion-2.3.3.ebuild
dev-libs/criterion/files/criterion-libdir.patch [new file with mode: 0644]

index e0b34016c621568ceed70636fd152db31f1b723d..1f2eda350a62d591de71d73b7a2939fbc0999c72 100644 (file)
@@ -1,10 +1,12 @@
-# Copyright 2019 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
 
+PYTHON_COMPAT=( python3_{6,7} )
+
 CMAKE_MAKEFILE_GENERATOR="emake"
-inherit cmake
+inherit cmake python-any-r1
 
 DESCRIPTION="Cross platform unit testing framework for C and C++"
 HOMEPAGE="https://github.com/Snaipe/Criterion"
@@ -18,13 +20,24 @@ RESTRICT="!test? ( test )"
 
 RDEPEND="dev-libs/nanomsg:="
 DEPEND="${RDEPEND}
-       test? ( dev-util/cram )"
+       test? (
+               $(python_gen_any_dep 'dev-util/cram[${PYTHON_USEDEP}]')
+       )"
 BDEPEND="virtual/pkgconfig"
 
+PATCHES="${FILESDIR}/${PN}-libdir.patch"
 S="${WORKDIR}/${PN}-v${PV}"
 
 QA_EXECSTACK="usr/lib*/libcriterion.so*"
 
+python_check_deps() {
+       has_version "dev-util/cram[${PYTHON_USEDEP}]"
+}
+
+pkg_setup() {
+       use test && python-any-r1_pkg_setup
+}
+
 src_configure() {
        local mycmakeargs=(
                -DCTESTS="$(usex test ON OFF)"
@@ -40,15 +53,3 @@ src_compile() {
                cmake_build criterion_tests
        fi
 }
-
-src_install() {
-       cmake_src_install
-
-       if [[ "/usr/lib" != "/usr/$(get_libdir)" ]]; then
-               mkdir -p "${D}/usr/$(get_libdir)" || die
-               mv "${D}"/usr/lib/libcriterion.so* "${D}/usr/$(get_libdir)/" || die
-       fi
-
-       sed -i "s@${prefix}/lib@${prefix}/$(get_libdir)@g" \
-               "${D}/usr/share/pkgconfig/criterion.pc" || die
-}
diff --git a/dev-libs/criterion/files/criterion-libdir.patch b/dev-libs/criterion/files/criterion-libdir.patch
new file mode 100644 (file)
index 0000000..91b28b0
--- /dev/null
@@ -0,0 +1,30 @@
+diff --git a/.cmake/Modules/PackageUtils.cmake b/.cmake/Modules/PackageUtils.cmake
+index 593f2d1..a771fd5 100644
+--- a/.cmake/Modules/PackageUtils.cmake
++++ b/.cmake/Modules/PackageUtils.cmake
+@@ -50,9 +50,9 @@ function (cr_add_library _LIB)
+   endforeach ()
+   install(TARGETS ${_LIB}
+-    RUNTIME DESTINATION bin
+-    LIBRARY DESTINATION lib
+-    ARCHIVE DESTINATION lib ${install_flags}
++    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
++    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
++    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ${install_flags}
+   )
+ endfunction ()
+diff --git a/src/criterion.pc.in b/src/criterion.pc.in
+index 18ac3d6..23737a4 100644
+--- a/src/criterion.pc.in
++++ b/src/criterion.pc.in
+@@ -1,7 +1,7 @@
+ prefix=@CMAKE_INSTALL_PREFIX@
+ exec_prefix=${prefix}
+ includedir=${prefix}/include
+-libdir=${prefix}/lib
++libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
+ Name: @PROJECT_NAME@
+ Description: A KISS, Cross platform unit testing framework for C and C++