diff --git a/.gitignore b/.gitignore index 23d3f5e..ac0d49e 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ Cargo.lock /parity-ethereum /_build /ebin +/priv/ecrecover.dll +/priv/ecrecover.so diff --git a/Makefile b/Makefile index 6f282aa..72aff5f 100644 --- a/Makefile +++ b/Makefile @@ -1,22 +1,31 @@ - UNAME := $(shell uname) +ifeq ($(OS),Windows_NT) + nif_lib_src = ecrecover.dll + nif_lib = ecrecover.dll +else ifeq ($(UNAME), Linux) - artefact = libecrecover.so + nif_lib_src = libecrecover.so + nif_lib = ecrecover.so endif ifeq ($(UNAME), Darwin) - artefact = libecrecover.dylib + nif_lib_src = libecrecover.dylib + nif_lib = ecrecover.so +endif endif +all: priv/$(nif_lib) compile -all: priv/ecrecover.so +compile: + ./rebar3 compile -priv/ecrecover.so: src/lib.rs parity-ethereum/ +priv/$(nif_lib): src/lib.rs parity-ethereum/ cargo build --release - cp target/release/$(artefact) priv/ecrecover.so + cp target/release/$(nif_lib_src) $@ clean: - rm -f priv/ecrecover.so target/release/$(artefact) + rm -f priv/$(nif_lib) target/release/$(nif_lib_src) + ./rebar3 clean parity-ethereum/: - git clone https://github.com/johnsnewby/parity-ethereum.git + git clone https://github.com/aeternity/parity-ethereum.git diff --git a/rebar.config b/rebar.config index 810f96e..292639f 100644 --- a/rebar.config +++ b/rebar.config @@ -3,7 +3,7 @@ {ecrecoverprebuilt, {ecrecoverprebuilt_app_with_priv_from_git, {git, "https://github.com/aeternity/ecrecover-prebuilt.git", - {ref, "fc52b89"}}}} + {ref, "274f90b"}}}} ]}. {plugins, [{rebar_ecrecoverprebuilt_dep, diff --git a/rebar.lock b/rebar.lock index 9b5998d..20f86cf 100644 --- a/rebar.lock +++ b/rebar.lock @@ -1,5 +1,5 @@ [{<<"ecrecoverprebuilt">>, {ecrecoverprebuilt_app_with_priv_from_git, {git,"https://github.com/aeternity/ecrecover-prebuilt.git", - {ref,"fc52b89643073be5ab65b192e466933d903994d7"}}}, + {ref,"274f90ba3d93468e8eec405309b43b6c97ae4246"}}}, 0}]. diff --git a/rebar3 b/rebar3 new file mode 100644 index 0000000..ea5a116 Binary files /dev/null and b/rebar3 differ