Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Aug 2024 18:37:22 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: 7971fb54fa95 - main - devel/nanobind: New port: Tiny and efficient C++/Python bindings (C++ version)
Message-ID:  <202408111837.47BIbM80077113@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=7971fb54fa95547cdddfb13b8a2c0abb673b8d10

commit 7971fb54fa95547cdddfb13b8a2c0abb673b8d10
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2024-08-11 18:36:37 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2024-08-11 18:37:20 +0000

    devel/nanobind: New port: Tiny and efficient C++/Python bindings (C++ version)
---
 devel/Makefile                 |  1 +
 devel/nanobind/Makefile        | 46 ++++++++++++++++++++++++++++++++++
 devel/nanobind/distinfo        |  5 ++++
 devel/nanobind/files/myext.cpp |  8 ++++++
 devel/nanobind/files/test.py   |  5 ++++
 devel/nanobind/pkg-descr       |  5 ++++
 devel/nanobind/pkg-plist       | 57 ++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 127 insertions(+)

diff --git a/devel/Makefile b/devel/Makefile
index 87d1846b8477..4786d0e9c760 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -1681,6 +1681,7 @@
     SUBDIR += myrepos
     SUBDIR += nana
     SUBDIR += nano-signal-slot
+    SUBDIR += nanobind
     SUBDIR += nanopb
     SUBDIR += nant
     SUBDIR += nasm
diff --git a/devel/nanobind/Makefile b/devel/nanobind/Makefile
new file mode 100644
index 000000000000..a66823ddd61e
--- /dev/null
+++ b/devel/nanobind/Makefile
@@ -0,0 +1,46 @@
+PORTNAME=	nanobind
+DISTVERSIONPREFIX=	v
+DISTVERSION=	2.1.0
+CATEGORIES=	devel
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	Tiny and efficient C++/Python bindings (C++ version)
+WWW=		https://github.com/wjakob/nanobind
+
+LICENSE=	BSD3CLAUSE
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+BUILD_DEPENDS=	robin-map>0:devel/robin-map
+RUN_DEPENDS=	robin-map>0:devel/robin-map
+
+USES=		localbase python
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	wjakob
+
+CXXFLAGS+=	-I${WRKSRC}/include \
+		-I${PYTHON_INCLUDEDIR}
+
+do-build: # cmake scripts don't build the shared library
+	@cd ${WRKSRC}/src && \
+		${SETENV} ${MAKE_ENV} ${CXX} \
+			${CXXFLAGS} ${LDFLAGS} \
+			-fPIC \
+			-shared \
+			-Wl,-soname=libnanobind.so \
+			-o libnanobind.so \
+			nb_combined.cpp
+
+do-install:
+	# install headers
+	cd ${WRKSRC}/include && ${COPYTREE_SHARE} . ${STAGEDIR}${PREFIX}/include
+	# install shared library
+	${INSTALL_LIB} ${WRKSRC}/src/libnanobind.so ${STAGEDIR}${PREFIX}/lib
+
+do-test: # test fails because it doesn't create the PyInit_xx function
+	@cd ${WRKSRC} && \
+		${CXX} ${CXXFLAGS} ${LDFLAGS} -shared -o ${FILESDIR}/myext.cpp -o myext${PYTHON_EXT_SUFFIX}.so -L${LOCALBASE}/lib -lnanobind && \
+		${CP} ${FILESDIR}/test.py . && \
+		${PYTHON_CMD} ${FILESDIR}/test.py
+
+.include <bsd.port.mk>
diff --git a/devel/nanobind/distinfo b/devel/nanobind/distinfo
new file mode 100644
index 000000000000..544977c86605
--- /dev/null
+++ b/devel/nanobind/distinfo
@@ -0,0 +1,5 @@
+TIMESTAMP = 1723358161
+SHA256 (wjakob-nanobind-v2.1.0_GH0.tar.gz) = c37c53c60ada5fe1c956e24bd4b83af669a2309bf952bd251f36a7d2fa3bacf0
+SIZE (wjakob-nanobind-v2.1.0_GH0.tar.gz) = 850714
+SHA256 (Tessil-robin-map-188c455_GH0.tar.gz) = c3f05ed8933a1f9aa57295c8ad17bd44756cf5cf030a95325c61aa862fa19680
+SIZE (Tessil-robin-map-188c455_GH0.tar.gz) = 70577
diff --git a/devel/nanobind/files/myext.cpp b/devel/nanobind/files/myext.cpp
new file mode 100644
index 000000000000..4205447d5f80
--- /dev/null
+++ b/devel/nanobind/files/myext.cpp
@@ -0,0 +1,8 @@
+#include <nanobind/nanobind.h>
+
+int add(int a, int b) { return a + b; }
+
+NB_MODULE(myext, m) {
+    m.def("add", &add);
+}
+
diff --git a/devel/nanobind/files/test.py b/devel/nanobind/files/test.py
new file mode 100644
index 000000000000..35bf61155c3c
--- /dev/null
+++ b/devel/nanobind/files/test.py
@@ -0,0 +1,5 @@
+
+import myext
+
+
+print('Test succeeded.')
diff --git a/devel/nanobind/pkg-descr b/devel/nanobind/pkg-descr
new file mode 100644
index 000000000000..52bfaa1ab0b0
--- /dev/null
+++ b/devel/nanobind/pkg-descr
@@ -0,0 +1,5 @@
+nanobind is a small binding library that exposes C++ types in Python and vice
+versa. It is reminiscent of Boost.Python and pybind11 and uses near-identical
+syntax. In contrast to these existing tools, nanobind is more efficient:
+bindings compile in a shorter amount of time, produce smaller binaries, and have
+better runtime performance.
diff --git a/devel/nanobind/pkg-plist b/devel/nanobind/pkg-plist
new file mode 100644
index 000000000000..401fdc113df1
--- /dev/null
+++ b/devel/nanobind/pkg-plist
@@ -0,0 +1,57 @@
+include/nanobind/eigen/dense.h
+include/nanobind/eigen/sparse.h
+include/nanobind/eval.h
+include/nanobind/intrusive/counter.h
+include/nanobind/intrusive/counter.inl
+include/nanobind/intrusive/ref.h
+include/nanobind/make_iterator.h
+include/nanobind/nanobind.h
+include/nanobind/nb_accessor.h
+include/nanobind/nb_attr.h
+include/nanobind/nb_call.h
+include/nanobind/nb_cast.h
+include/nanobind/nb_class.h
+include/nanobind/nb_defs.h
+include/nanobind/nb_descr.h
+include/nanobind/nb_enums.h
+include/nanobind/nb_error.h
+include/nanobind/nb_func.h
+include/nanobind/nb_lib.h
+include/nanobind/nb_misc.h
+include/nanobind/nb_python.h
+include/nanobind/nb_traits.h
+include/nanobind/nb_tuple.h
+include/nanobind/nb_types.h
+include/nanobind/ndarray.h
+include/nanobind/operators.h
+include/nanobind/stl/array.h
+include/nanobind/stl/bind_map.h
+include/nanobind/stl/bind_vector.h
+include/nanobind/stl/chrono.h
+include/nanobind/stl/complex.h
+include/nanobind/stl/detail/chrono.h
+include/nanobind/stl/detail/nb_array.h
+include/nanobind/stl/detail/nb_dict.h
+include/nanobind/stl/detail/nb_list.h
+include/nanobind/stl/detail/nb_set.h
+include/nanobind/stl/detail/traits.h
+include/nanobind/stl/filesystem.h
+include/nanobind/stl/function.h
+include/nanobind/stl/list.h
+include/nanobind/stl/map.h
+include/nanobind/stl/optional.h
+include/nanobind/stl/pair.h
+include/nanobind/stl/set.h
+include/nanobind/stl/shared_ptr.h
+include/nanobind/stl/string.h
+include/nanobind/stl/string_view.h
+include/nanobind/stl/tuple.h
+include/nanobind/stl/unique_ptr.h
+include/nanobind/stl/unordered_map.h
+include/nanobind/stl/unordered_set.h
+include/nanobind/stl/variant.h
+include/nanobind/stl/vector.h
+include/nanobind/stl/wstring.h
+include/nanobind/trampoline.h
+include/nanobind/typing.h
+lib/libnanobind.so



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