summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 53aafdd5088a5cb33c662de595c61ef29d86898a (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
# Maintainer: Troy Will <troydwill at gmail dot com>
# Contributor: Charles Spence IV         <cspence@unomaha.edu>
# Contributor: /dev/rs0                  </dev/rs0@secretco.de.com>
# Contributor: Jacek Burghardt           <jacek@hebe.us>
# Contributor: Vojtech Aschenbrenner     <v@asch.cz>
# Contributor: Jason Gardner             <buhrietoe@gmail.com>
# Contributor: Ross melin                <rdmelin@gmail.com>
# Contributor (Parabola): Márcio Silva   <coadde@lavabit.com>
# Contributor (Parabola): André Silva    <emulatorman@lavabit.com>
# Orginally based on a Debian Squeeze package
_pkgname=zoneminder
pkgname=zoneminder
pkgver=1.28.1
pkgrel=4
pkgdesc='Capture, analyse, record and monitor video security cameras'
arch=( i686 x86_64 mips64el arm armv7h )
backup=( etc/zm.conf )
url="https://github.com/ZoneMinder/ZoneMinder/releases"
license=( GPL )
depends=(
    mariadb perl-dbd-mysql perl-dbi
    apache php php-apache php-gd php-mcrypt perl-php-serialization
    perl-libwww perl-net-sftp-foreign
    ffmpeg vlc perl-sys-mmap
    gnutls polkit
    perl-expect perl-archive-zip perl-date-manip
    perl-mime-lite perl-mime-tools
)
makedepends=(
    cmake make gcc netpbm
)
optdepends=(
    netpbm
    cambozola
    perl-time-modules
    perl-x10
    perl-astro-suntime
)
install=$_pkgname.install

source=(
    https://github.com/ZoneMinder/ZoneMinder/archive/v$pkgver.tar.gz
    httpd-zoneminder.conf
    zoneminder.service
    zoneminder-tmpfile.conf
)
sha256sums=('e55fa6ce1fd6c27912cd1de67fca3f80fad579f330020a384dc82838704d11ba'
            'c2ca71ec57e53da040de61ff212ac063574e5ddfb4c333b70be060d5ec26c62c'
            '7eb2f26246e240e23502da44854d5ed14485aa11bc448ad73e9b57fee13f00a3'
            'cc8af737c3c07750fc71317c81999376e4bbb39da883780164a8747b3d7c95a7'
           )
     
build() {
    cd $srcdir/ZoneMinder-$pkgver

    # ZM_PERL_SUBPREFIX=/lib/perl5 flag added to force Perl modules
    # to /usr/lib/perl5/ on non i686 architectures
    
    cmake -DCMAKE_INSTALL_PREFIX=/usr \
          -DZM_PERL_SUBPREFIX=/lib/perl5 \
          -DZM_WEBDIR=/srv/http/zoneminder \
          -DZM_CGIDIR=/srv/http/cgi-bin \
          -DZM_WEB_USER=http \
          -DZM_CONTENTDIR=/var/cache/zoneminder \
          -DZM_LOGDIR=/var/log/zoneminder \
          -DZM_RUNDIR=/run/zoneminder \
          -DZM_TMPDIR=/srv/zoneminder/tmp \
          -DZM_SOCKDIR=/srv/zoneminder/socks .
     
    make V=0
}
     
package() {

    cd $srcdir/ZoneMinder-$pkgver

    DESTDIR=$pkgdir make install

    # Change Polkit directory permissions to Arch Linux policy
    chmod -v 700 $pkgdir/usr/share/polkit-1/rules.d/
    chown -v polkitd $pkgdir/usr/share/polkit-1/rules.d/

    # BEGIN CREATE_ZONEMINDER_DIRECTORIES
    mkdir -pv           $pkgdir/var/{cache/zoneminder,log/zoneminder}
    chown -Rv http.http $pkgdir/var/{cache/zoneminder,log/zoneminder}
    
    mkdir -v           $pkgdir/srv/zoneminder
    chown -v http.http $pkgdir/srv/zoneminder
    mkdir -v           $pkgdir/srv/zoneminder/socks
    chown -v http.http $pkgdir/srv/zoneminder/socks
    
    mkdir -pv          $pkgdir/srv/zoneminder/tmp
    chown -v http.http $pkgdir/srv/zoneminder/tmp
    
    chown -v  http.http $pkgdir/etc/zm.conf 
    chmod 0700          $pkgdir/etc/zm.conf
    # END CREATE_ZONEMINDER_DIRECTORIES

    # Make content directories in /var/cache/zoneminder and to link them in /srv/http/zoneminder
    for i in events images temp; do
        mkdir              $pkgdir/var/cache/$_pkgname/$i
        chown -v http.http $pkgdir/var/cache/$_pkgname/$i
        ln -s                     /var/cache/$_pkgname/$i $pkgdir/srv/http/$_pkgname/$i
        chown -v --no-dereference http.http               $pkgdir/srv/http/$_pkgname/$i
    done

    # Create a link to the Zoneminder cgi binaries
    ln -sv /srv/http/cgi-bin $pkgdir/srv/http/$_pkgname

    chown -h http.http $pkgdir/srv/http/{cgi-bin,$_pkgname,$_pkgname/cgi-bin}

    # Link Cambozola
    # ln -s /usr/share/cambozola/cambozola.jar $pkgdir/srv/http/$_pkgname

    # Install configuration files
    mkdir -p                                        $pkgdir/etc/httpd/conf/extra
    install -D -m 644 $srcdir/httpd-$_pkgname.conf  $pkgdir/etc/httpd/conf/extra
    
    mkdir -p                                        $pkgdir/usr/lib/systemd/system
    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
    
    mkdir -p                                        $pkgdir/usr/share/doc/$_pkgname
    # install -D -m 644 $srcdir/README              $pkgdir/usr/share/doc/$_pkgname

    install -Dm644 ../zoneminder-tmpfile.conf "$pkgdir"/usr/lib/tmpfiles.d/zoneminder.conf

}