Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update libsecp256k1, remove libsecp256k1 build instructions #371

Merged
merged 8 commits into from
Aug 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,9 @@ jobs:
working_directory: ~/app

steps:
- run: sudo apt-get update; sudo apt-get -y install libtool autoconf libgmp3-dev
- checkout
- run: git submodule sync --recursive
- run: git submodule update --recursive --init
- run: curl https://sh.rustup.rs -sSf | sh -s -- -y
- run: echo 'export PATH=~/.cargo/bin:$PATH' >> $BASH_ENV

- run: mix local.hex --force
- run: mix local.rebar --force

- restore_cache:
keys:
Expand All @@ -38,12 +32,12 @@ jobs:
- v1-build-cache-{{ .Branch }}
- v1-build-cache

- run: echo 'export PATH=~/.cargo/bin:$PATH' >> $BASH_ENV

- run:
command: mix do deps.get, compile
command: ./bin/setup
no_output_timeout: 2400

- run: cd deps/libsecp256k1 && rebar compile

- save_cache:
key: v1-env-cache-{{ arch }}-{{ .Branch }}
paths:
Expand Down
2 changes: 1 addition & 1 deletion apps/exth_crypto/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ defmodule ExthCrypto.Mixfile do
# Type "mix help deps" for more examples and options
defp deps do
[
{:libsecp256k1, "~> 0.1.4"},
{:libsecp256k1, "~> 0.1.9"},
{:keccakf1600, "~> 2.0.0", hex: :keccakf1600_orig},
{:credo, "~> 0.8", only: [:dev, :test], runtime: false},
{:binary, "~> 0.0.4"}
Expand Down
56 changes: 18 additions & 38 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,24 @@ install_linux_deps() {
esac
}

install_linux_rust() {
curl https://sh.rustup.rs -sSf | sh
install_darwin_deps(){
fancy_echo "Installing dependencies via brew"
brew bundle --file=- <<EOF
brew "automake"
brew "autoconf"
brew "gmp"
brew "libtool"
EOF
}

install_rust() {
curl https://sh.rustup.rs -sSf | sh -s -- -y
if [ $? -ne 0 ]; then
fancy_echo "Rust installation failed"
exit 1
fi
}

install_rust() {
local sys=`uname -s`
case $sys in
Linux*)
install_linux_rust
;;
Darwin*)
brew install rust
;;
*)
fancy_echo "Unknown system"
exit 1
;;
esac
}

install_deps() {
local sys=`uname -s`
echo $sys
Expand All @@ -57,13 +51,7 @@ install_deps() {
install_linux_deps
;;
Darwin*)
fancy_echo "Installing dependencies via brew"
brew bundle --file=- <<EOF
brew "automake"
brew "autoconf"
brew "gmp"
brew "libtool"
EOF
install_darwin_deps
;;
*)
fancy_echo "Unknown system"
Expand All @@ -90,23 +78,14 @@ if ! command -v mix > /dev/null; then
exit 1
fi

ELIXIR_PATCH_VERSION=`elixir -v |grep Elixir | sed -n 's/.*1\.6\.\([0-9]\).*$/\1/p'`
if [ $ELIXIR_PATCH_VERSION -lt 5 ]; then
fancy_echo "Your elixir version must be ~> 1.6.5"
ELIXIR_PATCH_VERSION=`elixir -v |grep Elixir | sed -n 's/.*1\.7\.\([0-9]\).*$/\1/p'`
if [ $ELIXIR_PATCH_VERSION -lt 2 ]; then
fancy_echo "Your elixir version must be ~> 1.7.2"
fancy_echo "Your current version:"
elixir -v
exit 1
fi

mix local.rebar --force

if ! command -v rebar > /dev/null; then
fancy_echo "\`rebar\`: Command not found"
fancy_echo "Please either add ~/.mix to your \$PATH environemnt varible or install it with brew: \`brew install rebar\`"

exit 1
fi

mix local.hex --force

if ! command -v mix > /dev/null; then
Expand All @@ -121,8 +100,9 @@ if ! command -v rustc > /dev/null; then
fi

fancy_echo "Installing elixir dependencies and compiling."
mix local.hex --force
mix local.rebar --force
mix deps.get
cd deps/libsecp256k1 && rebar compile && cd ../../
mix do deps.compile, compile

fancy_echo "You're all set!"