From f11a26865582931a570124311404197e1c5efd2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20V=C4=83caru?= <16517508+anvacaru@users.noreply.github.com> Date: Tue, 6 Aug 2024 15:29:03 +0300 Subject: [PATCH] proxy: install-build-deps: Automate installation of required system packages (#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 Co-authored-by: devops --- README.md | 124 +++++++----------------------- install-build-deps | 104 +++++++++++++++++++++++++ kevm-pyk/pyproject.toml | 2 +- kevm-pyk/src/kevm_pyk/__init__.py | 2 +- package/version | 2 +- 5 files changed, 135 insertions(+), 99 deletions(-) create mode 100755 install-build-deps diff --git a/README.md b/README.md index 02966e28e6..0ab42a6360 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/install-build-deps b/install-build-deps new file mode 100755 index 0000000000..61ed11b9eb --- /dev/null +++ b/install-build-deps @@ -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.' diff --git a/kevm-pyk/pyproject.toml b/kevm-pyk/pyproject.toml index ba85354ee6..d5aad4921a 100644 --- a/kevm-pyk/pyproject.toml +++ b/kevm-pyk/pyproject.toml @@ -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. ", diff --git a/kevm-pyk/src/kevm_pyk/__init__.py b/kevm-pyk/src/kevm_pyk/__init__.py index b66359e5b4..ab6eb08470 100644 --- a/kevm-pyk/src/kevm_pyk/__init__.py +++ b/kevm-pyk/src/kevm_pyk/__init__.py @@ -5,4 +5,4 @@ if TYPE_CHECKING: from typing import Final -VERSION: Final = '1.0.666' +VERSION: Final = '1.0.667' diff --git a/package/version b/package/version index 8c4ec9d68d..7d8fe7a5f9 100644 --- a/package/version +++ b/package/version @@ -1 +1 @@ -1.0.666 +1.0.667