Skip to content

Commit

Permalink
proxy: install-build-deps: Automate installation of required system p…
Browse files Browse the repository at this point in the history
…ackages (#2555)

* install-build-deps: Automate installation of required system packages

These used to be listed in README.md; some notes on the various
systems still remain there.

The framework for this script is taken from the same script in [k].

This has been tested on Ubuntu 22.04 and recent Arch. The MacOS code from
the [k] version has been tested on MacOS, and this is so similar (including
the use of `stack`) that there should be no issues with it. The Arch
support is untested, but is so simple it's hard to see what could go wrong.

[k]: https://github.com/runtimeverification/k

* Set Version: 1.0.666

* Set Version: 1.0.667

---------

Co-authored-by: Curt J. Sampson <[email protected]>
Co-authored-by: devops <[email protected]>
  • Loading branch information
3 people authored Aug 6, 2024
1 parent c7c8fe1 commit f11a268
Show file tree
Hide file tree
Showing 5 changed files with 135 additions and 99 deletions.
124 changes: 28 additions & 96 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,102 +61,34 @@ This repository generates the build-products for each backend in `$XDG_CACHE_HOM

### System Dependencies


#### Ubuntu

On Ubuntu >= 22.04 (for example):

```sh
sudo apt-get install \
bison \
build-essential \
clang-15 \
cmake \
curl \
flex \
g++ \
gcc \
libboost-test-dev \
libfmt-dev \
libgmp-dev \
libjemalloc-dev \
libmpfr-dev \
libsecp256k1-dev \
libstdc++-12-dev \
libtool \
libyaml-dev \
libz3-dev \
lld-15 \
llvm-15-tools \
m4 \
maven \
openjdk-17-jdk \
pkg-config \
python3 \
python3-dev \
z3 \
zlib1g-dev
```

On Ubuntu < 18.04, you'll need to skip `libsecp256k1-dev` and instead build it from source (via our `Makefile`):

```sh
make libsecp256k1
```

#### Arch Linux

On ArchLinux:

```sh
sudo pacman -S \
base base-devel boost clang cmake crypto++ curl git gmp \
gflags jdk-openjdk jemalloc libsecp256k1 lld llvm maven \
mpfr poetry python stack yaml-cpp zlib
```

#### macOS

After installing the Command Line Tools, [Homebrew](https://brew.sh/), and getting the [blockchain plugin](#blockchain-plugin), run:

```sh
brew tap runtimeverification/k
brew install \
bison \
boost \
cmake \
flex \
fmt \
gcc \
gmp \
openjdk \
jemalloc \
libyaml \
llvm \
make \
maven \
mpfr \
pkg-config \
python \
secp256k1 \
stack \
zlib \
z3
```

**NOTE**: It is recommended to use the homebrew version of `flex` and XCode.

If you are building on an Apple Silicon machine, ensure that your `PATH` is set up correctly before running `make deps` or `make k-deps`.
You can do so using [`direnv`](https://direnv.net/) by copying `macos-envrc` to `.envrc`, then running `direnv allow`.

If the build on macOS still fails, you can also try adding the following lines to the top of your `Makefile` under `UNAME_S`:

```sh
ifeq ($(UNAME_S), Darwin)
SHELL := /usr/local/bin/bash
PATH := $(pwd)/.build/usr/bin:$(PATH)
endif
```
Run `install-build-deps` to install the required OS-supplied dependencies.

There are some additional notes for specific systems:

Ubuntu:
- The script works for ≥ 22.04.
- On Ubuntu < 18.04, you'll need to skip `libsecp256k1-dev` and instead
build it from source (via our `Makefile`) using `make libsecp256k1`.

Arch:
- No issues known.

MacOS:
- After installing the Command Line Tools, [Homebrew](https://brew.sh/),
and getting the [blockchain plugin](#blockchain-plugin), run:
- **NOTE**: It is recommended to use the homebrew version of `flex` and
XCode.
- If you are building on an Apple Silicon machine, ensure that your `PATH`
is set up correctly before running `make deps` or `make k-deps`. You can
do so using [`direnv`](https://direnv.net/) by copying `macos-envrc` to
`.envrc`, then running `direnv allow`.
- If the build on macOS still fails, you can also try adding the following
lines to the top of your `Makefile` under `UNAME_S`:

ifeq ($(UNAME_S), Darwin)
SHELL := /usr/local/bin/bash
PATH := $(pwd)/.build/usr/bin:$(PATH)
endif

#### Haskell Stack (all platforms)

Expand Down
104 changes: 104 additions & 0 deletions install-build-deps
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#!/usr/bin/env bash
#
# Install OS packages containing dependencies required to build K.
#
set -Eeuo pipefail

die() { local ec="$1"; shift; echo "ERROR: $@"; exit $ec; }

try() {
local command="$1"; shift
local platform="$1"; shift

echo "===== Checking for $command for platform $platform"
$command --version >/dev/null 2>&1 || return 1
echo "----- Found platform $platform"
inst_$platform
}

####################################################################

inst_Debian() {
# On Ubuntu < 18.04, you'll need to skip `libsecp256k1-dev` and
# instead build it from source (via our `Makefile`):
# make libsecp256k1

echo '===== Debian packages:'
sudo apt-get install -q \
bison \
build-essential \
clang-15 \
cmake \
curl \
flex \
g++ \
gcc \
libboost-test-dev \
libfmt-dev \
libgmp-dev \
libjemalloc-dev \
libmpfr-dev \
libsecp256k1-dev \
libstdc++-12-dev \
libtool \
libyaml-dev \
libz3-dev \
lld-15 \
llvm-15-tools \
m4 \
maven \
openjdk-17-jdk \
pkg-config \
python3 \
python3-dev \
z3 \
zlib1g-dev

if stack --version >/dev/null 2>&1; then
echo 'Using existing Haskell Stack installation.'
else
echo '===== Haskell Stack:'
curl -sSL https://get.haskellstack.org/ | sh
fi
}

inst_MacOS() {
echo '===== Brew packages'
brew tap runtimeverification/k
brew install \
bison \
boost \
cmake \
flex \
fmt \
gcc \
gmp \
openjdk \
jemalloc \
libyaml \
llvm \
make \
maven \
mpfr \
pkg-config \
python \
secp256k1 \
stack \
zlib \
z3
}

inst_Arch() {
echo '===== Arch packages'
sudo pacman -S \
base base-devel boost clang cmake crypto++ curl git gmp \
gflags jdk-openjdk jemalloc libsecp256k1 lld llvm maven \
mpfr poetry python stack yaml-cpp zlib
}

####################################################################

try apt-get Debian && exit 0
try brew MacOS && exit 0
try pacman Arch && exit 0
die 1 'Cannot find known platform. Your system appears to be unsupported.'
2 changes: 1 addition & 1 deletion kevm-pyk/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "kevm-pyk"
version = "1.0.666"
version = "1.0.667"
description = ""
authors = [
"Runtime Verification, Inc. <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion kevm-pyk/src/kevm_pyk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
if TYPE_CHECKING:
from typing import Final

VERSION: Final = '1.0.666'
VERSION: Final = '1.0.667'
2 changes: 1 addition & 1 deletion package/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.666
1.0.667

0 comments on commit f11a268

Please sign in to comment.