summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b1332757c36b474f35d35b79cfaa439240f172ff (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
pkgname=cms-germany-git
pkgver=r3802.4d519c16
pkgrel=4
pkgdesc="CMS, or Contest Management System, is a distributed system for running and (to some extent) organizing a programming contest. This is a fork used for the German IOI team selection process."
arch=('i686' 'x86_64')
url="https://github.com/ioi-germany/cms"
license=('AGPL3')
depends=(
    'python2'
    'python2-tornado'
    'python2-psycopg2'
    'python2-sqlalchemy'
    'python2-netifaces'
    'python2-crypto'
    'python2-pytz'
    'python2-psutil'
    'python2-six'
    'python2-requests'
    'python2-gevent'
    'python2-werkzeug'
    'patool-py2'
    'python2-bcrypt'
    'python2-chardet'
    'python2-ipaddress'
    'python2-yaml'
    'postgresql'
    'postgresql-client'
    'libcgroup'
    'iso-codes'
    'shared-mime-info'
    'python2-pathlib'
    'asymptote'
    'texlive-core'
    'texlive-fontsextra'
    'texlive-latexextra'
    'texlive-pstricks'
    'libcap'
)
optdepends=(
    'python2-pycups: printing support'
    'python2-pypdf: printing support'
    'a2ps: printing support'
    'fpc: support for Pascal submissions'
    'jdk8-openjdk: support for Java submissions'
)
makedepends=(
    'asciidoc'
    'python2-setuptools'
)

provides=('cms-germany' 'isolate-germany')
conflicts=('cms' 'isolate')
install=$pkgname.install

source=(
    'git://github.com/ioi-germany/cms.git'
    'git://github.com/ioi-germany/isolate.git'
)
sha256sums=(
    'SKIP' 'SKIP'
)

pkgver() {
    cd cms
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
    cd isolate
    make PREFIX="/usr" VARPREFIX="/var" CONFIGDIR="/etc" isolate isolate.1

    cd ../cms

    git config submodule.isolate.url "$srcdir/isolate"
    git submodule update
}

package() {
    cd isolate
    make PREFIX="$pkgdir/usr" VARPREFIX="$pkgdir/var" CONFIGDIR="$pkgdir/etc" install install-doc

    # Patch the configuration file so that it uses a standard directory
    sed -i "s|/var/local/lib/isolate|/var/lib/isolate|" $pkgdir/etc/isolate

    # The isolate binary has the setuid bit set (to run as root without sudo)
    # however we should let only the owner and the group be able to run it:
    chmod o-x $pkgdir/usr/bin/isolate

    cd ../cms

    # Logs and cache directories
    install -d -m770 $pkgdir/var/log/cms
    install -d -m770 $pkgdir/var/cache/cms

    # Configuration files
    install -D -m660 config/cms.conf.sample $pkgdir/usr/lib/cms/cms.conf
    install -D -m660 config/cms.ranking.conf.sample $pkgdir/usr/lib/cms/cms.ranking.conf

    # I'm not even sure if this is needed at all
    install -d -m770 $pkgdir/var/lib/cms

    # Fix testlib.h path (maybe patch CMS for this?)
    install -d -m755 $pkgdir/usr/include/cms
    ln -s /usr/include/testlib.h $pkgdir/usr/include/cms/testlib.h

    python2 prerequisites.py build_l10n --as-root
    python2 setup.py install --root="$pkgdir" --optimize=1

    install -d $pkgdir/var/local/log
    install -d $pkgdir/var/local/cache
    install -d $pkgdir/var/local/lib
    install -d $pkgdir/var/local/run
    ln -s /var/log/cms $pkgdir/var/local/log/cms
    ln -s /var/cache/cms $pkgdir/var/local/cache/cms
    ln -s /var/lib/cms $pkgdir/var/local/lib/cms
    ln -s /var/run/cms $pkgdir/var/local/run/cms
}