No need to fiddle around with static/shared or boost/python bits in the
autoconf system when cmake just gets it right.

cmake does not build egg files by default (there's an option, though).

No symbol changes as per /usr/src/lib/check_sym.

The current autoconf build links against system boost as well,
with cmake only the python boost library is used.
This looks like a needless extra in the autoconf version.

No static library besides the dynamic one anymore, but I don't see that
as a problem.

Tests pass and qbittorrent on amd64 keeps working as before.

Feedback? OK?

Index: Makefile
===================================================================
RCS file: /cvs/ports/net/libtorrent-rasterbar/Makefile,v
retrieving revision 1.25
diff -u -p -r1.25 Makefile
--- Makefile    5 Jan 2023 22:55:39 -0000       1.25
+++ Makefile    5 Jan 2023 23:12:37 -0000
@@ -1,8 +1,8 @@
 COMMENT =              C++ library implementing a BitTorrent client
 
-MODPY_EGG_VERSION =    1.2.17
-DISTNAME =             libtorrent-rasterbar-${MODPY_EGG_VERSION}
-REVISION =             1
+V =                    1.2.17
+DISTNAME =             libtorrent-rasterbar-${V}
+REVISION =             2
 
 SHARED_LIBS +=         torrent-rasterbar 6.0   # 10.0.0
 
@@ -13,15 +13,14 @@ HOMEPAGE =          https://libtorrent.org/
 # BSD3
 PERMIT_PACKAGE =       Yes
 
-WANTLIB += ${COMPILER_LIBCXX} boost_python${MODPY_MAJORMINOR}
-WANTLIB += boost_system boost_system-mt crypto iconv m ssl
+WANTLIB += ${COMPILER_LIBCXX} boost_python${MODPY_MAJORMINOR}-mt crypto iconv
+WANTLIB += m ssl
 
-MASTER_SITES =         
https://github.com/arvidn/libtorrent/releases/download/v${MODPY_EGG_VERSION}/
+MASTER_SITES =         
https://github.com/arvidn/libtorrent/releases/download/v${V}/
 
-MODULES =              lang/python
-
-MODPY_PYBUILD =                setuptools
-MODPY_PYTEST =         No
+# cmake must come first for correct do-* targets
+MODULES =              devel/cmake \
+                       lang/python
 
 BUILD_DEPENDS =                devel/libtool
 
@@ -31,33 +30,10 @@ LIB_DEPENDS =               converters/libiconv \
 # boost
 COMPILER =             base-clang ports-gcc
 
-CONFIGURE_STYLE =      gnu
-
-CONFIGURE_ARGS =       --enable-python-binding \
-                       --enable-tests \
-                       --with-boost-system=boost_system-mt \
-                       --with-boost-python=boost_python${MODPY_MAJORMINOR}-mt \
-                       --with-libiconv
+CONFIGURE_ARGS =       -Dpython-bindings=ON \
+                       -Dbuild_tests=ON
 
 # https://github.com/arvidn/libtorrent/issues/6468
-CONFIGURE_ARGS +=      --with-cxx-standard=17
-
-.ifdef DEBUG
-CONFIGURE_ARGS +=      --enable-debug
-.endif
-
-post-patch:
-       ${SUBST_CMD} ${WRKSRC}/Jamfile
-
-pre-configure:
-       sed -i 's,-Os,,g' ${WRKSRC}/configure
-
-pre-test:
-       ln -sf ${MODPY_BIN} ${WRKDIR}/bin/python
-
-EGG =  ${PREFIX}/lib/python${MODPY_VERSION}/site-packages/libtorrent-*.egg
-post-install:
-       mv ${EGG}/libtorrent.${MODPY_PYC_MAGIC_TAG}so ${EGG}/..
-       rm -rf ${EGG}
+CONFIGURE_ARGS +=      -DCMAKE_CXX_STANDARD=17
 
 .include <bsd.port.mk>
Index: patches/patch-Jamfile
===================================================================
RCS file: patches/patch-Jamfile
diff -N patches/patch-Jamfile
--- patches/patch-Jamfile       12 Aug 2022 16:56:56 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,54 +0,0 @@
-libtorrent.cpython-*.so fails to load libtorrent-rasterbar.so.10.0.0.
-Give it the proper SHARED_LIB.
-
-Add include path to find boost headers.
-
-commit 1ec11e4e9b2d12d26f4661a14743822c91d76003
-from: arvidn <ar...@libtorrent.org>
-date: Fri Jul 22 22:12:42 2022 UTC
-via: Arvid Norberg <arvid.norb...@gmail.com>
-
-back-port Jamfile version fix from RC_2_0
-
-Index: Jamfile
---- Jamfile.orig
-+++ Jamfile
-@@ -18,6 +18,8 @@ ECHO "CXXFLAGS =" $(CXXFLAGS) ;
- ECHO "LDFLAGS =" $(LDFLAGS) ;
- ECHO "OS =" [ os.name ] ;
- 
-+jam-version = [ modules.peek : JAM_VERSION ] ;
-+
- if $(BOOST_ROOT)
- {
-       ECHO "building boost from source directory: " $(BOOST_ROOT) ;
-@@ -46,7 +48,7 @@ else
- 
- # we need version numbers in the form X.Y.Z in order to trigger the built-in
- # support for generating symlinks to the installed library
--VERSION = 10.0.0 ;
-+VERSION = ${LIBtorrent-rasterbar_VERSION} ;
- 
- rule linking ( properties * )
- {
-@@ -756,6 +758,7 @@ ED25519_SOURCES =
- local usage-requirements =
-       <include>./include
-       <include>./include/libtorrent
-+      <include>${LOCALBASE}/include
-       <include>/usr/sfw/include
-       <variant>release:<define>NDEBUG
-       <define>_FILE_OFFSET_BITS=64
-@@ -823,8 +826,10 @@ rule install-paths ( properties * )
-       # package.paths was introduced in boost-1.70 (2018.02)
-       # however, boost build's versioning scheme changed in boost-1.71 to 
version
-       # 4.0
--      local boost-build-version = [ SPLIT_BY_CHARACTERS [ version.boost-build 
] : "-" ] ;
--      if [ version.version-less [ SPLIT_BY_CHARACTERS 
$(boost-build-version[1]) : "." ] : 2018 03 ]
-+      # so, if versions are 4.0+ we want to use package.paths, but if it's a 
year,
-+      # say 2018, that means it's old and we use the fallback below. Any 
version <
-+      # 1990 is considered the 4.0 and later numbering scheme.
-+      if [ version.version-less 1990 0 : $(jam-version) ]
-       {
-               import option ;
-               import property ;
Index: patches/patch-bindings_python_setup_py
===================================================================
RCS file: patches/patch-bindings_python_setup_py
diff -N patches/patch-bindings_python_setup_py
--- patches/patch-bindings_python_setup_py      12 Aug 2022 16:56:56 -0000      
1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,23 +0,0 @@
-Index: bindings/python/setup.py
---- bindings/python/setup.py.orig
-+++ bindings/python/setup.py
-@@ -207,7 +207,7 @@ class LibtorrentBuildExt(BuildExtBase):
-     def initialize_options(self):
- 
-         self.config_mode = self.CONFIG_MODE_DISTUTILS
--        self.b2_args = ""
-+        self.b2_args = "toolset=clang cxxstd=17 libtorrent-python-pic=on"
-         self.no_autoconf = ""
- 
-         self.cxxflags = None
-@@ -365,8 +365,8 @@ class LibtorrentBuildExt(BuildExtBase):
-         if os.name == "nt":
-             self._maybe_add_arg("--abbreviate-paths")
- 
--        self._maybe_add_arg("boost-link=static")
--        self._maybe_add_arg("libtorrent-link=static")
-+        self._maybe_add_arg("boost-link=shared")
-+        self._maybe_add_arg("libtorrent-link=shared")
- 
-         self._maybe_add_arg("crypto=openssl")
- 
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/net/libtorrent-rasterbar/pkg/PLIST,v
retrieving revision 1.9
diff -u -p -r1.9 PLIST
--- pkg/PLIST   12 Aug 2022 16:56:56 -0000      1.9
+++ pkg/PLIST   5 Jan 2023 23:12:37 -0000
@@ -249,8 +249,12 @@ include/libtorrent/web_connection_base.h
 include/libtorrent/web_peer_connection.hpp
 include/libtorrent/write_resume_data.hpp
 include/libtorrent/xml_parse.hpp
-@static-lib lib/libtorrent-rasterbar.a
-lib/libtorrent-rasterbar.la
+lib/cmake/
+lib/cmake/LibtorrentRasterbar/
+lib/cmake/LibtorrentRasterbar/LibtorrentRasterbarConfig.cmake
+lib/cmake/LibtorrentRasterbar/LibtorrentRasterbarConfigVersion.cmake
+lib/cmake/LibtorrentRasterbar/LibtorrentRasterbarTargets${MODCMAKE_BUILD_SUFFIX}
+lib/cmake/LibtorrentRasterbar/LibtorrentRasterbarTargets.cmake
 @lib lib/libtorrent-rasterbar.so.${LIBtorrent-rasterbar_VERSION}
 lib/pkgconfig/libtorrent-rasterbar.pc
 @so 
lib/python${MODPY_VERSION}/site-packages/libtorrent.${MODPY_PYC_MAGIC_TAG}so

Reply via email to