1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-24 09:25:01 +00:00

net-im/prosody: refactor and move to lua 5.2

- Use Lua 5.2 and drop support for the dead LuaJIT.
- Explicitly state all required configure options
  as the "freebsd" preset has some of them wrong.
- Do not install the example certs as they clutter the
  config directory and nobody should ever use them.
  They can be recreated with prosodyctl if needed.
- Remove the broken "daemonize" option from the rc script,
  handle all actions with "prosodyctl" instead.
- Change data directory from /usr/local/var/lib/prosody to
  /var/db/prosody and include instructions in UPDATING
- Install the prosody migrator
- Use arc4random

PR:		241619
Submitted by:	thomas@beingboiled.info
Reviewed by:	lx (maintainer), Sascha Biberhofer <ports@skyforge.at>
Approved by:	lx (maintainer timeout)
This commit is contained in:
Kurt Jaeger 2020-03-04 19:47:53 +00:00
parent fc84d9d97f
commit baee6b2d5e
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=527796
8 changed files with 98 additions and 59 deletions

View File

@ -148,6 +148,28 @@ you update your ports collection, before attempting any port upgrades.
default configuration, but if you have a custom configuration, they might not
be.
20200210:
AFFECTS: users of net-im/prosody
AUTHOR: thomas@beingboiled.info
Prosody's pid file and data directory have moved to a new location.
If you are upgrading from a version with the pid file and data
directory in /usr/local/var/lib/prosody please perform these steps:
# stop Prosody
pkill -F /usr/local/var/lib/prosody/prosody.pid
# copy the data directory
cp -a /usr/local/var/lib/prosody /var/db/prosody
rm -f /var/db/prosody/prosody.pid
Make sure your prosody config has the following option set:
pidfile = "/var/run/prosody/prosody.pid"
Then start Prosody again. Everything should be working as before and
the /usr/local/var/lib/prosody directory can now be removed.
20200207:
AFFECTS: users of security/nss
AUTHOR: lwhsu@FreeBSD.org

View File

@ -3,6 +3,7 @@
PORTNAME= prosody
PORTVERSION= 0.11.4
PORTREVISION= 1
CATEGORIES= net-im
MASTER_SITES= http://prosody.im/downloads/source/ \
http://redundancy.redundancy.org/mirror/
@ -13,27 +14,30 @@ COMMENT= Simple extensible XMPP server written in Lua
LICENSE= MIT
LICENSE_FILE= ${WRKSRC}/COPYING
RUN_DEPENDS= ${LUA_MODLIBDIR}/socket/core.so:net/luasocket-51 \
${LUA_MODLIBDIR}/ssl.so:security/luasec-51 \
${LUA_MODLIBDIR}/lxp.so:textproc/luaexpat-51 \
${LUA_MODLIBDIR}/lfs.so:devel/luafilesystem-51 \
${LUA_MODLIBDIR}/bit.so:devel/lua51-bitop
RUN_DEPENDS= ${LUA_MODLIBDIR}/socket/core.so:net/luasocket \
${LUA_MODLIBDIR}/ssl.so:security/luasec \
${LUA_MODLIBDIR}/lxp.so:textproc/luaexpat \
${LUA_MODLIBDIR}/lfs.so:devel/luafilesystem \
${LUA_MODLIBDIR}/bit.so:devel/lua-bitop
LIB_DEPENDS= libidn.so:dns/libidn
USES= compiler:c11 cpe gmake lua:51 shebangfix ssl
SHEBANG_FILES= prosody prosodyctl
USES= compiler:c11 cpe gmake lua:52 ssl
LUA_PREMK= yes
HAS_CONFIGURE= yes
CFLAGS+= -I${OPENSSLINC}
LDFLAGS+= -L${OPENSSLLIB}
CONFIGURE_ARGS= --ostype=freebsd \
--c-compiler="${CC}" \
--linker="${CC}" \
--with-lua-include="${LUA_INCDIR}" \
CONFIGURE_ARGS= --prefix="${PREFIX}" \
--datadir="/var/db/prosody" \
--lua-version="${LUA_VER}" \
--lua-suffix="${LUA_VER_STR}" \
--with-lua-include="${LUA_INCDIR}" \
--with-lua-lib="${LUA_LIBDIR}" \
--prefix="${PREFIX}"
--with-random=arc4random \
--c-compiler="${CC}" \
--cflags="${CFLAGS}" \
--add-cflags="-fPIC -std=c99 -I${LOCALBASE}/include -I${OPENSSLINC}" \
--linker="${CC}" \
--ldflags="${LDFLAGS}" \
--add-ldflags="-shared -L${LOCALBASE}/lib -L${OPENSSLLIB}" \
--no-example-certs
MAKEFILE= GNUmakefile
USERS= prosody
@ -47,19 +51,9 @@ PLIST_SUB= PROSODY_USER=${USERS} \
PROSODY_GROUP=${GROUPS} \
PROSODY_GROUP_regex=\b${GROUPS}\b
OPTIONS_DEFINE= LUAJIT
LUAJIT_DESC= Run prosody using luajit
LUAJIT_LIB_DEPENDS= libluajit-5.1.so:lang/luajit
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MLUAJIT}
lua_CMD= ${LOCALBASE}/bin/luajit
.else
lua_CMD= ${LOCALBASE}/bin/${LUA_CMD}
.endif
post-install:
@${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/prosody/util/*.so
@${MKDIR} ${STAGEDIR}/var/run/prosody
@${RM} ${STAGEDIR}${ETCDIR}/certs/*
.include <bsd.port.mk>

View File

@ -1,6 +1,6 @@
--- GNUmakefile.orig 2018-12-01 14:51:46.042219000 +0000
+++ GNUmakefile 2018-12-01 14:52:30.212140000 +0000
@@ -6,7 +6,7 @@
--- GNUmakefile.orig 2020-01-02 09:49:37 UTC
+++ GNUmakefile
@@ -6,7 +6,7 @@ CONFIG = $(DESTDIR)$(SYSCONFDIR)
MODULES = $(DESTDIR)$(LIBDIR)/prosody/modules
SOURCE = $(DESTDIR)$(LIBDIR)/prosody
DATA = $(DESTDIR)$(DATADIR)
@ -9,7 +9,7 @@
INSTALLEDSOURCE = $(LIBDIR)/prosody
INSTALLEDCONFIG = $(SYSCONFDIR)
@@ -57,7 +57,7 @@
@@ -57,9 +57,10 @@ install: prosody.install prosodyctl.install prosody.cf
$(INSTALL_DATA) plugins/mod_mam/*.lua $(MODULES)/mod_mam
$(INSTALL_DATA) certs/* $(CONFIG)/certs
$(INSTALL_DATA) man/prosodyctl.man $(MAN)/man1/prosodyctl.1
@ -17,4 +17,7 @@
+ $(INSTALL_DATA) prosody.cfg.lua.install $(CONFIG)/prosody.cfg.lua.sample
-test -f prosody.version && $(INSTALL_DATA) prosody.version $(SOURCE)/prosody.version
$(MAKE) install -C util-src
+ $(MAKE) install -C tools/migration
clean:
rm -f prosody.install

View File

@ -0,0 +1,28 @@
--- tools/migration/Makefile.orig 2020-01-02 09:49:37 UTC
+++ tools/migration/Makefile
@@ -5,7 +5,7 @@ BIN = $(DESTDIR)$(PREFIX)/bin
CONFIG = $(DESTDIR)$(SYSCONFDIR)
SOURCE = $(DESTDIR)$(LIBDIR)/prosody
DATA = $(DESTDIR)$(DATADIR)
-MAN = $(DESTDIR)$(PREFIX)/share/man
+MAN = $(DESTDIR)$(PREFIX)/man
INSTALLEDSOURCE = $(LIBDIR)/prosody
INSTALLEDCONFIG = $(SYSCONFDIR)
@@ -22,14 +22,14 @@ install: prosody-migrator.install migrator.cfg.lua.ins
install -d $(SOURCE)/migrator
install -m755 ./prosody-migrator.install $(BIN)/prosody-migrator
install -m644 $(SOURCE_FILES) $(SOURCE)/migrator
- test -e $(CONFIG)/migrator.cfg.lua || install -m644 migrator.cfg.lua.install $(CONFIG)/migrator.cfg.lua
+ install -m644 migrator.cfg.lua.install $(CONFIG)/migrator.cfg.lua.sample
clean:
rm -f prosody-migrator.install
rm -f migrator.cfg.lua.install
prosody-migrator.install: prosody-migrator.lua
- sed "1s/\blua\b/$(RUNWITH)/; \
+ sed "1s/ lua$$/ $(RUNWITH)/; \
s|^CFG_SOURCEDIR=.*;$$|CFG_SOURCEDIR='$(INSTALLEDSOURCE)';|; \
s|^CFG_CONFIGDIR=.*;$$|CFG_CONFIGDIR='$(INSTALLEDCONFIG)';|;" \
< prosody-migrator.lua > prosody-migrator.install

View File

@ -1,9 +1,9 @@
--- util-src/time.c.orig 2018-12-01 10:50:51.975557000 +0000
+++ util-src/time.c 2018-12-01 10:51:05.667316000 +0000
--- util-src/time.c.orig 2020-01-02 09:49:37 UTC
+++ util-src/time.c
@@ -1,5 +1,5 @@
#ifndef _POSIX_C_SOURCE
-#define _POSIX_C_SOURCE 199309L
+#define _POSIX_C_SOURCE 200809L
#endif
#include <time.h>

View File

@ -17,7 +17,8 @@ POST-DEINSTALL)
echo " pw groupdel -n %%GROUPS%%"
echo ""
echo " and to remove all server data:"
echo " rm -rf /usr/local/var/lib/prosody"
echo " rm -rf /var/db/prosody"
echo " rm -rf /var/run/prosody"
echo ""
;;
esac

View File

@ -15,32 +15,22 @@
. /etc/rc.subr
name="prosody"
rcvar=prosody_enable
rcvar="prosody_enable"
command="%%PREFIX%%/bin/prosodyctl"
load_rc_config $name
prosody_enable=${prosody_enable:-"NO"}
pidfile=${prosody_pidfile:-"%%PREFIX%%/var/lib/prosody/prosody.pid"}
pidfile=${prosody_pidfile:-"/var/run/prosody/prosody.pid"}
extra_commands="reload status"
start_cmd="prosody_start"
extra_commands="reload"
start_cmd="prosody_cmd start"
stop_cmd="prosody_cmd stop"
reload_cmd="prosody_cmd reload"
restart_cmd="$stop_cmd; $start_cmd"
restart_cmd="prosody_cmd restart"
status_cmd="prosody_cmd status"
prosody_start()
{
config="%%PREFIX%%/etc/prosody/prosody.cfg.lua"
if grep -q '^daemonize[[:blank:]]*=[[:blank:]]*false' $config; then
# Prosody's not going to daemonize on its own, use daemon(8)
daemon $command start
else
$command start
fi
}
export PATH="%%PREFIX%%/bin:$PATH"
prosody_cmd()
{

View File

@ -1,13 +1,8 @@
bin/prosody
bin/prosodyctl
%%ETCDIR%%/certs/GNUmakefile
%%ETCDIR%%/certs/example.com.crt
%%ETCDIR%%/certs/example.com.key
%%ETCDIR%%/certs/localhost.cnf
%%ETCDIR%%/certs/localhost.crt
%%ETCDIR%%/certs/localhost.key
%%ETCDIR%%/certs/makefile
%%ETCDIR%%/certs/openssl.cnf
bin/prosody-migrator
@dir %%ETCDIR%%/certs
@sample %%ETCDIR%%/migrator.cfg.lua.sample
@sample %%ETCDIR%%/prosody.cfg.lua.sample
%%LUA_LIBDIR%%/prosody/core/certmanager.lua
%%LUA_LIBDIR%%/prosody/core/configmanager.lua
@ -23,6 +18,10 @@ bin/prosodyctl
%%LUA_LIBDIR%%/prosody/core/statsmanager.lua
%%LUA_LIBDIR%%/prosody/core/storagemanager.lua
%%LUA_LIBDIR%%/prosody/core/usermanager.lua
%%LUA_LIBDIR%%/prosody/migrator/jabberd14.lua
%%LUA_LIBDIR%%/prosody/migrator/mtools.lua
%%LUA_LIBDIR%%/prosody/migrator/prosody_files.lua
%%LUA_LIBDIR%%/prosody/migrator/prosody_sql.lua
%%LUA_LIBDIR%%/prosody/modules/adhoc/adhoc.%%LUA_LIBDIR%%.lua
%%LUA_LIBDIR%%/prosody/modules/adhoc/mod_adhoc.lua
%%LUA_LIBDIR%%/prosody/modules/mod_admin_adhoc.lua
@ -144,6 +143,7 @@ bin/prosodyctl
%%LUA_LIBDIR%%/prosody/util/cache.lua
%%LUA_LIBDIR%%/prosody/util/caps.lua
%%LUA_LIBDIR%%/prosody/util/compat.so
%%LUA_LIBDIR%%/prosody/util/crand.so
%%LUA_LIBDIR%%/prosody/util/dataforms.lua
%%LUA_LIBDIR%%/prosody/util/datamanager.lua
%%LUA_LIBDIR%%/prosody/util/datetime.lua
@ -216,4 +216,5 @@ bin/prosodyctl
%%LUA_LIBDIR%%/prosody/util/xmppstream.lua
%%LUA_LIBDIR%%/prosody/util/xpcall.lua
man/man1/prosodyctl.1.gz
@dir(%%PROSODY_USER%%,%%PROSODY_GROUP%%,) var/%%LUA_LIBDIR%%/prosody
@dir(%%PROSODY_USER%%,%%PROSODY_GROUP%%,) /var/db/prosody
@dir(%%PROSODY_USER%%,%%PROSODY_GROUP%%,) /var/run/prosody