From 849b91157fca6451301abc4cfcd4bbd867a193b9 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Fri, 31 May 2019 20:51:23 -0700 Subject: [PATCH 01/27] Add rough draft of makefile to experiment with --- src/build-deps.sh | 6 ++++++ src/build.sh | 3 +++ src/install.sh | 6 ++++++ src/makefile | 11 +++++++++++ 4 files changed, 26 insertions(+) create mode 100644 src/build-deps.sh create mode 100644 src/build.sh create mode 100644 src/install.sh create mode 100644 src/makefile diff --git a/src/build-deps.sh b/src/build-deps.sh new file mode 100644 index 000000000..bbfd9c3cf --- /dev/null +++ b/src/build-deps.sh @@ -0,0 +1,6 @@ +#!/bin/sh +vendors/opam-repository-tools/rewrite-local-opam-repository.sh +opam repository add localrepo "file://$PWD/vendors/ligo-opam-repository-local-generated/" +opam install ocp-indent merlin alcotest-lwt crowbar +opam user-setup install +opam install -y --build-test --deps-only ./src/ diff --git a/src/build.sh b/src/build.sh new file mode 100644 index 000000000..d203b42e5 --- /dev/null +++ b/src/build.sh @@ -0,0 +1,3 @@ +#! /bin/sh + +dune build -p ligo diff --git a/src/install.sh b/src/install.sh new file mode 100644 index 000000000..99d86d003 --- /dev/null +++ b/src/install.sh @@ -0,0 +1,6 @@ +add-apt-repository ppa:avsm/ppa +apt update +apt-get install opam mercurial darcs make m4 gcc libev-dev libgmp-dev pkg-config libhidapi-dev +opam init --bare +y +y diff --git a/src/makefile b/src/makefile new file mode 100644 index 000000000..e775b0376 --- /dev/null +++ b/src/makefile @@ -0,0 +1,11 @@ +install: + ./install.sh + +build-deps: + ./build-deps.sh + +build: build-deps + ./build.sh + +test: build + dune build @ligo-test From 533913fd3623d990ca5fe3c5b2119c005d6db7d0 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Fri, 31 May 2019 21:09:08 -0700 Subject: [PATCH 02/27] Tweak make scripts based on observations in virtual machine --- src/build-deps.sh | 4 +++- src/install.sh | 12 ++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/build-deps.sh b/src/build-deps.sh index bbfd9c3cf..821186320 100644 --- a/src/build-deps.sh +++ b/src/build-deps.sh @@ -1,6 +1,8 @@ #!/bin/sh +opam switch create .. ocaml-base-compiler.4.06.1 +eval $(opam env) vendors/opam-repository-tools/rewrite-local-opam-repository.sh opam repository add localrepo "file://$PWD/vendors/ligo-opam-repository-local-generated/" -opam install ocp-indent merlin alcotest-lwt crowbar +opam install -y ocp-indent merlin alcotest-lwt crowbar opam user-setup install opam install -y --build-test --deps-only ./src/ diff --git a/src/install.sh b/src/install.sh index 99d86d003..78e7c42e5 100644 --- a/src/install.sh +++ b/src/install.sh @@ -1,6 +1,6 @@ -add-apt-repository ppa:avsm/ppa -apt update -apt-get install opam mercurial darcs make m4 gcc libev-dev libgmp-dev pkg-config libhidapi-dev -opam init --bare -y -y +#! /bin/sh +sudo add-apt-repository -y ppa:avsm/ppa +sudo apt-get update +sudo apt-get install -y opam mercurial darcs make m4 gcc libev-dev libgmp-dev pkg-config libhidapi-dev +opam init --bare -a + From afa272245642b1781a234116aac7a65064f79902 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Fri, 31 May 2019 22:32:23 -0700 Subject: [PATCH 03/27] Change directory of make files --- build-deps.sh | 8 ++++++++ build.sh | 3 +++ install.sh | 6 ++++++ makefile | 11 +++++++++++ 4 files changed, 28 insertions(+) create mode 100644 build-deps.sh create mode 100644 build.sh create mode 100644 install.sh create mode 100644 makefile diff --git a/build-deps.sh b/build-deps.sh new file mode 100644 index 000000000..821186320 --- /dev/null +++ b/build-deps.sh @@ -0,0 +1,8 @@ +#!/bin/sh +opam switch create .. ocaml-base-compiler.4.06.1 +eval $(opam env) +vendors/opam-repository-tools/rewrite-local-opam-repository.sh +opam repository add localrepo "file://$PWD/vendors/ligo-opam-repository-local-generated/" +opam install -y ocp-indent merlin alcotest-lwt crowbar +opam user-setup install +opam install -y --build-test --deps-only ./src/ diff --git a/build.sh b/build.sh new file mode 100644 index 000000000..d203b42e5 --- /dev/null +++ b/build.sh @@ -0,0 +1,3 @@ +#! /bin/sh + +dune build -p ligo diff --git a/install.sh b/install.sh new file mode 100644 index 000000000..78e7c42e5 --- /dev/null +++ b/install.sh @@ -0,0 +1,6 @@ +#! /bin/sh +sudo add-apt-repository -y ppa:avsm/ppa +sudo apt-get update +sudo apt-get install -y opam mercurial darcs make m4 gcc libev-dev libgmp-dev pkg-config libhidapi-dev +opam init --bare -a + diff --git a/makefile b/makefile new file mode 100644 index 000000000..e775b0376 --- /dev/null +++ b/makefile @@ -0,0 +1,11 @@ +install: + ./install.sh + +build-deps: + ./build-deps.sh + +build: build-deps + ./build.sh + +test: build + dune build @ligo-test From 1a8ced68af82ef2cef862a5ebb1f5ef2a8051a22 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Fri, 31 May 2019 22:52:20 -0700 Subject: [PATCH 04/27] Add execution permissions to shell scripts --- build-deps.sh | 0 build.sh | 0 install.sh | 0 3 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 build-deps.sh mode change 100644 => 100755 build.sh mode change 100644 => 100755 install.sh diff --git a/build-deps.sh b/build-deps.sh old mode 100644 new mode 100755 diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 diff --git a/install.sh b/install.sh old mode 100644 new mode 100755 From 0537d9e3331af099d6240bc027f1b5baed1aa145 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Fri, 31 May 2019 23:44:48 -0700 Subject: [PATCH 05/27] Remove question from opam user-setup installation, attempt to set opam env vars --- build-deps.sh | 2 +- makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build-deps.sh b/build-deps.sh index 821186320..b38c70b7a 100755 --- a/build-deps.sh +++ b/build-deps.sh @@ -4,5 +4,5 @@ eval $(opam env) vendors/opam-repository-tools/rewrite-local-opam-repository.sh opam repository add localrepo "file://$PWD/vendors/ligo-opam-repository-local-generated/" opam install -y ocp-indent merlin alcotest-lwt crowbar -opam user-setup install +opam -y user-setup install opam install -y --build-test --deps-only ./src/ diff --git a/makefile b/makefile index e775b0376..675e82ad8 100644 --- a/makefile +++ b/makefile @@ -5,7 +5,7 @@ build-deps: ./build-deps.sh build: build-deps - ./build.sh + source ./build.sh test: build dune build @ligo-test From b604c3badfd4e6280ac6a3843b0d4a0643601522 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Sat, 1 Jun 2019 02:06:44 -0700 Subject: [PATCH 06/27] Undo addition of source command to makefile build-deps --- makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefile b/makefile index 675e82ad8..e775b0376 100644 --- a/makefile +++ b/makefile @@ -5,7 +5,7 @@ build-deps: ./build-deps.sh build: build-deps - source ./build.sh + ./build.sh test: build dune build @ligo-test From d88beae3d487fb8aefb07f93b42f112f553914b8 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Sat, 1 Jun 2019 02:24:59 -0700 Subject: [PATCH 07/27] Add environmental variables to make build --- src/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/build.sh b/src/build.sh index d203b42e5..e79f66d86 100644 --- a/src/build.sh +++ b/src/build.sh @@ -1,3 +1,3 @@ #! /bin/sh - +eval $(opam env) dune build -p ligo From f951161884c31fdf0527c587464be2e1a8f3393e Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Sat, 1 Jun 2019 03:36:10 -0700 Subject: [PATCH 08/27] Move build.sh after emacs accidentally wrote it back in /src/ --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100755 => 100644 build.sh diff --git a/build.sh b/build.sh old mode 100755 new mode 100644 index d203b42e5..e79f66d86 --- a/build.sh +++ b/build.sh @@ -1,3 +1,3 @@ #! /bin/sh - +eval $(opam env) dune build -p ligo From c16c85f1de12cd450fb5f2c14c5dfaac43f74bf6 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Sat, 1 Jun 2019 20:04:46 -0700 Subject: [PATCH 09/27] Add execution privileges to build.sh --- build.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 build.sh diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 From ff50c920d7bf81d3189723393fdb01fac1695173 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Sat, 1 Jun 2019 20:07:16 -0700 Subject: [PATCH 10/27] Add environmental variable setter to make test --- makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/makefile b/makefile index e775b0376..44d6ec1fc 100644 --- a/makefile +++ b/makefile @@ -8,4 +8,5 @@ build: build-deps ./build.sh test: build + eval $(opam env) dune build @ligo-test From ed418bae71569e9f8a5663e8d5b17cc518b3a4f5 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Fri, 7 Jun 2019 22:01:23 -0700 Subject: [PATCH 11/27] Add temporary build environment setup script --- scripts/install_build_environment.sh | 31 ++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 scripts/install_build_environment.sh diff --git a/scripts/install_build_environment.sh b/scripts/install_build_environment.sh new file mode 100644 index 000000000..7f1df608d --- /dev/null +++ b/scripts/install_build_environment.sh @@ -0,0 +1,31 @@ +sudo apt-get install -y make \ + m4 \ + gcc \ + patch \ + bubblewrap \ + rsync \ + curl \ + +if [ -n "`uname -a | grep -i ubuntu`" ] +then + sudo add-apt-repository -y ppa:avsm/ppa + sudo apt-get update + sudo apt-get install -y opam +else + # I'm going to assume here that we're on x86_64, 32-bit users should be basically + # extinct at this point right? + curl -L https://github.com/ocaml/opam/releases/download/2.0.4/opam-2.0.4-x86_64-linux \ + --output opam + if [ `openssl sha256 -r opam` = \ + "373e34f92f282273d482537f8103caad0d17b6f2699ff504bed77f474cb0c951 *opam" ] + then + sudo mv opam /usr/local/bin/opam + sudo chmod +x /usr/local/bin/opam + else + echo "opam file hash doesn't match what was recorded at time of signature verification!" + echo "(If you actually get this message, you should probably file an issue)" + exit 1 + fi +fi + +opam init -a --bare From e157e0527b0e1b117e2392685d0708de7492152c Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Fri, 7 Jun 2019 22:16:55 -0700 Subject: [PATCH 12/27] Change makefile to use preexisting setup scripts for docker and add new ones --- makefile | 15 ++++++++++++--- scripts/build_ligo_local.sh | 2 ++ scripts/setup_dev_switch.sh | 4 ++++ 3 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 scripts/build_ligo_local.sh create mode 100644 scripts/setup_dev_switch.sh diff --git a/makefile b/makefile index 44d6ec1fc..cceb4f50b 100644 --- a/makefile +++ b/makefile @@ -1,11 +1,20 @@ install: - ./install.sh +# Install opam and dependencies + scripts/install_build_environment.sh +# Install ligo/tezos specific system-level dependencies + scripts/install_native_dependencies.sh build-deps: - ./build-deps.sh +# Create opam dev switch locally for use with Ligo, add merlin/etc + scripts/create_dev_switch.sh +# Set up the local ligo opam repository so that it can be built + scripts/setup_ligo_opam_repository.sh +# Install OCaml build dependencies for Ligo + scripts/install_ligo_with_dependencies.sh build: build-deps - ./build.sh +# Build Ligo for local dev use + scripts/build_ligo_local.sh test: build eval $(opam env) diff --git a/scripts/build_ligo_local.sh b/scripts/build_ligo_local.sh new file mode 100644 index 000000000..85fcb6892 --- /dev/null +++ b/scripts/build_ligo_local.sh @@ -0,0 +1,2 @@ +eval $(opam env) +dune build -p ligo diff --git a/scripts/setup_dev_switch.sh b/scripts/setup_dev_switch.sh new file mode 100644 index 000000000..bf2c08293 --- /dev/null +++ b/scripts/setup_dev_switch.sh @@ -0,0 +1,4 @@ +opam switch create . ocaml-base-compiler.4.06.1 +eval $(opam env) +opam install -y ocp-indent merlin alcotest-lwt crowbar +opam -y user-setup install From a1a61e64f96a9ed852157cb94fe146c28a518105 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Fri, 7 Jun 2019 22:25:34 -0700 Subject: [PATCH 13/27] Add execution permissions to new build scripts --- scripts/build_ligo_local.sh | 0 scripts/install_build_environment.sh | 3 +-- scripts/setup_dev_switch.sh | 0 3 files changed, 1 insertion(+), 2 deletions(-) mode change 100644 => 100755 scripts/build_ligo_local.sh mode change 100644 => 100755 scripts/install_build_environment.sh mode change 100644 => 100755 scripts/setup_dev_switch.sh diff --git a/scripts/build_ligo_local.sh b/scripts/build_ligo_local.sh old mode 100644 new mode 100755 diff --git a/scripts/install_build_environment.sh b/scripts/install_build_environment.sh old mode 100644 new mode 100755 index 7f1df608d..d76e78e61 --- a/scripts/install_build_environment.sh +++ b/scripts/install_build_environment.sh @@ -16,8 +16,7 @@ else # extinct at this point right? curl -L https://github.com/ocaml/opam/releases/download/2.0.4/opam-2.0.4-x86_64-linux \ --output opam - if [ `openssl sha256 -r opam` = \ - "373e34f92f282273d482537f8103caad0d17b6f2699ff504bed77f474cb0c951 *opam" ] + if [ "`openssl sha256 -r opam`" = "373e34f92f282273d482537f8103caad0d17b6f2699ff504bed77f474cb0c951 *opam" ] then sudo mv opam /usr/local/bin/opam sudo chmod +x /usr/local/bin/opam diff --git a/scripts/setup_dev_switch.sh b/scripts/setup_dev_switch.sh old mode 100644 new mode 100755 From efb480a4494a40689fc2a6c91bdd8f278b4e2fc0 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Sat, 8 Jun 2019 01:57:32 -0700 Subject: [PATCH 14/27] Fix typos/miscalls, minor tweaks --- makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefile b/makefile index cceb4f50b..9f2fef049 100644 --- a/makefile +++ b/makefile @@ -6,7 +6,7 @@ install: build-deps: # Create opam dev switch locally for use with Ligo, add merlin/etc - scripts/create_dev_switch.sh + scripts/setup_dev_switch.sh # Set up the local ligo opam repository so that it can be built scripts/setup_ligo_opam_repository.sh # Install OCaml build dependencies for Ligo From 0575176939343a229dfcba891765177dd2b2bd76 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Sat, 8 Jun 2019 12:03:53 -0700 Subject: [PATCH 15/27] Make build env script more robust, take it out of makefile --- makefile | 8 +++--- scripts/install_build_environment.sh | 43 ++++++++++++++++++++++++---- 2 files changed, 42 insertions(+), 9 deletions(-) diff --git a/makefile b/makefile index 9f2fef049..0cf6ca549 100644 --- a/makefile +++ b/makefile @@ -1,8 +1,8 @@ -install: -# Install opam and dependencies - scripts/install_build_environment.sh +# Use install-deps instead of 'install' because usually 'make install' adds a +# binary to the system path and we don't want to confuse users +install-deps: # Install ligo/tezos specific system-level dependencies - scripts/install_native_dependencies.sh + sudo scripts/install_native_dependencies.sh build-deps: # Create opam dev switch locally for use with Ligo, add merlin/etc diff --git a/scripts/install_build_environment.sh b/scripts/install_build_environment.sh index d76e78e61..bea987d2a 100755 --- a/scripts/install_build_environment.sh +++ b/scripts/install_build_environment.sh @@ -1,3 +1,20 @@ +# This script installs opam for the user. It should NOT be included in any makefiles/etc. + +if [ -n "`which opam`"] +then + if [ -n "`opam --version | grep -P "2\..\.."`" ] + then + echo "Opam 2.x seems to already exist, exiting..." + exit 1 + fi +else + read -p "This script will upgrade opam to the 2.x series, are you okay with that? (y/n)" choice1 + case "$choice1" in + y|Y ) : ;; + n|N ) exit ;; + esac +fi + sudo apt-get install -y make \ m4 \ gcc \ @@ -5,24 +22,40 @@ sudo apt-get install -y make \ bubblewrap \ rsync \ curl \ - + if [ -n "`uname -a | grep -i ubuntu`" ] then sudo add-apt-repository -y ppa:avsm/ppa sudo apt-get update - sudo apt-get install -y opam + sudo apt-get install opam else # I'm going to assume here that we're on x86_64, 32-bit users should be basically # extinct at this point right? curl -L https://github.com/ocaml/opam/releases/download/2.0.4/opam-2.0.4-x86_64-linux \ - --output opam + --output opam_temp_version_2_0_4.bin if [ "`openssl sha256 -r opam`" = "373e34f92f282273d482537f8103caad0d17b6f2699ff504bed77f474cb0c951 *opam" ] then - sudo mv opam /usr/local/bin/opam - sudo chmod +x /usr/local/bin/opam + # Stay paranoid, in case other checks fail don't want to overrwrite + # user's opam on accident + chmod +x opam_temp_version_2_0_4.bin # Set execute so we can get version + if [ -e /usr/local/bin/opam ] + then + opam_old_v=`/usr/local/bin/opam --version` + opam_new_v=`opam_temp_version_2_0_4.bin --version` + read -p "This will overrwrite the opam you have in /usr/local/bin (version $opam_old_v) with version $opam_new_v, do you actually want to do that? Type yes. (yes/n)" choice2 + else + choice2="yes" + fi + if [ $choice2 = "yes" ] + then + sudo mv opam_temp_version_2_0_4.bin /usr/local/bin/opam + else + rm opam_temp_version_2_0_4.bin + exit else echo "opam file hash doesn't match what was recorded at time of signature verification!" echo "(If you actually get this message, you should probably file an issue)" + echo "https://gitlab.com/ligolang/ligo/issues" exit 1 fi fi From 1592da58b7ccd51f7b7c0b371d36c0cb26d5c332 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Sat, 8 Jun 2019 12:13:06 -0700 Subject: [PATCH 16/27] Fix typos breaking first if conditional, syntax error --- scripts/install_build_environment.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/install_build_environment.sh b/scripts/install_build_environment.sh index bea987d2a..f2c45d757 100755 --- a/scripts/install_build_environment.sh +++ b/scripts/install_build_environment.sh @@ -1,6 +1,6 @@ # This script installs opam for the user. It should NOT be included in any makefiles/etc. -if [ -n "`which opam`"] +if [ -n "`which opam`" ] then if [ -n "`opam --version | grep -P "2\..\.."`" ] then @@ -52,6 +52,7 @@ else else rm opam_temp_version_2_0_4.bin exit + fi else echo "opam file hash doesn't match what was recorded at time of signature verification!" echo "(If you actually get this message, you should probably file an issue)" From 512044c52bcea33884bd42ba5983830ae49f8a02 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Sat, 8 Jun 2019 14:19:07 -0700 Subject: [PATCH 17/27] Change first if conditional so upgrade q only asked if opam installed --- scripts/install_build_environment.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/install_build_environment.sh b/scripts/install_build_environment.sh index f2c45d757..fcf77f06a 100755 --- a/scripts/install_build_environment.sh +++ b/scripts/install_build_environment.sh @@ -6,13 +6,13 @@ then then echo "Opam 2.x seems to already exist, exiting..." exit 1 + else + read -p "This script will upgrade opam to the 2.x series, are you okay with that? (y/n)" choice1 + case "$choice1" in + y|Y ) : ;; + n|N ) exit ;; + esac fi -else - read -p "This script will upgrade opam to the 2.x series, are you okay with that? (y/n)" choice1 - case "$choice1" in - y|Y ) : ;; - n|N ) exit ;; - esac fi sudo apt-get install -y make \ From 7413ac22d6151de0389a5c0a8cbb8d04def65d28 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Sat, 8 Jun 2019 15:19:47 -0700 Subject: [PATCH 18/27] Add oneshell to makefile and fix filename bug in build env script --- makefile | 1 + scripts/install_build_environment.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/makefile b/makefile index 0cf6ca549..e9596f6c1 100644 --- a/makefile +++ b/makefile @@ -1,5 +1,6 @@ # Use install-deps instead of 'install' because usually 'make install' adds a # binary to the system path and we don't want to confuse users +.ONESHELL: install-deps: # Install ligo/tezos specific system-level dependencies sudo scripts/install_native_dependencies.sh diff --git a/scripts/install_build_environment.sh b/scripts/install_build_environment.sh index fcf77f06a..4d5e36400 100755 --- a/scripts/install_build_environment.sh +++ b/scripts/install_build_environment.sh @@ -33,7 +33,7 @@ else # extinct at this point right? curl -L https://github.com/ocaml/opam/releases/download/2.0.4/opam-2.0.4-x86_64-linux \ --output opam_temp_version_2_0_4.bin - if [ "`openssl sha256 -r opam`" = "373e34f92f282273d482537f8103caad0d17b6f2699ff504bed77f474cb0c951 *opam" ] + if [ "`openssl sha256 -r opam_temp_version_2_0_4.bin`" = "373e34f92f282273d482537f8103caad0d17b6f2699ff504bed77f474cb0c951 *opam_temp_version_2_0_4.bin" ] then # Stay paranoid, in case other checks fail don't want to overrwrite # user's opam on accident From 8c8f1c45774a55019877761625266833531df51e Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Sat, 8 Jun 2019 18:27:30 -0700 Subject: [PATCH 19/27] Try moving oneshell invocation --- makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefile b/makefile index e9596f6c1..3482fbf15 100644 --- a/makefile +++ b/makefile @@ -1,6 +1,5 @@ # Use install-deps instead of 'install' because usually 'make install' adds a # binary to the system path and we don't want to confuse users -.ONESHELL: install-deps: # Install ligo/tezos specific system-level dependencies sudo scripts/install_native_dependencies.sh @@ -17,6 +16,7 @@ build: build-deps # Build Ligo for local dev use scripts/build_ligo_local.sh +.ONESHELL: test: build eval $(opam env) dune build @ligo-test From 30700aefd420ce3388b6c65accfde8f8a6319207 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Sat, 8 Jun 2019 19:04:59 -0700 Subject: [PATCH 20/27] Try shell if syntax in makefile --- makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/makefile b/makefile index 3482fbf15..011c720d5 100644 --- a/makefile +++ b/makefile @@ -6,7 +6,9 @@ install-deps: build-deps: # Create opam dev switch locally for use with Ligo, add merlin/etc - scripts/setup_dev_switch.sh + if [ -n "`opam switch show | grep -P ".+/ligo"`" ]; + then exit; else scripts/setup_dev_switch.sh; + fi # Set up the local ligo opam repository so that it can be built scripts/setup_ligo_opam_repository.sh # Install OCaml build dependencies for Ligo From c30244a4e4c3ffe562acec66094d58fb17cfc81e Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Sat, 8 Jun 2019 20:11:29 -0700 Subject: [PATCH 21/27] Add a second test conditional to stop double-execution of make scripts --- makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/makefile b/makefile index 011c720d5..3587aa3ea 100644 --- a/makefile +++ b/makefile @@ -10,7 +10,9 @@ build-deps: then exit; else scripts/setup_dev_switch.sh; fi # Set up the local ligo opam repository so that it can be built - scripts/setup_ligo_opam_repository.sh + if [ -n "`opam repo list --safe | grep -P "ligo-opam-repository"`" ]; + then exit; else scripts/setup_ligo_opam_repository.sh; + fi # Install OCaml build dependencies for Ligo scripts/install_ligo_with_dependencies.sh From 77b743f0e12fece57cbf85b153df9fd97fa89326 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Sat, 8 Jun 2019 21:13:59 -0700 Subject: [PATCH 22/27] Try adding failure case message to makefile test --- makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/makefile b/makefile index 3587aa3ea..f7226602a 100644 --- a/makefile +++ b/makefile @@ -23,4 +23,6 @@ build: build-deps .ONESHELL: test: build eval $(opam env) - dune build @ligo-test + if [ ! dune build @ligo-test ] + then echo "If you get a error message that dune can't be found/isn't in your path, run 'eval $(opam env)' and this command will work."; + fi From 540bf1d550350f106604e947cf4bde7920c5a106 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Sat, 8 Jun 2019 21:20:33 -0700 Subject: [PATCH 23/27] Use hopefully valid syntax with test if conditional --- makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/makefile b/makefile index f7226602a..7b3bc00e1 100644 --- a/makefile +++ b/makefile @@ -23,6 +23,7 @@ build: build-deps .ONESHELL: test: build eval $(opam env) - if [ ! dune build @ligo-test ] - then echo "If you get a error message that dune can't be found/isn't in your path, run 'eval $(opam env)' and this command will work."; + run_outcome=`dune build @ligo-test` + if [ ! -n $run_outcome ] + then echo "Run 'eval $(opam env)' and this command will work."; fi From 8e715f17a7ac4ca414955c8ec985ffed26989768 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Sat, 8 Jun 2019 21:57:46 -0700 Subject: [PATCH 24/27] Swap makefile-native test command with script, add script --- makefile | 6 +----- scripts/test_ligo.sh | 2 ++ 2 files changed, 3 insertions(+), 5 deletions(-) create mode 100644 scripts/test_ligo.sh diff --git a/makefile b/makefile index 7b3bc00e1..069943f5b 100644 --- a/makefile +++ b/makefile @@ -22,8 +22,4 @@ build: build-deps .ONESHELL: test: build - eval $(opam env) - run_outcome=`dune build @ligo-test` - if [ ! -n $run_outcome ] - then echo "Run 'eval $(opam env)' and this command will work."; - fi + scripts/test_ligo.sh diff --git a/scripts/test_ligo.sh b/scripts/test_ligo.sh new file mode 100644 index 000000000..d13e26d3d --- /dev/null +++ b/scripts/test_ligo.sh @@ -0,0 +1,2 @@ +eval $(opam env) +dune build @ligo-test From 8b60b8597ffeefe24caa1f95243f2aa7f3f69151 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Sat, 8 Jun 2019 22:30:49 -0700 Subject: [PATCH 25/27] Add execution permission to test ligo script --- scripts/test_ligo.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/test_ligo.sh diff --git a/scripts/test_ligo.sh b/scripts/test_ligo.sh old mode 100644 new mode 100755 From 623290d66dca3077fd745ddce8474a807e5e1d81 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Sat, 8 Jun 2019 23:53:43 -0700 Subject: [PATCH 26/27] Delete unused build scripts --- build-deps.sh | 8 -------- build.sh | 3 --- install.sh | 6 ------ src/build-deps.sh | 8 -------- src/build.sh | 3 --- src/install.sh | 6 ------ src/makefile | 11 ----------- 7 files changed, 45 deletions(-) delete mode 100755 build-deps.sh delete mode 100755 build.sh delete mode 100755 install.sh delete mode 100644 src/build-deps.sh delete mode 100644 src/build.sh delete mode 100644 src/install.sh delete mode 100644 src/makefile diff --git a/build-deps.sh b/build-deps.sh deleted file mode 100755 index b38c70b7a..000000000 --- a/build-deps.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -opam switch create .. ocaml-base-compiler.4.06.1 -eval $(opam env) -vendors/opam-repository-tools/rewrite-local-opam-repository.sh -opam repository add localrepo "file://$PWD/vendors/ligo-opam-repository-local-generated/" -opam install -y ocp-indent merlin alcotest-lwt crowbar -opam -y user-setup install -opam install -y --build-test --deps-only ./src/ diff --git a/build.sh b/build.sh deleted file mode 100755 index e79f66d86..000000000 --- a/build.sh +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -eval $(opam env) -dune build -p ligo diff --git a/install.sh b/install.sh deleted file mode 100755 index 78e7c42e5..000000000 --- a/install.sh +++ /dev/null @@ -1,6 +0,0 @@ -#! /bin/sh -sudo add-apt-repository -y ppa:avsm/ppa -sudo apt-get update -sudo apt-get install -y opam mercurial darcs make m4 gcc libev-dev libgmp-dev pkg-config libhidapi-dev -opam init --bare -a - diff --git a/src/build-deps.sh b/src/build-deps.sh deleted file mode 100644 index 821186320..000000000 --- a/src/build-deps.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -opam switch create .. ocaml-base-compiler.4.06.1 -eval $(opam env) -vendors/opam-repository-tools/rewrite-local-opam-repository.sh -opam repository add localrepo "file://$PWD/vendors/ligo-opam-repository-local-generated/" -opam install -y ocp-indent merlin alcotest-lwt crowbar -opam user-setup install -opam install -y --build-test --deps-only ./src/ diff --git a/src/build.sh b/src/build.sh deleted file mode 100644 index e79f66d86..000000000 --- a/src/build.sh +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -eval $(opam env) -dune build -p ligo diff --git a/src/install.sh b/src/install.sh deleted file mode 100644 index 78e7c42e5..000000000 --- a/src/install.sh +++ /dev/null @@ -1,6 +0,0 @@ -#! /bin/sh -sudo add-apt-repository -y ppa:avsm/ppa -sudo apt-get update -sudo apt-get install -y opam mercurial darcs make m4 gcc libev-dev libgmp-dev pkg-config libhidapi-dev -opam init --bare -a - diff --git a/src/makefile b/src/makefile deleted file mode 100644 index e775b0376..000000000 --- a/src/makefile +++ /dev/null @@ -1,11 +0,0 @@ -install: - ./install.sh - -build-deps: - ./build-deps.sh - -build: build-deps - ./build.sh - -test: build - dune build @ligo-test From a729ec95b46f2de0bb3564c86d35b398a45a4b6d Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Sun, 9 Jun 2019 22:03:08 -0700 Subject: [PATCH 27/27] Add tuareg to dev switch setup --- scripts/setup_dev_switch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setup_dev_switch.sh b/scripts/setup_dev_switch.sh index bf2c08293..5b9ea1dca 100755 --- a/scripts/setup_dev_switch.sh +++ b/scripts/setup_dev_switch.sh @@ -1,4 +1,4 @@ opam switch create . ocaml-base-compiler.4.06.1 eval $(opam env) -opam install -y ocp-indent merlin alcotest-lwt crowbar +opam install -y ocp-indent tuareg merlin alcotest-lwt crowbar opam -y user-setup install