From 3272723f1479ff10ce2b9a539db2df76ccb30683 Mon Sep 17 00:00:00 2001 From: dsainty Date: Fri, 10 Apr 2015 02:58:49 +0000 Subject: 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. --- 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 +++++-- .../patches/patch-src_zm_ffmpeg_camera_cpp | 18 ++++++++++++ .../zoneminder/patches/patch-src_zm_signal_cpp | 25 ++++++++++++++++ 6 files changed, 88 insertions(+), 10 deletions(-) create mode 100644 security/zoneminder/patches/patch-src_zm_ffmpeg_camera_cpp create mode 100644 security/zoneminder/patches/patch-src_zm_signal_cpp (limited to 'security') diff --git a/security/zoneminder/Makefile b/security/zoneminder/Makefile index e59d5b51ea7..e1816555831 100644 --- a/security/zoneminder/Makefile +++ b/security/zoneminder/Makefile @@ -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 --git a/security/zoneminder/distinfo b/security/zoneminder/distinfo index ccd4535e80f..c1a0253788a 100644 --- a/security/zoneminder/distinfo +++ b/security/zoneminder/distinfo @@ -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-configure_ac) = 110a7a10506ba931369904d777dec5cc2185f556 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 --git a/security/zoneminder/patches/patch-src_zm__thread.h b/security/zoneminder/patches/patch-src_zm__thread.h index 91469767f58..7d8489a656d 100644 --- a/security/zoneminder/patches/patch-src_zm__thread.h +++ b/security/zoneminder/patches/patch-src_zm__thread.h @@ -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 + #include ++#include + #include +-#ifdef HAVE_SYS_SYSCALL_H +-#include +-#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 --git a/security/zoneminder/patches/patch-src_zm__timer.h b/security/zoneminder/patches/patch-src_zm__timer.h index bcfa81c5066..3c18d3a80d5 100644 --- a/security/zoneminder/patches/patch-src_zm__timer.h +++ b/security/zoneminder/patches/patch-src_zm__timer.h @@ -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 @@ $NetBSD: patch-src_zm__timer.h,v 1.2 2015/04/05 08:51:08 dsainty Exp $ { 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 --git a/security/zoneminder/patches/patch-src_zm_ffmpeg_camera_cpp b/security/zoneminder/patches/patch-src_zm_ffmpeg_camera_cpp new file mode 100644 index 00000000000..e15cef78352 --- /dev/null +++ b/security/zoneminder/patches/patch-src_zm_ffmpeg_camera_cpp @@ -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 --git a/security/zoneminder/patches/patch-src_zm_signal_cpp b/security/zoneminder/patches/patch-src_zm_signal_cpp new file mode 100644 index 00000000000..b8a6c00fc65 --- /dev/null +++ b/security/zoneminder/patches/patch-src_zm_signal_cpp @@ -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 -- cgit v1.2.3