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

# find available plugins and locales
# tar xf ${pkgbase}-${pkgver}.tar.gz # this isn't optimal but i couldn't trick
# makepkg to do it by itself
plugins=($(find ${pkgbase}-${pkgver}/plugins/ -mindepth 1 -maxdepth 1 -type d -printf "%f\n"))
locales=($(find ${pkgbase}-${pkgver}/locale/ -mindepth 1 -maxdepth 1 -type d -printf "%f\n" ))

pkgname=(statusnet-base
# plugins
         $(echo ${plugins[@]} | \
         tr [A-Z] [a-z] | tr ' ' "\n" | \
         sed "s/^/statusnet-plugin-/")
# locales
         $(echo ${locales[@]} | \
         tr [A-Z] [a-z] | tr ' ' "\n" | \
         sed "s/^/statusnet-i18n-/"))
pkgrel=1
pkgdesc="StatusNet is a Free and Open Source microblogging platform."
arch=('any')
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