Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/scripts/install-blst.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
set -eux -o pipefail

## The following script builds and installs blst to ~/.local/lib

INSTALL_VERSION=0.3.11

if [[ "$(uname -s)" =~ ^MSYS_NT.* ]]; then
echo "This script is only meant to run on Windows under MSYS2"
exit 1
fi

PREFIX="$HOME/.local"
curl -LO "https://github.com/supranational/blst/archive/v$INSTALL_VERSION.zip"
unzip "v$INSTALL_VERSION.zip" && rm "v$INSTALL_VERSION.zip"
cd "blst-$INSTALL_VERSION" || exit 1

# Build using the provided build script
# The script auto-detects platform and uses appropriate assembly
# CFLAGS must be set as environment variable, not passed as argument
CFLAGS="-O2 -fPIC -D__BLST_PORTABLE__" ./build.sh

# Install headers and library
mkdir -p "$PREFIX/lib" "$PREFIX/include"
cp libblst.a "$PREFIX/lib/"
cp bindings/blst.h "$PREFIX/include/"
cp bindings/blst_aux.h "$PREFIX/include/"
63 changes: 63 additions & 0 deletions .github/scripts/install-c-kzg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash
set -eux -o pipefail

## The following script builds and installs c-kzg to ~/.local/lib

INSTALL_VERSION=2.1.5

# Capture repo root before changing directories
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"

if [[ "$(uname -s)" =~ ^MSYS_NT.* ]]; then
echo "This script is only meant to run on Windows under MSYS2"
exit 1
fi

PREFIX="$HOME/.local"
curl -LO "https://github.com/ethereum/c-kzg-4844/archive/v$INSTALL_VERSION.zip"
unzip "v$INSTALL_VERSION.zip" && rm "v$INSTALL_VERSION.zip"
cd "c-kzg-4844-$INSTALL_VERSION/src" || exit 1

# Compiler flags matching flake.nix
CFLAGS="-O2 -fPIC -Wno-implicit-function-declaration -Wno-gnu-folding-constant"
CFLAGS="$CFLAGS -I$PREFIX/include -I. -Icommon -Ieip4844 -Ieip7594 -Isetup"

# Compile common files
clang $CFLAGS -c common/alloc.c -o alloc.o
clang $CFLAGS -c common/bytes.c -o bytes.o
clang $CFLAGS -c common/ec.c -o ec.o
clang $CFLAGS -c common/fr.c -o fr.o
clang $CFLAGS -c common/lincomb.c -o lincomb.o
clang $CFLAGS -c common/utils.c -o utils.o

# Compile setup files
clang $CFLAGS -c setup/setup.c -o setup.o

# Compile eip4844 files
clang $CFLAGS -c eip4844/eip4844.c -o eip4844.o
clang $CFLAGS -c eip4844/blob.c -o blob.o

# Compile eip7594 files
clang $CFLAGS -c eip7594/eip7594.c -o eip7594.o
clang $CFLAGS -c eip7594/cell.c -o cell.o
clang $CFLAGS -c eip7594/fft.c -o fft.o
clang $CFLAGS -c eip7594/fk20.c -o fk20.o
clang $CFLAGS -c eip7594/poly.c -o poly.o
clang $CFLAGS -c eip7594/recovery.c -o recovery.o

# Create static library
ar rcs libckzg.a alloc.o bytes.o ec.o fr.o lincomb.o utils.o \
setup.o eip4844.o blob.o eip7594.o cell.o fft.o fk20.o poly.o recovery.o

# Install library and headers
mkdir -p "$PREFIX/lib" "$PREFIX/include"
cp libckzg.a "$PREFIX/lib/"
cp ckzg.h "$PREFIX/include/"
cp -r common "$PREFIX/include/"
cp -r eip4844 "$PREFIX/include/"
cp -r eip7594 "$PREFIX/include/"
cp -r setup "$PREFIX/include/"

# Generate embedded trusted setup header (MSYS2 uses 'python' not 'python3')
python "$REPO_ROOT/scripts/generate-kzg-trusted-setup.py" \
trusted_setup.txt "$PREFIX/include/kzg-trusted-setup-data.h"
7 changes: 7 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ jobs:
git
unzip
bash
python
pacboy: >-
cmake:p
ninja:p
Expand Down Expand Up @@ -168,6 +169,12 @@ jobs:
echo "::group::Installing libff"
./.github/scripts/install-libff.sh
echo "::endgroup::"
echo "::group::Installing blst"
./.github/scripts/install-blst.sh
echo "::endgroup::"
echo "::group::Installing c-kzg"
./.github/scripts/install-c-kzg.sh
echo "::endgroup::"
- name: Configure the build
run: |
export PATH="$HASKELL_PATHS:$PATH"
Expand Down
Loading