Justin Traglia 69f6155d75
Bytes-only interface (#62)
* Convert argument types to bytes

* Update java bindings

* Update python bindings

* Update node.js bindings

* Update c# bindings

* Fix java binding compile issues

* Fix incorrect memcpy in nodejs bindings

* Fix bug (called the wrong func)

* Fix issues with java bindings

* Fix issues with node.js bindings

* Remove unnecessary wrapped funcs for c#

* Rename struct member to bytes

* Use goto out for callocs

* Fix nit

* Make un-exported funcs static

* Fix python bindings

* Check commitment length in python bindings

* Update python error message

* Steal good ideas from #37

* Fix tests.py which didn't get copied over

* Convert remaining a[] to *a

* Add missing Py_DECREF

* Bytes only rust (#1)

* Make interface bytes only
* Fix benches
* Avoid newtypes for kzg types
* Fix benches again
* Make fields private
* tidy
* Address review comments

* Fix one small thing in rust bindings

* Use ckzg types where possible

* Remove null terminator from domain bytes in rust

* Update rust binding docs

* Use BYTES_PER_* where applicable

* Add extra check for calloc

Co-authored-by: Pawan Dhananjay <pawandhananjay@gmail.com>
2023-01-16 20:05:23 +00:00

74 lines
1.7 KiB
Makefile

INCLUDE_DIRS = ../../src ../../blst/bindings
TARGETS=c_kzg_4844_jni.c ../../src/c_kzg_4844.c ../../lib/libblst.a
CC_FLAGS=
OPTIMIZATION_LEVEL=-O2
ifeq ($(OS),Windows_NT)
CLANG_EXECUTABLE=gcc
CLANG_FLAGS=-shared
JNI_INCLUDE_FOLDER=win32
OS_ARCH=amd64
LIBRARY_RESOURCE=ckzg4844jni.dll
GRADLE_COMMAND=gradlew
else
CLANG_EXECUTABLE=clang
UNAME_S := $(shell uname -s)
UNAME_M := $(shell uname -m)
ifeq ($(UNAME_S),Linux)
CLANG_FLAGS=-fPIC -shared
JNI_INCLUDE_FOLDER=linux
ifeq ($(UNAME_M),x86_64)
OS_ARCH=amd64
else
OS_ARCH=$(UNAME_M)
endif
LIBRARY_RESOURCE=libckzg4844jni.so
endif
ifeq ($(UNAME_S),Darwin)
ifeq ($(JAVA_HOME),)
JAVA_HOME := $(shell /usr/libexec/java_home)
endif
CLANG_FLAGS=-dynamiclib
JNI_INCLUDE_FOLDER=darwin
ifeq ($(UNAME_M),arm64)
OS_ARCH=aarch64
else
OS_ARCH=$(UNAME_M)
endif
LIBRARY_RESOURCE=libckzg4844jni.dylib
endif
GRADLE_COMMAND=./gradlew
endif
PRESET ?= mainnet
ifeq ($(PRESET),minimal)
FIELD_ELEMENTS_PER_BLOB ?= 4
else
FIELD_ELEMENTS_PER_BLOB ?= 4096
endif
LIBRARY_FOLDER=src/main/resources/ethereum/ckzg4844/lib/${OS_ARCH}/${PRESET}
ifeq ($(JAVA_HOME),)
$(error JAVA_HOME is not set and autodetection failed)
endif
all: build test benchmark
.PHONY: build
build:
mkdir -p ${LIBRARY_FOLDER}
${CLANG_EXECUTABLE} ${CC_FLAGS} ${CLANG_FLAGS} ${OPTIMIZATION_LEVEL} -Wall -Wno-missing-braces ${addprefix -I,${INCLUDE_DIRS}} -I"${JAVA_HOME}/include" -I"${JAVA_HOME}/include/${JNI_INCLUDE_FOLDER}" -DFIELD_ELEMENTS_PER_BLOB=${FIELD_ELEMENTS_PER_BLOB} -o ${LIBRARY_FOLDER}/${LIBRARY_RESOURCE} ${TARGETS}
.PHONY: test
test:
${GRADLE_COMMAND} clean test
.PHONY: benchmark
benchmark:
${GRADLE_COMMAND} clean jmh