summaryrefslogtreecommitdiff
path: root/pcr/spectrum
diff options
context:
space:
mode:
authorOmar Vega Ramos <ovruni@gnu.org.pe>2013-02-15 12:58:31 -0500
committerOmar Vega Ramos <ovruni@gnu.org.pe>2013-02-15 12:58:31 -0500
commit3b2e0940912977aadb95b4b19f7f46c18b6ae93e (patch)
tree10ac82b7c5b8e6af2722376600214cc9ce74e558 /pcr/spectrum
parent20e3130d771b0f74af0ef0fc0b36c5fa184e7e8f (diff)
Adding poco, libpurple-minimal and spectrum to pcr
Diffstat (limited to 'pcr/spectrum')
-rw-r--r--pcr/spectrum/PKGBUILD81
-rw-r--r--pcr/spectrum/gcc47.patch97
-rw-r--r--pcr/spectrum/logrotate.spectrum10
-rw-r--r--pcr/spectrum/spectrum.install45
-rw-r--r--pcr/spectrum/spectrum.tmpfiles1
-rw-r--r--pcr/spectrum/spectrum@.service14
6 files changed, 248 insertions, 0 deletions
diff --git a/pcr/spectrum/PKGBUILD b/pcr/spectrum/PKGBUILD
new file mode 100644
index 000000000..250840fb7
--- /dev/null
+++ b/pcr/spectrum/PKGBUILD
@@ -0,0 +1,81 @@
+# Maintainer: Clément Démoulins <clement@archivel.fr>
+# Contributor: Sonny Piers <sonny.piers@gmail.com>
+# Contributor: Tim Besard <tim.besard@gmail.com>
+# Contributor: miniature <miniature@archlinux.us>
+
+pkgname=spectrum
+pkgver=1.4.8
+pkgrel=4
+pkgdesc="XMPP libpurple transport/gateway."
+arch=('i686' 'x86_64' 'mips64el')
+url="http://spectrum.im"
+license=('GPL')
+depends=('gloox' 'libpurple-minimal' 'poco' 'python2' libev)
+replaces=('spectrum-git')
+makedepends=('cmake' 'gettext')
+optdepends=('mysql: MySQL database backend support'
+ 'postgresql-libs: PostgreSQL database backend support'
+ 'sqlite3: SQLite database backend support'
+ 'libevent: support for libevent'
+ 'imagemagick: support for avatars synchronization with legacy networks'
+
+ # Protocols plugins
+ 'mbpurple-svn: microblogging services support like Twitter or identi.ca/StatusNet'
+ 'msn-pecan: a different implementation of the MSN protocol for libpurple'
+ 'pidgin-facebookchat: Facebook support, with more features than Facebook XMPP server'
+ 'pidgin-sipe: SIPE protocol support'
+)
+backup=('etc/conf.d/spectrum')
+install='spectrum.install'
+
+source=('https://github.com/downloads/hanzz/libtransport/spectrum-1.4.8.tar.gz'
+ 'logrotate.spectrum'
+ 'gcc47.patch'
+ 'spectrum@.service'
+ 'spectrum.tmpfiles')
+md5sums=('edd88e1e70f86fe9aa4b43d787529a47'
+ '4f9cbfe3878fe5f4137d1bb5acc9e850'
+ '7a3de7e91d581b6c9119965ac34b9510'
+ '8abfd4926fec074847c4d28465af22bb'
+ '21dc715b3b2fb90c5349a12966277bc6')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+
+ msg "Starting make..."
+
+ sed -i -e 's/${PYTHON_EXECUTABLE}/python2/g' CMakeLists.txt
+ patch -p1 < ../gcc47.patch
+ cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr .
+ make
+
+ cd spectrumctl
+ python2 setup.py build
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+
+ # Various needed folders -- correct permissions are set in spectrum.install
+ install -d "${pkgdir}/etc/spectrum"
+ install -d "${pkgdir}/var/log/spectrum"
+ install -d "${pkgdir}/var/lib/spectrum"
+
+ # Install binaries and Python control script
+ make DESTDIR="${pkgdir}" install
+
+ cd spectrumctl
+ python2 setup.py install --root="${pkgdir}"
+
+ # Install initscript and logrotate config
+ install -Dm755 "${srcdir}/${pkgname}-${pkgver}/initscripts/archlinux/spectrum-rc.d" "${pkgdir}/etc/rc.d/spectrum"
+ install -Dm644 "${srcdir}/${pkgname}-${pkgver}/initscripts/archlinux/spectrum-conf.d" "${pkgdir}/etc/conf.d/spectrum"
+ install -Dm644 "${srcdir}/logrotate.spectrum" "${pkgdir}/etc/logrotate.d/spectrum"
+
+ # Install systemd related files
+ install -Dm644 "${srcdir}/spectrum@.service" "${pkgdir}/usr/lib/systemd/system/spectrum@.service"
+ install -Dm644 "${srcdir}/spectrum.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/spectrum.conf"
+
+ # Patch to use python2
+ sed -i -e "s|#!/usr/bin/env python|#!/usr/bin/env python2|" "${pkgdir}/usr/bin/spectrumctl"
+}
diff --git a/pcr/spectrum/gcc47.patch b/pcr/spectrum/gcc47.patch
new file mode 100644
index 000000000..82cc58677
--- /dev/null
+++ b/pcr/spectrum/gcc47.patch
@@ -0,0 +1,97 @@
+diff -rupN spectrum-1.4.8/src/configinterface.cpp spectrum-1.4.8_gcc47/src/configinterface.cpp
+--- spectrum-1.4.8/src/configinterface.cpp 2011-06-11 15:17:44.000000000 +0200
++++ spectrum-1.4.8_gcc47/src/configinterface.cpp 2012-04-14 18:27:14.000000000 +0200
+@@ -18,6 +18,7 @@
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
+ */
+
++#include <unistd.h>
+ #include "configinterface.h"
+ #include "sys/un.h"
+ #include "sys/socket.h"
+diff -rupN spectrum-1.4.8/src/spectrum_util.cpp spectrum-1.4.8_gcc47/src/spectrum_util.cpp
+--- spectrum-1.4.8/src/spectrum_util.cpp 2011-06-11 15:17:44.000000000 +0200
++++ spectrum-1.4.8_gcc47/src/spectrum_util.cpp 2012-04-14 18:26:33.000000000 +0200
+@@ -28,6 +28,7 @@
+ #include "protocols/abstractprotocol.h"
+ #include "transport.h"
+ #include <sys/param.h>
++#include <unistd.h>
+ #ifdef BSD
+ #include <sys/types.h>
+ #include <sys/sysctl.h>
+diff -rupN spectrum-1.4.8/src/utf8/checked.h spectrum-1.4.8_gcc47/src/utf8/checked.h
+--- spectrum-1.4.8/src/utf8/checked.h 2010-10-08 09:15:22.000000000 +0200
++++ spectrum-1.4.8_gcc47/src/utf8/checked.h 2012-04-14 18:26:31.000000000 +0200
+@@ -65,6 +65,35 @@ namespace utf8
+
+ /// The library API - functions intended to be called by the users
+
++ template <typename octet_iterator>
++ octet_iterator append(uint32_t cp, octet_iterator result)
++ {
++ if (!internal::is_code_point_valid(cp))
++ throw invalid_code_point(cp);
++
++ if (cp < 0x80) // one octet
++ *(result++) = static_cast<uint8_t>(cp);
++ else if (cp < 0x800) { // two octets
++ *(result++) = static_cast<uint8_t>((cp >> 6) | 0xc0);
++ *(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80);
++ }
++ else if (cp < 0x10000) { // three octets
++ *(result++) = static_cast<uint8_t>((cp >> 12) | 0xe0);
++ *(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f) | 0x80);
++ *(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80);
++ }
++ else if (cp <= internal::CODE_POINT_MAX) { // four octets
++ *(result++) = static_cast<uint8_t>((cp >> 18) | 0xf0);
++ *(result++) = static_cast<uint8_t>(((cp >> 12)& 0x3f) | 0x80);
++ *(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f) | 0x80);
++ *(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80);
++ }
++ else
++ throw invalid_code_point(cp);
++
++ return result;
++ }
++
+ template <typename octet_iterator, typename output_iterator>
+ output_iterator replace_invalid(octet_iterator start, octet_iterator end, output_iterator out, uint32_t replacement)
+ {
+@@ -104,35 +133,6 @@ namespace utf8
+ }
+
+ template <typename octet_iterator>
+- octet_iterator append(uint32_t cp, octet_iterator result)
+- {
+- if (!internal::is_code_point_valid(cp))
+- throw invalid_code_point(cp);
+-
+- if (cp < 0x80) // one octet
+- *(result++) = static_cast<uint8_t>(cp);
+- else if (cp < 0x800) { // two octets
+- *(result++) = static_cast<uint8_t>((cp >> 6) | 0xc0);
+- *(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80);
+- }
+- else if (cp < 0x10000) { // three octets
+- *(result++) = static_cast<uint8_t>((cp >> 12) | 0xe0);
+- *(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f) | 0x80);
+- *(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80);
+- }
+- else if (cp <= internal::CODE_POINT_MAX) { // four octets
+- *(result++) = static_cast<uint8_t>((cp >> 18) | 0xf0);
+- *(result++) = static_cast<uint8_t>(((cp >> 12)& 0x3f) | 0x80);
+- *(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f) | 0x80);
+- *(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80);
+- }
+- else
+- throw invalid_code_point(cp);
+-
+- return result;
+- }
+-
+- template <typename octet_iterator>
+ uint32_t next(octet_iterator& it, octet_iterator end)
+ {
+ uint32_t cp = 0;
diff --git a/pcr/spectrum/logrotate.spectrum b/pcr/spectrum/logrotate.spectrum
new file mode 100644
index 000000000..ae52ff156
--- /dev/null
+++ b/pcr/spectrum/logrotate.spectrum
@@ -0,0 +1,10 @@
+/var/log/spectrum/*.log {
+ notifempty
+ missingok
+ sharedscripts
+ postrotate
+ for P in /var/run/spectrum/*.pid; do
+ /bin/kill -HUP `cat "$P" 2>/dev/null` 2>/dev/null || true
+ done
+ endscript
+}
diff --git a/pcr/spectrum/spectrum.install b/pcr/spectrum/spectrum.install
new file mode 100644
index 000000000..d3e0449fc
--- /dev/null
+++ b/pcr/spectrum/spectrum.install
@@ -0,0 +1,45 @@
+# arg 1: the new package version
+post_install() {
+ if [ -z "`grep '^spectrum:' /etc/group`" ]; then
+ groupadd -g 417 spectrum
+ fi
+ if [ -z "`grep '^spectrum:' /etc/passwd`" ]; then
+ useradd -u 417 -d /etc/spectrum -g spectrum -s /bin/false spectrum
+ fi
+
+ chown spectrum:spectrum var/lib/spectrum
+ chown spectrum:spectrum var/log/spectrum
+
+cat << EOF
+
+==> Documentation: http://spectrum.im/
+
+==> You must now customize the configuration file located in /etc/spectrum/. Copy and reconfigure for each seperate protocol.
+
+EOF
+
+}
+
+# arg 1: the new package version
+# arg 2: the old package version
+post_upgrade() {
+ post_install $1
+}
+
+# arg 1: the old package version
+post_remove() {
+ userdel spectrum
+
+ paths=(/etc/spectrum /var/lib/spectrum /var/log/spectrum)
+
+ first=true
+ for path in ${paths[@]}; do
+ if [ -d $path ]; then
+ if $first; then
+ first=false
+ echo "==> Leftover Paths:"
+ fi
+ echo "==> $path"
+ fi
+ done
+}
diff --git a/pcr/spectrum/spectrum.tmpfiles b/pcr/spectrum/spectrum.tmpfiles
new file mode 100644
index 000000000..cabe97bc5
--- /dev/null
+++ b/pcr/spectrum/spectrum.tmpfiles
@@ -0,0 +1 @@
+d /run/spectrum 0750 spectrum spectrum -
diff --git a/pcr/spectrum/spectrum@.service b/pcr/spectrum/spectrum@.service
new file mode 100644
index 000000000..8e1338543
--- /dev/null
+++ b/pcr/spectrum/spectrum@.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Spectrum XMPP transport for %i
+After=network.service prosody.service ejabberd.service
+
+[Service]
+Type=forking
+PIDFile=/run/spectrum/%i.pid
+ExecStart=/usr/bin/spectrumctl --su=spectrum -c /etc/spectrum/%i.cfg start
+ExecStop=/usr/binspectrumctl --su=spectrum -c /etc/spectrum/%i.cfg stop
+ExecReload=/usr/binspectrumctl --su=spectrum -c /etc/spectrum/%i.cfg reload
+
+[Install]
+WantedBy=multi-user.target
+