2023-07-15 17:15:38 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub, autoreconfHook }:
|
|
|
|
|
|
|
|
stdenv.mkDerivation ( finalAttrs: {
|
|
|
|
pname = "blst";
|
2023-08-22 20:05:09 +00:00
|
|
|
version = "0.3.11";
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "supranational";
|
|
|
|
repo = "blst";
|
|
|
|
rev = "v${finalAttrs.version}";
|
2023-08-22 20:05:09 +00:00
|
|
|
hash = "sha256-oqljy+ZXJAXEB/fJtmB8rlAr4UXM+Z2OkDa20gpILNA=";
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
./build.sh ${lib.optionalString stdenv.hostPlatform.isWindows "flavour=mingw64"}
|
|
|
|
./build.sh -shared ${lib.optionalString stdenv.hostPlatform.isWindows "flavour=mingw64"}
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mkdir -p $out/{lib,include}
|
|
|
|
for lib in libblst.{a,so,dylib}; do
|
|
|
|
if [ -f $lib ]; then
|
|
|
|
cp $lib $out/lib/
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
cp bindings/{blst.h,blst_aux.h} $out/include
|
|
|
|
|
|
|
|
for lib in blst.dll; do
|
|
|
|
if [ -f $lib ]; then
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp $lib $out/bin/
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
mkdir -p $out/lib/pkgconfig
|
|
|
|
cat <<EOF > $out/lib/pkgconfig/libblst.pc
|
|
|
|
prefix=$out
|
|
|
|
exec_prefix=''\\''${prefix}
|
|
|
|
libdir=''\\''${exec_prefix}/lib
|
|
|
|
includedir=''\\''${prefix}/include
|
|
|
|
|
|
|
|
Name: libblst
|
|
|
|
Description: ${finalAttrs.meta.description}
|
|
|
|
URL: ${finalAttrs.meta.homepage}
|
|
|
|
Version: ${finalAttrs.version}
|
|
|
|
|
|
|
|
Cflags: -I''\\''${includedir}
|
|
|
|
Libs: -L''\\''${libdir} -lblst
|
|
|
|
Libs.private:
|
|
|
|
EOF
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
# ensure we have the right install id set. Otherwise the library
|
|
|
|
# wouldn't be found during install. The alternative would be to work
|
|
|
|
# lib.optional stdenv.isDarwin "LDFLAGS=-Wl,-install_name,$(out)/lib/libblst.dylib";
|
|
|
|
# into the setup.sh
|
|
|
|
postFixup = lib.optionalString stdenv.isDarwin ''
|
|
|
|
install_name_tool -id $out/lib/libblst.dylib $out/lib/libblst.dylib
|
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Multilingual BLS12-381 signature library";
|
|
|
|
homepage = "https://github.com/supranational/blst";
|
|
|
|
license = licenses.isc;
|
|
|
|
maintainers = with maintainers; [ iquerejeta yvan-sraka ];
|
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
})
|