Skip to content

Commit

Permalink
Init & build scripts (#1886)
Browse files Browse the repository at this point in the history
* Init script
  • Loading branch information
kamilsa authored Dec 6, 2023
1 parent ee15e3d commit 492ea87
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 4 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,15 @@ More details of KAGOME development can be found within the [supported features](

#### Prerequisites

For now, please refer to the [Dockerfile](housekeeping/docker/kagome-dev/minideb.Dockerfile) to get a picture of what you need for a local build-environment.

If you are using a Debian Linux system, the following command allows you to build KAGOME:

```sh
git clone https://github.com/soramitsu/kagome
git clone https://github.com/qdrvm/kagome
cd kagome
sudo chmod +x scripts/init.sh scripts/build.sh

make build
sudo ./scripts/init.sh
./scripts/build.sh
```

You will get KAGOME binary in the `build/node/` folder
Expand Down
8 changes: 8 additions & 0 deletions scripts/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
RUST_VERSION=nightly-2022-11-20
RUSTUP_HOME=~/.rustup
CARGO_HOME=~/.cargo

CMAKE_VERSION="3.25"
CMAKE_CORE_NUMBER=6

PATH="${CARGO_HOME}/bin:${PATH}"
11 changes: 11 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -ex
current_dir=$(dirname $(readlink -f "$0"))
parent_dir=$(dirname "$current_dir")
cd $parent_dir

set -a; source $current_dir/.env; set +a #include .env vars

source $parent_dir/venv/bin/activate
$parent_dir/venv/bin/cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Release
$parent_dir/venv/bin/cmake --build build --target kagome -j ${CMAKE_CORE_NUMBER}
19 changes: 19 additions & 0 deletions scripts/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -ex
current_dir=$(dirname $(readlink -f "$0"))
parent_dir=$(dirname "$current_dir")
cd $parent_dir

set -a; source $current_dir/.env; set +a #include .env vars

apt update
apt install --no-install-recommends -y build-essential git gcc ca-certificates python-is-python3 python3-pip python3-venv curl libgmp-dev

python3 -m venv "$parent_dir/venv"

echo "Python environment created successfully in $parent_dir/venv"

$parent_dir/venv/bin/pip install --no-cache-dir cmake==${CMAKE_VERSION} gitpython requests

curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain ${RUST_VERSION} && \
rustup default ${RUST_VERSION}

0 comments on commit 492ea87

Please sign in to comment.