1 { stdenv, lib, fetchFromGitHub }:
3 stdenv.mkDerivation ( finalAttrs: {
7 src = fetchFromGitHub {
8 owner = "supranational";
10 rev = "v${finalAttrs.version}";
11 hash = "sha256-+Ae2cCVVEXnV/ftVOApxDcXM3COf/4DXXd1AOuGS5uc=";
17 ./build.sh ${lib.optionalString stdenv.hostPlatform.isWindows "flavour=mingw64"}
18 ./build.sh -shared ${lib.optionalString stdenv.hostPlatform.isWindows "flavour=mingw64"}
25 mkdir -p $out/{lib,include}
26 for lib in libblst.{a,so,dylib}; do
31 cp bindings/{blst.h,blst_aux.h} $out/include
33 for lib in blst.dll; do
40 mkdir -p $out/lib/pkgconfig
41 cat <<EOF > $out/lib/pkgconfig/libblst.pc
43 exec_prefix=''\\''${prefix}
44 libdir=''\\''${exec_prefix}/lib
45 includedir=''\\''${prefix}/include
48 Description: ${finalAttrs.meta.description}
49 URL: ${finalAttrs.meta.homepage}
50 Version: ${finalAttrs.version}
52 Cflags: -I''\\''${includedir}
53 Libs: -L''\\''${libdir} -lblst
60 # ensure we have the right install id set. Otherwise the library
61 # wouldn't be found during install. The alternative would be to work
62 # lib.optional stdenv.hostPlatform.isDarwin "LDFLAGS=-Wl,-install_name,$(out)/lib/libblst.dylib";
64 postFixup = lib.optionalString stdenv.hostPlatform.isDarwin ''
65 install_name_tool -id $out/lib/libblst.dylib $out/lib/libblst.dylib
71 description = "Multilingual BLS12-381 signature library";
72 homepage = "https://github.com/supranational/blst";
73 license = licenses.isc;
74 maintainers = with maintainers; [ iquerejeta yvan-sraka ];
75 platforms = platforms.all;