pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/security/zoneminder Patch up some Linux-specific assum...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/3467f836d3b0
branches:  trunk
changeset: 649803:3467f836d3b0
user:      dsainty <dsainty%pkgsrc.org@localhost>
date:      Fri Apr 10 02:58:49 2015 +0000

description:
Patch up some Linux-specific assumptions in the code.

Fixes build under NetBSD.

Bump PKGREVISION for switch to ffmpeg2, and some portability changes that
aren't expected to affect functionality.

diffstat:

 security/zoneminder/Makefile                               |   3 +-
 security/zoneminder/distinfo                               |   8 ++-
 security/zoneminder/patches/patch-src_zm__thread.h         |  34 ++++++++++++-
 security/zoneminder/patches/patch-src_zm__timer.h          |  10 +++-
 security/zoneminder/patches/patch-src_zm_ffmpeg_camera_cpp |  18 +++++++
 security/zoneminder/patches/patch-src_zm_signal_cpp        |  25 ++++++++++
 6 files changed, 88 insertions(+), 10 deletions(-)

diffs (163 lines):

diff -r 9d3e3cb12554 -r 3467f836d3b0 security/zoneminder/Makefile
--- a/security/zoneminder/Makefile      Fri Apr 10 02:53:20 2015 +0000
+++ b/security/zoneminder/Makefile      Fri Apr 10 02:58:49 2015 +0000
@@ -1,7 +1,8 @@
-# $NetBSD: Makefile,v 1.16 2015/04/10 02:53:20 dsainty Exp $
+# $NetBSD: Makefile,v 1.17 2015/04/10 02:58:49 dsainty Exp $
 
 PKGNAME=       ${DISTNAME:S/ZoneMinder-/zoneminder-/}
 DISTNAME=      ZoneMinder-1.28.1
+PKGREVISION=   1
 CATEGORIES=    security
 MASTER_SITES=  ${MASTER_SITE_GITHUB:=ZoneMinder/}
 GITHUB_PROJECT=        ZoneMinder
diff -r 9d3e3cb12554 -r 3467f836d3b0 security/zoneminder/distinfo
--- a/security/zoneminder/distinfo      Fri Apr 10 02:53:20 2015 +0000
+++ b/security/zoneminder/distinfo      Fri Apr 10 02:58:49 2015 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.6 2015/04/07 12:54:36 dsainty Exp $
+$NetBSD: distinfo,v 1.7 2015/04/10 02:58:49 dsainty Exp $
 
 SHA1 (ZoneMinder-1.28.1.tar.gz) = 3e173ae1aac529b60d79a5fc668c107f0679d0a2
 RMD160 (ZoneMinder-1.28.1.tar.gz) = b3cc305656cb5b73d4ac0e21fe937c237467cdd1
@@ -8,14 +8,16 @@
 SHA1 (patch-scripts_ZoneMinder_lib_ZoneMinder_General_pm) = 841d897662958698a4dfcb95dd5bc43bb5fed568
 SHA1 (patch-scripts_zm_in) = 8f59085bb9293afa7aeb268000c75988e5371c66
 SHA1 (patch-src_Makefile_am) = 0f6571c9d5a3e688544f93d687d266e1b71f0f43
-SHA1 (patch-src_zm__thread.h) = fd4fc0a5d8003a29777ce57fe928901ca50b50f7
-SHA1 (patch-src_zm__timer.h) = 7371f7dbe42f04d031276eda3b2e94bd8f24cf68
+SHA1 (patch-src_zm__thread.h) = 67dbd1e9c19df63fd120344cc8a36d663a724409
+SHA1 (patch-src_zm__timer.h) = 38080d08b5834e3dae713e81488944887ce5848b
 SHA1 (patch-src_zm__utils.cpp) = f6a109296146822014d57d39094390adcc5df760
 SHA1 (patch-src_zm__utils.h) = dbda8ba527f08b0337f6d2afa155ce4adc733e1e
 SHA1 (patch-src_zm_comms_cpp) = d40932a3d0ae4375a649f200d973995d56aa71c7
 SHA1 (patch-src_zm_comms_h) = baeb73040ff3ba862f23ad6301de7daba182456e
+SHA1 (patch-src_zm_ffmpeg_camera_cpp) = 6ead5f9afbe984aab14fee337093fd0269c6e9d8
 SHA1 (patch-src_zm_logger_cpp) = 3b0373e9d648d25ef4e3e09429199f654f876ccb
 SHA1 (patch-src_zm_remote_camera_h) = 0d4bd7dae0188df7e463586250ac2ed530230f3d
+SHA1 (patch-src_zm_signal_cpp) = fa11938f55ccd50a1a9e949d6b58dd07773f2690
 SHA1 (patch-src_zm_thread_cpp) = c5f64697c3024c6c382f9ae2c5dbe9c21b529b6e
 SHA1 (patch-src_zmc_cpp) = d1046ddfad3a88bdd30501237834ec9e9fbc4c83
 SHA1 (patch-web_Makefile.am) = ddb3815fa1b1799658034789302c8d3840f2b894
diff -r 9d3e3cb12554 -r 3467f836d3b0 security/zoneminder/patches/patch-src_zm__thread.h
--- a/security/zoneminder/patches/patch-src_zm__thread.h        Fri Apr 10 02:53:20 2015 +0000
+++ b/security/zoneminder/patches/patch-src_zm__thread.h        Fri Apr 10 02:58:49 2015 +0000
@@ -1,13 +1,39 @@
-$NetBSD: patch-src_zm__thread.h,v 1.3 2015/04/05 08:51:08 dsainty Exp $
+$NetBSD: patch-src_zm__thread.h,v 1.4 2015/04/10 02:58:49 dsainty Exp $
+
+Fix build with Clang.
+
+pthread_t is opaque, and under NetBSD is a pointer.  It's being abused here,
+but the value is only used for logging, and casting pthread_self() is more
+portable than syscall(SYS_gettid).
 
 --- src/zm_thread.h.orig       2015-02-05 15:52:37.000000000 +1300
-+++ src/zm_thread.h    2015-04-01 17:04:46.728233504 +1300
-@@ -32,7 +32,7 @@
++++ src/zm_thread.h    2015-04-09 18:48:51.419626259 +1200
+@@ -22,17 +22,15 @@
+ 
+ #include <unistd.h>
+ #include <pthread.h>
++#include <stdint.h>
+ #include <unistd.h>
+-#ifdef HAVE_SYS_SYSCALL_H
+-#include <sys/syscall.h>
+-#endif // HAVE_SYS_SYSCALL_H
+ #include "zm_exception.h"
+ #include "zm_utils.h"
+ 
  class ThreadException : public Exception
  {
  public:
 -    ThreadException( const std::string &message ) : Exception( stringtf( "(%d) "+message, (long int)syscall(SYS_gettid) ) )
-+    ThreadException( const std::string &message ) : Exception( stringtf( ("(%d) "+message).c_str(), (long int)syscall(SYS_gettid) ) )
++    ThreadException( const std::string &message ) : Exception( stringtf( ("(%lu) "+message).c_str(), (unsigned long)(uintptr_t)pthread_self() ) )
      {
      }
  };
+@@ -205,7 +203,7 @@
+ 
+     pid_t id() const
+     {
+-        return( (pid_t)syscall(SYS_gettid) );
++        return (pid_t)(uintptr_t)pthread_self();
+     }
+     void exit( int status = 0 )
+     {
diff -r 9d3e3cb12554 -r 3467f836d3b0 security/zoneminder/patches/patch-src_zm__timer.h
--- a/security/zoneminder/patches/patch-src_zm__timer.h Fri Apr 10 02:53:20 2015 +0000
+++ b/security/zoneminder/patches/patch-src_zm__timer.h Fri Apr 10 02:58:49 2015 +0000
@@ -1,4 +1,10 @@
-$NetBSD: patch-src_zm__timer.h,v 1.2 2015/04/05 08:51:08 dsainty Exp $
+$NetBSD: patch-src_zm__timer.h,v 1.3 2015/04/10 02:58:49 dsainty Exp $
+
+Fix build with Clang.
+
+pthread_t is opaque, and under NetBSD is a pointer.  It's being abused here,
+but the value is only used for logging, and casting pthread_self() is more
+portable than syscall(SYS_gettid).
 
 --- src/zm_timer.h.orig        2008-07-25 09:33:24.000000000 +0000
 +++ src/zm_timer.h
@@ -7,7 +13,7 @@
      {
      public:
 -        TimerException( const std::string &message ) : Exception( stringtf( "(%d) "+message, (long int)syscall(SYS_gettid) ) )
-+        TimerException( const std::string &message ) : Exception( stringtf( ("(%d) "+message).c_str(), (long int)syscall(SYS_gettid) ) )
++        TimerException( const std::string &message ) : Exception( stringtf( ("(%lu) "+message).c_str(), (unsigned long)(uintptr_t)pthread_self() ) )
          {
          }
      };
diff -r 9d3e3cb12554 -r 3467f836d3b0 security/zoneminder/patches/patch-src_zm_ffmpeg_camera_cpp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/security/zoneminder/patches/patch-src_zm_ffmpeg_camera_cpp        Fri Apr 10 02:58:49 2015 +0000
@@ -0,0 +1,18 @@
+$NetBSD: patch-src_zm_ffmpeg_camera_cpp,v 1.1 2015/04/10 02:58:49 dsainty Exp $
+
+Replace the non-portable pthread_tryjoin_np() with pthread_join(), assessed
+as a reasonable patch by the original author.
+
+https://github.com/ZoneMinder/ZoneMinder/commit/7534557533a7347f4901a139c2b698e76aaf164d
+
+--- src/zm_ffmpeg_camera.cpp.orig      2015-04-09 12:31:49.987117639 +1200
++++ src/zm_ffmpeg_camera.cpp   2015-04-09 14:40:54.059009480 +1200
+@@ -120,7 +120,7 @@
+         void *retval = 0;
+         int ret;
+         
+-        ret = pthread_tryjoin_np(mReopenThread, &retval);
++        ret = pthread_join(mReopenThread, &retval);
+         if (ret != 0){
+             Error("Could not join reopen thread.");
+         }
diff -r 9d3e3cb12554 -r 3467f836d3b0 security/zoneminder/patches/patch-src_zm_signal_cpp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/security/zoneminder/patches/patch-src_zm_signal_cpp       Fri Apr 10 02:58:49 2015 +0000
@@ -0,0 +1,25 @@
+$NetBSD: patch-src_zm_signal_cpp,v 1.1 2015/04/10 02:58:49 dsainty Exp $
+
+Don't assume machine-dependent IP register details are available for any
+platform except Linux.  Only Linux is sure to have this style of mcontext_t.
+
+Resolves build on systems that have ucontext_t but an mcontext_t that
+doesn't look like Linux.
+
+--- src/zm_signal.cpp.orig     2015-04-09 19:15:46.423693213 +1200
++++ src/zm_signal.cpp  2015-04-09 19:18:25.475699808 +1200
+@@ -66,10 +66,14 @@
+               ucontext_t *uc = (ucontext_t *) context;
+ #if defined(__x86_64__)
+               cr2 = info->si_addr;
++#if defined(__linux__)
+               ip = (void *)(uc->uc_mcontext.gregs[REG_RIP]);
++#endif // defined(__linux__)
+ #else
+               cr2 = info->si_addr;
++#if defined(__linux__)
+               ip = (void *)(uc->uc_mcontext.gregs[REG_EIP]);
++#endif // defined(__linux__)
+ #endif                                // defined(__x86_64__)
+ 
+               // Print the signal address and instruction pointer if available



Home | Main Index | Thread Index | Old Index