From 47409db7db6ca5438d16ceac0115a7822517acc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georges=20Dup=C3=A9ron?= Date: Tue, 28 May 2019 20:54:07 +0200 Subject: [PATCH] =?UTF-8?q?Started=20using=20the=20scripts/=E2=80=A6=20in?= =?UTF-8?q?=20.gitignore,=20started=20a=20Makefile=20for=20one-liners=20to?= =?UTF-8?q?=20be=20used=20by=20the=20devs,=20e.g.=20make=20build-deps,=20m?= =?UTF-8?q?ake,=20make=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 16 +++++----------- Makefile | 3 +++ scripts/install_native_dependencies.sh | 12 ++++++++---- scripts/install_opam.sh | 10 ++++++++++ 4 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 Makefile create mode 100644 scripts/install_opam.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f6e6b62ed..17372ad7a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -37,18 +37,13 @@ stages: # Install dependencies # rsync is needed by opam to sync a package installed from a local directory with the copy in ~/.opam - apt-get update -qq - - apt-get -y -qq install rsync libhidapi-dev libcap-dev libev-dev bubblewrap - - wget https://github.com/ocaml/opam/releases/download/2.0.1/opam-2.0.1-x86_64-linux -O opam-2.0.1-x86_64-linux - - cp opam-2.0.1-x86_64-linux /usr/local/bin/opam - - chmod +x /usr/local/bin/opam + - scripts/install_native_dependencies.sh + - scripts/install_opam.sh - export PATH="/usr/local/bin${PATH:+:}${PATH:-}" - # Initialise opam + # Initialise opam, create switch, load opam environment variables - printf '' | opam init --bare - - eval $(opam config env) - - # Create switch - - printf '' | opam switch create toto ocaml-base-compiler.4.06.1 + - printf '' | opam switch create ligo-switch ocaml-base-compiler.4.06.1 - eval $(opam config env) # Show versions and current switch @@ -61,8 +56,7 @@ local-dune-job: <<: *before_script stage: test script: - - vendors/opam-repository-tools/rewrite-local-opam-repository.sh - - opam repository add localrepo "file://$PWD/vendors/ligo-opam-repository-local-generated/" + - scripts/setup_ligo_opam_repository.sh - opam install -y --build-test --deps-only ./src/ - dune build -p ligo # TODO: also try instead from time to time: diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..f70b9412a --- /dev/null +++ b/Makefile @@ -0,0 +1,3 @@ +build-deps: + scripts/install_native_dependencies.sh + scripts/install_opam.sh diff --git a/scripts/install_native_dependencies.sh b/scripts/install_native_dependencies.sh index 0797f0300..6b06f51ad 100755 --- a/scripts/install_native_dependencies.sh +++ b/scripts/install_native_dependencies.sh @@ -1,10 +1,14 @@ -#!/bin/bash -set -euET -o pipefail +#!/bin/sh +set -e -apt-get -y install \ +apt-get update -qq +apt-get -y -qq install \ libev-dev \ perl \ pkg-config \ libgmp-dev \ libhidapi-dev \ - m4 + m4 \ + libcap-dev \ + bubblewrap \ + rsync diff --git a/scripts/install_opam.sh b/scripts/install_opam.sh new file mode 100644 index 000000000..b65cee626 --- /dev/null +++ b/scripts/install_opam.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -euET -o pipefail + +# TODO: this has many different modes of failure (file temp.opam-2.0.1-x86_64-linux.download-in-progress already exists, /usr/local/bin/opam already exists and is a directory or hard link, …) +# Try to improve these aspects. + +wget https://github.com/ocaml/opam/releases/download/2.0.1/opam-2.0.1-x86_64-linux -O temp.opam-2.0.1-x86_64-linux.download-in-progress +cp -i temp.opam-2.0.1-x86_64-linux.download-in-progress /usr/local/bin/opam +chmod +x /usr/local/bin/opam +rm temp.opam-2.0.1-x86_64-linux.download-in-progress