This is a diff for an update to net/libtorrent-rasterbar 1.2.8, released
on August 4, 2020.

changelog:
https://github.com/arvidn/libtorrent/blob/libtorrent-1.2.8/ChangeLog

base-clang 10.0.1 unbreaks libtorrent-rasterbar. This diff is based on
rsadowski@'s devel/boost 1.67.0 update.

https://marc.info/?l=openbsd-ports&m=159566156026888&w=2

This diff:
- is based on rsadowski@'s devel/boost 1.67.0 update, which moves from
boost_python3 to boost_python38. rsadowski@ uses MODPY_VERSION here in
naming WANTLIB and CONFIGURE_ARGS
- updates to 1.2.8
- bumps library major due to symbol deletion
- adds a license marker for ConvertUTF.cpp, slated to be removed in
upcoming 1.2.9
- changes MASTER_SITES to properly download the new release
- specifies devel/boost>=1.67.0
- uses non-mt variants of both boost_system and boost_python38
- links to -liconv (libiconv.so.7.0) instead of libiconv.a
- regens WANTLIB with boost_python38, boost_system (non-mt) and iconv

python bindings
===============

lboost_python38 and lboost_system = works
lboost_python38-mt and lboost_system-mt = works
nonmatching -mt = broken

When they were nonmatching -mt as in rsadowski@'s boost update, I had two
outcomes:
 - more recently, SIGILL on deluge startup
 - update-plist in deluge:
 Warning: libtorrent (libtorrent-rasterbar) not found: Cannot load specified 
object
 ===>  Faking installation for deluge-2.0.3p1

I can no longer reproduce the latter since moving from ports-clang back to
base-clang. I now always get the SIGILL with nonmatching -mt.

To resolve make sure that _system and _python are matching -mt or
non-mt.

I have an experimental cmake build where cmake uses -lboost_python38-mt
and -lboost_system-mt in building python bindings
(bindings/python/libtorrent.so). See the first half of the log file. It
works.

The second half of the log file shows the autohell Makefile using
-lboost_system-mt and -lboost_python38, which was broken.

log file: https://www.namtsui.com/public/pythonbindings.txt

upstream states that boost build (b2) > cmake > autohell for reliably
building libtorrent python bindings (libtorrent.so). autohell is removed
altogether in the libtorrent 2 branch, unrelated to 1.2.8. Moving to
cmake is an option but not necessary.

iconv
=====

libiconv.a is always preferred by autohell over libiconv.so.7.0. I
replace all generated Makefiles using iconv.a (second half of log file)
with -liconv (first half of log file).

Specifically, I deleted /usr/local/lib/libiconv.a so that it could only
find libiconv.so.7.0. The result is printed in the first half of log
file.

log file: https://www.namtsui.com/public/iconv.txt

make port-lib-depends-check is happy and iconv is now added to
WANTLIB. This is hacky. Other options:
- move to cmake, which finds -liconv
- use libiconv.a and remove this

Licensing
=========

debian removed libtorrent-rasterbar because ConvertUTF8.cpp has a
special Unicode, Inc., license.

Is it fine to leave PERMIT_PACKAGE as is, since upstream will remove it
in the upcoming 1.2.9?

https://github.com/arvidn/libtorrent/pull/4966
https://github.com/arvidn/libtorrent/issues/4951

Major bump
==========

1. I referenced "CMakeLists.txt: set (SOVERSION "10")" to keep # 10.0.0 as
kn@ had done with a previous update.

2. has_udp_outgoing-sockets() (see 1.2.3's
include/libtorrent/aux_/session_impl.hpp:731) has been removed in
1.2.8. This symbol deletion is enough for bumping major.

3. Changelog also says, "deprecate broadcast_lsd setting. Just use
multicast"

- include/libtorrent/settings_pack.hpp
settings_pack struct in 1.2.3 used to have broadcast_lsd:

// if ``broadcast_lsd`` is set to true, the local peer discovery (or
// Local Service Discovery) will not only use IP multicast, but also
// broadcast its messages. This can be useful when running on networks
// that don't support multicast. Since broadcast messages might be
// expensive and disruptive on networks, only every 8th announce uses
// broadcast.
broadcast_lsd,

- in 1.2.8:

#if TORRENT_ABI_VERSION == 1
  // if ``broadcast_lsd`` is set to true, the local peer discovery (or
  // Local Service Discovery) will not only use IP multicast, but also
  // broadcast its messages. This can be useful when running on networks
  // that don't support multicast. Since broadcast messages might be
  // expensive and disruptive on networks, only every 8th announce uses
  // broadcast.
  broadcast_lsd TORRENT_DEPRECATED_ENUM,
#else
  deprecated_broadcast_lsd,
#endif

- TORRENT_DEPRECATED_ENUM is defined as:

include/libtorrent/aux_/deprecated.hpp:43:
#  define TORRENT_DEPRECATED_ENUM __attribute__ ((deprecated))

The deprecated attribute means that its use is discourged with a warning
if used but still supported. This could also arguably warrant a major
bump, but the removal in #2 is enough.

Testing
=======

To test:
1. update to boost 1.67
https://marc.info/?l=openbsd-ports&m=159566156026888&w=2
2. use this diff instead for net/libtorrent-rasterbar

I tested torrenting a linux ISO with net/deluge and
net/qbitorrent. Tests are in the same state as before: 47/50 pass.

Feedback and tests are welcome.

Index: Makefile
===================================================================
RCS file: /cvs/ports/net/libtorrent-rasterbar/Makefile,v
retrieving revision 1.10
diff -u -p -u -p -r1.10 Makefile
--- Makefile    3 Jul 2020 21:12:59 -0000       1.10
+++ Makefile    15 Aug 2020 22:26:10 -0000
@@ -2,23 +2,24 @@
 
 COMMENT =              C++ library implementing a BitTorrent client
 
-MODPY_EGG_VERSION =    1.2.3
+MODPY_EGG_VERSION =    1.2.8
 DISTNAME =             libtorrent-rasterbar-${MODPY_EGG_VERSION}
-REVISION =             0
 
-SHARED_LIBS +=         torrent-rasterbar 2.0   # 10.0.0
+SHARED_LIBS +=         torrent-rasterbar 3.0   # 10.0.0
 
 CATEGORIES =           net devel
 
 HOMEPAGE =             https://libtorrent.org/
 
 # BSD3
+# ConvertUTF.cpp (Unicode, Inc., license) will be removed in 1.2.9. see:
+# https://github.com/arvidn/libtorrent/pull/4966
 PERMIT_PACKAGE =       Yes
 
-WANTLIB += boost_python3 boost_system-mt crypto m ssl
-WANTLIB += ${COMPILER_LIBCXX} ${MODPY_WANTLIB}
+WANTLIB += ${COMPILER_LIBCXX} boost_python${MODPY_VERSION:C/\.//g}
+WANTLIB += boost_system crypto iconv m ssl
 
-MASTER_SITES =         
https://github.com/arvidn/libtorrent/releases/download/libtorrent-${MODPY_EGG_VERSION:S/./_/g}/
+MASTER_SITES =         
https://github.com/arvidn/libtorrent/releases/download/libtorrent-${MODPY_EGG_VERSION}/
 
 MODULES =              lang/python
 MODPY_VERSION =                ${MODPY_DEFAULT_VERSION_3}
@@ -26,7 +27,7 @@ MODPY_VERSION =               ${MODPY_DEFAULT_VERSION
 BUILD_DEPENDS =                devel/libtool
 
 LIB_DEPENDS =          converters/libiconv \
-                       devel/boost
+                       devel/boost>=1.67.0
 
 # boost
 COMPILER =             base-clang ports-gcc
@@ -34,8 +35,8 @@ 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_python3 \
+                       --with-boost-system=boost_system \
+                       
--with-boost-python=boost_python${MODPY_VERSION:C/\.//g} \
                        --with-libiconv
 CONFIGURE_ENV +=       CPPFLAGS="-Wno-deprecated-declarations \
                                  -Wno-macro-redefined \
@@ -51,6 +52,11 @@ CONFIGURE_ARGS +=    --enable-debug
 
 pre-configure:
        sed -i 's,-Os,,g' ${WRKSRC}/configure
+
+# link to -liconv. autotools incorrectly prefers libiconv.a over -liconv.
+post-configure:
+       find ${WRKSRC} -type f \( -name "Makefile" -o -name "link_flags" \) \
+               -exec sed -ie "s;${LOCALBASE}/lib/libiconv\.a;-liconv;g" {} +
 
 pre-test:
        ln -sf ${MODPY_BIN} ${WRKDIR}/bin/python
Index: distinfo
===================================================================
RCS file: /cvs/ports/net/libtorrent-rasterbar/distinfo,v
retrieving revision 1.6
diff -u -p -u -p -r1.6 distinfo
--- distinfo    6 Feb 2020 20:00:16 -0000       1.6
+++ distinfo    15 Aug 2020 22:26:10 -0000
@@ -1,2 +1,2 @@
-SHA256 (libtorrent-rasterbar-1.2.3.tar.gz) = 
FYL9u9BEm8/k/64sy55b8Fd0WaMrslYE4BrMuEfaGi0=
-SIZE (libtorrent-rasterbar-1.2.3.tar.gz) = 4145859
+SHA256 (libtorrent-rasterbar-1.2.8.tar.gz) = 
BgDWsf28kHZCJtr4u+MDFMmes73GlFd2i/u7/ekkFt4=
+SIZE (libtorrent-rasterbar-1.2.8.tar.gz) = 4121254
Index: patches/patch-include_libtorrent_config_hpp
===================================================================
RCS file: 
/cvs/ports/net/libtorrent-rasterbar/patches/patch-include_libtorrent_config_hpp,v
retrieving revision 1.3
diff -u -p -u -p -r1.3 patch-include_libtorrent_config_hpp
--- patches/patch-include_libtorrent_config_hpp 6 Feb 2020 20:00:16 -0000       
1.3
+++ patches/patch-include_libtorrent_config_hpp 15 Aug 2020 22:26:10 -0000
@@ -2,7 +2,7 @@ $OpenBSD: patch-include_libtorrent_confi
 Index: include/libtorrent/config.hpp
 --- include/libtorrent/config.hpp.orig
 +++ include/libtorrent/config.hpp
-@@ -411,6 +411,10 @@ POSSIBILITY OF SUCH DAMAGE.
+@@ -414,6 +414,10 @@ POSSIBILITY OF SUCH DAMAGE.
  #define TORRENT_USE_UNC_PATHS 0
  #endif
  
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/net/libtorrent-rasterbar/pkg/PLIST,v
retrieving revision 1.4
diff -u -p -u -p -r1.4 PLIST
--- pkg/PLIST   6 Feb 2020 20:00:16 -0000       1.4
+++ pkg/PLIST   15 Aug 2020 22:26:10 -0000
@@ -36,6 +36,7 @@ include/libtorrent/aux_/has_block.hpp
 include/libtorrent/aux_/instantiate_connection.hpp
 include/libtorrent/aux_/io.hpp
 include/libtorrent/aux_/ip_notifier.hpp
+include/libtorrent/aux_/keepalive.hpp
 include/libtorrent/aux_/listen_socket_handle.hpp
 include/libtorrent/aux_/lsd.hpp
 include/libtorrent/aux_/merkle.hpp
@@ -254,3 +255,6 @@ lib/libtorrent-rasterbar.la
 lib/pkgconfig/libtorrent-rasterbar.pc
 @so lib/python${MODPY_VERSION}/site-packages/libtorrent.so
 
lib/python${MODPY_VERSION}/site-packages/python_libtorrent-${MODPY_EGG_VERSION}-py${MODPY_VERSION}.egg-info
+share/cmake/
+share/cmake/Modules/
+share/cmake/Modules/FindLibtorrentRasterbar.cmake

Reply via email to