Patched in changes to 1.28.1 to allow OmniOS/Illumos to build and work

haven't attempted to build yet, there are some changes
pull/842/head
Rick Sayre 2015-05-17 17:18:54 -07:00
parent ea7c1f6883
commit 12516da3dc
17 changed files with 94 additions and 12 deletions

View File

@ -34,6 +34,11 @@ case $host_os in
HOST_OS='BSD'
AC_DEFINE(BSD,1,"This is a BSD system")
;;
*solaris*)
# Do something specific for Solaris
HOST_OS='solaris'
AC_DEFINE(SOLARIS,1,"We are running a Solaroid OS [tested on OmniOS]")
;;
*)
#Default Case
AC_MSG_ERROR([Your platform is not currently supported])

View File

@ -834,6 +834,8 @@ sub killAll
if ( '@HOST_OS@' eq 'BSD' )
{
$killall = 'killall -';
} elsif ( '@HOST_OS@' eq 'solaris' ) {
$killall = 'pkill -';
} else {
$killall = 'killall -q -s ';
}

View File

@ -189,7 +189,7 @@ if ( $command =~ /^(?:start|restart)$/ )
if ( $status eq "stopped" )
{
if ( $Config{ZM_DYN_DB_VERSION}
and ( $Config{ZM_DYN_DB_VERSION} ne ZM_VERSION )
and ( $Config{ZM_DYN_DB_VERSION} ne $Config{ZM_VERSION} )
)
{
Fatal( "Version mismatch, system is version ".ZM_VERSION
@ -294,7 +294,12 @@ sub systemdRunning
{
my $result = 0;
my $output = qx(ps -o comm="" 1);
my $output;
if ( '@HOST_OS@' eq 'solaris' ) {
$output = qx(ps -o comm="" -p 1);
} else {
$output = qx(ps -o comm="" 1);
}
chomp( $output );
if ($output =~ /systemd/) {
@ -309,7 +314,12 @@ sub calledBysystem
my $result = 0;
my $ppid = getppid();
my $output = qx(ps -o comm="" $ppid);
my $output;
if ( '@HOST_OS@' eq 'solaris' ) {
$output = qx(ps -o comm="" -p $ppid);
} else {
$output = qx(ps -o comm="" $ppid);
}
chomp( $output );
if ($output =~ /^(?:systemd|init)$/) {

View File

@ -82,7 +82,7 @@ use constant EVENT_PATH => ($Config{ZM_DIR_EVENTS}=~m|/|)?$Config{ZM_DIR_EVENTS}
$| = 1;
$ENV{PATH} = '/bin:/usr/bin:/usr/local/bin';
$ENV{PATH} = '/bin:/usr/bin:/usr/local/bin:/opt/local/bin';
$ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL};
delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
@ -165,7 +165,7 @@ if ( $check && $Config{ZM_CHECK_FOR_UPDATES} )
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
$ua->agent( "ZoneMinder Update Agent/".ZM_VERSION );
$ua->agent( "ZoneMinder Update Agent/".$Config{ZM_VERSION} );
if ( $Config{ZM_UPDATE_CHECK_PROXY} ) {
$ua->proxy( "http", $Config{ZM_UPDATE_CHECK_PROXY} );
}
@ -374,13 +374,13 @@ if ( $version )
my ( $detaint_version ) = $version =~ /^([\w.]+)$/;
$version = $detaint_version;
if ( ZM_VERSION eq $version )
if ( $Config{ZM_VERSION} eq $version )
{
print( "\nDatabase already at version $version, update aborted.\n\n" );
exit( 0 );
}
print( "\nInitiating database upgrade to version ".ZM_VERSION." from version $version\n" );
print( "\nInitiating database upgrade to version ".$Config{ZM_VERSION}." from version $version\n" );
if ( $interactive )
{
if ( $Config{ZM_DYN_DB_VERSION} && $Config{ZM_DYN_DB_VERSION} ne $version )
@ -489,7 +489,7 @@ if ( $version )
}
print( "\nUpgrading database to version ".ZM_VERSION."\n" );
print( "\nUpgrading database to version ".$Config{ZM_VERSION}."\n" );
# Update config first of all
loadConfigFromDB();
@ -1050,7 +1050,7 @@ if ( $version )
if ( $cascade )
{
my $installed_version = ZM_VERSION;
my $installed_version = $Config{ZM_VERSION};
my $sql = "update Config set Value = ? where Name = ?";
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
my $res = $sth->execute( "$installed_version", "ZM_DYN_DB_VERSION" ) or die( "Can't execute: ".$sth->errstr() );
@ -1061,7 +1061,7 @@ if ( $version )
zmDbDisconnect();
die( "Can't find upgrade from version '$version'" );
}
print( "\nDatabase upgrade to version ".ZM_VERSION." successful.\n\n" );
print( "\nDatabase upgrade to version ".$Config{ZM_VERSION}." successful.\n\n" );
}
zmDbDisconnect();
exit( 0 );

View File

@ -25,6 +25,10 @@
#define ZM_H
#include "zm_config.h"
#ifdef SOLARIS
#undef DEFAULT_TYPE // pthread defines this which breaks StreamType DEFAULT_TYPE
#include <string.h> // define strerror() and friends
#endif
#include "zm_logger.h"
#include <stdint.h>

View File

@ -23,7 +23,11 @@
#include "zm.h"
#include "zm_coord.h"
#ifndef SOLARIS
#include <math.h>
#else
#include <cmath>
#endif
//
// Class used for storing a box, which is defined as a region

View File

@ -36,6 +36,10 @@
#include <sys/param.h>
#include <netinet/tcp.h>
#ifdef SOLARIS
#include <sys/filio.h> // define FIONREAD
#endif
int CommsBase::readV( int iovcnt, /* const void *, int, */ ... )
{
va_list arg_ptr;

View File

@ -27,6 +27,12 @@
#define AV_ERROR_MAX_STRING_SIZE 64
#endif
#ifdef SOLARIS
#include <sys/errno.h> // for ESRCH
#include <signal.h>
#include <pthread.h>
#endif
FfmpegCamera::FfmpegCamera( int p_id, const std::string &p_path, const std::string &p_method, const std::string &p_options, int p_width, int p_height, int p_colours, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture ) :
Camera( p_id, FFMPEG_SRC, p_width, p_height, p_colours, ZM_SUBPIX_ORDER_DEFAULT_FOR_COLOUR(p_colours), p_brightness, p_contrast, p_hue, p_colour, p_capture ),
mPath( p_path ),

View File

@ -1580,7 +1580,11 @@ Image *Image::Highlight( unsigned int n_images, Image *images[], const Rgb thres
{
uint8_t *psrc = images[j]->buffer+c;
#ifndef SOLARIS
if ( (unsigned)abs((*psrc)-RGB_VAL(ref_colour,c)) >= RGB_VAL(threshold,c) )
#else
if ( (unsigned)std::abs((*psrc)-RGB_VAL(ref_colour,c)) >= RGB_VAL(threshold,c) )
#endif
{
count++;
}

View File

@ -542,7 +542,10 @@ void Logger::logPrint( bool hex, const char * const file, const int line, const
if ( (syscall(SYS_thr_self, &tid)) < 0 ) // Thread/Process id
# else
// SOLARIS doesn't have SYS_gettid; don't assume
#ifdef SYS_gettid
if ( (tid = syscall(SYS_gettid)) < 0 ) // Thread/Process id
#endif // SYS_gettid
#endif
#endif // HAVE_SYSCALL
#endif

View File

@ -55,6 +55,11 @@
#include <sys/shm.h>
#endif // ZM_MEM_MAPPED
// SOLARIS - we don't have MAP_LOCKED on openSolaris/illumos
#ifndef MAP_LOCKED
#define MAP_LOCKED 0
#endif
//=============================================================================
std::vector<std::string> split(const std::string &s, char delim) {
std::vector<std::string> elems;

View File

@ -20,7 +20,11 @@
#include "zm.h"
#include "zm_poly.h"
#ifndef SOLARIS
#include <math.h>
#else
#include <cmath>
#endif
void Polygon::calcArea()
{

View File

@ -26,6 +26,10 @@
#include <errno.h>
#include <netdb.h>
#ifdef SOLARIS
#include <sys/filio.h> // FIONREAD and friends
#endif
RemoteCameraHttp::RemoteCameraHttp( int p_id, const std::string &p_method, const std::string &p_host, const std::string &p_port, const std::string &p_path, int p_width, int p_height, int p_colours, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture ) :
RemoteCamera( p_id, "http", p_host, p_port, p_path, p_width, p_height, p_colours, p_brightness, p_contrast, p_hue, p_colour, p_capture )
{

View File

@ -35,6 +35,7 @@
class ThreadException : public Exception
{
private:
#ifndef SOLARIS
pid_t pid() {
pid_t tid;
#ifdef __FreeBSD__
@ -50,6 +51,9 @@ pid_t pid() {
#endif
return tid;
}
#else
pthread_t pid() { return( pthread_self() ); }
#endif
public:
ThreadException( const std::string &message ) : Exception( stringtf( "(%d) "+message, (long int)pid() ) ) {
}
@ -213,7 +217,11 @@ protected:
Mutex mThreadMutex;
Condition mThreadCondition;
#ifndef SOLARIS
pid_t mPid;
#else
pthread_t mPid;
#endif
bool mStarted;
bool mRunning;
@ -221,6 +229,7 @@ protected:
Thread();
virtual ~Thread();
#ifndef SOLARIS
pid_t id() const
{
pid_t tid;
@ -238,6 +247,12 @@ protected:
#endif
return tid;
}
#else
pthread_t id() const
{
return( pthread_self() );
}
#endif
void exit( int status = 0 )
{
//INFO( "Exiting" );

View File

@ -33,6 +33,7 @@ private:
class TimerException : public Exception
{
private:
#ifndef SOLARIS
pid_t pid() {
pid_t tid;
#ifdef __FreeBSD__
@ -48,6 +49,9 @@ private:
#endif
return tid;
}
#else
pthread_t pid() { return( pthread_self() ); }
#endif
public:
TimerException( const std::string &message ) : Exception( stringtf( "(%d) "+message, (long int)pid() ) )
{

View File

@ -22,8 +22,6 @@
// This section contains options substituted by the zmconfig.pl utility, do not edit these directly
//
define( "ZM_CONFIG", "@ZM_CONFIG@" ); // Path to config file
// Define, and override any given in config file
define( "ZM_VERSION", "@VERSION@" ); // Version
$configFile = ZM_CONFIG;
$localConfigFile = basename($configFile);
@ -48,6 +46,13 @@ while ( !feof($cfg) )
define( $matches[1], $matches[2] );
}
fclose( $cfg );
// Define, and override any given in config file
// to override, must be done AFTER asignment, cripes
// @VERSION@ hasn't been defined in tests, perhaps configure.ac needs fix?
if (!defined("ZM_VERSION")) { // avoid double definition warning
define( "ZM_VERSION", "@VERSION@" ); // Version
}
//
// This section is options normally derived from other options or configuration

View File

@ -48,3 +48,6 @@ ZM_DB_PASS=@ZM_DB_PASS@
# Host of this machine
ZM_SERVER_HOST=
# Version of zoneminder - must be set
ZM_VERSION=1.28.1