summaryrefslogtreecommitdiffstats
path: root/abs/core/zoneminder/PKGBUILD
blob: c0bb18681e62b1cd7059e38c2d86a66734c8ebd3 (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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# Maintainer: Troy Will <troydwill at gmail dot com>
# 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>
# Contributor: Charles Spence IV         <cspence@unomaha.edu>
# Contributor: Joe Julian                <me@joejulian.name>     
# Orginally based on a Debian Squeeze package
_pkgname=zoneminder
pkgname=zoneminder
pkgver=1.30.2.r45.ga43adc2
pkgrel=2
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=(
    ffmpeg gnutls lighttpd mysql
    perl-archive-zip
    perl-class-std-fast
    perl-data-dump
    perl-data-uuid
    perl-date-manip
    perl-dbd-mysql
    perl-dbi
    perl-device-serialport
    perl-expect
    perl-io-socket-multicast
    perl-libwww
    perl-mime-lite
    perl-mime-tools
    perl-net-sftp-foreign
    perl-php-serialization
    perl-sys-cpu
    perl-sys-meminfo
    perl-sys-mmap
    perl-wsdl
    php php-gd php-mcrypt
    polkit
)
makedepends=(
    cmake make gcc netpbm
)
optdepends=(
    netpbm
    cambozola
    perl-time-modules
    perl-x10
    perl-astro-suntime
)
install=$pkgname.install
     
source=(
    git://github.com/$_pkgname/$_pkgname.git
    git://github.com/FriendsOfCake/crud.git
    httpd-zoneminder.conf
    zoneminder.service
    zoneminder-tmpfile.conf
    zm.include
    zm.sysctrl.conf
    zm_gen_light.conf
)
# Because the source is not static, skip Git checksum:
sha256sums=('SKIP'
            'SKIP'
            'ff7382b38ac07dadead0ad4d583e3dbcf8da4aaa06b76d048ee334f69f95db67'
            '043d77a995553c533d62f48db4b719d29cf6c7074f215d866130e97be57ed646'
            'cc8af737c3c07750fc71317c81999376e4bbb39da883780164a8747b3d7c95a7'
            '894c3f43fb9d77aec9edaed98bc556c90bed9326de57bc17cd33b44ab7818335'
            'bb50ad6411426d90df00568b967bf762844978cd34b84435ecbfc0d652c67b42'
            'eafcd625248731382506622eb3ff9b736b670f601692386723bd63275cacc781'
           )
     
pkgver() {
    cd "$_pkgname"
    # See https://wiki.archlinux.org/index.php/VCS_package_guidelines#The_pkgver.28.29_function
    git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare () {
    cd $srcdir/$_pkgname
    git submodule init
    git config submodule.web/api/app/Plugin/Crud.url $srcdir/crud
    git config submodule.web/api/app/Plugin/Crud.branch 3.0
    git submodule update
}

build() {
    cd $srcdir/$_pkgname

    # 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=/data/srv/httpd/zoneminder \
          -DZM_CGIDIR=/data/srv/httpd/cgi-bin \
          -DZM_WEB_USER=http \
          -DZM_CONTENTDIR=/var/cache/zoneminder \
          -DZM_LOGDIR=/var/log/zoneminder \
          -DZM_RUNDIR=/run/zoneminder \
          -DZM_TMPDIR=/var/lib/zoneminder/temp \
          -DZM_SOCKDIR=/data/srv/zoneminder/sock .
     
    make V=0
}
     
package() {

    cd $srcdir/$_pkgname

    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}
    
    # corresponds to -DZM_SOCKDIR=/data/srv/zoneminder/sock
    mkdir -pv          $pkgdir/data/srv/zoneminder/sock
    chown -v http.http $pkgdir/data/srv/zoneminder/sock
    
    # corresponds to -DZM_TMPDIR=/var/lib/zoneminder/temp
    mkdir -pv          $pkgdir/var/lib/zoneminder/temp
    chown -v http.http $pkgdir/var/lib/zoneminder/temp
    
    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/httpd/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/data/srv/httpd/$pkgname/$i
        chown -v --no-dereference http.http               $pkgdir/data/srv/httpd/$pkgname/$i
    done

    # Create a link to the Zoneminder cgi binaries
    ln -sv /data/srv/httpd/cgi-bin $pkgdir/data/srv/httpd/$pkgname

    chown -h http.http $pkgdir/data/srv/httpd/{cgi-bin,$pkgname,$pkgname/cgi-bin}

    # Link Cambozola
    # ln -s /usr/share/cambozola/cambozola.jar $pkgdir/data/srv/httpd/$pkgname

    # Install configuration files
    # don't need these in LinHES as we use lighttpd not apache
    #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

    #LinHES stuff
    #lighttpd zm include
    install -D -m644 $srcdir/zm.include $pkgdir/etc/lighttpd/zm.include
    #sysctrl conf - to set the shared mem
    install -o root -g root -D -m0755 $srcdir/zm.sysctrl.conf $pkgdir/etc/sysctl.d/zm.conf
    #gen_light_conf
    install -D -m0744 ${srcdir}/zm_gen_light.conf $pkgdir/etc/gen_light_conf.d/zoneminder.conf
}