diff options
Diffstat (limited to 'abs/core/zoneminder/PKGBUILD')
-rw-r--r--[-rwxr-xr-x] | abs/core/zoneminder/PKGBUILD | 281 |
1 files changed, 205 insertions, 76 deletions
diff --git a/abs/core/zoneminder/PKGBUILD b/abs/core/zoneminder/PKGBUILD index 6b5c6c8..4dc5c63 100755..100644 --- a/abs/core/zoneminder/PKGBUILD +++ b/abs/core/zoneminder/PKGBUILD @@ -1,84 +1,213 @@ -# This is a ZoneMinder PKGBUILD file. -# Contributor: Ross melin <rdmelin@gmail.com> +# Maintainer: Vojtech Aschenbrenner <v@asch.cz> +# Contributor: Jason Gardner <buhrietoe@gmail.com> +# Contributor: Ross melin <rdmelin@gmail.com> +# Maintainer (Parabola): Márcio Silva <coadde@lavabit.com> +# Contributor (Parabola): André Silva <emulatorman@lavabit.com> + +# based of debian squeeze package pkgname=zoneminder pkgver=1.25.0 -pkgrel=2 -pkgdesc="Capture, analyse, record and monitor video security cameras." -arch=('i686' 'x86_64') -url="http://www.zoneminder.com" -license=('GPL') -depends=('cambozola' 'apache' 'php' 'mysql' 'pcre' 'openssl' 'ffmpeg' 'perl-php-serialization' 'perl-libwww' 'perl-date-manip' 'perl-unicode-map' 'perl-dbi' 'perl-dbd-mysql' 'perl-io-stringy' 'perl-mime-lite' 'perl-timedate' 'perl-x10' 'perl-time-modules' 'perl-net-smtp-ssl' 'perl-sys-mmap' 'sudo' 'libv4l') -makedepends=() -install=zoneminder.install -source=("http://www2.zoneminder.com/downloads/ZoneMinder-${pkgver}.tar.gz" -zm.rc.d -Controls_Orbit.sql -zminit.arch -customdb -httpd-zm.conf -zmfilter.pl -zmeventbackup -Makefile.patch -run) +pkgrel=22 +pkgdesc='Capture, analyse, record and monitor video security cameras' +arch=( + i686 + x86_64 + mips64el +) +backup=( + etc/zm.conf +) +url="http://www.$pkgname.com" +license=( + GPL +) +depends=( + #apache + lighttpd + cambozola + #ffmpeg-static + ffmpeg + gnutls + mysql + perl-archive-zip + perl-date-manip + perl-dbd-mysql + perl-dbi + perl-expect + perl-libwww + perl-mime-lite + perl-mime-tools + perl-php-serialization + perl-net-sftp-foreign + perl-sys-mmap + perl-time-modules + perl-x10 + php + #php-apache + php-gd + php-mcrypt +) +makedepends=( + netpbm +) +optdepends=( + netpbm +) +install=$pkgname.install +source=( + http://www.$pkgname.com/downloads/ZoneMinder-$pkgver.tar.gz + httpd-$pkgname.conf + $pkgname + $pkgname.service + patch-ffmpeg-0.11.patch + zm.include + zm.sysctrl.conf +) + build() { - cd "$srcdir/ZoneMinder-$pkgver" - - cat ../Controls_Orbit.sql >> db/zm_create.sql.in - ./configure --prefix=/usr \ - --sysconfdir=/etc \ - --with-webuser=http \ - --with-webgroup=http \ - --with-mysql=/usr \ - --with-webdir=/srv/zoneminder/www \ - --with-cgidir=/srv/zoneminder/cgi-bin \ - --bindir=/srv/zoneminder/bin \ - ZM_SSL_LIB=openssl \ - CPPFLAGS=-D__STDC_CONSTANT_MACROS - # goddamn chown line just mucks everything up, we'll chown it in the install - # script. - sed -i '/chown/d' Makefile - make || return 1 - make DESTDIR="$pkgdir" install || return 1 - - install -D -m 700 $startdir/src/zminit.arch $startdir/pkg/usr/lib/zm/bin/zminit - install -D -m 700 $startdir/src/zm.rc.d $startdir/pkg/etc/rc.d/zm - install -D -m 700 scripts/zmdbbackup $startdir/pkg/usr/lib/zm/bin/zmdbbackup - install -D -m 700 scripts/zmdbrestore $startdir/pkg/usr/lib/zm/bin/zmdbrestore - install -D -m 700 scripts/zmeventdump $startdir/pkg/usr/lib/zm/bin/zmeventdump - install -D -m 700 scripts/zmlogrotate.conf $startdir/pkg/etc/logrotate.d/zm - install -D -m 700 $startdir/src/zmeventbackup $startdir/pkg/etc/cron.hourly/zmeventbackup - install -D -m 755 scripts/zmfilter.pl $startdir/pkg/usr/lib/zm/bin/zmfilter.pl - install -D -m 755 scripts/zmupdate.pl $startdir/pkg/usr/lib/zm/bin/zmupdate.pl - - mkdir -p $startdir/pkg/etc/httpd/conf/extra/ - install -m 644 $startdir/src/httpd-zm.conf $startdir/pkg/etc/httpd/conf/extra/httpd-zm.conf - - install -D -m 700 $startdir/src/customdb $startdir/pkg/usr/lib/zm/upgrade/customdb - install -D db/zm*.sql $startdir/pkg/usr/lib/zm/upgrade/ - - mkdir -p $startdir/pkg/var/run/zm - mkdir -p $startdir/pkg/var/lib/zm - - #install runit files - mkdir -p $pkgdir/etc/sv/zm - install -D -m 755 $srcdir/run $pkgdir/etc/sv/zm - - ### remove special files - find $startdir/pkg/ -name "perllocal.pod" \ - -o -name ".packlist" \ - -o -name "*.bs" \ - |xargs -i rm -f {} + cd $srcdir/ZoneMinder-$pkgver + + # ZM_RUNDIR need change to run dir + export CPPFLAGS=-D__STDC_CONSTANT_MACROS\ + ZM_LOGDIR=/var/log/$pkgname\ + ZM_RUNDIR=/tmp/$pkgname\ + ZM_SSL_LIB=gnutls\ + ZM_TMPDIR=/tmp/$pkgname + + # Patch for GCC 4.7.x + sed -i -e 's/^#include <errno.h>/#include <errno.h>\n#include <unistd.h>/'\ + src/zm_logger.cpp || read + sed -i -e 's/^#include <pthread.h>/#include <pthread.h>\n#include <unistd.h>/'\ + src/zm_thread.h || read + + # Patch for automake 1.12 + sed -i -e '/am__api_version=/ s/1.11/1.12/'\ + configure || read + + # Patch for disable ZM_CHECK_FOR_UPDATES + sed -i -e '/ZM_CHECK_FOR_UPDATES/,+1 s/yes/no/'\ + scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in || read + + # Patch for support html5 video and flv + sed -i -e '/ZM_MPEG_LIVE_FORMAT/,+1 s/swf/webm/;/ZM_MPEG_REPLAY_FORMAT/,+1 s/swf/webm/; + /ZM_FFMPEG_FORMATS/,+1 s/mpg mpeg wmv asf avi\* mov swf 3gp\*\*/mpg mpeg wmv asf avi\* mov flv swf 3gp\*\* webm ogg h254/'\ + scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in || read + + # Patch for change path run dir + sed -i -e '/ZM_PATH_SOCKS/,+1 s/TMP/RUN/'\ + scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in || read + + # Patch for change ZM name to ZoneMinder + sed -i -e '/ZM_WEB_TITLE_PREFIX/,+1 s/"ZM"/"ZoneMinder"/'\ + scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in || read + + # Patch for v4l1 compat support + sed -i -e "s/$ENV{SHELL} = \'\/bin\/sh\' if exists $ENV{SHELL};/$ENV{SHELL} = \'\/bin\/sh\' if exists $ENV{SHELL};\n$ENV{LD_PRELOAD} = \'\/usr\/lib\/libv4l\/v4l1compat.so\' ;/"\ + scripts/zmdc.pl.in || read + + # Patch for add more socket tries + sed -i -e '/$max_socket_tries/ s/3/15/'\ + web/ajax/stream.php || read + + # Patch for wrong "suppported" + sed -i -e 's/suppported/supported/'\ + src/zm_local_camera.cpp || read + + # Patch for type cast in linux-libre kernel 3.5 + sed -i -e 's/enum v4l2_buf_type type = v4l2_data.fmt.type;/enum v4l2_buf_type type = (v4l2_buf_type)v4l2_data.fmt.type;/'\ + src/zm_local_camera.cpp || read + + # Patch for drop custom perl install paths + sed -i -e '/# Slight hack for non-standard perl install paths/,+10 d; + s/^AC_SUBST(ZM_CONFIG,"$SYSCONFDIR\/zm.conf")/AC_SUBST(ZM_CONFIG,"$SYSCONFDIR\/zm.conf")\n\nEXTRA_PERL_LIB="# Include from system perl paths only"\nPERL_MM_PARMS="INSTALLDIRS=vendor"/'\ + configure.ac + + # Patch for support new ffmpeg + patch -p1 < $srcdir/patch-ffmpeg-0.11.patch +# sed -i -e 's/if ( av_open_input_file( \&mFormatContext, mPath.c_str(), NULL, 0, NULL ) !=0 )/if ( avformat_open_input( \&mFormatContext, mPath.c_str(), NULL, NULL ) !=0 )/; +# s/if ( avcodec_open( mCodecContext, mCodec ) < 0 )/if ( avcodec_open2( mCodecContext, mCodec, NULL ) < 0 )/'\ +# src/zm_ffmpeg_camera.cpp +# sed -i -e 's/if ( av_set_parameters(ofc, NULL) < 0 )/\/\*\n \* Removed in last ffmpeg\n \* if ( av_set_parameters(ofc, NULL) < 0 )/; +# /Panic( "Invalid output format parameters" );/,+1 s/}/}\*/; +# /if ( avio_open(&ofc->pb, filename, URL_WRONLY) < 0 )/ s/URL_WRONLY/AVIO_FLAG_WRITE/; +# s/av_write_header(ofc);/avformat_write_header(ofc, NULL);/'\ +# src/zm_mpeg.cpp + sed -i -e 's/avcodec_init/avcodec_open/'\ + configure{,.ac} + + # Patch for support ffmpeg with <libavutil/mathematics.h> and C library + sed -i -e 's/^extern "C" {/extern "C" {\n#ifdef _STDINT_H\n#undef _STDINT_H\n#endif\n#include <stdint.h>/ + s/^#include <libavutil\/avutil.h>/#include <libavutil\/avutil.h>\n#include <libavutil\/mathematics.h>/'\ + src/zm_ffmpeg.h + sed -i -e 's/^AM_CONFIG_HEADER(config.h)/AM_CONFIG_HEADER(config.h)\n\nAC_SUBST([AM_CXXFLAGS], [-D__STDC_CONSTANT_MACROS])/; + s/^AC_CHECK_HEADERS(mysql\/mysql.h,,AC_MSG_ERROR(zm requires MySQL headers - check that MySQL development packages are installed),)/AC_CHECK_HEADERS(mysql\/mysql.h,,AC_MSG_ERROR(zm requires MySQL headers - check that MySQL development packages are installed),)\nAC_LANG_PUSH([C])/; + s/^AC_CHECK_HEADERS(libswscale\/swscale.h,,,)/AC_CHECK_HEADERS(libswscale\/swscale.h,,,)\nAC_LANG_POP([C])/'\ + configure.ac + + # Patch for wrong install run, tmp and log dir + sed -i -e '/ install-data-hook/d;/install-data-hook:/d;/# Yes, you are correct. This is a HACK!/d; + / ( cd $(DESTDIR)$(sysconfdir); chown $(webuser):$(webgroup) $(sysconf_DATA); chmod 600 $(sysconf_DATA) )/d; + / ( if ! test -e $(ZM_RUNDIR); then mkdir -p $(ZM_RUNDIR); fi; if test "$(ZM_RUNDIR)" != "\/var\/run"; then chown $(webuser):$(webgroup) $(ZM_RUNDIR); chmod u+w $(ZM_RUNDIR); fi )/d; + / ( if ! test -e $(ZM_TMPDIR); then mkdir -m 700 -p $(ZM_TMPDIR); fi; if test "$(ZM_TMPDIR)" != "\/tmp"; then chown $(webuser):$(webgroup) $(ZM_TMPDIR); chmod u+w $(ZM_TMPDIR); fi )/d; + / ( if ! test -e $(ZM_LOGDIR); then mkdir -p $(ZM_LOGDIR); fi; if test "$(ZM_LOGDIR)" != "\/var\/log"; then chown $(webuser):$(webgroup) $(ZM_LOGDIR); chmod u+w $(ZM_LOGDIR); fi )/,+1 d'\ + Makefile.{am,in} + + ./configure --prefix=/usr\ + --enable-crashtrace=no\ + --enable-debug=no\ + --enable-mmap=yes\ + --sysconfdir=/etc\ + --with-cgidir=/data/srv/httpd/cgi-bin\ + --with-extralibs='-L/usr/lib -L/usr/lib/mysql'\ + --with-ffmpeg=/usr\ + --with-libarch=lib\ + --with-mysql=/usr\ + --with-webdir=/data/srv/httpd/$pkgname\ + --with-webgroup=http\ + --with-webhost=localhost\ + --with-webuser=http + + make V=0 +} + +package() { + cd $srcdir/ZoneMinder-$pkgver + + make DESTDIR=$pkgdir install + + mkdir -p $pkgdir/{etc/{httpd/conf/extra,rc.d},data/srv/httpd/{cgi-bin,$pkgname},usr/{lib/systemd/system,share/{license/$pkgname,$pkgname/db}},var/{cache/$pkgname,log/$pkgname}} + + chown -R http.http $pkgdir/{etc/zm.conf,var/{cache/$pkgname,log/$pkgname}} + chmod 0700 $pkgdir/etc/zm.conf + + for i in events images temp; do + mv $pkgdir/data/srv/httpd/$pkgname/$i $pkgdir/var/cache/$pkgname/$i + ln -s /var/cache/$pkgname/$i $pkgdir/data/srv/httpd/$pkgname/$i + chown -h http.http $pkgdir/data/srv/httpd/$pkgname/$i + done + + ln -s /data/srv/httpd/cgi-bin $pkgdir/data/srv/httpd/$pkgname + chown -h http.http $pkgdir/data/srv/httpd/{cgi-bin,$pkgname,$pkgname/cgi-bin} + + ln -s /usr/share/cambozola/cambozola.jar $pkgdir/data/srv/httpd/$pkgname + mkdir -p $pkgdir/etc/lighttpd + install -D -m 644 $srcdir/zm.include $pkgdir/etc/lighttpd/ + #sysctrl conf + install -o root -g root -D -m 0755 $srcdir/zm.sysctrl.conf $startdir/pkg/etc/sysctl.d/zm.conf + + install -D -m 644 $srcdir/httpd-$pkgname.conf $pkgdir/etc/httpd/conf/extra + install -D -m 644 $srcdir/$pkgname $pkgdir/etc/rc.d + install -D -m 644 $srcdir/$pkgname.service $pkgdir/usr/lib/systemd/system + install -D -m 644 COPYING $pkgdir/usr/share/license/$pkgname + install -D -m 644 db/zm*.sql $pkgdir/usr/share/$pkgname/db } md5sums=('eaefa14befd482154970541252aa1a39' - 'b20fb25b187eb6abb21321e153a7fb25' - '5033bc098bf497c8aed1fc1b3c9c5f9c' - 'f9720872736f26d17bc49d8725b75ae4' - '4ace13d1e20934abe192ef7372c75988' - '00201eba9c0a5d1ed14b10cc55410698' - '80c52cc3575073a7462ff6a54886a345' - '8b40137b6ff54f2fb26104b70edd22e9' - 'bb308c2393e947a224d56862c85a3ad9' - '0c7024c355ce36828627bed10d965202') + '72380d8793a784ec24cb6809aea4a739' + '034b61cda8849fc3001849e76ef26041' + 'ca3fe00739707b9f92eaaa9034d4da2b' + '81c8be870260142e2633eedf73c72040' + '9d93f9b7b0a1384df533efde19ed3021' + '9a60f8b9af050220e1cb86da438952b3') |