Files
guru/media-libs/dr_mp3/dr_mp3-0.6.40.ebuild
2025-01-02 13:05:45 +01:00

62 lines
1.2 KiB
Bash

# Copyright 2023-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit eapi9-pipestatus edo toolchain-funcs
COMMIT="37a5ffb671a4465cfefc7ba8ce7e8ae298612e5a"
DESCRIPTION="Single-header MP3 audio decoder library"
HOMEPAGE="https://github.com/mackron/dr_libs/"
SRC_URI="https://github.com/mackron/dr_libs/archive/${COMMIT}.tar.gz -> ${P}.gh.tar.gz"
S="${WORKDIR}/dr_libs-${COMMIT}"
LICENSE="|| ( MIT-0 public-domain )"
SLOT="0"
KEYWORDS="~amd64"
IUSE="test"
RESTRICT="!test? ( test )"
# Unfortunately, the only other test is interactive.
TESTCASES=(
dr_mp3_test_0.c
)
src_prepare() {
awk '/Introduction/,/\*\//' dr_mp3.h | sed '$d' > README
pipestatus || die
awk '/REVISION HISTORY/,/\*\//' dr_mp3.h | sed '$d' > CHANGELOG
pipestatus || die
default
}
src_compile() {
if use test; then
local MY_{CC,BUILD}
MY_CC=$(tc-getCC)
pushd tests > /dev/null || die
for tcase in ${TESTCASES[@]}; do
MY_BUILD="${MY_CC} mp3/${tcase} -o bin/${tcase} ${CFLAGS} ${CPPFLAGS}"
edo ${MY_BUILD}
done
popd || die
fi
}
src_test() {
pushd tests > /dev/null || die
for tcase in ${TESTCASES[@]}; do
edo bin/${tcase}
done
popd || die
}
src_install() {
einstalldocs
doheader dr_mp3.h
}