libgcrypt: fix build for riscv64-linux

Fixes the following error:
```
libtool: compile:  riscv64-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I.. -I../src -I../src -I../mpi -I../mpi -I/nix/store/kva3r0bwa554vhxg9z9zl9c29ygq4n5z-libgpg-error-riscv64-unknown-linux-gnu-1.55-dev/include -g -O2 -fvisibility=hidden -fno-delete-null-pointer-checks -Wall -O2 -march=rv64imafdcv -mstrict-align -c chacha20-riscv-v.c  -fPIC -DPIC -o .libs/chacha20-riscv-v.o
chacha20-riscv-v.c:26:10: fatal error: simd-common-riscv.h: No such file or directory
   26 | #include "simd-common-riscv.h"
      |          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [Makefile:1724: chacha20-riscv-v.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
rijndael-vp-riscv.c:58:10: fatal error: simd-common-riscv.h: No such file or directory
   58 | #include "simd-common-riscv.h"
      |          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [Makefile:1730: rijndael-vp-riscv.lo] Error 1
make[2]: Leaving directory '/build/libgcrypt-1.11.1/cipher'
make[1]: *** [Makefile:500: all-recursive] Error 1
make[1]: Leaving directory '/build/libgcrypt-1.11.1'
make: *** [Makefile:432: all] Error 2
```

See https://dev.gnupg.org/T7647
This commit is contained in:
misuzu 2025-07-06 12:56:59 +03:00
parent 1d26f2a4c0
commit 4a3c1a1ab2

View File

@ -69,9 +69,21 @@ stdenv.mkDerivation rec {
"build"
];
postConfigure = ''
postConfigure =
''
sed -i configure \
-e 's/NOEXECSTACK_FLAGS=$/NOEXECSTACK_FLAGS="-Wa,--noexecstack"/'
''
# The cipher/simd-common-riscv.h wasn't added to the release tarball, please remove this hack on next version update
# https://dev.gnupg.org/T7647
+ lib.optionalString stdenv.hostPlatform.isRiscV ''
cp ${
fetchurl {
url = "https://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgcrypt.git;a=blob_plain;f=cipher/simd-common-riscv.h;h=8381000f9ac148c60a6963a1d9ec14a3fee1c576;hb=81ce5321b1b79bde6dfdc3c164efb40c13cf656b";
hash = "sha256-Toe15YLAOYULnLc2fGMMv/xzs/q1t3LsyiqtL7imc+8=";
name = "simd-common-riscv.h";
}
} cipher/simd-common-riscv.h
'';
enableParallelBuilding = true;