From 341a8aa7f7cdbf3da548e8c6d0403abe80d09896 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sun, 28 Jan 2024 17:18:07 -0500 Subject: [PATCH] bacula: fix build on Darwin After the CoreFoundation hook was dropped, bacula requires the following changes to build on Darwin: * Ensure bacula links CoreFoundation. Override incorrectly failing `configure` tests and add gettext as a build input. Even if those tests pass, bacula only links CoreFoundation when it finds libintl. * Add Kerberos framework. Required to build on x86_64-darwin. --- pkgs/tools/backup/bacula/default.nix | 12 ++++++++++-- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/backup/bacula/default.nix b/pkgs/tools/backup/bacula/default.nix index d21336813008..58bb7ebb4014 100644 --- a/pkgs/tools/backup/bacula/default.nix +++ b/pkgs/tools/backup/bacula/default.nix @@ -1,5 +1,5 @@ { lib, stdenv, fetchurl, sqlite, postgresql, zlib, acl, ncurses, openssl, readline -, CoreFoundation, IOKit +, gettext, CoreFoundation, IOKit, Kerberos }: stdenv.mkDerivation rec { @@ -19,8 +19,10 @@ stdenv.mkDerivation rec { buildInputs = [ postgresql sqlite zlib ncurses openssl readline ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ + gettext # bacula requires CoreFoundation, but its `configure` script will only link it when it detects libintl. CoreFoundation IOKit + Kerberos ] # acl relies on attr, which I can't get to build on darwin ++ lib.optional (!stdenv.hostPlatform.isDarwin) acl; @@ -31,7 +33,13 @@ stdenv.mkDerivation rec { "--with-logdir=/var/log/bacula" "--with-working-dir=/var/lib/bacula" "--mandir=\${out}/share/man" - ] ++ lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) "ac_cv_func_setpgrp_void=yes"; + ] ++ lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) "ac_cv_func_setpgrp_void=yes" + ++ lib.optionals stdenv.isDarwin [ + # bacula’s `configure` script fails to detect CoreFoundation correctly, + # but these symbols are available in the nixpkgs CoreFoundation framework. + "gt_cv_func_CFLocaleCopyCurrent=yes" + "gt_cv_func_CFPreferencesCopyAppValue=yes" + ]; installFlags = [ "logdir=\${out}/logdir" diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5542da6fbc4f..170340c8b56e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6083,7 +6083,7 @@ with pkgs; }; bacula = callPackage ../tools/backup/bacula { - inherit (darwin.apple_sdk.frameworks) CoreFoundation IOKit; + inherit (darwin.apple_sdk.frameworks) CoreFoundation IOKit Kerberos; }; bacon = callPackage ../development/tools/bacon {