2020-09-16 13:28:28 +00:00
|
|
|
load("@prysm//tools/go:def.bzl", "go_library")
|
|
|
|
load("@io_bazel_rules_go//go:def.bzl", "go_test")
|
|
|
|
|
2022-04-28 10:02:02 +00:00
|
|
|
config_setting(
|
|
|
|
name = "blst_modern",
|
|
|
|
constraint_values = [
|
|
|
|
"@platforms//os:linux",
|
|
|
|
"@platforms//cpu:x86_64",
|
|
|
|
],
|
|
|
|
values = {
|
|
|
|
"define": "blst_modern=true",
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
2020-09-16 13:28:28 +00:00
|
|
|
go_library(
|
|
|
|
name = "go_default_library",
|
|
|
|
srcs = [
|
|
|
|
"bindings/go/blst.go",
|
|
|
|
"bindings/go/server.c",
|
|
|
|
],
|
|
|
|
cgo = True,
|
|
|
|
copts = [
|
|
|
|
"-D__BLST_CGO__",
|
|
|
|
"-Ibindings",
|
|
|
|
"-Isrc",
|
2020-09-26 08:48:02 +00:00
|
|
|
"-O",
|
2020-09-16 13:28:28 +00:00
|
|
|
] + select({
|
|
|
|
"@io_bazel_rules_go//go/platform:amd64": [
|
|
|
|
"-mno-avx",
|
|
|
|
"-D__ADX__",
|
|
|
|
],
|
|
|
|
"//conditions:default": [],
|
2022-04-28 10:02:02 +00:00
|
|
|
}) + select({
|
|
|
|
"//conditions:default": [
|
|
|
|
"-D__BLST_PORTABLE__",
|
|
|
|
],
|
|
|
|
":blst_modern": [],
|
2020-09-16 13:28:28 +00:00
|
|
|
}),
|
|
|
|
cdeps = [":blst"],
|
|
|
|
importpath = "github.com/supranational/blst/bindings/go",
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
|
|
|
go_test(
|
|
|
|
name = "go_default_test",
|
|
|
|
srcs = [
|
|
|
|
"bindings/go/blst_htoc_test.go",
|
|
|
|
"bindings/go/blst_minpk_test.go",
|
|
|
|
"bindings/go/blst_minsig_test.go",
|
|
|
|
],
|
|
|
|
embed = [":go_default_library"],
|
|
|
|
data = glob([
|
|
|
|
"bindings/go/hash_to_curve/*.json",
|
|
|
|
]),
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "blst",
|
|
|
|
srcs = [
|
|
|
|
"bindings/blst.h",
|
|
|
|
"bindings/blst_aux.h",
|
|
|
|
],
|
|
|
|
hdrs = [
|
|
|
|
"bindings/blst.h",
|
|
|
|
"bindings/blst_aux.h",
|
|
|
|
],
|
|
|
|
deps = [
|
|
|
|
":src",
|
|
|
|
":asm",
|
|
|
|
],
|
|
|
|
strip_include_prefix = "bindings",
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "asm_hdrs",
|
|
|
|
hdrs = glob([
|
|
|
|
"build/**/*.s",
|
|
|
|
"build/**/*.S",
|
|
|
|
], exclude = ["build/assembly.s"]),
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "asm",
|
|
|
|
srcs = [
|
|
|
|
"build/assembly.S",
|
|
|
|
],
|
|
|
|
copts = [
|
2020-09-26 08:48:02 +00:00
|
|
|
"-O",
|
2020-09-16 13:28:28 +00:00
|
|
|
] + select({
|
|
|
|
"@io_bazel_rules_go//go/platform:amd64": [
|
|
|
|
"-mno-avx",
|
|
|
|
"-D__ADX__",
|
|
|
|
],
|
|
|
|
"//conditions:default": [],
|
2022-04-28 10:02:02 +00:00
|
|
|
}) + select({
|
|
|
|
"//conditions:default": [
|
|
|
|
"-D__BLST_PORTABLE__",
|
|
|
|
],
|
|
|
|
":blst_modern": [],
|
2020-09-16 13:28:28 +00:00
|
|
|
}),
|
|
|
|
deps = [":asm_hdrs"],
|
|
|
|
linkstatic = True,
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "hdrs",
|
|
|
|
hdrs = glob(
|
|
|
|
[
|
|
|
|
"src/*.c",
|
|
|
|
"src/*.h",
|
|
|
|
],
|
|
|
|
exclude = [
|
|
|
|
"src/server.c",
|
|
|
|
"src/client_*.c",
|
|
|
|
],
|
|
|
|
),
|
|
|
|
strip_include_prefix = "src",
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "src",
|
|
|
|
srcs = [
|
|
|
|
"src/server.c",
|
|
|
|
],
|
|
|
|
deps = [
|
|
|
|
":hdrs",
|
|
|
|
],
|
|
|
|
)
|