commit: b498f79b3ec1b5f436a2308a256425363fb99076
parent 92482facf642da7ba35a1966766a048825f829b9
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Tue, 7 Sep 2021 12:30:42 +0200
media-libs/portsmf: New Package
Signed-off-by: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Diffstat:
3 files changed, 110 insertions(+), 0 deletions(-)
diff --git a/media-libs/portsmf/Manifest b/media-libs/portsmf/Manifest
@@ -0,0 +1 @@
+DIST portsmf-239.tar.gz 82769 BLAKE2B 7596c3c66c15a5daa51c4962f785375568c35093a293bba48ec2742c6409c72ba3ff2f10c2b0a38969a0c14510ef06b94c6ed52429d5c55f05635637b5acbb37 SHA512 5908ef79043b44f90da8286d639a0693334f160454d206f4a212fe958a7a2e19cbc18e4240e191c1678690f34976c5e0d34dcb030d7bab007ee528fbb5e19486
diff --git a/media-libs/portsmf/files/portsmf-239-ctest.patch b/media-libs/portsmf/files/portsmf-239-ctest.patch
@@ -0,0 +1,82 @@
+From 7f24dac7f55e47667e78b6c5681b44ff2f0d5bff Mon Sep 17 00:00:00 2001
+From: "Haelwenn (lanodan) Monnier" <contact@hacktivis.me>
+Date: Thu, 26 Aug 2021 04:24:03 +0200
+Subject: [PATCH 1/2] CMake: hook up tests to CTest
+
+- test/test.cpp: remove prompt for Enter
+- "test" is a reserved name so smftest is used instead
+- Remove option for "BUILD_TESTING", CTest provides it, enabled by default
+
+Signed-off-by: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
+---
+ CMakeLists.txt | 2 +-
+ test/CMakeLists.txt | 5 +++--
+ test/test.cpp | 2 --
+ 3 files changed, 4 insertions(+), 5 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index defe5f6..9d306f2 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -92,7 +92,7 @@ if(BUILD_APPS)
+ add_subdirectory(apps)
+ endif()
+
+-option(BUILD_TESTING "Include test projects" OFF)
++include(CTest)
+ if(BUILD_TESTING)
+ add_subdirectory(test)
+ endif()
+diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
+index 36f3104..cf989e5 100644
+--- a/test/CMakeLists.txt
++++ b/test/CMakeLists.txt
+@@ -1,2 +1,3 @@
+-add_executable(test test.cpp)
+-target_link_libraries(test PortSMF)
++add_executable(smftest test.cpp)
++target_link_libraries(smftest PortSMF)
++add_test(NAME smftest COMMAND smftest)
+diff --git a/test/test.cpp b/test/test.cpp
+index 3746d72..7553bb5 100644
+--- a/test/test.cpp
++++ b/test/test.cpp
+@@ -831,6 +831,4 @@ int main()
+ //test32();
+ printf("*** Test 33 ... DISABLED\n");
+ //test33();
+- printf("press enter to exit\n");
+- getchar();
+ }
+
+From fa2459efa55bb4afc67457b1c3696fa1fb50bd50 Mon Sep 17 00:00:00 2001
+From: "Haelwenn (lanodan) Monnier" <contact@hacktivis.me>
+Date: Thu, 26 Aug 2021 04:39:28 +0200
+Subject: [PATCH 2/2] Github Workflows: Add CTest
+
+ctest(1) needs to be run into the build directory and doesn't accepts --config
+
+Windows is disabled because Github Workflows seems to be incomplete for CTest,
+as seen by the following log line with apparently means a missing DLL:
+
+ 1/1 Test #1: smftest ..........................Exit code 0xc0000135
+
+Signed-off-by: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
+---
+ .github/workflows/build.yml | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
+index 3c5fac5..ddbc397 100644
+--- a/.github/workflows/build.yml
++++ b/.github/workflows/build.yml
+@@ -34,6 +34,9 @@ jobs:
+ run: cmake --build build ${{ matrix.cmake_config }}
+ env:
+ CMAKE_BUILD_PARALLEL_LEVEL: 2
++ - name: Test
++ if: ${{ runner.os != 'Windows' }}
++ run: cd build && ctest --build-config RelWithDebInfo --output-on-failure && cd ..
+ - name: Install
+ run: cmake --install . ${{ matrix.cmake_config }}
+ working-directory: build
diff --git a/media-libs/portsmf/portsmf-239.ebuild b/media-libs/portsmf/portsmf-239.ebuild
@@ -0,0 +1,27 @@
+# Copyright 2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit cmake
+
+DESCRIPTION="Portable library for reading/writing Standard MIDI Files"
+HOMEPAGE="https://github.com/tenacityteam/portsmf"
+SRC_URI="https://github.com/tenacityteam/portsmf/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz"
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64"
+
+IUSE="examples test"
+RESTRICT="!test? ( test )"
+
+PATCHES=( "${FILESDIR}/${P}-ctest.patch" )
+
+src_configure() {
+ local mycmakeargs=(
+ -DBUILD_APPS=$(usex examples)
+ -DBUILD_TESTING=$(usex test)
+ )
+
+ cmake_src_configure
+}