diff --git a/pkgs/by-name/pa/pacemaker/package.nix b/pkgs/by-name/pa/pacemaker/package.nix index a9e5a0fc5a8b..7d670749fe05 100644 --- a/pkgs/by-name/pa/pacemaker/package.nix +++ b/pkgs/by-name/pa/pacemaker/package.nix @@ -7,9 +7,13 @@ bzip2, corosync, dbus, + docbook_xsl, fetchFromGitHub, + getopt, + gettext, glib, gnutls, + help2man, libqb, libtool, libuuid, @@ -19,6 +23,7 @@ pkg-config, python3, nixosTests, + versionCheckHook, # Pacemaker is compiled twice, once with forOCF = true to extract its # OCF definitions for use in the ocf-resource-agents derivation, then @@ -26,6 +31,7 @@ # as the OCF_ROOT. forOCF ? false, ocf-resource-agents, + withManpages ? !forOCF, }: stdenv.mkDerivation (finalAttrs: { @@ -35,32 +41,54 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "ClusterLabs"; repo = "pacemaker"; - rev = "Pacemaker-${finalAttrs.version}"; - sha256 = "sha256-23YkNzqiimLy/KjO+hxVQQ4rUhSEhn5Oc2jUJO/VRo0="; + tag = "Pacemaker-${finalAttrs.version}"; + hash = "sha256-23YkNzqiimLy/KjO+hxVQQ4rUhSEhn5Oc2jUJO/VRo0="; }; + outputs = [ "out" ] ++ lib.optionals withManpages [ "man" ]; + nativeBuildInputs = [ autoconf automake + gettext + getopt libtool pkg-config + python3 + ] + ++ lib.optionals withManpages [ + # If we don't supply the dependencies the manpage build will be silently skipped + help2man # for tool man pages (see mk/man.mk) + libxml2 # for other man pages (xmllint) + libxslt # for other man pages (xsltproc) ]; buildInputs = [ bash bzip2 corosync - dbus.dev + dbus glib gnutls libqb + libtool libuuid - libxml2.dev - libxslt.dev + libxml2 + libxslt pam - python3 ]; + strictDeps = true; + + # If we do this unconditionally the build will fail because it sees a valid MANPAGE_XSLT + # but required executables are not available. + postPatch = lib.optionalString withManpages '' + # Avoid the use of xmlcatalog to resolve stylesheet for manpages, but set the path directly + substituteInPlace configure.ac \ + --replace-fail 'MANPAGE_XSLT=""' 'MANPAGE_XSLT="${docbook_xsl}/xml/xsl/docbook/manpages/docbook.xsl"' \ + --replace-fail 'AS_IF([test x"''${XSLTPROC}" != x""],' 'AS_IF([false],' + ''; + preConfigure = '' ./autogen.sh --prefix="$out" ''; @@ -87,11 +115,21 @@ stdenv.mkDerivation (finalAttrs: { enableParallelBuilding = true; - postInstall = '' - # pacemaker's install linking requires a weirdly nested hierarchy - mv $out$out/* $out - rm -r $out/nix - ''; + # pacemaker's install linking requires a weirdly nested hierarchy + postInstall = + lib.optionalString withManpages '' + mkdir -p $man + mv $out$man/* $man + '' + + '' + mv $out$out/* $out + rm -r $out/nix + ''; + + doInstallCheck = true; + nativeInstallCheckInputs = [ versionCheckHook ]; + versionCheckProgram = [ "${placeholder "out"}/sbin/pacemakerd" ]; + versionCheckProgramArg = "--version"; passthru.tests = { inherit (nixosTests) pacemaker;