summaryrefslogtreecommitdiff
path: root/pcr/zoneminder/PKGBUILD
blob: 97f7ee9b7790d702fb716c1a511649246c1380e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# 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>
# Maintainer (Parabola): André Silva     <emulatorman@lavabit.com>

pkgname=zoneminder
pkgver=1.25.0
pkgrel=13
pkgdesc="Capture, analyse, record and monitor video security cameras"
arch=('i686' 'x86_64' 'mips64el')
url="http://www.zoneminder.com"
license=('GPL')
depends=('cambozola' 'apache' 'php' 'php-gd' 'php-mcrypt' 'mysql' 'pcre' 'openssl' 'ffmpeg' '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' 'perl-net-sftp-foreign' 'perl-mime-tools' 'perl-io-tty' 'libv4l' 'libjpeg' 'gnutls' 'php-apache')
makedepends=()
install=zoneminder.install
source=("http://www.zoneminder.com/downloads/ZoneMinder-${pkgver}.tar.gz"
          zm.rc.d
          Controls_Orbit.sql
          zminit.arch
          customdb
          httpd-zm.conf
          zmeventbackup
          patch-ffmpeg-0.11.patch
          patch-libavcodec-detection.patch
          zoneminder-1.25.0-kernel35.patch
          arm-context.patch)

md5sums=('eaefa14befd482154970541252aa1a39'
         '9fb81f81b056c18be6eef3f1c8e0dd6d'
         '5033bc098bf497c8aed1fc1b3c9c5f9c'
         'f9720872736f26d17bc49d8725b75ae4'
         '942f6641c744ffe7d64846a5c34d84f1'
         'e63262d1417105ae24c7a03d98b2c64c'
         '1a6d7c43af79c786b27cc88f7ba7ed3e'
         'b872dd86926ab00c5d4733e7e38eaa9c'
         '94bf5d95fe5429f7df458ddfbabf0c12'
         '88bd124dfb841320cecb0a757b2a78c1'
         'b28c8eb392a7e7b6ef665817d7fe61f4')

build() {
  cd "$srcdir/ZoneMinder-$pkgver"

  # Patch for GCC 4.7.x
  sed -i -e '1 s/^/#include <unistd.h>\n/;' src/zm_logger.cpp
  sed -i -e '1 s/^/#include <unistd.h>\n/;' src/zm_thread.h

  # Patch for build/upgrade path
  sed -i -e 's#ZM_PATH_BUILD=@PATH_BUILD@#ZM_PATH_BUILD=/srv/zoneminder/upgrade\nZM_PATH_UPDATE=/srv/zoneminder/upgrade#' zm.conf.in

  # Patch for support new ffmpeg
  patch -p1 < ../patch-ffmpeg-0.11.patch

  # Patch for correct libavcodec detection
  patch -p0 < ../patch-libavcodec-detection.patch

  # Patch for type cast in kernel3.5
  patch -p0 < ../zoneminder-1.25.0-kernel35.patch

  # Patch for ARM
  if test "$CARCH" == arm; then
    patch -p0 < ../arm-context.patch
  fi

  # Add some more configs into DB
  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

  # chown line mucks everything up, we'll chown it in the install script
  sed -i '/chown/d' Makefile

  # modify hard-coded paths
  sed -i 's#/var/lib/zm#/srv/zoneminder/backup#' scripts/zmdbrestore.in
  sed -i 's#/var/lib/zm#/srv/zoneminder/backup#' scripts/zmlogrotate.conf.in
  sed -i 's#/var/lib/zm#/srv/zoneminder/backup#' scripts/zmdbbackup.in

  # Build it!
  make || return 1
  make DESTDIR="$pkgdir" ZM_RUNDIR="$pkgdir/var/run" ZM_TMPDIR="$pkgdir/tmp" ZM_LOGDIR="$pkgdir/var/log" install || return 1

  install -D -m 700 $startdir/src/zminit.arch  $startdir/pkg/srv/zoneminder/bin/zminit
  install -D -m 755 $startdir/src/zm.rc.d  $startdir/pkg/etc/rc.d/zm
  install -D -m 700 scripts/zmdbbackup  $startdir/pkg/srv/zoneminder/bin/zmdbbackup
  install -D -m 700 scripts/zmdbbackup  $startdir/pkg/srv/zoneminder/bin/zmdbbackup
  install -D -m 700 scripts/zmdbrestore  $startdir/pkg/srv/zoneminder/bin/zmdbrestore
  install -D -m 700 scripts/zmeventdump  $startdir/pkg/srv/zoneminder/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

  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/srv/zoneminder/upgrade/customdb
  install -D  db/zm*.sql $startdir/pkg/srv/zoneminder/upgrade/

  mkdir -p $startdir/pkg/var/run/zm

  ### remove special files
  find $startdir/pkg/ -name "perllocal.pod" \
    -o -name ".packlist"                \
    -o -name "*.bs"                     \
    |xargs -i rm -f {}

}

# vim:set ft=sh ts=2 sw=2 et: