Re: Fix libtorrent-rasterbar for gcc 4.9 on -rOPENBSD_6_3 (tested on OpenBSD/Loongson)

2018-04-26 Thread manphiz

Hi,

Emergent fix below.

On 4/26/18 4:17 AM, manp...@gmail.com wrote:

Hi,

On 4/23/18 10:32 PM, manp...@gmail.com wrote:

Hi Stuart,

On 4/23/18 10:48 AM, Stuart Henderson wrote:

On 2018/04/22 15:54, manp...@gmail.com wrote:

On 4/22/18 4:39 AM, manp...@gmail.com wrote:

On 4/15/18 1:25 PM, manp...@gmail.com 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.


And it turns out it's a bad idea to patch configure.ac and 
Makefile.am which
will require "autoreconf". Attaching the patch dropping those parts. 
1.1.7
on -current has similar issue and I'll provide a separate patch and 
also try

to incorporate upstream.


No loongson here so I can't test any of this, but a few things:

- we work on -current primarily, sometimes things can be backported 
but if

this is broken on -current at the moment, that needs fixing first



Agreed.

- compilers should come from the environment rather than hardcoded, 
maybe

try something like:

MAKE_ENV =  CC="${CC}" CXX="${CXX}"
CXXFLAGS += --std=gnu++14



I'm currently working with upstream to incorporate those patches as 
well. Once the patches are incorporated I'll backport them to -current 
and then -stable.


This is the corresponding patch for -stable similar to the one against 
-current in my other mail[1].


[1] https://marc.info/?l=openbsd-ports&m=152474002010011&w=2


Sorry my previous patch was missing a line. This revised patch should 
work and attached.
diff -Naur Makefile Makefile
--- MakefileWed Feb  7 22:30:34 2018
+++ MakefileThu Apr 26 03:58:27 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
@@ -36,7 +37,9 @@
--with-libiconv
 CONFIGURE_ENV +=   CPPFLAGS="-Wno-deprecated-declarations \
  -Wno-macro-redefined \
- -pthread"
+ -pthread" \
+   PYTHON_CXXFLAGS="${PYTHON_CXXFLAGS} -std=gnu++14"
+MAKE_ENV = CC=${CC} CXX=${CXX}
+CXXFLAGS +=-std=gnu++14
 
 .ifdef DEBUG
 CONFIGURE_ARGS +=  --enable-debug
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 Thu Apr 26 
03:56:01 2018
@@ -0,0 +1,14 @@
+$OpenBSD$
+https://github.com/arvidn/libtorrent/pull/2965
+
+--- include/libtorrent/aux_/session_interface.hpp.orig
 include/libtorrent/aux_/session_interface.hpp
+@@ -52,6 +52,7 @@ POSSIBILITY OF SUCH DAMAGE.
+ 
+ #ifndef TORRENT_DISABLE_LOGGING
+ #include 
++#include  // for va_list
+ #endif
+ 
+ #ifdef TORRENT_USE_OPENSSL
+
diff -Naur patches/patch-src_disk_io_thread_cpp 
patches/patch-src_disk_io_thread_cpp
--- patches/patch-src_disk_io_thread_cppWed Dec 31 16:00:00 1969
+++ patches/patch-src_disk_io_thread_cppThu Apr 26 03:56:01 2018
@@ -0,0 +1,13 @@
+$OpenBSD$
+https://github.com/arvidn/libtorrent/pull/2965
+
+--- src/disk_io_thread.cpp.orig
 src/disk_io_thread.cpp
+@@ -62,6 +62,7 @@ POSSIBILITY OF SUCH DAMAGE.
+ #if __cplusplus >= 201103L || defined __clang__
+ 
+ #if DEBUG_DISK_THREAD
++#include  // for va_list
+ #define DLOG(...) debug_log(__VA_ARGS__)
+ #else
+ #define DLOG(...) do {} while(false)
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  Thu Apr 26 03:56:01 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/kade

Re: Fix libtorrent-rasterbar for gcc 4.9 on -rOPENBSD_6_3 (tested on OpenBSD/Loongson)

2018-04-26 Thread manphiz

Hi,

On 4/23/18 10:32 PM, manp...@gmail.com wrote:

Hi Stuart,

On 4/23/18 10:48 AM, Stuart Henderson wrote:

On 2018/04/22 15:54, manp...@gmail.com wrote:

On 4/22/18 4:39 AM, manp...@gmail.com wrote:

On 4/15/18 1:25 PM, manp...@gmail.com 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.


And it turns out it's a bad idea to patch configure.ac and 
Makefile.am which
will require "autoreconf". Attaching the patch dropping those parts. 
1.1.7
on -current has similar issue and I'll provide a separate patch and 
also try

to incorporate upstream.


No loongson here so I can't test any of this, but a few things:

- we work on -current primarily, sometimes things can be backported 
but if

this is broken on -current at the moment, that needs fixing first



Agreed.


- compilers should come from the environment rather than hardcoded, maybe
try something like:

MAKE_ENV =  CC="${CC}" CXX="${CXX}"
CXXFLAGS += --std=gnu++14



I'm currently working with upstream to incorporate those patches as 
well. Once the patches are incorporated I'll backport them to -current 
and then -stable.


This is the corresponding patch for -stable similar to the one against 
-current in my other mail[1].


[1] https://marc.info/?l=openbsd-ports&m=152474002010011&w=2
diff -Naur Makefile Makefile
--- MakefileWed Feb  7 22:30:34 2018
+++ MakefileThu Apr 26 03:58:27 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
@@ -36,7 +37,9 @@
--with-libiconv
 CONFIGURE_ENV +=   CPPFLAGS="-Wno-deprecated-declarations \
  -Wno-macro-redefined \
- -pthread"
+ -pthread" \
+   PYTHON_CXXFLAGS="${PYTHON_CXXFLAGS} -std=gnu++14"
+MAKE_ENV = CC=${CC} CXX=${CXX}
 
 .ifdef DEBUG
 CONFIGURE_ARGS +=  --enable-debug
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 Thu Apr 26 
03:56:01 2018
@@ -0,0 +1,14 @@
+$OpenBSD$
+https://github.com/arvidn/libtorrent/pull/2965
+
+--- include/libtorrent/aux_/session_interface.hpp.orig
 include/libtorrent/aux_/session_interface.hpp
+@@ -52,6 +52,7 @@ POSSIBILITY OF SUCH DAMAGE.
+ 
+ #ifndef TORRENT_DISABLE_LOGGING
+ #include 
++#include  // for va_list
+ #endif
+ 
+ #ifdef TORRENT_USE_OPENSSL
+
diff -Naur patches/patch-src_disk_io_thread_cpp 
patches/patch-src_disk_io_thread_cpp
--- patches/patch-src_disk_io_thread_cppWed Dec 31 16:00:00 1969
+++ patches/patch-src_disk_io_thread_cppThu Apr 26 03:56:01 2018
@@ -0,0 +1,13 @@
+$OpenBSD$
+https://github.com/arvidn/libtorrent/pull/2965
+
+--- src/disk_io_thread.cpp.orig
 src/disk_io_thread.cpp
+@@ -62,6 +62,7 @@ POSSIBILITY OF SUCH DAMAGE.
+ #if __cplusplus >= 201103L || defined __clang__
+ 
+ #if DEBUG_DISK_THREAD
++#include  // for va_list
+ #define DLOG(...) debug_log(__VA_ARGS__)
+ #else
+ #define DLOG(...) do {} while(false)
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  Thu Apr 26 03:56:01 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 const&)> f)
+   {
+-   

Re: Fix libtorrent-rasterbar for gcc 4.9 on -rOPENBSD_6_3 (tested on OpenBSD/Loongson)

2018-04-23 Thread manphiz

Hi Stuart,

On 4/23/18 10:48 AM, Stuart Henderson wrote:

On 2018/04/22 15:54, manp...@gmail.com wrote:

On 4/22/18 4:39 AM, manp...@gmail.com wrote:

On 4/15/18 1:25 PM, manp...@gmail.com 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.


And it turns out it's a bad idea to patch configure.ac and Makefile.am which
will require "autoreconf". Attaching the patch dropping those parts. 1.1.7
on -current has similar issue and I'll provide a separate patch and also try
to incorporate upstream.


No loongson here so I can't test any of this, but a few things:

- we work on -current primarily, sometimes things can be backported but if
this is broken on -current at the moment, that needs fixing first



Agreed.


- compilers should come from the environment rather than hardcoded, maybe
try something like:

MAKE_ENV =  CC="${CC}" CXX="${CXX}"
CXXFLAGS += --std=gnu++14



I'm currently working with upstream to incorporate those patches as 
well. Once the patches are incorporated I'll backport them to -current 
and then -stable.




Re: Fix libtorrent-rasterbar for gcc 4.9 on -rOPENBSD_6_3 (tested on OpenBSD/Loongson)

2018-04-23 Thread Stuart Henderson
On 2018/04/22 15:54, manp...@gmail.com wrote:
> On 4/22/18 4:39 AM, manp...@gmail.com wrote:
> > On 4/15/18 1:25 PM, manp...@gmail.com 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.
> 
> And it turns out it's a bad idea to patch configure.ac and Makefile.am which
> will require "autoreconf". Attaching the patch dropping those parts. 1.1.7
> on -current has similar issue and I'll provide a separate patch and also try
> to incorporate upstream.

No loongson here so I can't test any of this, but a few things:

- we work on -current primarily, sometimes things can be backported but if
this is broken on -current at the moment, that needs fixing first

- compilers should come from the environment rather than hardcoded, maybe
try something like:

MAKE_ENV =  CC="${CC}" CXX="${CXX}"
CXXFLAGS += --std=gnu++14



Re: Fix libtorrent-rasterbar for gcc 4.9 on -rOPENBSD_6_3 (tested on OpenBSD/Loongson)

2018-04-22 Thread manphiz

On 4/22/18 4:39 AM, manp...@gmail.com wrote:

On 4/15/18 1:25 PM, manp...@gmail.com 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.


And it turns out it's a bad idea to patch configure.ac and Makefile.am 
which will require "autoreconf". Attaching the patch dropping those 
parts. 1.1.7 on -current has similar issue and I'll provide a separate 
patch and also try to incorporate upstream.
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_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_inWed Dec 31 16:00:00 1969
+++ ./patches/patch-bindings_python_compile_flags_inSat 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-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/l

Re: Fix libtorrent-rasterbar for gcc 4.9 on -rOPENBSD_6_3 (tested on OpenBSD/Loongson)

2018-04-22 Thread manphiz

On 4/15/18 1:25 PM, manp...@gmail.com 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_inWed Dec 31 16:00:00 1969
+++ ./patches/patch-bindings_python_compile_flags_inSat 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-lengt

Fix libtorrent-rasterbar for gcc 4.9 on -rOPENBSD_6_3 (tested on OpenBSD/Loongson)

2018-04-15 Thread manphiz
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.
Index: Makefile
===
RCS file: /cvs/ports/net/libtorrent-rasterbar/Makefile,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 Makefile
--- Makefile8 Feb 2018 06:30:34 -   1.1.1.1
+++ Makefile15 Apr 2018 20:19:13 -
@@ -3,6 +3,7 @@
 COMMENT =  C++ library implementing a BitTorrent client
 
 MODPY_EGG_VERSION =1.1.6
+REVISION = 1
 DISTNAME = libtorrent-rasterbar-${MODPY_EGG_VERSION}
 
 SHARED_LIBS += torrent-rasterbar 0.0   # 9.0.0
Index: patches/patch-configure
===
RCS file: patches/patch-configure
diff -N patches/patch-configure
--- /dev/null   1 Jan 1970 00:00:00 -
+++ patches/patch-configure 15 Apr 2018 20:19:13 -
@@ -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
Index: patches/patch-include_libtorrent_aux__session_interface_hpp
===
RCS file: patches/patch-include_libtorrent_aux__session_interface_hpp
diff -N patches/patch-include_libtorrent_aux__session_interface_hpp
--- /dev/null   1 Jan 1970 00:00:00 -
+++ patches/patch-include_libtorrent_aux__session_interface_hpp 15 Apr 2018 
20:19:13 -
@@ -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  // for va_list
++
+ #include "libtorrent/config.hpp"
+ #include "libtorrent/peer_id.hpp"
+ #include "libtorrent/address.hpp"
Index: patches/patch-src_disk_io_thread_cpp
===
RCS file: patches/patch-src_disk_io_thread_cpp
diff -N patches/patch-src_disk_io_thread_cpp
--- /dev/null   1 Jan 1970 00:00:00 -
+++ patches/patch-src_disk_io_thread_cpp15 Apr 2018 20:19:13 -
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- src/disk_io_thread.cpp.origMon 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  // for va_list
++
+ #define DEBUG_DISK_THREAD 0
+ 
+ #if __cplusplus >= 201103L || defined __clang__
Index: patches/patch-src_kademlia_dht_tracker_cpp
===
RCS file: patches/patch-src_kademlia_dht_tracker_cpp
diff -N patches/patch-src_kademlia_dht_tracker_cpp
--- /dev/null   1 Jan 1970 00:00:00 -
+++ patches/patch-src_kademlia_dht_tracker_cpp  15 Apr 2018 20:19:13 -
@@ -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 const&)> f)
+   {
+-  m_dht.get_peers(ih, f, NULL, false);
++  m_dht.get_peers(ih, f
++  , 
boost::function > const&)>()
++  , false);
+   }
+ 
+   void dht_tracker::announce(sha1_hash const& ih, int listen_port, int 
flags
Index: patches/patch-src_session_impl_cpp
===
RCS file: patches/patch-src_session_impl_cpp
diff -N patches/patch-src_session_impl_cpp
--- /dev/null   1 Jan 1970 00:00:00 -
+++ patches/patch-src_session_impl_cpp  15 Apr 2018 20:19:13 -
@@ -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  // for va_list
++
+ // for logging the size of DHT structures
+ #ifndef TORRENT_DISABLE_DHT
+ #include