On 4/15/18 1:25 PM, [email protected] wrote:
The patch attached fixes building libtorrent-rasterbar on
OpenBSD/Loongson for -rOPENBSD_6_3. It added several missing includes,
added "-std=gnu++14" to CXXFLAGS as it is now default for newer compiler
and the code uses those new features, and another patch from -current.
I'm not sure whether this is the correct way to update ports for a
-stable branch so let me know.
Thanks.
It seems that there is another problem with the setup.py of python
binding that relies on existence of environment variable CXX to be
defined, otherwise it will use "cc" instead of "c++" to build the
binding, which then lead to another problem: the main library would be
built using C++14 that enabled using std::chrono, while the bindings
would not and used boost::chrono instead, and the bindings will fail to
load due to missing symbols (actually symbol mismatch). The fix is to
define CXX=c++ in Makefile.am of python binding.
The revised patch against -rOPENBSD_6_3 is attached.
diff -Naur ./Makefile ./Makefile
--- ./Makefile Wed Feb 7 22:30:34 2018
+++ ./Makefile Sat Apr 21 17:48:43 2018
@@ -3,6 +3,7 @@
COMMENT = C++ library implementing a BitTorrent client
MODPY_EGG_VERSION = 1.1.6
+REVISION = 0
DISTNAME = libtorrent-rasterbar-${MODPY_EGG_VERSION}
SHARED_LIBS += torrent-rasterbar 0.0 # 9.0.0
diff -Naur ./patches/patch-bindings_python_Makefile_am
./patches/patch-bindings_python_Makefile_am
--- ./patches/patch-bindings_python_Makefile_am Wed Dec 31 16:00:00 1969
+++ ./patches/patch-bindings_python_Makefile_am Sun Apr 22 04:14:36 2018
@@ -0,0 +1,23 @@
+diff --git bindings/python/Makefile.am bindings/python/Makefile.am
+index 41b9942..16d124b 100644
+--- bindings/python/Makefile.am
++++ bindings/python/Makefile.am
+@@ -33,15 +33,15 @@ EXTRA_DIST = \
+ if ENABLE_PYTHON_BINDING
+
+ all-local:
+- $(PYTHON) $(srcdir)/setup.py build
++ CXX=c++ $(PYTHON) $(srcdir)/setup.py build
+
+ install-exec-local:
+- $(PYTHON) $(srcdir)/setup.py install @PYTHON_INSTALL_PARAMS@
++ CXX=c++ $(PYTHON) $(srcdir)/setup.py install @PYTHON_INSTALL_PARAMS@
+
+ uninstall-local:
+ rm -rf $(DESTDIR)$(libdir)/python*/*-packages/*libtorrent*
+
+ clean-local:
+- $(PYTHON) $(srcdir)/setup.py clean --all
++ CXX=c++ $(PYTHON) $(srcdir)/setup.py clean --all
+
+ endif
diff -Naur ./patches/patch-bindings_python_Makefile_in
./patches/patch-bindings_python_Makefile_in
--- ./patches/patch-bindings_python_Makefile_in Wed Dec 31 16:00:00 1969
+++ ./patches/patch-bindings_python_Makefile_in Sun Apr 22 04:08:04 2018
@@ -0,0 +1,24 @@
+diff --git bindings/python/Makefile.in bindings/python/Makefile.in
+index 0fe5288..31191da 100644
+--- bindings/python/Makefile.in
++++ bindings/python/Makefile.in
+@@ -526,16 +526,16 @@ uninstall-am: uninstall-local
+
+
+ @ENABLE_PYTHON_BINDING_TRUE@all-local:
+-@ENABLE_PYTHON_BINDING_TRUE@ $(PYTHON) $(srcdir)/setup.py build
++@ENABLE_PYTHON_BINDING_TRUE@ CXX=c++ $(PYTHON) $(srcdir)/setup.py build
+
+ @ENABLE_PYTHON_BINDING_TRUE@install-exec-local:
+-@ENABLE_PYTHON_BINDING_TRUE@ $(PYTHON) $(srcdir)/setup.py install
@PYTHON_INSTALL_PARAMS@
++@ENABLE_PYTHON_BINDING_TRUE@ CXX=c++ $(PYTHON) $(srcdir)/setup.py install
@PYTHON_INSTALL_PARAMS@
+
+ @ENABLE_PYTHON_BINDING_TRUE@uninstall-local:
+ @ENABLE_PYTHON_BINDING_TRUE@ rm -rf
$(DESTDIR)$(libdir)/python*/*-packages/*libtorrent*
+
+ @ENABLE_PYTHON_BINDING_TRUE@clean-local:
+-@ENABLE_PYTHON_BINDING_TRUE@ $(PYTHON) $(srcdir)/setup.py clean --all
++@ENABLE_PYTHON_BINDING_TRUE@ CXX=c++ $(PYTHON) $(srcdir)/setup.py clean --all
+
+ # Tell versions [3.59,3.63) of GNU make to not export all variables.
+ # Otherwise a system limit (for SysV at least) may be exceeded.
diff -Naur ./patches/patch-bindings_python_compile_flags_in
./patches/patch-bindings_python_compile_flags_in
--- ./patches/patch-bindings_python_compile_flags_in Wed Dec 31 16:00:00 1969
+++ ./patches/patch-bindings_python_compile_flags_in Sat Apr 21 17:15:37 2018
@@ -0,0 +1,7 @@
+diff --git bindings/python/compile_flags.in bindings/python/compile_flags.in
+index d51261c..bf979b8 100644
+--- bindings/python/compile_flags.in
++++ bindings/python/compile_flags.in
+@@ -1 +1 @@
+--I@top_srcdir@/include @COMPILETIME_OPTIONS@ @CPPFLAGS@ @BOOST_CPPFLAGS@
@PYTHON_CXXFLAGS@ @OPENSSL_INCLUDES@
++-std=gnu++14 -I@top_srcdir@/include @COMPILETIME_OPTIONS@ @CPPFLAGS@
@BOOST_CPPFLAGS@ @PYTHON_CXXFLAGS@ @OPENSSL_INCLUDES@
diff -Naur ./patches/patch-configure ./patches/patch-configure
--- ./patches/patch-configure Wed Dec 31 16:00:00 1969
+++ ./patches/patch-configure Sat Apr 21 17:14:10 2018
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- configure.orig Sun Dec 31 06:21:37 2017
++++ configure Sat Apr 14 17:39:19 2018
+@@ -16763,7 +16763,7 @@
+ LIBS="$PTHREAD_LIBS $LIBS"
+ CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
+ CC="$PTHREAD_CC"
+-CXXFLAGS="$CXXFLAGS -ftemplate-depth=120 -Wno-format-zero-length"
++CXXFLAGS="$CXXFLAGS -std=gnu++14 -ftemplate-depth=120 -Wno-format-zero-length"
+
+ $as_echo "Checking for visibility support:"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for
__attribute__((visibility(\"hidden\")))" >&5
diff -Naur ./patches/patch-configure_ac ./patches/patch-configure_ac
--- ./patches/patch-configure_ac Wed Dec 31 16:00:00 1969
+++ ./patches/patch-configure_ac Sun Apr 22 04:15:33 2018
@@ -0,0 +1,13 @@
+diff --git configure.ac configure.ac
+index a64d21b..7898844 100644
+--- configure.ac
++++ configure.ac
+@@ -99,7 +99,7 @@ AX_PTHREAD()
+ LIBS="$PTHREAD_LIBS $LIBS"
+ CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
+ CC="$PTHREAD_CC"
+-CXXFLAGS="$CXXFLAGS -ftemplate-depth=120 -Wno-format-zero-length"
++CXXFLAGS="$CXXFLAGS -std=gnu++14 -ftemplate-depth=120 -Wno-format-zero-length"
+
+ AS_ECHO "Checking for visibility support:"
+ AC_CACHE_CHECK([for __attribute__((visibility("hidden")))],
diff -Naur ./patches/patch-include_libtorrent_aux__session_interface_hpp
./patches/patch-include_libtorrent_aux__session_interface_hpp
--- ./patches/patch-include_libtorrent_aux__session_interface_hpp Wed Dec
31 16:00:00 1969
+++ ./patches/patch-include_libtorrent_aux__session_interface_hpp Sat Apr
21 17:14:10 2018
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- include/libtorrent/aux_/session_interface.hpp.orig Mon Dec 11 14:59:32 2017
++++ include/libtorrent/aux_/session_interface.hpp Sat Apr 14 16:36:02 2018
+@@ -33,6 +33,8 @@
+ #ifndef TORRENT_SESSION_INTERFACE_HPP_INCLUDED
+ #define TORRENT_SESSION_INTERFACE_HPP_INCLUDED
+
++#include <cstdarg> // for va_list
++
+ #include "libtorrent/config.hpp"
+ #include "libtorrent/peer_id.hpp"
+ #include "libtorrent/address.hpp"
diff -Naur ./patches/patch-src_disk_io_thread_cpp
./patches/patch-src_disk_io_thread_cpp
--- ./patches/patch-src_disk_io_thread_cpp Wed Dec 31 16:00:00 1969
+++ ./patches/patch-src_disk_io_thread_cpp Sat Apr 21 17:14:10 2018
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- src/disk_io_thread.cpp.orig Mon Dec 11 14:59:32 2017
++++ src/disk_io_thread.cpp Sat Apr 14 16:44:04 2018
+@@ -57,6 +57,8 @@
+
+ #include "libtorrent/debug.hpp"
+
++#include <cstdarg> // for va_list
++
+ #define DEBUG_DISK_THREAD 0
+
+ #if __cplusplus >= 201103L || defined __clang__
diff -Naur ./patches/patch-src_kademlia_dht_tracker_cpp
./patches/patch-src_kademlia_dht_tracker_cpp
--- ./patches/patch-src_kademlia_dht_tracker_cpp Wed Dec 31 16:00:00 1969
+++ ./patches/patch-src_kademlia_dht_tracker_cpp Sat Apr 21 17:14:10 2018
@@ -0,0 +1,18 @@
+$OpenBSD: patch-src_kademlia_dht_tracker_cpp,v 1.1 2018/04/12 04:40:41 bentley
Exp $
+
+https://github.com/arvidn/libtorrent/pull/2931
+
+Index: src/kademlia/dht_tracker.cpp
+--- src/kademlia/dht_tracker.cpp.orig
++++ src/kademlia/dht_tracker.cpp
+@@ -224,7 +224,9 @@ namespace libtorrent { namespace dht
+ void dht_tracker::get_peers(sha1_hash const& ih
+ , boost::function<void(std::vector<tcp::endpoint> const&)> f)
+ {
+- m_dht.get_peers(ih, f, NULL, false);
++ m_dht.get_peers(ih, f
++ ,
boost::function<void(std::vector<std::pair<node_entry, std::string> > const&)>()
++ , false);
+ }
+
+ void dht_tracker::announce(sha1_hash const& ih, int listen_port, int
flags
diff -Naur ./patches/patch-src_session_impl_cpp
./patches/patch-src_session_impl_cpp
--- ./patches/patch-src_session_impl_cpp Wed Dec 31 16:00:00 1969
+++ ./patches/patch-src_session_impl_cpp Sat Apr 21 17:14:10 2018
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- src/session_impl.cpp.orig Thu Dec 28 07:54:12 2017
++++ src/session_impl.cpp Sat Apr 14 16:44:23 2018
+@@ -107,6 +107,8 @@
+ // for logging stat layout
+ #include "libtorrent/stat.hpp"
+
++#include <cstdarg> // for va_list
++
+ // for logging the size of DHT structures
+ #ifndef TORRENT_DISABLE_DHT
+ #include <libtorrent/kademlia/find_data.hpp>