diff --git a/pkgs/development/libraries/zeromq/4.x.nix b/pkgs/development/libraries/zeromq/4.x.nix index d8509c8fc3f4..6801eddc178f 100644 --- a/pkgs/development/libraries/zeromq/4.x.nix +++ b/pkgs/development/libraries/zeromq/4.x.nix @@ -1,30 +1,49 @@ -{ lib -, stdenv -, fetchFromGitHub -, cmake -, asciidoc -, pkg-config -, libsodium -, enableDrafts ? false +{ + lib, + stdenv, + fetchFromGitHub, + cmake, + pkg-config, + libsodium, + asciidoc, + xmlto, + enableDrafts ? false, + # for passthru.tests + azmq, + cppzmq, + czmq, + zmqpp, + ffmpeg, + python3, }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "zeromq"; version = "4.3.5"; src = fetchFromGitHub { owner = "zeromq"; repo = "libzmq"; - rev = "v${version}"; - sha256 = "sha256-q2h5y0Asad+fGB9haO4Vg7a1ffO2JSb7czzlhmT3VmI="; + rev = "v${finalAttrs.version}"; + hash = "sha256-q2h5y0Asad+fGB9haO4Vg7a1ffO2JSb7czzlhmT3VmI="; }; - nativeBuildInputs = [ cmake asciidoc pkg-config ]; + nativeBuildInputs = [ + cmake + pkg-config + asciidoc + xmlto + ]; + buildInputs = [ libsodium ]; doCheck = false; # fails all the tests (ctest) - cmakeFlags = lib.optional enableDrafts "-DENABLE_DRAFTS=ON"; + cmakeFlags = [ + (lib.cmakeBool "WITH_LIBSODIUM" true) + (lib.cmakeBool "ENABLE_CURVE" true) + (lib.cmakeBool "ENABLE_DRAFTS" enableDrafts) + ]; postPatch = '' substituteInPlace CMakeLists.txt \ @@ -32,12 +51,46 @@ stdenv.mkDerivation rec { --replace '$'{prefix}/'$'{CMAKE_INSTALL_INCLUDEDIR} '$'{CMAKE_INSTALL_FULL_INCLUDEDIR} ''; - meta = with lib; { + postBuild = '' + # From https://gitlab.archlinux.org/archlinux/packaging/packages/zeromq/-/blob/main/PKGBUILD + # man pages aren't created when using cmake + # https://github.com/zeromq/libzmq/issues/4160 + pushd ../doc + for FILE in *.txt; do + asciidoc \ + -d manpage \ + -b docbook \ + -f asciidoc.conf \ + -a zmq_version="${finalAttrs.version}" \ + "''${FILE}" + xmlto --skip-validation man "''${FILE%.txt}.xml" + done + popd + ''; + + postInstall = '' + # Install manually created man pages + install -vDm644 -t "$out/share/man/man3" ../doc/*.3 + install -vDm644 -t "$out/share/man/man7" ../doc/*.7 + ''; + + passthru.tests = { + inherit + azmq + cppzmq + czmq + zmqpp + ; + pyzmq = python3.pkgs.pyzmq; + ffmpeg = ffmpeg.override { withZmq = true; }; + }; + + meta = { branch = "4"; homepage = "http://www.zeromq.org"; description = "Intelligent Transport Layer"; - license = licenses.mpl20; - platforms = platforms.all; - maintainers = with maintainers; [ fpletz ]; + license = lib.licenses.mpl20; + platforms = lib.platforms.all; + maintainers = with lib.maintainers; [ fpletz ]; }; -} +})