Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 4 May 2024 02:07:02 GMT
From:      Yuri Victorovich <yuri@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: af42bbacc245 - main - audio/py-samplerate: New port: Python wrapper for libsamplerate based on pybind11 and NumPy
Message-ID:  <202405040207.444272fN005843@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=af42bbacc245be293a76409adef3843d50aef9f0

commit af42bbacc245be293a76409adef3843d50aef9f0
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2024-05-04 00:16:24 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2024-05-04 02:06:56 +0000

    audio/py-samplerate: New port: Python wrapper for libsamplerate based on pybind11 and NumPy
---
 audio/Makefile                                 |  1 +
 audio/py-samplerate/Makefile                   | 33 ++++++++++++++++++++++++++
 audio/py-samplerate/distinfo                   |  3 +++
 audio/py-samplerate/files/patch-CMakeLists.txt | 33 ++++++++++++++++++++++++++
 audio/py-samplerate/pkg-descr                  |  2 ++
 5 files changed, 72 insertions(+)

diff --git a/audio/Makefile b/audio/Makefile
index 6cb0b167e054..9fa1446c7df8 100644
--- a/audio/Makefile
+++ b/audio/Makefile
@@ -659,6 +659,7 @@
     SUBDIR += py-python-mpd2
     SUBDIR += py-pyttsx3
     SUBDIR += py-resampy
+    SUBDIR += py-samplerate
     SUBDIR += py-simpleaudio
     SUBDIR += py-soundcloud
     SUBDIR += py-sounddevice
diff --git a/audio/py-samplerate/Makefile b/audio/py-samplerate/Makefile
new file mode 100644
index 000000000000..010017d57e9e
--- /dev/null
+++ b/audio/py-samplerate/Makefile
@@ -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>
diff --git a/audio/py-samplerate/distinfo b/audio/py-samplerate/distinfo
new file mode 100644
index 000000000000..a0725985f378
--- /dev/null
+++ b/audio/py-samplerate/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1714760637
+SHA256 (samplerate-0.2.1.tar.gz) = 464d3574412024184fb7428ecbaa1b2e207bddf5fbc10a5d9ddc3fc1c7b7ab1e
+SIZE (samplerate-0.2.1.tar.gz) = 21494
diff --git a/audio/py-samplerate/files/patch-CMakeLists.txt b/audio/py-samplerate/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..7f822e90d3d4
--- /dev/null
+++ b/audio/py-samplerate/files/patch-CMakeLists.txt
@@ -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}
++)
diff --git a/audio/py-samplerate/pkg-descr b/audio/py-samplerate/pkg-descr
new file mode 100644
index 000000000000..7e3b3f7188be
--- /dev/null
+++ b/audio/py-samplerate/pkg-descr
@@ -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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202405040207.444272fN005843>