2018-08-05 18:02:40 +02:00
|
|
|
{ stdenv, writeScriptBin, makeWrapper, lib, fetchurl, git, cacert, libpng, libjpeg, libwebp
|
2018-02-25 18:17:51 +01:00
|
|
|
, erlang, openssl, expat, libyaml, bash, gnused, gnugrep, coreutils, utillinux, procps, gd
|
2018-03-26 06:01:31 +02:00
|
|
|
, flock
|
2015-09-11 22:39:21 +02:00
|
|
|
, withMysql ? false
|
|
|
|
, withPgsql ? false
|
|
|
|
, withSqlite ? false, sqlite
|
|
|
|
, withPam ? false, pam
|
|
|
|
, withZlib ? true, zlib
|
|
|
|
, withRiak ? false
|
|
|
|
, withElixir ? false, elixir
|
|
|
|
, withIconv ? true
|
|
|
|
, withTools ? false
|
|
|
|
, withRedis ? false
|
|
|
|
}:
|
2008-01-23 19:11:03 +01:00
|
|
|
|
2015-09-11 22:39:21 +02:00
|
|
|
let
|
|
|
|
fakegit = writeScriptBin "git" ''
|
2016-02-11 00:36:09 +01:00
|
|
|
#! ${stdenv.shell} -e
|
|
|
|
if [ "$1" = "describe" ]; then
|
|
|
|
[ -r .rev ] && cat .rev || true
|
|
|
|
fi
|
2015-09-11 22:39:21 +02:00
|
|
|
'';
|
|
|
|
|
2016-04-29 19:56:02 +02:00
|
|
|
ctlpath = lib.makeBinPath [ bash gnused gnugrep coreutils utillinux procps ];
|
2015-09-11 22:39:21 +02:00
|
|
|
|
|
|
|
in stdenv.mkDerivation rec {
|
2020-03-19 05:44:02 +01:00
|
|
|
version = "20.03";
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "ejabberd";
|
2015-09-11 22:39:21 +02:00
|
|
|
|
2009-11-17 17:54:04 +01:00
|
|
|
src = fetchurl {
|
2020-03-19 05:44:02 +01:00
|
|
|
url = "https://www.process-one.net/downloads/downloads-action.php?file=/${version}/${pname}-${version}.tgz";
|
|
|
|
sha256 = "0i013l9cygmgainfid298n6llhs3mblfklry3jw2a6irvhffym0s";
|
2008-01-23 19:11:03 +01:00
|
|
|
};
|
2015-09-11 22:39:21 +02:00
|
|
|
|
|
|
|
nativeBuildInputs = [ fakegit ];
|
|
|
|
|
2018-08-05 18:02:40 +02:00
|
|
|
buildInputs = [ erlang openssl expat libyaml gd makeWrapper ]
|
2015-09-11 22:39:21 +02:00
|
|
|
++ lib.optional withSqlite sqlite
|
|
|
|
++ lib.optional withPam pam
|
|
|
|
++ lib.optional withZlib zlib
|
|
|
|
++ lib.optional withElixir elixir
|
|
|
|
;
|
|
|
|
|
|
|
|
# Apparently needed for Elixir
|
|
|
|
LANG = "en_US.UTF-8";
|
|
|
|
|
2016-04-29 19:56:02 +02:00
|
|
|
deps = stdenv.mkDerivation {
|
2019-08-13 23:52:01 +02:00
|
|
|
pname = "ejabberd-deps";
|
|
|
|
inherit version;
|
2016-04-29 19:56:02 +02:00
|
|
|
|
|
|
|
inherit src;
|
|
|
|
|
2016-08-23 02:36:14 +02:00
|
|
|
configureFlags = [ "--enable-all" "--with-sqlite3=${sqlite.dev}" ];
|
2016-04-29 19:56:02 +02:00
|
|
|
|
2018-01-10 01:27:23 +01:00
|
|
|
nativeBuildInputs = [ git erlang openssl expat libyaml sqlite pam zlib elixir ];
|
2016-04-29 19:56:02 +02:00
|
|
|
|
|
|
|
GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt";
|
|
|
|
|
|
|
|
makeFlags = [ "deps" ];
|
|
|
|
|
2016-07-02 18:06:48 +02:00
|
|
|
phases = [ "unpackPhase" "configurePhase" "buildPhase" "installPhase" ];
|
|
|
|
|
2016-04-29 19:56:02 +02:00
|
|
|
installPhase = ''
|
|
|
|
for i in deps/*; do
|
|
|
|
( cd $i
|
|
|
|
git reset --hard
|
2016-07-02 18:06:48 +02:00
|
|
|
git clean -ffdx
|
2016-04-29 19:56:02 +02:00
|
|
|
git describe --always --tags > .rev
|
|
|
|
rm -rf .git
|
|
|
|
)
|
|
|
|
done
|
2016-04-30 02:48:47 +02:00
|
|
|
rm deps/.got
|
2016-04-29 19:56:02 +02:00
|
|
|
|
|
|
|
cp -r deps $out
|
|
|
|
'';
|
|
|
|
|
|
|
|
outputHashMode = "recursive";
|
|
|
|
outputHashAlgo = "sha256";
|
2020-03-19 05:44:02 +01:00
|
|
|
outputHash = "0xwgi9hy6y0m8mwznl6px98kdmkcxg98k62zgqbaqd4paks5zwqa";
|
2016-04-29 19:56:02 +02:00
|
|
|
};
|
2015-09-11 22:39:21 +02:00
|
|
|
|
|
|
|
configureFlags =
|
2016-02-11 00:36:09 +01:00
|
|
|
[ (lib.enableFeature withMysql "mysql")
|
2015-09-11 22:39:21 +02:00
|
|
|
(lib.enableFeature withPgsql "pgsql")
|
|
|
|
(lib.enableFeature withSqlite "sqlite")
|
|
|
|
(lib.enableFeature withPam "pam")
|
|
|
|
(lib.enableFeature withZlib "zlib")
|
|
|
|
(lib.enableFeature withRiak "riak")
|
|
|
|
(lib.enableFeature withElixir "elixir")
|
|
|
|
(lib.enableFeature withIconv "iconv")
|
|
|
|
(lib.enableFeature withTools "tools")
|
|
|
|
(lib.enableFeature withRedis "redis")
|
2016-04-16 19:47:23 +02:00
|
|
|
] ++ lib.optional withSqlite "--with-sqlite3=${sqlite.dev}";
|
2015-09-11 22:39:21 +02:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
preBuild = ''
|
2016-04-29 19:56:02 +02:00
|
|
|
cp -r $deps deps
|
|
|
|
chmod -R +w deps
|
2016-07-23 11:23:25 +02:00
|
|
|
patchShebangs deps
|
2008-09-22 16:07:25 +02:00
|
|
|
'';
|
2015-09-11 22:39:21 +02:00
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
sed -i \
|
|
|
|
-e '2iexport PATH=${ctlpath}:$PATH' \
|
2018-03-26 06:01:31 +02:00
|
|
|
-e 's,\(^ *FLOCK=\).*,\1${flock}/bin/flock,' \
|
2015-09-11 22:39:21 +02:00
|
|
|
-e 's,\(^ *JOT=\).*,\1,' \
|
|
|
|
-e 's,\(^ *CONNLOCKDIR=\).*,\1/var/lock/ejabberdctl,' \
|
|
|
|
$out/sbin/ejabberdctl
|
2018-08-05 18:02:40 +02:00
|
|
|
wrapProgram $out/lib/eimp-*/priv/bin/eimp --prefix LD_LIBRARY_PATH : "${stdenv.lib.makeLibraryPath [ libpng libjpeg libwebp ]}"
|
2013-11-02 01:46:30 +01:00
|
|
|
'';
|
|
|
|
|
2018-02-25 18:17:51 +01:00
|
|
|
meta = with stdenv.lib; {
|
2008-09-22 16:07:25 +02:00
|
|
|
description = "Open-source XMPP application server written in Erlang";
|
2018-02-25 18:17:51 +01:00
|
|
|
license = licenses.gpl2;
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://www.ejabberd.im";
|
2018-02-25 18:17:51 +01:00
|
|
|
platforms = platforms.linux;
|
2019-12-02 14:18:20 +01:00
|
|
|
maintainers = with maintainers; [ sander abbradar ajs124 ];
|
2016-04-29 19:56:02 +02:00
|
|
|
broken = withElixir;
|
2008-09-22 16:07:25 +02:00
|
|
|
};
|
2008-01-23 19:11:03 +01:00
|
|
|
}
|