about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorSergei Trofimovich <slyich@gmail.com>2023-11-21 09:45:00 +0000
committerSergei Trofimovich <slyich@gmail.com>2023-11-21 10:27:35 +0000
commit30bdf7a79ee57c084b98f881f7279b1f8c0a5a59 (patch)
treeb101b5fd1441880270b333edd10e93d6b0a39e19 /pkgs
parent1156cd9e9b57e2f5a11564c6cf64b86b01fae17a (diff)
libdeltachat: do not use __FILE__ as a path to headers location
`-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 <github@dotlambda.de>
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/libraries/libdeltachat/default.nix8
1 files changed, 8 insertions, 0 deletions
diff --git a/pkgs/development/libraries/libdeltachat/default.nix b/pkgs/development/libraries/libdeltachat/default.nix
index d62e8bf245cad..f7aab70d42e6e 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 = {