Skip to content

Commit bfdd1c3

Browse files
authored
Set libblst .version to match Cargo.toml (#603)
An alternative would have been to set the version only in the `.pc` file based on `Cargo.toml`. However, the derivation’s `.version` must be accurate so that haskell.nix planning can detect it without building. Therefore, we hardcode `.version` in the derivation, and add a check against `Cargo.toml` to ensure it stays in sync.
1 parent 64ca6f4 commit bfdd1c3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

overlays/crypto/libblst.nix

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,21 @@
22

33
stdenv.mkDerivation rec {
44
pname = "blst";
5-
version = src.shortRev;
5+
version = "0.3.14";
66

77
inherit src;
88

99
# note on -D__BLST_PORTABLE__, this should allow us to have MULX, and similar
1010
# stuff run-time detected, and as such blst built on newer hardware should still
1111
# work on older. Notably Intel before Broadwell, and AMD before Ryzen, do not
1212
# support ADX, which means they lack MULX support, which blst uses.
13+
# The `version` number is checked against the `Cargo.toml` file.
1314
buildPhase = ''
15+
actual=$(grep -m1 -E '^version\s*=' bindings/rust/Cargo.toml | cut -d'"' -f2)
16+
if [ "$actual" != "${version}" ]; then
17+
echo "ERROR: Cargo.toml version mismatch (expected ${version}, found $actual) in iohk-nix/overlays/crypto/libblst.nix"
18+
exit 1
19+
fi
1420
./build.sh -D__BLST_PORTABLE__ ${lib.optionalString stdenv.hostPlatform.isWindows "flavour=mingw64"}
1521
'' + lib.optionalString enableShared ''
1622
./build.sh -D__BLST_PORTABLE__ -shared ${lib.optionalString stdenv.hostPlatform.isWindows "flavour=mingw64"}

0 commit comments

Comments
 (0)