From 375a9a799bbf7da3c7d603d437166497f280a629 Mon Sep 17 00:00:00 2001 From: Michael Rodler Date: Fri, 13 May 2022 19:58:05 +0200 Subject: [PATCH 1/2] added some common container definitions (i.e., Dockerfile based on Ubuntu; a shell.nix for quick development) --- Dockerfile | 36 ++++++++++++++++++++++++++++++++++++ Makefile | 14 ++++++++++++++ _tags | 2 +- build | 2 +- shell.nix | 25 +++++++++++++++++++++++++ 5 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 Dockerfile create mode 100755 Makefile create mode 100644 shell.nix diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d56f59f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,36 @@ +FROM ubuntu:jammy + +ARG DEBIAN_FRONTEND=noninteractive +# Install some basic pre-requisites +RUN apt-get -qq update \ + && apt-get install -q -y \ + sudo wget git \ + build-essential g++ gcc m4 make pkg-config libgmp3-dev unzip cmake \ + opam \ + python3 python3-pip \ + time \ + z3 \ + libz3-dev \ + && apt-get clean -q -y \ + && rm -rf /var/lib/apt/lists/* + +RUN pip3 install solc-select +RUN solc-select install 0.7.6 \ + && solc-select use 0.7.6 \ + && solc-select install 0.4.26 +ENV PATH=$PATH:/root/.solc-select/artifacts/ + +WORKDIR /build +ADD . ./verismart + +WORKDIR /build/verismart +RUN opam init -y --disable-sandboxing \ + && eval $(opam env) \ + && opam update \ + && opam install -y \ + conf-m4.1 ocamlfind ocamlbuild num yojson batteries ocamlgraph zarith z3 +# Make sure that ocamlbuild and such exists in the path +RUN echo 'eval $(opam env)' >> $HOME/.bashrc + +RUN chmod +x build && eval $(opam env) && ./build && ./main.native --help >/dev/null +RUN ln -s $(realpath ./main.native) /usr/local/bin/verismart diff --git a/Makefile b/Makefile new file mode 100755 index 0000000..5938f0f --- /dev/null +++ b/Makefile @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +TARGET=main.native +INCLUDE_DIRS=src/frontend,src/pre,src/pre/interval,src/verify,src/vlang,src/util,src/checker,src/exploit + +build: + time ocamlbuild src/$(TARGET) -use-ocamlfind -tag thread -Is $(INCLUDE_DIRS) + +clean: + ocamlbuild -clean + +rebuild: clean build + +.PHONY: clean build rebuild debug diff --git a/_tags b/_tags index 4f5ad57..89afd86 100644 --- a/_tags +++ b/_tags @@ -1 +1 @@ -true: package(batteries), package(str), package(Z3), package(yojson), package(ocamlgraph) +true: package(batteries), package(str), package(z3), package(yojson), package(ocamlgraph) diff --git a/build b/build index 544a846..3d22931 100755 --- a/build +++ b/build @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash TARGET=main.native INCLUDE_DIRS=src/frontend,src/pre,src/pre/interval,src/verify,src/vlang,src/util,src/checker,src/exploit diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..c11b64a --- /dev/null +++ b/shell.nix @@ -0,0 +1,25 @@ +{ pkgs ? import { } }: + +pkgs.mkShell { + buildInputs = [ + pkgs.ocaml + pkgs.opam + + pkgs.ocamlPackages.findlib + pkgs.ocamlPackages.ocamlbuild + pkgs.ocamlPackages.batteries + pkgs.ocamlPackages.ocamlgraph + pkgs.ocamlPackages.num + pkgs.ocamlPackages.yojson + pkgs.ocamlPackages.zarith + pkgs.ocamlPackages.z3 + + pkgs.z3 + + pkgs.gnum4 + pkgs.gnumake + + # pkgs.solc-select + pkgs.solc + ]; +} From df3f130a10f686330677490b0486ba10e0ca7aef Mon Sep 17 00:00:00 2001 From: Michael Rodler Date: Fri, 13 May 2022 20:15:48 +0200 Subject: [PATCH 2/2] added dockerignore file --- .dockerignore | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..707aa3c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +Dockerfile +_build +validation-files/* +output/*