summaryrefslogtreecommitdiff
path: root/pcr/zoneminder/PKGBUILD
blob: c53cc26952f02080c608f2b2942b4a65eff58885 (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
# 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>

# based of debian squeeze package

pkgname=zoneminder
pkgver=1.25.0
pkgrel=15
pkgdesc='Capture, analyse, record and monitor video security cameras'
arch=(i686 x86_64 mips64el)
backup=(etc/zm.conf etc/httpd/conf/extra/httpd-zm.conf)
url=http://www.$pkgname.com
license=(GPL)
depends=(
  apache cambozola ffmpeg gnutls mysql perl-archive-zip perl-date-manip perl-dbd-mysql perl-dbi perl-libwww perl-mime-lite 
  perl-mime-tools perl-net-sftp-foreign perl-sys-mmap perl-time-modules perl-x10 php php-apache php-gd php-mcrypt
)
makedepends=(netpbm)
install=$pkgname.install
source=(
  http://www.$pkgname.com/downloads/ZoneMinder-$pkgver.tar.gz
  patch-ffmpeg-0.11.patch
  patch-libavcodec-detection.patch
  $pkgname-1.25.0-kernel35.patch
  httpd-zm.conf
  zm.rc.d
  $pkgname.service
)
md5sums=(
  eaefa14befd482154970541252aa1a39
  81c8be870260142e2633eedf73c72040
  94bf5d95fe5429f7df458ddfbabf0c12
  48a3c48394e18bf072f7b32730db18df
  831e3538facff18e27d402e36dbd6b8d
  034b61cda8849fc3001849e76ef26041
  7487cc72ead82aea0bc78f2e4106ae1a
)
build() {
  cd $srcdir/ZoneMinder-$pkgver

  export CPPFLAGS=-D__STDC_CONSTANT_MACROS \
    ZM_SSL_LIB=gnutls

  # 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 support new ffmpeg
  patch -p1 < $srcdir/patch-ffmpeg-0.11.patch

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

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

  ./configure --prefix=/usr \
    --build \
    --enable-crashtrace=yes \
    --enable-debug=yes \
    --enable-mmap=yes \
    --mandir=/usr/share/man \
    --sysconfdir=/etc \
    --with-cgidir=/usr/lib/$pkgname/cgi-bin \
    --with-ffmpeg=/usr \
    --with-libarch=lib \
    --with-mysql=/usr \
    --with-webdir=/usr/share/$pkgname \
    --with-webgroup=http \
    --with-webuser=http
  make V=0
}

package() {
  cd $srcdir/ZoneMinder-$pkgver

  make DESTDIR=$pkgdir \
    ZM_LOGDIR=$pkgdir/var/log/zm \
    ZM_RUNDIR=$pkgdir/run \
    ZM_TMPDIR=$pkgdir/tmp \
    install

  rmdir $pkgdir/run
  rmdir $pkgdir/tmp

  mkdir -p $pkgdir/etc/httpd/conf/extra
  mkdir -p $pkgdir/etc/rc.d
  mkdir -p $pkgdir/usr/lib/systemd/system
  mkdir -p $pkgdir/usr/share/license/$pkgname
  mkdir -p $pkgdir/usr/share/$pkgname/db
  mkdir -p $pkgdir/var/cache/$pkgname

  for i in events images temp; do
    mv    $pkgdir/usr/share/$pkgname/$i $pkgdir/var/cache/$pkgname/$i
    ln -s /var/cache/$pkgname/$i        $pkgdir/usr/share/$pkgname/$i
  done

  ln -s /usr/lib/$pkgname/cgi-bin          $pkgdir/usr/share/$pkgname
  ln -s /usr/share/cambozola/cambozola.jar $pkgdir/usr/share/$pkgname

  chown    http.http $pkgdir/etc/zm.conf
  chown -R http.http $pkgdir/var/cache/$pkgname
  chown    http.http $pkgdir/var/log/zm

  install -D -m 644 $srcdir/httpd-zm.conf    $pkgdir/etc/httpd/conf/extra
  install -D -m 644 $srcdir/zm.rc.d          $pkgdir/etc/rc.d/zm
  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
}