[sledge] Update build to use vendored package for LLVM 11

Summary:
Since the llvm bindings package has a setup step that is normally done
when pinning the opam package, to build when it is instead vendored
requires adding a setup step to the sledge build.

Reviewed By: martintrojer

Differential Revision: D27188295

fbshipit-source-id: edb0b317c
master
Josh Berdine 4 years ago committed by Facebook GitHub Bot
parent 8d1743bf27
commit fb95eee214

6
sledge/.gitignore vendored

@ -1,6 +1,3 @@
.llvm_build
.llvm_install
/llvm/
/model/cxxabi.bc /model/cxxabi.bc
/model/lib_fuzzer_main.bc /model/lib_fuzzer_main.bc
/test/**/*.bc /test/**/*.bc
@ -11,4 +8,7 @@
/test/*.sexp /test/*.sexp
/test/extra /test/extra
/test/local /test/local
/vendor/llvm-dune/llvm-project/llvm/test
/vendor/llvm-dune/llvm_*.opam
/vendor/llvm-dune/src
_build _build

@ -20,38 +20,59 @@ dune_install_trace = $(subst release,trace,$(dune_install_release))
dune_build_debug = $(subst release,debug,$(dune_build_release)) dune_build_debug = $(subst release,debug,$(dune_build_release))
dune_install_debug = $(subst release,debug,$(dune_install_release)) dune_install_debug = $(subst release,debug,$(dune_install_release))
LLVM_OCAML_SRC = $(shell git ls-files -- vendor/llvm-dune)
# file to use as a sentinel indicating llvm ocaml bindings are up-to-date
LLVM_OCAML_SENTINEL=vendor/llvm-dune/src/llvm/common/dune
# Note that this does not correctly detect llvm shared libraries on
# macos since llvm-config is broken. A filthy workaround seems to be
# to create the libLLVM-11.dylib file llvm-config looks for as a
# symbolic link to libLLVM.dylib:
# LLVMROOT=$(dirname $(dirname $(opam config var conf-llvm:config))) \
# ln -s $LLVMROOT/lib/libLLVM.dylib $LLVMROOT/lib/libLLVM-11.dylib
$(LLVM_OCAML_SENTINEL): $(LLVM_OCAML_SRC)
cd vendor/llvm-dune; ./setup.sh $$(opam config var conf-llvm:config) &>/dev/null
clean_llvm:
rm -rf vendor/llvm-dune/{src,llvm_*.opam}
.PHONY: setup
setup: $(LLVM_OCAML_SENTINEL)
.PHONY: check .PHONY: check
check: check: setup
dune build @check dune build @check
.PHONY: exes .PHONY: exes
exes: exes: setup
dune build $(TARGETS) dune build $(TARGETS)
$(dune_install_debug) $(dune_install_debug)
$(dune_install_trace) $(dune_install_trace)
$(dune_install_release) $(dune_install_release)
.PHONY: debug .PHONY: debug
debug: debug: setup
$(dune_build_debug) $(dune_build_debug)
$(dune_install_debug) $(dune_install_debug)
.PHONY: trace .PHONY: trace
trace: trace: setup
$(dune_build_trace) $(dune_build_trace)
$(dune_install_trace) $(dune_install_trace)
.PHONY: release .PHONY: release
release: release: setup
$(dune_build_release) $(dune_build_release)
$(dune_install_release) $(dune_install_release)
.PHONY: report .PHONY: report
report: report: setup
dune build $(REPORT_TARGETS) dune build $(REPORT_TARGETS)
.PHONY: watch .PHONY: watch
watch: watch: setup
dune build --watch --terminal-persistence=clear-on-rebuild $(TARGETS) dune build --watch --terminal-persistence=clear-on-rebuild $(TARGETS)
.PHONY: test .PHONY: test

@ -107,7 +107,7 @@
(preprocess (preprocess
(pps ppx_sledge ppx_trace)))) (pps ppx_sledge ppx_trace))))
(dirs :standard \ llvm test) (dirs :standard \ test)
(vendored_dirs vendor) (vendored_dirs vendor)

@ -61,7 +61,8 @@ let debug = ref false
;; ;;
Driver.Cookies.add_simple_handler "ppx_trace_enabled" Ast_pattern.__ Driver.Cookies.add_simple_handler "ppx_trace_enabled" Ast_pattern.__
~f:(function ~f:(function
| Some {pexp_desc= Pexp_constant (Pconst_string (("1" | "true"), _))} -> | Some {pexp_desc= Pexp_constant (Pconst_string (("1" | "true"), _, _))}
->
debug := true debug := true
| _ -> () ) | _ -> () )

@ -14,6 +14,7 @@ depends: [
"base" "base"
"containers" "containers"
"containers-data" "containers-data"
"conf-llvm" {= "11.0.0"}
"core" {>= "v0.14"} "core" {>= "v0.14"}
"ctypes" "ctypes"
"ctypes-foreign" "ctypes-foreign"
@ -21,11 +22,10 @@ depends: [
"dune-build-info" {build} "dune-build-info" {build}
"fpath" "fpath"
"iter" "iter"
"llvm" {= "8.0.0"}
"mtime" "mtime"
"ppx_compare" "ppx_compare"
"ppx_hash" "ppx_hash"
"ppxlib" {< "0.16.0"} "ppxlib" {>= "0.21.0"}
"shexp" "shexp"
"smtlib-utils" "smtlib-utils"
"yojson" "yojson"

@ -33,8 +33,8 @@ sledge_report_exe:
# which utilities to use # which utilities to use
diff?=patdiff diff?=patdiff
# configure the non-host llvm and clang # select llvm and clang used by opam
export PATH := $(CURDIR)/../.llvm_install/sledge/bin:$(PATH) export PATH := $(shell $$(opam config var conf-llvm:config) --bindir):$(PATH)
# configure sort # configure sort
export LANG := C export LANG := C

@ -1 +1 @@
../llvm/test ../vendor/llvm-dune/llvm-project/llvm/test

@ -1,4 +1,4 @@
#!/bin/sh -ex #!/bin/sh -e
if test "$(dirname $0)" != '.'; then if test "$(dirname $0)" != '.'; then
echo "The script must be executed from its current directory." echo "The script must be executed from its current directory."
@ -19,12 +19,12 @@ llvm_config() {
"$llvm_config" $@ "$llvm_config" $@
} }
if llvm_config --link-static --libs; then if llvm_config --link-static; then
default_mode=static default_mode=static
support_static_mode=true support_static_mode=true
fi fi
if llvm_config --link-shared --libs; then if llvm_config --link-shared; then
default_mode=shared default_mode=shared
support_shared_mode=true support_shared_mode=true
fi fi

Loading…
Cancel
Save