ocaml bindings: add findlib META support
This makes it easier to link against LLVM libs, especially if you are using
_oasis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141992 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/autoconf/configure.ac b/autoconf/configure.ac
index 9832cdb..85fe8d4 100644
--- a/autoconf/configure.ac
+++ b/autoconf/configure.ac
@@ -1563,6 +1563,9 @@
dnl Do the first stage of configuration for llvm-config.in.
AC_CONFIG_FILES([tools/llvm-config/llvm-config.in])
+dnl OCaml findlib META file
+AC_CONFIG_FILES([bindings/ocaml/llvm/META.llvm])
+
dnl Do special configuration of Makefiles
AC_CONFIG_COMMANDS([setup],,[llvm_src="${srcdir}"])
AC_CONFIG_MAKEFILE(Makefile)
diff --git a/bindings/ocaml/llvm/META.llvm.in b/bindings/ocaml/llvm/META.llvm.in
new file mode 100644
index 0000000..29e7eb4
--- /dev/null
+++ b/bindings/ocaml/llvm/META.llvm.in
@@ -0,0 +1,63 @@
+name = "llvm"
+version = "@PACKAGE_VERSION@"
+description = "Low Level Virtual Machine OCaml bindings"
+archive(byte) = "llvm.cma"
+archive(native) = "llvm.cmxa"
+directory = "."
+linkopts = "-ccopt -lstdc++"
+
+package "analysis" (
+ requires = "llvm"
+ version = "@PACKAGE_VERSION@"
+ description = "Intermediate representation analysis for LLVM"
+ archive(byte) = "llvm_analysis.cma"
+ archive(native) = "llvm_analysis.cmxa"
+)
+
+package "bitreader" (
+ requires = "llvm"
+ version = "@PACKAGE_VERSION@"
+ description = "Bitcode reader for LLVM"
+ archive(byte) = "llvm_bitreader.cma"
+ archive(native) = "llvm_bitreader.cmxa"
+)
+
+package "bitwriter" (
+ requires = "llvm,unix"
+ version = "@PACKAGE_VERSION@"
+ description = "Bitcode writer for LLVM"
+ archive(byte) = "llvm_bitwriter.cma"
+ archive(native) = "llvm_bitwriter.cmxa"
+)
+
+package "executionengine" (
+ requires = "llvm,llvm.target"
+ version = "@PACKAGE_VERSION@"
+ description = "JIT and Interpreter for LLVM"
+ archive(byte) = "llvm_executionengine.cma"
+ archive(native) = "llvm_executionengine.cmxa"
+)
+
+package "ipo" (
+ requires = "llvm"
+ version = "@PACKAGE_VERSION@"
+ description = "IPO Transforms for LLVM"
+ archive(byte) = "llvm_ipo.cma"
+ archive(native) = "llvm_ipo.cmxa"
+)
+
+package "scalar_opts" (
+ requires = "llvm"
+ version = "@PACKAGE_VERSION@"
+ description = "Scalar Transforms for LLVM"
+ archive(byte) = "llvm_scalar_opts.cma"
+ archive(native) = "llvm_scalar_opts.cmxa"
+)
+
+package "target" (
+ requires = "llvm"
+ version = "@PACKAGE_VERSION@"
+ description = "Target Information for LLVM"
+ archive(byte) = "llvm_target.cma"
+ archive(native) = "llvm_target.cmxa"
+)
diff --git a/bindings/ocaml/llvm/Makefile b/bindings/ocaml/llvm/Makefile
index 99e347b..673eaa2 100644
--- a/bindings/ocaml/llvm/Makefile
+++ b/bindings/ocaml/llvm/Makefile
@@ -17,3 +17,24 @@
UsedOcamLibs := llvm
include ../Makefile.ocaml
+
+all-local:: copy-meta
+install-local:: install-meta
+uninstall-local:: uninstall-meta
+
+DestMETA := $(PROJ_libocamldir)/META.llvm
+
+# Easy way of generating META in the objdir
+copy-meta: $(OcamlDir)/META.llvm
+
+$(OcamlDir)/META.llvm: META.llvm
+ $(Verb) $(CP) -f $< $@
+
+install-meta:: $(ObjDir)/META.llvm
+ $(Echo) "Install $(BuildMode) $(DestMETA)"
+ $(Verb) $(MKDIR) $(PROJ_libocamldir)
+ $(Verb) $(DataInstall) META.llvm "$(DestMETA)"
+
+uninstall-meta::
+ $(Echo) "Uninstalling $(DestMETA)"
+ -$(Verb) $(RM) -f "$(DestMETA)"
diff --git a/configure b/configure
index a65f94f..000249c 100755
--- a/configure
+++ b/configure
@@ -21052,7 +21052,6 @@
ac_config_files="$ac_config_files Makefile.config"
-
ac_config_files="$ac_config_files llvm.spec"
@@ -21065,6 +21064,7 @@
ac_config_files="$ac_config_files tools/llvm-config/llvm-config.in"
+ac_config_files="$ac_config_files bindings/ocaml/llvm/META.llvm"
ac_config_commands="$ac_config_commands setup"