From cef60d848566b56692a9604df7c4e53c8b5605c6 Mon Sep 17 00:00:00 2001 From: Kiyoshi Aman Date: Tue, 9 Oct 2018 17:03:32 -0500 Subject: user/prosody: new package --- user/prosody/APKBUILD | 59 ++++++++++++++++++++++++++++++++++++++ user/prosody/luasec-0.6-fix.patch | 14 +++++++++ user/prosody/mallinfo.patch | 13 +++++++++ user/prosody/prosody.cfg.lua.patch | 36 +++++++++++++++++++++++ user/prosody/prosody.initd | 47 ++++++++++++++++++++++++++++++ user/prosody/prosody.pre-install | 11 +++++++ user/prosody/prosodyctl.patch | 11 +++++++ 7 files changed, 191 insertions(+) create mode 100644 user/prosody/APKBUILD create mode 100644 user/prosody/luasec-0.6-fix.patch create mode 100644 user/prosody/mallinfo.patch create mode 100644 user/prosody/prosody.cfg.lua.patch create mode 100644 user/prosody/prosody.initd create mode 100644 user/prosody/prosody.pre-install create mode 100644 user/prosody/prosodyctl.patch diff --git a/user/prosody/APKBUILD b/user/prosody/APKBUILD new file mode 100644 index 000000000..990de722f --- /dev/null +++ b/user/prosody/APKBUILD @@ -0,0 +1,59 @@ +# Contributor: Mika Havela +# Contributor: Francesco Colista +# Maintainer: Kiyoshi Aman +pkgname=prosody +pkgver=0.10.2 +pkgrel=0 +pkgdesc="Lua based Jabber/XMPP server" +url="http://prosody.im/" +arch="all" +options="!check" # broken testsuite +license="MIT" +depends="lua-socket lua-expat lua-filesystem lua-sec lua5.3" +makedepends="linux-headers lua5.3-dev libidn-dev openssl-dev" +install="prosody.pre-install" +subpackages="$pkgname-doc $pkgname-openrc" +pkgusers="prosody" +pkggroups="prosody" +source="https://prosody.im/downloads/source/$pkgname-$pkgver.tar.gz + prosody.cfg.lua.patch + mallinfo.patch + $pkgname.initd + " + +build() { + cd "$builddir" + ./configure \ + --prefix=/usr \ + --sysconfdir=/etc/prosody \ + --ostype=linux \ + --with-lua-lib=/usr/lib \ + --with-lua-include=/usr/include \ + --lua-version=5.3 \ + --no-example-certs + # Don't generate certs + rm -f "$builddir"/certs/Makefile + + make +} + +check() { + cd "$builddir" + make test +} + +package() { + cd "$builddir" + make DESTDIR="$pkgdir" install + + install -d -o prosody -g prosody "$pkgdir/var/log/prosody" + install -d -o prosody -g prosody "$pkgdir/var/run/prosody" + install -d -m750 -o prosody -g prosody "$pkgdir/var/lib/prosody" + + install -D -m755 "$srcdir"/"$pkgname".initd "$pkgdir"/etc/init.d/"$pkgname" +} + +sha512sums="9fc05e34b45b0c16835ba94a73532fb3b4ee335f27d56bb9260e1b3e22614f89f44eb5d04b4e90d016db0b5bee6f5c7e7d099e1defb027e6823ee7667c1fe28f prosody-0.10.2.tar.gz +a6ca168fe3d11ee3b05295fb36dfaf8240c60a85507032b2502f9a97d3fd055f7eee38ba6efbb8f79472fc7cdd3556922194d0bd7099f7fb809be01890acc511 prosody.cfg.lua.patch +b07498cd42677d09f1a3fd4a5d91a085e90dd10cee7d6ee7c5e41438cfc2f4049ab9948c0fd0f7e148dd81f6a25c64c6ae832ea4864cee2329d3c6735216b78b mallinfo.patch +24360603dbd5d2a92758e6c4b4aab4f02cbd05373580cba2df76df98b6045891e8108e8c2d16af9508e93968ed5880db952e7a21b2742ebeec6f14b167968c2c prosody.initd" diff --git a/user/prosody/luasec-0.6-fix.patch b/user/prosody/luasec-0.6-fix.patch new file mode 100644 index 000000000..c8e37d091 --- /dev/null +++ b/user/prosody/luasec-0.6-fix.patch @@ -0,0 +1,14 @@ +diff --git a/util/dependencies.lua b/util/dependencies.lua +index 4d50cf6..9ea211d 100644 +--- a/util/dependencies.lua ++++ b/util/dependencies.lua +@@ -99,6 +99,9 @@ function check_dependencies() + ["luarocks"] = "luarocks install luasec"; + ["Source"] = "http://www.inf.puc-rio.br/~brunoos/luasec/"; + }, "SSL/TLS support will not be available"); ++ elseif not _G.ssl then ++ _G.ssl = ssl; ++ _G.ssl.context = require "ssl.context"; + end + + local encodings, err = softreq "util.encodings" diff --git a/user/prosody/mallinfo.patch b/user/prosody/mallinfo.patch new file mode 100644 index 000000000..4f9247c9b --- /dev/null +++ b/user/prosody/mallinfo.patch @@ -0,0 +1,13 @@ +diff --git a/util-src/pposix.c b/util-src/pposix.c +index e70a9d7..b9729ab 100644 +--- a/util-src/pposix.c ++++ b/util-src/pposix.c +@@ -52,7 +52,7 @@ + #include + #endif + +-#if !defined(WITHOUT_MALLINFO) && defined(__linux__) ++#ifdef __GLIBC__ + #include + #define WITH_MALLINFO + #endif diff --git a/user/prosody/prosody.cfg.lua.patch b/user/prosody/prosody.cfg.lua.patch new file mode 100644 index 000000000..ff74c5172 --- /dev/null +++ b/user/prosody/prosody.cfg.lua.patch @@ -0,0 +1,36 @@ +diff --git a/prosody.cfg.lua.dist b/prosody.cfg.lua.dist +index a0fc6c9..23a36ac 100644 +--- a/prosody.cfg.lua.dist ++++ b/prosody.cfg.lua.dist +@@ -13,6 +13,9 @@ + -- blanks. Good luck, and happy Jabbering! + + ++daemonize = true ++pidfile = "/var/run/prosody/prosody.pid" ++ + ---------- Server-wide settings ---------- + -- Settings in this section apply to the whole server and are the default settings + -- for any virtual hosts +@@ -86,7 +89,7 @@ modules_disabled = { + -- "offline"; -- Store offline messages + -- "c2s"; -- Handle client connections + -- "s2s"; -- Handle server-to-server connections +- -- "posix"; -- POSIX functionality, sends server to background, enables syslog, etc. ++ "posix"; -- POSIX functionality, sends server to background, enables syslog, etc. + } + + -- Disable account creation by default, for security +@@ -161,9 +164,9 @@ archive_expires_after = "1w" -- Remove archived messages after 1 week + -- Logging configuration + -- For advanced logging see https://prosody.im/doc/logging + log = { +- info = "prosody.log"; -- Change 'info' to 'debug' for verbose logging +- error = "prosody.err"; +- -- "*syslog"; -- Uncomment this for logging to syslog ++ -- info = "prosody.log"; -- Change 'info' to 'debug' for verbose logging ++ -- error = "prosody.err"; ++ "*syslog"; -- Uncomment this for logging to syslog + -- "*console"; -- Log to the console, useful for debugging with daemonize=false + } + diff --git a/user/prosody/prosody.initd b/user/prosody/prosody.initd new file mode 100644 index 000000000..1d835daca --- /dev/null +++ b/user/prosody/prosody.initd @@ -0,0 +1,47 @@ +#!/sbin/openrc-run +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +description="Prosody is a server for prosody/XMPP written in Lua." +description_reload="Reload configuration and reopen log files." +extra_started_commands="reload" +pidfile="/var/run/prosody/prosody.pid" + +depend() { + use dns + need net + provide prosody-server +} + +checkconfig() { + if [ ! -e /etc/prosody/prosody.cfg.lua ] ; then + eerror "You need a /etc/prosody/prosody.cfg.lua file to run prosody" + return 1 + fi + luac5.2 -p /etc/prosody/prosody.cfg.lua + return $? +} + +start() { + checkconfig || return 1 + checkpath -q -d -m 0770 -o prosody:prosody "$(dirname ${pidfile})" + checkpath -q -f -m 0770 -o prosody:prosody "${pidfile}" + checkpath -q -d -m 0750 -o prosody:prosody /var/log/prosody + ebegin "Starting Prosody XMPP Server" + prosodyctl start + eend $? +} + +stop() { + ebegin "Stopping Prosody XMPP Server" + prosodyctl stop + eend $? +} + +reload() { + checkconfig || return 1 + ebegin "Reloading configuration of Prosody XMPP Server" + prosodyctl reload + eend $? +} diff --git a/user/prosody/prosody.pre-install b/user/prosody/prosody.pre-install new file mode 100644 index 000000000..39d9cfadd --- /dev/null +++ b/user/prosody/prosody.pre-install @@ -0,0 +1,11 @@ +#!/bin/sh + +addgroup -S prosody 2>/dev/null +adduser -S -D \ + -h /var/lib/prosody \ + -s /sbin/nologin \ + -G prosody \ + -g "Prosody XMPP Server" \ + prosody 2>/dev/null + +exit 0 diff --git a/user/prosody/prosodyctl.patch b/user/prosody/prosodyctl.patch new file mode 100644 index 000000000..18333dd52 --- /dev/null +++ b/user/prosody/prosodyctl.patch @@ -0,0 +1,11 @@ +--- prosody-0.9.10.q/prosodyctl ++++ prosody-0.9.10/prosodyctl +@@ -244,7 +244,7 @@ + local modulemanager = require "core.modulemanager" + + local prosodyctl = require "util.prosodyctl" +-require "socket" ++local socket = require "socket" + ----------------------- + + -- FIXME: Duplicate code waiting for util.startup -- cgit v1.2.3-60-g2f50