llvm.org GIT mirror llvm / cf0fe98
[OCaml] Avoid embedding absolute paths into executables. Bindings built out-of-tree, e.g. via OPAM, should append a line to META.llvm like the following: linkopts = "-cclib -L$libdir -cclib -Wl,-rpath,$libdir" where $libdir is the lib/ directory where LLVM libraries are installed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221139 91177308-0d34-0410-b5e6-96231b3b80d8 Peter Zotov 5 years ago
2 changed file(s) with 16 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
5252 # from toplevels.
5353 ifneq ($(ObjectsO),)
5454 ifeq ($(ENABLE_SHARED),1)
55 OCAMLSTUBS := 1
55 OCAMLSTUBS := 1
56 OCAMLSTUBFLAGS := $(patsubst %,-cclib %, $(LLVMLibsOptions) -l$(LIBRARYNAME))
57 endif
58 endif
59
60 # Avoid the need for LD_LIBRARY_PATH
61 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
62 ifneq ($(HOST_OS),Darwin)
63 OCAMLRPATH := $(RPATH) -Wl,'$$ORIGIN/../../lib'
5664 endif
5765 endif
5866
8189 Compile.CMX := $(strip $(OCAMLFIND) opt -c $(OCAMLCFLAGS) $(OCAMLDEBUGFLAG) -o)
8290
8391 ifdef OCAMLSTUBS
84 # Avoid the need for LD_LIBRARY_PATH
85 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
86 ifneq ($(HOST_OS),Darwin)
87 OCAMLRPATH := $(RPATH) -Wl,'$(SharedLibDir)'
88 endif
89 endif
90 endif
91
92 ifdef OCAMLSTUBS
9392 Archive.CMA := $(strip $(OCAMLFIND) c -a -dllib -l$(LIBRARYNAME) $(OCAMLDEBUGFLAG) \
9493 -o)
9594 else
9897 endif
9998
10099 ifdef OCAMLSTUBS
101 Archive.CMXA := $(strip $(OCAMLFIND) opt -a $(patsubst %,-cclib %, \
102 $(LLVMLibsOptions) -l$(LIBRARYNAME) \
103 -L$(SharedLibDir) $(OCAMLRPATH)) \
104 $(OCAMLDEBUGFLAG) -o)
100 Archive.CMXA := $(strip $(OCAMLFIND) opt -a $(OCAMLSTUBFLAGS) $(OCAMLDEBUGFLAG) -o)
105101 else
106102 Archive.CMXA := $(strip $(OCAMLFIND) opt -a $(OCAMLAFLAGS) $(OCAMLDEBUGFLAG) -o)
107103 endif
430426 $(Echo) "LLVM_CONFIG : " '$(LLVM_CONFIG)'
431427 $(Echo) "OCAMLCFLAGS : " '$(OCAMLCFLAGS)'
432428 $(Echo) "OCAMLAFLAGS : " '$(OCAMLAFLAGS)'
429 $(Echo) "OCAMLRPATH : " '$(OCAMLRPATH)'
430 $(Echo) "OCAMLSTUBS : " '$(OCAMLSTUBS)'
431 $(Echo) "OCAMLSTUBFLAGS : " '$(OCAMLSTUBFLAGS)'
433432 $(Echo) "OCAMLFIND : " '$(OCAMLFIND)'
434433 $(Echo) "Compile.CMI : " '$(Compile.CMI)'
435434 $(Echo) "Compile.CMO : " '$(Compile.CMO)'
437436 $(Echo) "Compile.CMX : " '$(Compile.CMX)'
438437 $(Echo) "Archive.CMXA : " '$(Archive.CMXA)'
439438 $(Echo) "CAML_LIBDIR : " '$(CAML_LIBDIR)'
439 $(Echo) "LibraryA : " '$(LibraryA)'
440440 $(Echo) "LibraryCMA : " '$(LibraryCMA)'
441441 $(Echo) "LibraryCMXA : " '$(LibraryCMXA)'
442442 $(Echo) "SharedLib : " '$(SharedLib)'
200200 "%s ocamlc %s" % (config.ocamlfind_executable, config.ocaml_flags)) )
201201 if config.have_ocamlopt in ('1', 'TRUE'):
202202 config.substitutions.append( ('%ocamlopt',
203 "%s ocamlopt %s" % (config.ocamlfind_executable, config.ocaml_flags)) )
203 "%s ocamlopt -cclib -L%s -cclib -Wl,-rpath,%s %s" %
204 (config.ocamlfind_executable, llvm_lib_dir, llvm_lib_dir, config.ocaml_flags)) )
204205 else:
205206 config.substitutions.append( ('%ocamlopt', "true" ) )
206207