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

Fix opam build by making libff a git submodule #753

Merged
merged 4 commits into from
Jan 14, 2020
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,6 @@ src/stdlib/*.json
.DS_Store

# external dependencies
_deps/*
deps/libff/build/
deps/libff/install/

3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "deps/libff/src"]
path = deps/libff/src
url = https://github.com/scipr-lab/libff
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ clean:
dune clean
# Remove remaining files/folders ignored by git as defined in .gitignore (-X)
# but keeping a local opam switch and other dependencies built.
git clean -dfXq --exclude=\!_deps/** --exclude=\!_opam/**
git clean -dfXq --exclude=\!_opam/**

# Build a standalone scilla docker
docker:
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ A comprehensive documentation on Scilla, its features and constructs can be foun

We suggest users to use the latest release of Scilla available [here](https://github.com/Zilliqa/scilla/releases).

If you'd like to hack on Scilla, clone it with all of its submodules:
```shell
git clone --jobs 4 --recurse-submodules https://github.com/Zilliqa/scilla/
```

### Build requirements

Platform specific instructions for setting up your system for building Scilla can be
Expand Down
1 change: 1 addition & 0 deletions deps/libff/src
Submodule src added at f20671
4 changes: 2 additions & 2 deletions scilla.opam
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ depends: [
"patdiff" {with-test & (>= "v0.12.1" & < "v0.13~")}
]
build: [
[ "dune" "build" "-j" jobs "@install" ]
[ "dune" "runtest" "-p" name "-j" jobs ] {with-test}
[ "./scripts/libff.sh" ]
[ "dune" "build" "-p" name "-j" jobs ]
]
synopsis: "Scilla: Safe-By-Design Smart Contract Language"
description: """
Expand Down
14 changes: 5 additions & 9 deletions scripts/libff.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/usr/bin/env bash

set -ev

# This script is expected to be executed from Scilla root
# $./scripts/libff.sh
# The script fetches, builds and installs libff in the
# The script builds and installs libff in the
# _build directory of Scilla root.

libffurl="https://github.com/scipr-lab/libff.git"
libffdir="_deps/libff"
libffdir="deps/libff"

# Check if CWD has `scilla.opam`, assuring us that it's the root.
if [[ ! -f scilla.opam ]]
Expand All @@ -21,15 +23,9 @@ then
exit 0
fi

mkdir -p $libffdir
cd $libffdir
mkdir -p build install
echo "Cloning libff into ${libffdir}/src"
git clone $libffurl src
cd src
echo "Fetching submodules for libff"
git submodule init && git submodule update
git checkout f2067162520f91438b44e71a2cab2362f1c3cab4
anton-trunov marked this conversation as resolved.
Show resolved Hide resolved
echo "Installing libff into ${libffdir}/install"
cd ../build
cmake ../src -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_POSITION_INDEPENDENT_CODE=1 -DWITH_PROCPS=OFF
Expand Down
4 changes: 2 additions & 2 deletions src/base/cpp/config/discover.ml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ let () =
in

(* This file runs in _build/default/src/base/cpp.
* libff is installed in _deps/libff/install. *)
let libff_dir = Sys.getcwd() ^ "/../../../../../_deps/libff/install" in
* libff is installed in deps/libff/install. *)
let libff_dir = Sys.getcwd() ^ "/../../../../../deps/libff/install" in
let libff_include_dir = libff_dir ^ "/include" in
let libff_lib_dir = libff_dir ^ "/lib" in
if not (Sys.file_exists libff_include_dir) || not (Sys.file_exists libff_lib_dir)
Expand Down