llvm.org GIT mirror llvm / 464a522
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225778 91177308-0d34-0410-b5e6-96231b3b80d8 Peter Zotov 5 years ago
2 changed file(s) with 12 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
6464 endif
6565 endif
6666
67 # See http://caml.inria.fr/mantis/view.php?id=6642
68 OCAMLORIGIN := -ccopt -L'$$CAMLORIGIN/..' \
69 -ccopt $(RPATH) -ccopt -Wl,'$$CAMLORIGIN/..'
70
6771 # Tools
6872 OCAMLCFLAGS += -I $(OcamlDir) $(addprefix -package ,$(FindlibPackages))
6973
9195 ifdef OCAMLSTUBS
9296 # -dllib is engaged with ocamlc builds, $(OCAMLSTUBFLAGS) in ocamlc -custom builds.
9397 Archive.CMA := $(strip $(OCAMLFIND) c -a -dllib -l$(LIBRARYNAME) $(OCAMLSTUBFLAGS) \
94 $(OCAMLDEBUGFLAG) -o)
98 $(OCAMLDEBUGFLAG) $(OCAMLORIGIN) -o)
9599 else
96100 Archive.CMA := $(strip $(OCAMLFIND) c -a -custom $(OCAMLAFLAGS) $(OCAMLDEBUGFLAG) \
97 -o)
101 $(OCAMLORIGIN) -o)
98102 endif
99103
100104 ifdef OCAMLSTUBS
101 Archive.CMXA := $(strip $(OCAMLFIND) opt -a $(OCAMLSTUBFLAGS) $(OCAMLDEBUGFLAG) -o)
105 Archive.CMXA := $(strip $(OCAMLFIND) opt -a $(OCAMLSTUBFLAGS) $(OCAMLDEBUGFLAG) \
106 $(OCAMLORIGIN) -o)
102107 else
103 Archive.CMXA := $(strip $(OCAMLFIND) opt -a $(OCAMLAFLAGS) $(OCAMLDEBUGFLAG) -o)
108 Archive.CMXA := $(strip $(OCAMLFIND) opt -a $(OCAMLAFLAGS) $(OCAMLDEBUGFLAG) \
109 $(OCAMLORIGIN) -o)
104110 endif
105111
106112 # Source files
5252 endif()
5353
5454 set(ocaml_flags "-lstdc++" "-ldopt" "-L${LLVM_LIBRARY_DIR}"
55 "-ccopt" "-L\\$CAMLORIGIN/.."
56 "-ccopt" "-Wl,-rpath,\\$CAMLORIGIN/.."
5557 ${ocaml_pkgs})
5658
5759 foreach( ocaml_dep ${ARG_OCAMLDEP} )