summaryrefslogtreecommitdiff
path: root/pcr/statusnet/PKGBUILD
blob: 998751df53dc7ac1bc92e68f9d6e7c1d820edc35 (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
# Contributor: fauno <fauno@kiwwwi.com.ar>
pkgbase=statusnet
pkgname=statusnet-base
pkgver=0.9.9

# find available plugins and locales
srcfile=${SRCDEST}/${pkgbase}-${pkgver}.tar.gz
if [ -e ${srcfile} ]; then
plugins=($(bsdtar -tf ${srcfile} \
                      ${pkgbase}-${pkgver}/plugins | \
                      cut -d'/' -f3 | sort -u))
locales=($(bsdtar -tf ${srcfile} \
                      ${pkgbase}-${pkgver}/locale | \
                      cut -d'/' -f3 | sort -u))
fi

# looping avoids having "statusnet-plugin-" package
pkgname=(${pkgname}
         $(for plugin in ${plugins[@]}; do
             echo ${plugin} | tr [A-Z] [a-z] | \
             sed "s/^/statusnet-plugin-/"
         done)
         $(for locale in ${locales[@]}; do
             echo ${locale} | tr [A-Z] [a-z] | \
             sed "s/^/statusnet-i18n-/"
         done))
pkgrel=1
arch=('any')
pkgdesc="StatusNet is a Free and Open Source microblogging platform."
url="http://status.net"
license=('AGPL')
depends=('php>=5.2.3' 'mysql>=5' 'php-gd' 'php-curl' 'php-gmp')
source=("http://status.net/${pkgbase}-${pkgver}.tar.gz"
        statusnet.install)
install=statusnet.install
md5sums=('766c9d42825fc99d8ad6c554a959568b'
         'c638cb36b7da7eb67a67e031f59e6068')
options=(!strip !zipman emptydirs)

build() {
    /bin/true
}

package_statusnet-base() {
  provides=('statusnet')
  optdepends=('memcache: for caching database queries'
              'php-xcache: for accelerating PHP code execution'
              'php-apc: for accelerating PHP code execution'
              'php-ldap: for the LDAP plugin'
              'statusnet-plugin-ostatus: for federation')

  cd "$srcdir/$pkgbase-${pkgver}"

  etc_dir="${pkgdir}/etc/webapps/${pkgbase}"
  usr_dir="${pkgdir}/usr/share/webapps/${pkgbase}"

  install -d ${usr_dir}
  install -d ${etc_dir}
  install -d ${pkgdir}/usr/share/doc/${pkgbase}/
  install -d ${pkgdir}/usr/share/licenses/${pkgbase}

  install -m644 ./{config.php,htaccess}.sample \
      ${pkgdir}/usr/share/doc/${pkgbase}/

  install -m644 ./{README,EVENTS.txt,lighttpd.conf.example} \
      ${pkgdir}/usr/share/doc/${pkgbase}/

  install -m644 COPYING ${pkgdir}/usr/share/licenses/${pkgbase}/

  rm -f *.sample README COPYING README EVENTS.txt *.example

  cp -ra * ${usr_dir}/
  chmod a+w ${usr_dir}/{avatar,background,file}

  msg2 "Install bogus config.php"
  touch ${etc_dir}/config.php
  chmod a+w ${etc_dir}/config.php
  ln -s /etc/webapps/statusnet/config.php ${usr_dir}/config.php

  msg2 "Remove locale and plugins in favor of split packages"
  rm -rf ${usr_dir}/{locale,plugins}

  install -d ${usr_dir}/plugins
  install -d ${usr_dir}/locale

  install -d ${pkgdir}/srv/http
  ln -s /usr/share/webapps/${pkgbase} ${pkgdir}/srv/http/
} 

# Helper for creating i18n packages
statusnet-i18n-helper() {
  cd "${srcdir}/${pkgbase}-${pkgver}"

  install -d "${pkgdir}/usr/share/webapps/statusnet/locale/${1}"
  cp -ra "./locale/${1}" "${pkgdir}/usr/share/webapps/statusnet/locale/${1}/"
}

# Helper for creating plugin packages
statusnet-plugin-helper() {
  cd "${srcdir}/${pkgbase}-${pkgver}"

  install -d "${pkgdir}/usr/share/webapps/statusnet/plugins/${1}"
  cp -ra "./plugins/${1}" "${pkgdir}/usr/share/webapps/statusnet/plugins/${1}/"
}


for plugin in ${plugins[@]}; do
    plugin_lower=$(echo ${plugin} | tr [A-Z] [a-z])

    eval "
package_statusnet-plugin-${plugin_lower}() {
    pkgdesc='${plugin} plugin for StatusNet'
    depends=('statusnet-base')
    groups=('statusnet-plugins')

    statusnet-plugin-helper ${plugin}
}"
done

for locale in ${locales[@]}; do
    locale_lower=$(echo ${locale} | tr [A-Z] [a-z])

    eval "
package_statusnet-i18n-${locale_lower}() {
    pkgdesc='${locale} locale for StatusNet'
    depends=('statusnet-base')
    groups=('statusnet-locales')

    statusnet-i18n-helper ${locale}
}"
done