summaryrefslogtreecommitdiff
path: root/community/cherokee/PKGBUILD
blob: 5e2b612349a847cc97f405de2f3740d0407ead01 (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
# $Id: PKGBUILD 55615 2011-09-16 00:44:29Z foutrelis $
# Maintainer: Evangelos Foutras <evangelos@foutrelis.com>
# Contributor: Link Dupont <link@subpop.net>

pkgname=cherokee
pkgver=1.2.99
pkgrel=3
pkgdesc="A very fast, flexible and easy to configure Web Server"
arch=('i686' 'x86_64')
url="http://www.cherokee-project.com/"
license=('GPL2')
depends=('openssl' 'pcre')
makedepends=('python2' 'gettext' 'libldap' 'pam' 'libmysqlclient'
             'ffmpeg' 'geoip')
optdepends=('python2: cherokee-admin (administrative web interface)'
            'libldap: ldap validator'
            'pam: pam validator'
            'libmysqlclient: mysql validator'
            'ffmpeg: Audio/Video streaming handler'
            'geoip: GeoIP rule module'
            'rrdtool: RRDtool based information collector')
backup=('etc/cherokee/cherokee.conf'
        'etc/logrotate.d/cherokee')
options=('!libtool')
source=(http://www.cherokee-project.com/download/1.2/$pkgver/cherokee-$pkgver.tar.gz
        cherokee.rc
        cherokee.logrotate
        fix-ctk-path-handler-match.patch)
md5sums=('c83115c3eebb29e6f2b4cc6fe699affe'
         'a2d2b69c6220fab57cda4f531b680f9f'
         '8d69341bd4002bffd69c6e82ff6c905f'
         'e9475edd26ee24d035783e5999244857')

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

  # Fix path matching bug in CTK apps (e.g. market)
  patch -Np1 -i "$srcdir/fix-ctk-path-handler-match.patch"

  # Use subdirectory for logs
  sed -i -r 's|(%localstatedir%/log)|\1/cherokee|' cherokee.conf.sample.pre

  # Use Python 2 in cherokee-admin
  sed -i 's/"python"/"python2"/' cherokee/main_admin.c

  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --localstatedir=/var \
    --disable-static \
    --with-wwwroot=/srv/http \
    --with-wwwuser=http \
    --with-wwwgroup=http \
    --with-python=python2 \
    --enable-os-string="Arch Linux"
  make
}

package() {
  cd "$srcdir/$pkgname-$pkgver"

  make -j1 DESTDIR="$pkgdir" install

  # PAM configuration file for cherokee
  install -D -m644 pam.d_cherokee "$pkgdir/etc/pam.d/$pkgname"

  # Fix ownership of /var/lib/cherokee/graphs
  chown -R http:http "$pkgdir/var/lib/$pkgname/graphs"

  # Use Python 2
  sed -i 's/env python$/&2/' \
    "$pkgdir/usr/share/cherokee/admin/"{server,upgrade_config}.py \
    "$pkgdir/usr/bin/"{CTK-run,cherokee-{admin-launcher,tweak}}
  sed -i -r "s/['\"]python/&2/g" \
    "$pkgdir/usr/share/cherokee/admin/wizards/django.py"

  # Compile Python scripts
  python2 -m compileall "$pkgdir"
  python2 -O -m compileall "$pkgdir"

  install -d -o http -g http "$pkgdir/var/log/$pkgname"
  install -D "$srcdir/$pkgname.rc" "$pkgdir/etc/rc.d/$pkgname"
  install -Dm644 "$srcdir/$pkgname.logrotate" "$pkgdir/etc/logrotate.d/$pkgname"

  # Cleanup
  rm -rf "$pkgdir/srv"
}

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