From 33e2ef174cd7440f18f63a35ae85766e76aa42c8 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Tue, 24 Apr 2018 19:27:10 +0000
Subject: openpht: rebuild

---
 abs/extra/openpht/PKGBUILD           | 15 ++++++++++----
 abs/extra/openpht/__changelog        |  2 ++
 abs/extra/openpht/plexNetwork.patch  | 38 ++++++++++++++++++++++++++++++++++++
 abs/extra/openpht/websocketSSL.patch | 27 +++++++++++++++++++++++++
 4 files changed, 78 insertions(+), 4 deletions(-)
 create mode 100644 abs/extra/openpht/plexNetwork.patch
 create mode 100644 abs/extra/openpht/websocketSSL.patch

diff --git a/abs/extra/openpht/PKGBUILD b/abs/extra/openpht/PKGBUILD
index 4962a65..d359bd1 100644
--- a/abs/extra/openpht/PKGBUILD
+++ b/abs/extra/openpht/PKGBUILD
@@ -5,7 +5,7 @@
 pkgname=openpht
 pkgver=1.8.0.148
 _pkghash=573b6d73
-pkgrel=1
+pkgrel=2
 pkgdesc='OpenPHT is a community driven fork of Plex Home Theater'
 arch=('i686' 'x86_64')
 url='https://github.com/RasPlex/OpenPHT/'
@@ -21,18 +21,22 @@ depends=('alsa-lib' 'avahi' 'boost-libs' 'curl' 'expat' 'ffmpeg2.8' 'freetype2'
          'libxext' 'libxrandr' 'lzo' 'pcre' 'python2' 'sdl' 'sdl_image'
          'sdl_mixer' 'sqlite' 'smbclient' 'taglib' 'tinyxml' 'yajl' 'zlib' 'rtmpdump')
 makedepends=('boost' 'cmake' 'doxygen' 'git' 'java-environment' 'shairplay'
-             'libcec' 'libplist' 'nasm' 'swig' 'unzip' 'zip' 'gcc-libs' 'glibc' 'llvm-libs')
+             'libplist' 'nasm' 'swig' 'unzip' 'zip' 'gcc-libs' 'glibc' 'llvm-libs')
 optdepends=('libplist: AirPlay support'
             'libcec: Pulse-Eight USB-CEC adapter support'
             'shairplay: Shairplay Support')
 source=("https://github.com/RasPlex/OpenPHT/archive/v${pkgver}-${_pkghash}.tar.gz"
         'plex_lib.conf'
         'fribidi.patch'
+        'websocketSSL.patch'
+        'plexNetwork.patch'
         'plexhometheater.desktop')
 
 prepare() {
   cd OpenPHT-${pkgver}-${_pkghash}
   patch -Np1 <../fribidi.patch
+  patch -Np2 <../plexNetwork.patch
+  patch -Np1 <../websocketSSL.patch
 }
 
 build() {
@@ -49,7 +53,8 @@ build() {
     -DENABLE_AUTOUPDATE='FALSE' \
     -DENABLE_PYTHON='TRUE' \
     -DPYTHON_EXEC='/usr/bin/python2' \
-    -DUSE_INTERNAL_FFMPEG='FALSE'
+    -DUSE_INTERNAL_FFMPEG='FALSE' \
+    -DENABLE_CEC:BOOL=OFF
   make
 }
 
@@ -65,7 +70,9 @@ package() {
   # add in plex_lib.conf
   install -D -m0744 ${srcdir}/plex_lib.conf ${pkgdir}/etc/gen_lib_xml.d/plex_lib.conf
 }
-md5sums=('cd2fff943de57123008c0f10f7fb20d1'
+md5sums=('7eddac9c7638d70c2a25d04cc451ddcc'
          'b9524fe29d0cc65087ba447d1b892da2'
          'a5980579c1b6341a6d06e80d9da2a924'
+         'ed2262e0991a4f28483542abc05d8d90'
+         'b4abf25d4da8e4f8e8722a9233fe7fc1'
          'e530e2b4d8333863ba1c87862c291ba1')
diff --git a/abs/extra/openpht/__changelog b/abs/extra/openpht/__changelog
index 140f8a0..244ed7e 100644
--- a/abs/extra/openpht/__changelog
+++ b/abs/extra/openpht/__changelog
@@ -2,4 +2,6 @@ copied plex-home-theater to openpht
 PKGBUILD - Remove opt dep pulseaudio
 PKGBUILD - Add dep ffmpeg2.8
 PKGBUILD - Added plex_lib.conf, this file goes in /etc/gen_lib_xml.d/
+PKGBUILD - add plexNetwork.patch
+PKDBUILD - add websocketSSL.patch
 openpht.install - add gen_lib_xml.py to post_install and post_remove and post_update
diff --git a/abs/extra/openpht/plexNetwork.patch b/abs/extra/openpht/plexNetwork.patch
new file mode 100644
index 0000000..9d3bd70
--- /dev/null
+++ b/abs/extra/openpht/plexNetwork.patch
@@ -0,0 +1,38 @@
+diff -u ./OpenPHT-1.8.0.148-573b6d73.a/plex/Network/NetworkInterfaceLinux.cpp ./OpenPHT-1.8.0.148-573b6d73/plex/Network/NetworkInterfaceLinux.cpp
+--- ./OpenPHT-1.8.0.148-573b6d73.a/plex/Network/NetworkInterfaceLinux.cpp	2017-03-16 22:22:06.000000000 +0000
++++ ./OpenPHT-1.8.0.148-573b6d73/plex/Network/NetworkInterfaceLinux.cpp	2018-04-24 17:16:23.300466486 +0000
+@@ -148,8 +148,8 @@
+ {
+   // Start the thread.
+   dprintf("NetworkInterface: Starting watch thread.");
+-  thread t = thread(boost::bind(&RunWatchingForChanges));
+-  t.detach();
++  boost::thread* t = new boost::thread(boost::bind(&RunWatchingForChanges));
++  t->detach();
+   
+   // Start with a change, because otherwise we're in steady state.
+   NetworkChanged();
+diff -u ./OpenPHT-1.8.0.148-573b6d73.a/plex/Network/NetworkServiceAdvertiser.h ./OpenPHT-1.8.0.148-573b6d73/plex/Network/NetworkServiceAdvertiser.h
+--- ./OpenPHT-1.8.0.148-573b6d73.a/plex/Network/NetworkServiceAdvertiser.h	2017-03-16 22:22:06.000000000 +0000
++++ ./OpenPHT-1.8.0.148-573b6d73/plex/Network/NetworkServiceAdvertiser.h	2018-04-24 17:16:23.280469056 +0000
+@@ -193,7 +193,7 @@
+     }
+     else
+     {
+-      eprintf("Network Service: Error in advertiser handle read: %d (%s) socket=%d", error.value(), error.message().c_str(), socket->native());
++      eprintf("Network Service: Error in advertiser handle read: %d (%s) socket=%d", error.value(), error.message().c_str(), socket->native_handle());
+       usleep(1000 * 100);
+     }
+     
+diff -u ./OpenPHT-1.8.0.148-573b6d73.a/plex/Network/NetworkServiceBrowser.h ./OpenPHT-1.8.0.148-573b6d73/plex/Network/NetworkServiceBrowser.h
+--- ./OpenPHT-1.8.0.148-573b6d73.a/plex/Network/NetworkServiceBrowser.h	2017-03-16 22:22:06.000000000 +0000
++++ ./OpenPHT-1.8.0.148-573b6d73/plex/Network/NetworkServiceBrowser.h	2018-04-24 17:16:23.290467773 +0000
+@@ -279,7 +279,7 @@
+     }
+     else
+     {
+-      eprintf("Network Service: Error in browser handle read: %d (%s) socket=%d", error.value(), error.message().c_str(), socket->native());
++      eprintf("Network Service: Error in browser handle read: %d (%s) socket=%d", error.value(), error.message().c_str(), socket->native_handle());
+       usleep(1000 * 100);
+     }
+     
diff --git a/abs/extra/openpht/websocketSSL.patch b/abs/extra/openpht/websocketSSL.patch
new file mode 100644
index 0000000..cf9d89d
--- /dev/null
+++ b/abs/extra/openpht/websocketSSL.patch
@@ -0,0 +1,27 @@
+From 1dd07113f2a7489444a8990a95be42e035f8e9df Mon Sep 17 00:00:00 2001
+From: Kurt Roeckx <kroeckx@debian.org>
+Date: Tue, 1 Nov 2016 12:57:35 +0100
+Subject: [PATCH] Fix issue #599
+
+---
+ websocketpp/transport/asio/security/tls.hpp | 4 ----
+ 1 file changed, 4 deletions(-)
+
+diff --git a/websocketpp/transport/asio/security/tls.hpp b/websocketpp/transport/asio/security/tls.hpp
+index 7b32db81..a8aafec5 100644
+--- a/lib/websocketpp/transport/asio/security/tls.hpp
++++ b/lib/websocketpp/transport/asio/security/tls.hpp
+@@ -355,13 +355,9 @@ class connection : public lib::enable_shared_from_this<connection> {
+     template <typename ErrorCodeType>
+     lib::error_code translate_ec(ErrorCodeType ec) {
+         if (ec.category() == lib::asio::error::get_ssl_category()) {
+-            if (ERR_GET_REASON(ec.value()) == SSL_R_SHORT_READ) {
+-                return make_error_code(transport::error::tls_short_read);
+-            } else {
+                 // We know it is a TLS related error, but otherwise don't know
+                 // more. Pass through as TLS generic.
+                 return make_error_code(transport::error::tls_error);
+-            }
+         } else {
+             // We don't know any more information about this error so pass
+             // through
-- 
cgit v0.12

