Skip to content

Commit 4ea7b3c

Browse files
ttuegelrv-jenkins
authored andcommitted
Allow user to override opam command (#592)
The user may override the opam command by setting the OPAM environment variable. The default is equivalent to `OPAM=opam`.
1 parent fda16de commit 4ea7b3c

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

Makefile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ LUA_PATH := $(PANDOC_TANGLE_SUBMODULE)/?.lua;;
3737
export TANGLER
3838
export LUA_PATH
3939

40+
OPAM ?= opam
41+
4042
.PHONY: all clean clean-submodules distclean install uninstall \
4143
deps all-deps llvm-deps haskell-deps repo-deps k-deps ocaml-deps plugin-deps libsecp256k1 libff \
4244
build build-all build-ocaml build-java build-node build-haskell build-llvm build-web3 \
@@ -140,8 +142,8 @@ $(PLUGIN_SUBMODULE)/make.timestamp:
140142
touch $(PLUGIN_SUBMODULE)/make.timestamp
141143

142144
ocaml-deps:
143-
eval $$(opam config env) \
144-
opam install --yes mlgmp zarith uuidm cryptokit secp256k1.0.3.2 bn128 ocaml-protoc rlp yojson hex ocp-ocamlres
145+
eval $$($(OPAM) config env) \
146+
$(OPAM) install --yes mlgmp zarith uuidm cryptokit secp256k1.0.3.2 bn128 ocaml-protoc rlp yojson hex ocp-ocamlres
145147

146148
# Building
147149
# --------
@@ -261,7 +263,7 @@ else
261263
endif
262264

263265
$(ocaml_dir)/$(MAIN_DEFN_FILE)-kompiled/constants.$(EXT): $(ocaml_files)
264-
eval $$(opam config env) \
266+
eval $$($(OPAM) config env) \
265267
&& $(K_BIN)/kompile --debug --main-module $(MAIN_MODULE) --backend ocaml \
266268
--syntax-module $(SYNTAX_MODULE) $(ocaml_dir)/$(MAIN_DEFN_FILE).k \
267269
--hook-namespaces "KRYPTO" --gen-ml-only -O3 --non-strict \
@@ -272,7 +274,7 @@ $(ocaml_dir)/$(MAIN_DEFN_FILE)-kompiled/constants.$(EXT): $(ocaml_files)
272274
$(ocaml_dir)/$(MAIN_DEFN_FILE)-kompiled/plugin/semantics.$(LIBEXT): $(wildcard $(PLUGIN_SUBMODULE)/plugin/*.ml $(PLUGIN_SUBMODULE)/plugin/*.mli) $(ocaml_dir)/$(MAIN_DEFN_FILE)-kompiled/constants.$(EXT)
273275
@mkdir -p $(dir $@)
274276
cp $(PLUGIN_SUBMODULE)/plugin/*.ml $(PLUGIN_SUBMODULE)/plugin/*.mli $(dir $@)
275-
eval $$(opam config env) \
277+
eval $$($(OPAM) config env) \
276278
&& ocp-ocamlres -format ocaml $(PLUGIN_SUBMODULE)/plugin/proto/VERSION -o $(dir $@)/apiVersion.ml \
277279
&& ocaml-protoc $(PLUGIN_SUBMODULE)/plugin/proto/*.proto -ml_out $(dir $@) \
278280
&& cd $(dir $@) \
@@ -284,7 +286,7 @@ $(ocaml_dir)/$(MAIN_DEFN_FILE)-kompiled/plugin/semantics.$(LIBEXT): $(wildcard $
284286
&& ocamlfind install ethereum-semantics-plugin-ocaml $(PLUGIN_SUBMODULE)/plugin/META semantics.* *.cmi *.$(EXT)
285287

286288
$(ocaml_kompiled): $(ocaml_dir)/$(MAIN_DEFN_FILE)-kompiled/plugin/semantics.$(LIBEXT)
287-
eval $$(opam config env) \
289+
eval $$($(OPAM) config env) \
288290
&& cd $(ocaml_dir)/$(MAIN_DEFN_FILE)-kompiled \
289291
&& ocamllex lexer.mll \
290292
&& ocamlyacc parser.mly \

kevm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ while [[ $# -gt 0 ]]; do
289289
esac
290290
done
291291
backend_dir="$defn_dir/$backend"
292-
[[ ! "$backend" == "ocaml" ]] || eval $(opam config env)
292+
[[ ! "$backend" == "ocaml" ]] || eval $(${OPAM:-opam} config env)
293293

294294
# get the run file
295295
if [[ ! "$run_command" =~ web3* ]]; then

0 commit comments

Comments
 (0)