diff --git a/.gitignore b/.gitignore index 89fb6fc..fd752c9 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ /priv/ecrecover.so /c_src/ecrecover.d /c_src/ecrecover.o +/c_src/secp256k1 diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 99e57d5..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "c_src/secp256k1"] - path = c_src/secp256k1 - url = https://github.com/bitcoin-core/secp256k1.git diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2f9c9e8 --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +REBAR3 ?= $(shell test -e `which rebar3` 2>/dev/null && which rebar3 || echo "./rebar3") + +all: compile + +compile: + ${REBAR3} compile + +clean: + ${REBAR3} clean + +test: compile + ${REBAR3} eunit \ No newline at end of file diff --git a/c_src/secp256k1 b/c_src/secp256k1 deleted file mode 160000 index cbe41ac..0000000 --- a/c_src/secp256k1 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit cbe41ac138bc0773d60ab1942b7ad6fc5eccfc19 diff --git a/rebar.config b/rebar.config index 614e851..c336dae 100644 --- a/rebar.config +++ b/rebar.config @@ -1,15 +1,7 @@ {deps, [{sha3, {git, "https://github.com/aeternity/erlang-sha3", {ref, "b5f27a2"}}}]}. -{pre_hooks, [ {compile, "git submodule update --init"} - , {"(linux|darwin)", compile, "sh -c \"cd c_src/secp256k1 && ./autogen.sh && ./configure --enable-module-recovery && make\""} - , {"win32", compile, "make -f Makefile.win32 win32_ecrecover"} - ]}. - -{post_hooks, [ {"(linux|darwin)", clean, "make -C \"c_src/secp256k1\" clean"} - , {"win32", clean, "make -f Makefile.win32 clean_win32_ecrecover"} - ]}. - +{pre_hooks, [ {compile, "./secp256k1.sh"} ]}. {plugins, [pc]}. diff --git a/secp256k1.sh b/secp256k1.sh new file mode 100755 index 0000000..109dcf8 --- /dev/null +++ b/secp256k1.sh @@ -0,0 +1,12 @@ +#! /bin/sh + +[ -f c_src/secp256k1/.libs/libsecp256k1.a ] && exit 0 + +cd c_src +git clone https://github.com/bitcoin/secp256k1 +cd secp256k1 +git -c advice.detachedHead=false checkout cbe41ac138bc0773d60ab1942b7ad6fc5eccfc19 +./autogen.sh +./configure --enable-module-recovery +make clean +make \ No newline at end of file