From 30bdf7a79ee57c084b98f881f7279b1f8c0a5a59 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Tue, 21 Nov 2023 09:45:00 +0000 Subject: [PATCH] libdeltachat: do not use __FILE__ as a path to headers location MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `-fmacro-prefix-map=` option can redirect path from the actual source location to the unrelated path (`build-time` vs `debug-time`). The change expands `__FILE__` in `deltachat.h` to the absolute location to stop relying on `__FILE__` expansion. The change fixes `python3.pkgs.deltachat` for me. Co-authored-by: Robert Schütz Co-authored-by: Sandro --- pkgs/development/libraries/libdeltachat/default.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/development/libraries/libdeltachat/default.nix b/pkgs/development/libraries/libdeltachat/default.nix index d62e8bf245ca..f7aab70d42e6 100644 --- a/pkgs/development/libraries/libdeltachat/default.nix +++ b/pkgs/development/libraries/libdeltachat/default.nix @@ -70,6 +70,14 @@ in stdenv.mkDerivation rec { cargoCheckHook ]; + # Sometimes -fmacro-prefix-map= can redirect __FILE__ to non-existent + # paths. This breaks packages like `python3.pkgs.deltachat`. We embed + # absolute path to headers by expanding `__FILE__`. + postInstall = '' + substituteInPlace $out/include/deltachat.h \ + --replace __FILE__ '"${placeholder "out"}/include/deltachat.h"' + ''; + passthru = { inherit cargoLock; tests = {