summaryrefslogtreecommitdiffstats
path: root/llvm/bindings
diff options
context:
space:
mode:
authorPeter Zotov <whitequark@whitequark.org>2015-01-13 09:47:59 +0000
committerPeter Zotov <whitequark@whitequark.org>2015-01-13 09:47:59 +0000
commit1f00ac9368e6473b3215ec7bd660c92dd0e2b76e (patch)
tree65f831b27e97cb615c21d32c90ff578cc2f85892 /llvm/bindings
parent1ba46c661c7a9361237ed007715dfac46ccad7d2 (diff)
downloadbcm5719-llvm-1f00ac9368e6473b3215ec7bd660c92dd0e2b76e.tar.gz
bcm5719-llvm-1f00ac9368e6473b3215ec7bd660c92dd0e2b76e.zip
[OCaml] Use $CAMLORIGIN, an rpath-$ORIGIN-like mechanism in OCaml.
As a result, installations of LLVM in non-standard locations will not require passing custom -ccopt -L flags when building the binary, nor absolute paths would be embedded in the cma/cmxa files. Additionally, the executables will not require changes to LD_LIBRARY_PATH, although CAML_LD_LIBRARY_PATH still has to be set for ocamlc without -custom. See http://caml.inria.fr/mantis/view.php?id=6642. Note that the patch is approved, but not merged yet. It will be released in 4.03 and likely 4.02. llvm-svn: 225778
Diffstat (limited to 'llvm/bindings')
-rw-r--r--llvm/bindings/ocaml/Makefile.ocaml14
1 files changed, 10 insertions, 4 deletions
diff --git a/llvm/bindings/ocaml/Makefile.ocaml b/llvm/bindings/ocaml/Makefile.ocaml
index ac719de3a5b..943061e65e6 100644
--- a/llvm/bindings/ocaml/Makefile.ocaml
+++ b/llvm/bindings/ocaml/Makefile.ocaml
@@ -65,6 +65,10 @@ OCAMLRPATH := $(RPATH) -Wl,'$$ORIGIN/../../lib'
endif
endif
+# See http://caml.inria.fr/mantis/view.php?id=6642
+OCAMLORIGIN := -ccopt -L'$$CAMLORIGIN/..' \
+ -ccopt $(RPATH) -ccopt -Wl,'$$CAMLORIGIN/..'
+
# Tools
OCAMLCFLAGS += -I $(OcamlDir) $(addprefix -package ,$(FindlibPackages))
@@ -92,16 +96,18 @@ Compile.CMX := $(strip $(OCAMLFIND) opt -c $(OCAMLCFLAGS) $(OCAMLDEBUGFLAG) -o)
ifdef OCAMLSTUBS
# -dllib is engaged with ocamlc builds, $(OCAMLSTUBFLAGS) in ocamlc -custom builds.
Archive.CMA := $(strip $(OCAMLFIND) c -a -dllib -l$(LIBRARYNAME) $(OCAMLSTUBFLAGS) \
- $(OCAMLDEBUGFLAG) -o)
+ $(OCAMLDEBUGFLAG) $(OCAMLORIGIN) -o)
else
Archive.CMA := $(strip $(OCAMLFIND) c -a -custom $(OCAMLAFLAGS) $(OCAMLDEBUGFLAG) \
- -o)
+ $(OCAMLORIGIN) -o)
endif
ifdef OCAMLSTUBS
-Archive.CMXA := $(strip $(OCAMLFIND) opt -a $(OCAMLSTUBFLAGS) $(OCAMLDEBUGFLAG) -o)
+Archive.CMXA := $(strip $(OCAMLFIND) opt -a $(OCAMLSTUBFLAGS) $(OCAMLDEBUGFLAG) \
+ $(OCAMLORIGIN) -o)
else
-Archive.CMXA := $(strip $(OCAMLFIND) opt -a $(OCAMLAFLAGS) $(OCAMLDEBUGFLAG) -o)
+Archive.CMXA := $(strip $(OCAMLFIND) opt -a $(OCAMLAFLAGS) $(OCAMLDEBUGFLAG) \
+ $(OCAMLORIGIN) -o)
endif
# Source files
OpenPOWER on IntegriCloud