aboutsummaryrefslogtreecommitdiffstats
path: root/ffi/go/bls
diff options
context:
space:
mode:
Diffstat (limited to 'ffi/go/bls')
-rw-r--r--ffi/go/bls/bls.go14
-rw-r--r--ffi/go/bls/config.h6
-rw-r--r--ffi/go/bls/dummy.cpp3
-rw-r--r--ffi/go/bls/mcl.go2
4 files changed, 12 insertions, 13 deletions
diff --git a/ffi/go/bls/bls.go b/ffi/go/bls/bls.go
index 91af1d1..e9a6be3 100644
--- a/ffi/go/bls/bls.go
+++ b/ffi/go/bls/bls.go
@@ -2,14 +2,16 @@ package bls
/*
#cgo bn256 CFLAGS:-DMCLBN_FP_UNIT_SIZE=4
-#cgo bn256 LDFLAGS:-lbls256
+#cgo bn256 LDFLAGS:${SRCDIR}/../../../lib/libbls256.a
#cgo bn384 CFLAGS:-DMCLBN_FP_UNIT_SIZE=6
-#cgo bn384 LDFLAGS:-lbls384
+#cgo bn384 LDFLAGS:${SRCDIR}/../../../lib/libbls384.a
#cgo bn384_256 CFLAGS:-DMCLBN_FP_UNIT_SIZE=6 -DMCLBN_FR_UNIT_SIZE=4
-#cgo bn384_256 LDFLAGS:-lbls384_256
-#cgo LDFLAGS:-lbls384
-#cgo LDFLAGS:-lcrypto -lgmp -lgmpxx -lstdc++
-#include "config.h"
+#cgo bn384_256 LDFLAGS:${SRCDIR}/../../../lib/libbls384_256.a
+#cgo !bn256,!bn384,!bn384_256 CFLAGS:-DMCLBN_FP_UNIT_SIZE=6
+#cgo !bn256,!bn384,!bn384_256 LDFLAGS:${SRCDIR}/../../../lib/libbls384.a
+#cgo CFLAGS:-I${SRCDIR}/../../../include -I${SRCDIR}/../../../../mcl/include
+#cgo LDFLAGS:${SRCDIR}/../../../../mcl/lib/libmcl.a -lgmpxx -lgmp
+#cgo pkg-config: libcrypto
typedef unsigned int (*ReadRandFunc)(void *, void *, unsigned int);
int wrapReadRandCgo(void *self, void *buf, unsigned int n);
#include <bls/bls.h>
diff --git a/ffi/go/bls/config.h b/ffi/go/bls/config.h
deleted file mode 100644
index 07e1481..0000000
--- a/ffi/go/bls/config.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#pragma
-// use bn384 unless tags is specified
-#ifndef MCLBN_FP_UNIT_SIZE
- #define MCLBN_FP_UNIT_SIZE 6
-#endif
-
diff --git a/ffi/go/bls/dummy.cpp b/ffi/go/bls/dummy.cpp
new file mode 100644
index 0000000..a5103a1
--- /dev/null
+++ b/ffi/go/bls/dummy.cpp
@@ -0,0 +1,3 @@
+// This is a dummy source file which forces cgo to use the C++ linker instead
+// of the default C linker. We can therefore eliminate non-portable linker
+// flags such as -lstdc++, which is likely to break on FreeBSD and OpenBSD.
diff --git a/ffi/go/bls/mcl.go b/ffi/go/bls/mcl.go
index a808bad..ca8d7f0 100644
--- a/ffi/go/bls/mcl.go
+++ b/ffi/go/bls/mcl.go
@@ -4,7 +4,7 @@ package bls
#cgo bn256 CFLAGS:-DMCLBN_FP_UNIT_SIZE=4
#cgo bn384 CFLAGS:-DMCLBN_FP_UNIT_SIZE=6
#cgo bn384_256 CFLAGS:-DMCLBN_FP_UNIT_SIZE=6 -DMCLBN_FR_UNIT_SIZE=4
-#include "config.h"
+#cgo !bn256,!bn384,!bn384_256 CFLAGS:-DMCLBN_FP_UNIT_SIZE=6
#include <mcl/bn.h>
*/
import "C"