summaryrefslogtreecommitdiff
path: root/pcr/zoneminder/PKGBUILD
blob: bf03b41333a3855bc5f4071246264c3c3638bda7 (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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# Maintainer:  Jacek Burghardt           <jacek@hebe.us>
# 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

pkgbase=zoneminder
pkgname=zoneminder
pkgver=1.25.0
pkgrel=27
pkgdesc='Capture, analyse, record and monitor video security cameras'
arch=(
  i686
  x86_64
  mips64el
  arm
)
backup=(
  etc/zm.conf
)
url="http://www.$pkgbase.com"
license=(
  GPL
)
depends=(
  apache
  cambozola
  gnutls
  mariadb
  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=$pkgbase.install
source=(
  http://www.$pkgbase.com/downloads/ZoneMinder-$pkgver.tar.gz
  httpd-$pkgbase.conf
  $pkgbase
  $pkgbase.service
  zoneminder-1.25.0-kernel35.patch
  zoneminder-1.25.0-gcc47.patch
  zoneminder-1.25.0-ffmpeg.patch
  zoneminder-1.25-text.patch
  zoneminder-1.25-fixwarning.patch
  zoneminder-1.25.0-gcrypt.patch
)
sha512sums=(
  3e18993b0539729491052c97d8c94227ccc089eb40277c2f07682f30049033303c7cfe9734fdac6d33ae67df29c76eb72bf7fbb5dae8227e8831fa603b61c375
  4ce0d8eba9d006d258f5b8a83920fc17f1f602b96518d37b7a47cd9b6eb84ef2587641a6ba839a469c3f0e33b46475866187279ae3f8be0d4054b074ee5d6b08
  ab4e1d5ddaf4d9cd53d6ca59d7965902afd6a2dc830fbbafa270736c52c2b3563075fee860bb0276466f96e9dbfb71b259ac45a4ae2e4ead8eaec154a0159eb0
  cfb0eb87a989236c72741a496ddc6a73aa2696e5beaaca4836d3c231ddb24c7ef5e9f65e7afa49674f2115cbfa4a07c75486e1947ce294c816ddbb875f3b99cf
  4fa79e49a3c04e9fdc9823792c6a28012002479c77ed41637bd2d21f089e4c15592bfcd5c24028f356c9f80d774a5080a6841e8e70a435d607e3089d0b121775
  3da7d4d21dea166ea12b49e88a05a9f7a75790881a1f2d7588fa9e0e6ce592b4b5ee71994fa8b05236efeeb57890157a622c752c12a9059c2ee915adf3b4660d
  7fc2a4663c3103bef641be065bd7992a2b3dc0699f1b99dc2fdb34c1c48e58686e490d3ade523ef7c8e29b3f04109658eef652c26ff6ee3fb9aee65453bdb6c4
  17b85051543c34a41c6b94ec8f46a10927aa4bc9554562650788c8257ffba8e362500cf3641708f2f9dabebc663a2d012fa9feacd7f9b33c637fbc965d405adf
  8eab0a922968465fee8537dc035ce781e51dc84cc05259a32acb5bf59c618bc1700dbf4eec90717ed5959841def119357974d109df8d7450c12ca4ea8576e55c
  8c9e7debcaf60be1c2dda656f95e497f6812d704edc3ca4a1c915a3b3c9dc1749c91d96bc2d60db7d90d5edfd9e2dfc39010dfe4feabfecfffd27f1fffc3d675
)

build() {
  cd $srcdir/ZoneMinder-$pkgver
  # 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
  sed -i -e '/am__api_version=/ s/1.11/1.13.1/'\
        configure || read
    # Patch for add more socket tries
  sed -i -e '/$max_socket_tries/ s/3/15/'\
      web/ajax/stream.php || 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 h264/'\
     scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in || read
   # Patch for wrong "suppported"
  sed -i -e 's/suppported/supported/'\
     src/zm_local_camera.cpp || read
  

   patch -Np1 -F99 -i ../zoneminder-1.25.0-kernel35.patch
   patch -Np1 -F99 -i ../zoneminder-1.25.0-gcc47.patch 
   patch -Np1 -F99 -i ../zoneminder-1.25.0-ffmpeg.patch
   patch -Np1 -F99 -i ../zoneminder-1.25-text.patch   
   patch -Np1 -F99 -i ../zoneminder-1.25-fixwarning.patch
   patch -Np1 -F99 -i ../zoneminder-1.25.0-gcrypt.patch

export CXXFLAGS=-D__STDC_CONSTANT_MACROS
./configure --prefix=/usr\
    --enable-crashtrace=no\
    --enable-debug=no\
    --enable-mmap=yes\
    --sysconfdir=/etc\
    --with-cgidir=/srv/http/cgi-bin\
    --with-extralibs='-L/usr/lib -L/usr/lib/mysql'\
    --with-libarch=lib\
    --with-ffmpeg=/usr \
    --with-mysql=/usr\
    --with-webdir=/srv/http/$pkgbase\
    --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},srv/http/{cgi-bin,$pkgbase},usr/{lib/systemd/system,share/{license/$pkgbase,$pkgbase/db}},var/{cache/$pkgbase,log/$pkgbase}}
  mkdir -p $pkgdir/srv/zoneminder/socks
  chown -R http.http $pkgdir/{etc/zm.conf,var/{cache/$pkgbase,log/$pkgbase}}
  chown -R http.http $pkgdir/srv/zoneminder/socks
  chmod 0700 $pkgdir/etc/zm.conf

  for i in events images temp; do
    mv    $pkgdir/srv/http/$pkgbase/$i $pkgdir/var/cache/$pkgbase/$i
    ln -s /var/cache/$pkgbase/$i       $pkgdir/srv/http/$pkgbase/$i
    chown -h http.http                 $pkgdir/srv/http/$pkgbase/$i
  done

  ln -s /srv/http/cgi-bin                  $pkgdir/srv/http/$pkgbase
  chown -h http.http                       $pkgdir/srv/http/{cgi-bin,$pkgbase,$pkgbase/cgi-bin}

  ln -s /usr/share/cambozola/cambozola.jar $pkgdir/srv/http/$pkgbase

  install -D -m 644 $srcdir/httpd-$pkgbase.conf $pkgdir/etc/httpd/conf/extra
  install -D -m 644 $srcdir/$pkgbase            $pkgdir/etc/rc.d
  install -D -m 644 $srcdir/$pkgbase.service    $pkgdir/usr/lib/systemd/system
  install -D -m 644 COPYING                     $pkgdir/usr/share/license/$pkgbase
  install -D -m 644 db/zm*.sql                  $pkgdir/usr/share/$pkgbase/db
}