rabbitmq: 3.6.10 -> 3.6.15 (and various improvements)

- split outputs (doc, man, out)
- a new runtime dependency on getconf
- fix up SCRIPTS_DIR in wrapper
- clean output folder of stray doc files
- add license & maintainer

Tested with `nixos/tests/rabbitmq.nix`, inside a docker image and manually.
This commit is contained in:
Profpatsch 2018-02-19 18:54:16 +01:00
parent f1dfc22128
commit 186c765398
2 changed files with 47 additions and 13 deletions

View File

@ -339,6 +339,7 @@ in rec {
tests.pumpio = callTest tests/pump.io.nix {}; tests.pumpio = callTest tests/pump.io.nix {};
# tests.quagga = callTest tests/quagga.nix {}; # tests.quagga = callTest tests/quagga.nix {};
tests.quake3 = callTest tests/quake3.nix {}; tests.quake3 = callTest tests/quake3.nix {};
tests.rabbitmq = callTest tests/rabbitmq.nix {};
tests.radicale = callTest tests/radicale.nix {}; tests.radicale = callTest tests/radicale.nix {};
tests.rspamd = callSubTests tests/rspamd.nix {}; tests.rspamd = callSubTests tests/rspamd.nix {};
tests.runInMachine = callTest tests/run-in-machine.nix {}; tests.runInMachine = callTest tests/run-in-machine.nix {};

View File

@ -1,25 +1,38 @@
{ stdenv, fetchurl, erlang, python, libxml2, libxslt, xmlto { stdenv, fetchurl, runCommand
, erlang, python, libxml2, libxslt, xmlto
, docbook_xml_dtd_45, docbook_xsl, zip, unzip, rsync , docbook_xml_dtd_45, docbook_xsl, zip, unzip, rsync
, AppKit, Carbon, Cocoa , AppKit, Carbon, Cocoa
}: }:
stdenv.mkDerivation rec { let
name = "rabbitmq-server-${version}"; # we only need that one glibc binary (28k instead of 2.7M)
getconf = runCommand "getconf" {} ''
install -D ${stdenv.lib.getBin stdenv.cc.libc}/bin/getconf $out/bin/getconf
'';
version = "3.6.10"; in stdenv.mkDerivation rec {
name = "rabbitmq-server-${version}";
version = "3.6.15";
src = fetchurl { src = fetchurl {
url = "https://www.rabbitmq.com/releases/rabbitmq-server/v${version}/${name}.tar.xz"; url = "https://www.rabbitmq.com/releases/rabbitmq-server/v${version}/${name}.tar.xz";
sha256 = "0k1rhg1a51201b1hp6vaf4fk48hqz7m9hw55b8xnnyz2ld88jiqg"; sha256 = "1zdmil657mhjmd20jv47s5dfpj2liqwvyg0zv2ky3akanfpgj98y";
}; };
buildInputs = buildInputs =
[ erlang python libxml2 libxslt xmlto docbook_xml_dtd_45 docbook_xsl zip unzip rsync ] [ erlang python libxml2 libxslt xmlto docbook_xml_dtd_45 docbook_xsl zip unzip rsync ]
++ stdenv.lib.optionals stdenv.isDarwin [ AppKit Carbon Cocoa ]; ++ stdenv.lib.optionals stdenv.isDarwin [ AppKit Carbon Cocoa ];
preBuild = outputs = [ "out" "man" "doc" ];
''
postPatch = with stdenv.lib; ''
# patch the path to getconf
substituteInPlace deps/rabbit_common/src/vm_memory_monitor.erl \
--replace "getconf PAGESIZE" "${getconf}/bin/getconf PAGESIZE"
'';
preBuild = ''
# Fix the "/usr/bin/env" in "calculate-relative". # Fix the "/usr/bin/env" in "calculate-relative".
patchShebangs . patchShebangs .
''; '';
@ -27,14 +40,34 @@ stdenv.mkDerivation rec {
installFlags = "PREFIX=$(out) RMQ_ERLAPP_DIR=$(out)"; installFlags = "PREFIX=$(out) RMQ_ERLAPP_DIR=$(out)";
installTargets = "install install-man"; installTargets = "install install-man";
postInstall = postInstall = ''
''
echo 'PATH=${erlang}/bin:''${PATH:+:}$PATH' >> $out/sbin/rabbitmq-env echo 'PATH=${erlang}/bin:''${PATH:+:}$PATH' >> $out/sbin/rabbitmq-env
# we know exactly where rabbitmq is gonna be,
# so we patch that into the env-script
substituteInPlace $out/sbin/rabbitmq-env \
--replace 'RABBITMQ_SCRIPTS_DIR=`dirname $SCRIPT_PATH`' \
"RABBITMQ_SCRIPTS_DIR=$out/sbin"
# theres a few stray files that belong into share
mkdir -p $doc/share/doc/rabbitmq-server
mv $out/LICENSE* $doc/share/doc/rabbitmq-server
# and an unecessarily copied INSTALL file
rm $out/INSTALL
# patched into a source file above;
# needs to be explicitely passed to not be stripped by fixup
mkdir -p $out/nix-support
echo "${getconf}" > $out/nix-support/dont-strip-getconf
''; '';
meta = { meta = {
homepage = http://www.rabbitmq.com/; homepage = http://www.rabbitmq.com/;
description = "An implementation of the AMQP messaging protocol"; description = "An implementation of the AMQP messaging protocol";
license = stdenv.lib.licenses.mpl11;
platforms = stdenv.lib.platforms.unix; platforms = stdenv.lib.platforms.unix;
maintainers = with stdenv.lib.maintainers; [ Profpatsch ];
}; };
} }