aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucio Sauer <watermanpaint@posteo.net>2023-09-04 00:20:49 +0200
committerLucio Sauer <watermanpaint@posteo.net>2023-09-04 00:24:30 +0200
commit53d81f1fa7fbd2e44e438dcc8ea6eb6bb791ba0b (patch)
treedf0405a557c2b4d8418715b7d4464de0f639fa6e /media-libs
parentapp-misc/chayang: new package, add 0.1.0 (diff)
downloadguru-53d81f1fa7fbd2e44e438dcc8ea6eb6bb791ba0b.tar.gz
guru-53d81f1fa7fbd2e44e438dcc8ea6eb6bb791ba0b.tar.bz2
guru-53d81f1fa7fbd2e44e438dcc8ea6eb6bb791ba0b.zip
media-libs/dr_wav: standardise dr_* lib ebuilds
- Respect user LDFLAGS variable where applicable. - Pre-compile tests in src_compile and run them in src_test. - Extract documentation from header and provide it in dedicated files in FILESDIR Signed-off-by: Lucio Sauer <watermanpaint@posteo.net>
Diffstat (limited to 'media-libs')
-rw-r--r--media-libs/dr_wav/Manifest3
-rw-r--r--media-libs/dr_wav/dr_wav-0.13.32.ebuild107
-rw-r--r--media-libs/dr_wav/files/dr_wav-0.13.32-docs.tar.xzbin0 -> 5644 bytes
3 files changed, 67 insertions, 43 deletions
diff --git a/media-libs/dr_wav/Manifest b/media-libs/dr_wav/Manifest
index 4f2756b16..b4652ddbc 100644
--- a/media-libs/dr_wav/Manifest
+++ b/media-libs/dr_wav/Manifest
@@ -1,3 +1,2 @@
-DIST dr_wav-0.13.32-README.md 1243 BLAKE2B 5b22e00252f4307b5407b2b7cdbc237fa60975f86b9151f5a8eeea8faa1e81d1eec15a22a1952d1440a1f0b76b1e59782a30eb38473cab978a47fcfa391c8a9a SHA512 661529e69639367920276c5f6ff425fdd176ac8a7475212a1c1e1e2ccdbdf076f1a26eae1a1913f98da0d9e1c6ca04a48e0de69f3c681b1a7574674d7015bbb6
-DIST dr_wav-0.13.32.gh.h 351384 BLAKE2B 2bcbeab7e7aa6a7519bea978742494205625a60b8c0a464305c6f6fb7eec33be54640fdb2578437c4143e50e5ad2d18730351ecdd824d25ab6e0f8af3b8d018c SHA512 a4a681546716b1a1a9e55321796828828b1872bf223c7c02529a1553b8beafe2a89ffe72a38e5aa3bf457a8ce4dd2dcf9cba7a9cde28e59586a8388f1439a8a1
DIST dr_wav-0.13.32.gh.tar.gz 518394 BLAKE2B 49447a2b845f95e9896fb45ac2cd9de8f59d45d3271e30e26c0e519355c3578b96f2c2978677d2774c1bfa4656a8213eafda00207cdd89f72d6823cf0f1b77cf SHA512 34126c8eb65f0735b77f058db9f1618b3c4e820698804b47f7a629c47df571e9cbbeefd4cce193409ebd715d37ed5faf1c3c27a7240e0f5418089cffe853f1ea
+DIST dr_wav-0.13.32.h 351384 BLAKE2B 2bcbeab7e7aa6a7519bea978742494205625a60b8c0a464305c6f6fb7eec33be54640fdb2578437c4143e50e5ad2d18730351ecdd824d25ab6e0f8af3b8d018c SHA512 a4a681546716b1a1a9e55321796828828b1872bf223c7c02529a1553b8beafe2a89ffe72a38e5aa3bf457a8ce4dd2dcf9cba7a9cde28e59586a8388f1439a8a1
diff --git a/media-libs/dr_wav/dr_wav-0.13.32.ebuild b/media-libs/dr_wav/dr_wav-0.13.32.ebuild
index b9ed2c4ca..a28e010ba 100644
--- a/media-libs/dr_wav/dr_wav-0.13.32.ebuild
+++ b/media-libs/dr_wav/dr_wav-0.13.32.ebuild
@@ -5,12 +5,11 @@ EAPI=8
inherit toolchain-funcs
-DESCRIPTION="WAV audio loader and writer"
+DESCRIPTION="Single-header WAV audio loader and writer library"
HOMEPAGE="https://github.com/mackron/dr_libs/"
COMMIT="d35a3bc5efd02455d98cbe12b94647136f09b42d"
-SRC_URI="https://raw.githubusercontent.com/mackron/dr_libs/${COMMIT}/dr_wav.h -> ${P}.gh.h
- https://raw.githubusercontent.com/mackron/dr_libs/${COMMIT}/README.md -> ${P}-README.md
- test? ( https://github.com/mackron/dr_libs/archive/${COMMIT}.tar.gz -> ${P}.gh.tar.gz )"
+SRC_URI="!test? ( https://raw.githubusercontent.com/mackron/dr_libs/${COMMIT}/dr_wav.h -> ${P}.h )
+ test? ( https://github.com/mackron/dr_libs/archive/${COMMIT}.tar.gz -> ${P}.gh.tar.gz )"
LICENSE="|| ( MIT-0 public-domain )"
SLOT="0"
@@ -21,72 +20,98 @@ RESTRICT="!test? ( test )"
BDEPEND="test? ( media-libs/libsndfile )"
-S="${DISTDIR}"
+TESTCASES=(
+ dr_wav_encoding.c
+ dr_wav_{decoding,test_0}.{c,cpp}
+)
+
+S="${WORKDIR}/dr_libs-${COMMIT}"
+
+src_unpack() {
+ default
+ unpack "${FILESDIR}"/${P}-docs.tar.xz
+}
src_prepare() {
if use test; then
- pushd "${WORKDIR}/dr_libs-${COMMIT}" > /dev/null || die
# Remove some unused parts of the source tree that could contribute different
# (but acceptable) license terms if they were used—just to prove that we do not
# use them.
- rm -rv old
+ rm -rv old || die
# Unbundle library with incorrect include path.
sed -i 's,"../../../miniaudio/miniaudio.h",<miniaudio/miniaudio.h>,' \
tests/wav/dr_wav_playback.c || die
- # Profiling tests aren't implemented.
+ # Disable profiling tests as they are not relevant downstream.
sed -i 's/doProfiling = DRWAV_TRUE/doProfiling = DRWAV_FALSE/' \
tests/wav/dr_wav_decoding.c || die
- popd || die
+ # Test cases dr_wav_{en,de}coding.{c,cpp} write and read a file from a
+ # missing directory.
+ mkdir tests/testvectors/wav/tests || die
fi
default
}
+src_compile() {
+ if use test; then
+ local MY_{C,CC,CXX,BUILD,FLAGS}
+ MY_CC=$(tc-getCC)
+ MY_CXX=$(tc-getCXX)
+
+ pushd tests > /dev/null || die
+ for tcase in ${TESTCASES[@]}; do
+ einfo "Compiling test case ${tcase}."
+ case ${tcase} in
+ *.cpp)
+ MY_C=${MY_CXX}
+ MY_FLAGS=${CXXFLAGS}
+ ;;
+ *.c)
+ MY_C=${MY_CC}
+ MY_FLAGS=${CFLAGS}
+ ;;
+ *)
+ die "Unknown test case ${tcase}"
+ ;;
+ esac
+ MY_BUILD="${MY_C} wav/${tcase} -o bin/${tcase} ${MY_FLAGS} ${CPPFLAGS}"
+ case ${tcase%.*} in
+ dr_wav_encoding)
+ MY_BUILD="${MY_BUILD} -lm ${LDFLAGS}"
+ ;;
+ *)
+ ;;
+ esac
+ ${MY_BUILD} || die "Build failed: ${MY_BUILD}"
+ done
+ popd || die
+ fi
+}
+
src_test() {
- local MY_{C,CC,CXX,BUILD,FLAGS,RUN} TESTCASES
- TESTCASES=(
- dr_wav_encoding.c
- dr_wav_{decoding,test_0}.{c,cpp}
- )
- MY_CC=$(tc-getCC)
- MY_CXX=$(tc-getCXX)
-
- pushd "${WORKDIR}/dr_libs-${COMMIT}/tests" > /dev/null || die
+ local MY_RUN
+
+ pushd tests || die
for tcase in ${TESTCASES[@]}; do
- einfo "Compiling and running test case ${tcase}."
- case ${tcase} in
- *.cpp)
- MY_C=${MY_CXX}
- MY_FLAGS=${CXXFLAGS}
- ;;
- *.c)
- MY_C=${MY_CC}
- MY_FLAGS=${CFLAGS}
- ;;
- *)
- die "Unknown test case ${tcase}"
- ;;
- esac
- MY_BUILD="${MY_C} wav/${tcase} -o bin/${tcase} ${MY_FLAGS} ${CPPFLAGS}"
+ einfo "Running test case ${tcase}."
MY_RUN="./bin/${tcase}"
case ${tcase%.*} in
dr_wav_encoding)
- MY_BUILD="${MY_BUILD} -lm"
MY_RUN="${MY_RUN} testvectors/wav/tests/test_encode_gentoo"
- mkdir testvectors/wav/tests || die
;;
*)
;;
esac
- echo "${MY_BUILD}" || die
- ${MY_BUILD} || die "Build failed: ${MY_BUILD}"
- echo "${MY_RUN}" || die
- ${MY_RUN} || die "Test case ${MY_RUN} failed."
+ ${MY_RUN} || die "Test case ${tcase} failed."
done
popd || die
}
src_install() {
- newheader ${P}.gh.h ${PN}.h
- newdoc ${P}-README.md README.md
+ einstalldocs
+ if use test; then
+ doheader dr_wav.h
+ else
+ newheader "${DISTDIR}"/${P}.h dr_wav.h
+ fi
}
diff --git a/media-libs/dr_wav/files/dr_wav-0.13.32-docs.tar.xz b/media-libs/dr_wav/files/dr_wav-0.13.32-docs.tar.xz
new file mode 100644
index 000000000..ad8f39c66
--- /dev/null
+++ b/media-libs/dr_wav/files/dr_wav-0.13.32-docs.tar.xz
Binary files differ