diff options
author | Sam James <sam@gentoo.org> | 2024-03-29 09:32:21 +0000 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2024-04-03 06:10:36 +0100 |
commit | a56f53313c576244d9c4dab4577c5b554d828298 (patch) | |
tree | 9fd3970ac223cf9196f3b54b0594d6760077fbc0 /media-libs/lastfmlib | |
parent | dev-vcs/vcsh: add 2.0.8 (diff) | |
download | gentoo-a56f53313c576244d9c4dab4577c5b554d828298.tar.gz gentoo-a56f53313c576244d9c4dab4577c5b554d828298.tar.bz2 gentoo-a56f53313c576244d9c4dab4577c5b554d828298.zip |
media-libs/lastfmlib: update EAPI 7 -> 8, wire up & fix tests
That said, we should really last-rite this anyway, per bug #928115, it's
just that I started working on this before I noticed that bug...
Bug: https://bugs.gentoo.org/928115
Closes: https://bugs.gentoo.org/889298
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'media-libs/lastfmlib')
3 files changed, 105 insertions, 0 deletions
diff --git a/media-libs/lastfmlib/files/lastfmlib-0.4.0-autotools-tests.patch b/media-libs/lastfmlib/files/lastfmlib-0.4.0-autotools-tests.patch new file mode 100644 index 000000000000..506d5a37693b --- /dev/null +++ b/media-libs/lastfmlib/files/lastfmlib-0.4.0-autotools-tests.patch @@ -0,0 +1,31 @@ +* Run the tests as part of 'make check' (not just building testrunner). +* Use pkg-config to find gtest, not the now-removed gtest-config. +--- a/Makefile.am ++++ b/Makefile.am +@@ -59,6 +59,7 @@ pkgconfig_DATA = liblastfmlib.pc + + if ENABLE_UNITTEST + check_PROGRAMS = testrunner ++TESTS = $(check_PROGRAMS) + endif + + testrunner_SOURCES = lastfmlib/unittest/testrunner.cpp \ +--- a/configure.ac ++++ b/configure.ac +@@ -51,13 +51,10 @@ AC_ARG_ENABLE(unittests, + [ --enable-unittests Enables build of unittests ], + ENABLE_UNITTEST=$enableval) + +-if test "$ENABLE_UNITTEST" = "yes"; then +- AC_CHECK_HEADERS( +- [gtest/gtest.h],, +- [AC_MSG_ERROR([Missing gtest library, install the google unittest framework])]) +- UNITTEST_LIBS="$(gtest-config --libs)" ++AS_IF([test "$ENABLE_UNITTEST" = "yes"], [ ++ PKG_CHECK_MODULES([UNITTEST], [gtest], [], [AC_MSG_ERROR([Missing gtest library, install the google unittest framework])]) + AC_SUBST(UNITTEST_LIBS) +-fi ++]) + AM_CONDITIONAL(ENABLE_UNITTEST, test "$enable_unittests" = "yes") + + AC_SUBST([pkgconfigdir]) diff --git a/media-libs/lastfmlib/files/lastfmlib-0.4.0-out-of-bounds-trim.patch b/media-libs/lastfmlib/files/lastfmlib-0.4.0-out-of-bounds-trim.patch new file mode 100644 index 000000000000..6c01a59269d4 --- /dev/null +++ b/media-libs/lastfmlib/files/lastfmlib-0.4.0-out-of-bounds-trim.patch @@ -0,0 +1,24 @@ +Fix out of bounds assertion with -D_GLIBCXX_ASSERTIONS on empty string in testsuite. +--- a/lastfmlib/utils/stringoperations.cpp ++++ b/lastfmlib/utils/stringoperations.cpp +@@ -40,7 +40,7 @@ void trim(std::string& aString) + { + size_t begin = 0; + size_t end = aString.size() - 1; +- ++ + while ( aString[begin] == ' ' || aString[begin] == '\t' + || aString[begin] == '\r' || aString[begin] == '\n') + { +@@ -50,8 +50,10 @@ void trim(std::string& aString) + break; + } + +- if (begin == aString.size()) ++ if (begin == aString.size()) { + aString = ""; ++ return; ++ } + + while ( aString[end] == ' ' || aString[end] == '\t' + || aString[end] == '\r' || aString[end] == '\n') diff --git a/media-libs/lastfmlib/lastfmlib-0.4.0-r2.ebuild b/media-libs/lastfmlib/lastfmlib-0.4.0-r2.ebuild new file mode 100644 index 000000000000..590503f295ec --- /dev/null +++ b/media-libs/lastfmlib/lastfmlib-0.4.0-r2.ebuild @@ -0,0 +1,50 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit autotools + +DESCRIPTION="C++ library to scrobble tracks on Last.fm" +HOMEPAGE="https://github.com/dirkvdb/lastfmlib/releases" +SRC_URI="https://github.com/dirkvdb/lastfmlib/archive/${P}.tar.gz" + +LICENSE="GPL-2+" +SLOT="0" +KEYWORDS="~amd64 ~ppc ~x86" +IUSE="debug syslog test" +RESTRICT="!test? ( test )" + +RDEPEND="net-misc/curl" +DEPEND=" + ${RDEPEND} + test? ( dev-cpp/gtest ) +" +BDEPEND="virtual/pkgconfig" + +PATCHES=( + "${FILESDIR}/${P}-string-conv.patch" + "${FILESDIR}/${PN}-0.4.0-autotools-tests.patch" + "${FILESDIR}/${PN}-0.4.0-out-of-bounds-trim.patch" +) + +src_prepare() { + default + eautoreconf +} + +src_configure() { + CONFIG_SHELL="${BROOT}"/bin/bash econf \ + $(use_enable debug) \ + $(use_enable syslog logging) \ + $(use_enable test unittests) +} + +src_test() { + emake check VERBOSE=1 +} + +src_install() { + default + find "${D}"/usr -name '*.la' -delete || die "Pruning failed" +} |