mirror of
https://git.freebsd.org/ports.git
synced 2025-04-28 01:26:39 -04:00
audio/py-samplerate: New port: Python wrapper for libsamplerate based on pybind11 and NumPy
This commit is contained in:
parent
b78025a96e
commit
af42bbacc2
5 changed files with 72 additions and 0 deletions
|
@ -659,6 +659,7 @@
|
||||||
SUBDIR += py-python-mpd2
|
SUBDIR += py-python-mpd2
|
||||||
SUBDIR += py-pyttsx3
|
SUBDIR += py-pyttsx3
|
||||||
SUBDIR += py-resampy
|
SUBDIR += py-resampy
|
||||||
|
SUBDIR += py-samplerate
|
||||||
SUBDIR += py-simpleaudio
|
SUBDIR += py-simpleaudio
|
||||||
SUBDIR += py-soundcloud
|
SUBDIR += py-soundcloud
|
||||||
SUBDIR += py-sounddevice
|
SUBDIR += py-sounddevice
|
||||||
|
|
33
audio/py-samplerate/Makefile
Normal file
33
audio/py-samplerate/Makefile
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
PORTNAME= samplerate
|
||||||
|
DISTVERSION= 0.2.1
|
||||||
|
CATEGORIES= audio
|
||||||
|
MASTER_SITES= PYPI
|
||||||
|
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
|
||||||
|
|
||||||
|
MAINTAINER= yuri@FreeBSD.org
|
||||||
|
COMMENT= Python wrapper for libsamplerate based on pybind11 and NumPy
|
||||||
|
WWW= https://github.com/tuxu/python-samplerate
|
||||||
|
|
||||||
|
LICENSE= MIT
|
||||||
|
LICENSE_FILE= ${WRKSRC}/LICENSE.rst
|
||||||
|
|
||||||
|
BUILD_DEPENDS= ${PY_SETUPTOOLS} \
|
||||||
|
${PYTHON_PKGNAMEPREFIX}setuptools-scm>=6.2:devel/py-setuptools-scm@${PY_FLAVOR} \
|
||||||
|
pybind11>0:devel/pybind11 \
|
||||||
|
cmake:devel/cmake-core
|
||||||
|
LIB_DEPENDS= libsamplerate.so:audio/libsamplerate
|
||||||
|
RUN_DEPENDS= ${PYNUMPY}
|
||||||
|
|
||||||
|
USES= cmake compiler:c++14-lang pkgconfig python
|
||||||
|
USE_PYTHON= flavors pytest
|
||||||
|
|
||||||
|
TEST_WRKSRC= ${WRKSRC}/tests
|
||||||
|
TEST_ENV= ${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
|
||||||
|
|
||||||
|
PLIST_FILES= ${PYTHON_SITELIBDIR}/samplerate${PYTHON_EXT_SUFFIX}.so
|
||||||
|
|
||||||
|
do-install:
|
||||||
|
${MKDIR} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
|
||||||
|
${INSTALL_LIB} ${BUILD_WRKSRC}/samplerate${PYTHON_EXT_SUFFIX}.so ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
|
||||||
|
|
||||||
|
.include <bsd.port.mk>
|
3
audio/py-samplerate/distinfo
Normal file
3
audio/py-samplerate/distinfo
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
TIMESTAMP = 1714760637
|
||||||
|
SHA256 (samplerate-0.2.1.tar.gz) = 464d3574412024184fb7428ecbaa1b2e207bddf5fbc10a5d9ddc3fc1c7b7ab1e
|
||||||
|
SIZE (samplerate-0.2.1.tar.gz) = 21494
|
33
audio/py-samplerate/files/patch-CMakeLists.txt
Normal file
33
audio/py-samplerate/files/patch-CMakeLists.txt
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
--- CMakeLists.txt.orig 2024-01-23 23:51:19 UTC
|
||||||
|
+++ CMakeLists.txt
|
||||||
|
@@ -11,7 +11,9 @@ cmake_policy(SET CMP0094 NEW)
|
||||||
|
cmake_policy(SET CMP0094 NEW)
|
||||||
|
|
||||||
|
# adds the external dependencies
|
||||||
|
-add_subdirectory(external)
|
||||||
|
+find_package(PkgConfig REQUIRED)
|
||||||
|
+find_package(pybind11 CONFIG REQUIRED)
|
||||||
|
+pkg_check_modules(SAMPLERATE REQUIRED IMPORTED_TARGET samplerate)
|
||||||
|
|
||||||
|
pybind11_add_module(python-samplerate src/samplerate.cpp)
|
||||||
|
|
||||||
|
@@ -25,7 +27,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
|
||||||
|
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
|
||||||
|
CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR
|
||||||
|
(CMAKE_CXX_COMPILER_ID MATCHES "Intel" AND NOT WIN32))
|
||||||
|
- target_compile_options(python-samplerate PRIVATE -std=c++14 -O3 -Wall -Wextra)
|
||||||
|
+ target_compile_options(python-samplerate PRIVATE -std=c++14 -Wall -Wextra)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
### stick the package and libsamplerate version into the module
|
||||||
|
@@ -43,4 +45,9 @@ set_target_properties(
|
||||||
|
LINKER_LANGUAGE C
|
||||||
|
)
|
||||||
|
|
||||||
|
-target_link_libraries(python-samplerate PUBLIC samplerate)
|
||||||
|
+target_compile_options(python-samplerate PRIVATE
|
||||||
|
+ ${SAMPLERATE_CFLAGS}
|
||||||
|
+)
|
||||||
|
+target_link_options(python-samplerate PRIVATE
|
||||||
|
+ ${SAMPLERATE_LDFLAGS}
|
||||||
|
+)
|
2
audio/py-samplerate/pkg-descr
Normal file
2
audio/py-samplerate/pkg-descr
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
samplerate is a wrapper around Erik de Castro Lopo's libsamplerate (aka Secret
|
||||||
|
Rabbit Code) for high-quality sample rate conversion.
|
Loading…
Add table
Reference in a new issue