[Libguestfs] [PATCH 1/2] build: factor out the OCaml link.sh scripts

Pino Toscano ptoscano at redhat.com
Wed May 13 14:47:04 UTC 2015


Create a single ocaml-link.sh script, which supports a -cclib parameter
so it can be used instead of the per-project link.sh scripts.
As result, the libraries for each OCaml application can be moved back to
each Makefile.am.
---
 .gitignore            |  7 -------
 builder/Makefile.am   | 14 ++++++++++++--
 builder/link.sh.in    | 22 ----------------------
 configure.ac          | 14 --------------
 customize/Makefile.am | 13 +++++++++++--
 customize/link.sh.in  | 22 ----------------------
 mllib/Makefile.am     | 13 +++++++++++--
 mllib/link.sh.in      | 22 ----------------------
 ocaml-link.sh         | 43 +++++++++++++++++++++++++++++++++++++++++++
 resize/Makefile.am    | 11 +++++++++--
 resize/link.sh.in     | 22 ----------------------
 sparsify/Makefile.am  |  7 +++++--
 sparsify/link.sh.in   | 22 ----------------------
 sysprep/Makefile.am   | 12 ++++++++++--
 sysprep/link.sh.in    | 22 ----------------------
 v2v/Makefile.am       | 17 +++++++++++++----
 v2v/link.sh.in        | 22 ----------------------
 17 files changed, 114 insertions(+), 191 deletions(-)
 delete mode 100644 builder/link.sh.in
 delete mode 100644 customize/link.sh.in
 delete mode 100644 mllib/link.sh.in
 create mode 100755 ocaml-link.sh
 delete mode 100644 resize/link.sh.in
 delete mode 100644 sparsify/link.sh.in
 delete mode 100644 sysprep/link.sh.in
 delete mode 100644 v2v/link.sh.in

diff --git a/.gitignore b/.gitignore
index 318cfa0..29f9d6d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -59,7 +59,6 @@ Makefile.in
 /builder/index-parse.h
 /builder/index-scan.c
 /builder/libguestfs.conf
-/builder/link.sh
 /builder/*.qcow2
 /builder/stamp-virt-builder.pod
 /builder/stamp-virt-index-validate.pod
@@ -95,7 +94,6 @@ Makefile.in
 /customize/customize_cmdline.mli
 /customize/customize-options.pod
 /customize/customize-synopsis.pod
-/customize/link.sh
 /customize/stamp-virt-customize.pod
 /customize/virt-customize
 /customize/virt-customize.1
@@ -311,7 +309,6 @@ Makefile.in
 /mllib/dummy
 /mllib/JSON_tests
 /mllib/libdir.ml
-/mllib/link.sh
 /mllib/oUnit-*
 /ocaml/bindtests.bc
 /ocaml/bindtests.opt
@@ -423,7 +420,6 @@ Makefile.in
 /rescue/virt-rescue
 /rescue/virt-rescue.1
 /resize/.depend
-/resize/link.sh
 /resize/stamp-virt-resize.pod
 /resize/virt-resize
 /resize/virt-resize.1
@@ -441,7 +437,6 @@ Makefile.in
 /ruby/stamp-rdoc
 /run
 /sparsify/.depend
-/sparsify/link.sh
 /sparsify/stamp-virt-sparsify.pod
 /sparsify/virt-sparsify
 /sparsify/virt-sparsify.1
@@ -476,7 +471,6 @@ Makefile.in
 /stamp-guestfs-release-notes.pod
 /stamp-h1
 /sysprep/.depend
-/sysprep/link.sh
 /sysprep/stamp-script1.sh
 /sysprep/stamp-script2.sh
 /sysprep/stamp-script4.sh
@@ -566,7 +560,6 @@ Makefile.in
 /v2v/centos-6.img
 /v2v/centos-7.0.img
 /v2v/fedora-20.img
-/v2v/link.sh
 /v2v/oUnit-*
 /v2v/rhel-5.10.img
 /v2v/rhel-6.5.img
diff --git a/builder/Makefile.am b/builder/Makefile.am
index bfe2f79..182f5a4 100644
--- a/builder/Makefile.am
+++ b/builder/Makefile.am
@@ -150,6 +150,16 @@ if HAVE_OCAML_PKG_GETTEXT
 OCAMLPACKAGES += -package gettext-stub
 endif
 
+OCAMLCLIBS = \
+	-pthread -lpthread \
+	-lutils \
+	$(LIBTINFO_LIBS) \
+	$(LIBCRYPT_LIBS) \
+	$(LIBLZMA_LIBS) \
+	$(LIBXML2_LIBS) \
+	$(LIBINTL) \
+	-lgnu
+
 OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR)
 
 if !HAVE_OCAMLOPT
@@ -162,9 +172,9 @@ BEST    = opt
 OCAMLLINKFLAGS = mlguestfs.cmxa
 endif
 
-virt_builder_DEPENDENCIES = $(OBJECTS)
+virt_builder_DEPENDENCIES = $(OBJECTS) $(top_srcdir)/ocaml-link.sh
 virt_builder_LINK = \
-	./link.sh \
+	$(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
 	  $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLLINKFLAGS) \
 	  $(OBJECTS) -o $@
 
diff --git a/builder/link.sh.in b/builder/link.sh.in
deleted file mode 100644
index 964617f..0000000
--- a/builder/link.sh.in
+++ /dev/null
@@ -1,22 +0,0 @@
-# libguestfs Makefile.am
-# @configure_input@
-# (C) Copyright 2014 Red Hat Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-# Hack automake to link binary properly.  There is no other way to add
-# the -cclib parameter to the end of the command line.
-
-exec "$@" -linkpkg -cclib '-pthread -lpthread -lutils @LIBTINFO_LIBS@ @LIBCRYPT_LIBS@ @LIBLZMA_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu'
diff --git a/configure.ac b/configure.ac
index 7a609cb..1807666 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1708,14 +1708,8 @@ mkdir -p \
 dnl http://www.mail-archive.com/automake@gnu.org/msg10204.html
 AC_CONFIG_FILES([appliance/libguestfs-make-fixed-appliance],
                 [chmod +x,-w appliance/libguestfs-make-fixed-appliance])
-AC_CONFIG_FILES([builder/link.sh],
-                [chmod +x,-w builder/link.sh])
-AC_CONFIG_FILES([customize/link.sh],
-                [chmod +x,-w customize/link.sh])
 AC_CONFIG_FILES([inspector/test-xmllint.sh],
                 [chmod +x,-w inspector/test-xmllint.sh])
-AC_CONFIG_FILES([mllib/link.sh],
-                [chmod +x,-w mllib/link.sh])
 AC_CONFIG_FILES([p2v/virt-p2v-make-disk],
                 [chmod +x,-w p2v/virt-p2v-make-disk])
 AC_CONFIG_FILES([p2v/virt-p2v-make-kickstart],
@@ -1726,16 +1720,8 @@ AC_CONFIG_FILES([pick-guests.pl],
                 [chmod +x,-w pick-guests.pl])
 AC_CONFIG_FILES([podwrapper.pl],
                 [chmod +x,-w podwrapper.pl])
-AC_CONFIG_FILES([resize/link.sh],
-                [chmod +x,-w resize/link.sh])
 AC_CONFIG_FILES([run],
                 [chmod +x,-w run])
-AC_CONFIG_FILES([sparsify/link.sh],
-                [chmod +x,-w sparsify/link.sh])
-AC_CONFIG_FILES([sysprep/link.sh],
-                [chmod +x,-w sysprep/link.sh])
-AC_CONFIG_FILES([v2v/link.sh],
-                [chmod +x,-w v2v/link.sh])
 
 AC_CONFIG_FILES([Makefile
                  align/Makefile
diff --git a/customize/Makefile.am b/customize/Makefile.am
index d36721a..8f0a2d8 100644
--- a/customize/Makefile.am
+++ b/customize/Makefile.am
@@ -109,6 +109,15 @@ if HAVE_OCAML_PKG_GETTEXT
 OCAMLPACKAGES += -package gettext-stub
 endif
 
+OCAMLCLIBS = \
+	-lutils \
+	$(LIBTINFO_LIBS) \
+	$(LIBCRYPT_LIBS) \
+	$(LIBVIRT_LIBS) \
+	$(LIBXML2_LIBS) \
+	$(LIBINTL) \
+	-lgnu
+
 OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR)
 
 if !HAVE_OCAMLOPT
@@ -121,9 +130,9 @@ BEST    = opt
 OCAMLLINKFLAGS = mlguestfs.cmxa
 endif
 
-virt_customize_DEPENDENCIES = $(OBJECTS)
+virt_customize_DEPENDENCIES = $(OBJECTS) $(top_srcdir)/ocaml-link.sh
 virt_customize_LINK = \
-	./link.sh \
+	$(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
 	  $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLLINKFLAGS) \
 	  $(OBJECTS) -o $@
 
diff --git a/customize/link.sh.in b/customize/link.sh.in
deleted file mode 100644
index 15b6e66..0000000
--- a/customize/link.sh.in
+++ /dev/null
@@ -1,22 +0,0 @@
-# libguestfs Makefile.am
-# @configure_input@
-# (C) Copyright 2014 Red Hat Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-# Hack automake to link binary properly.  There is no other way to add
-# the -cclib parameter to the end of the command line.
-
-exec "$@" -linkpkg -cclib '-lutils @LIBTINFO_LIBS@ @LIBCRYPT_LIBS@ @LIBVIRT_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu'
diff --git a/mllib/Makefile.am b/mllib/Makefile.am
index 0b43684..c7967b8 100644
--- a/mllib/Makefile.am
+++ b/mllib/Makefile.am
@@ -95,6 +95,15 @@ if HAVE_OCAML_PKG_OUNIT
 OCAMLPACKAGES_TESTS += -package oUnit
 endif
 
+OCAMLCLIBS = \
+	-lutils \
+	$(LIBTINFO_LIBS) \
+	$(LIBCRYPT_LIBS) \
+	$(LIBVIRT_LIBS) \
+	$(LIBXML2_LIBS) \
+	$(LIBINTL) \
+	-lgnu
+
 OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR)
 
 if !HAVE_OCAMLOPT
@@ -107,9 +116,9 @@ BEST    = opt
 OCAMLLINKFLAGS = mlguestfs.cmxa
 endif
 
-dummy_DEPENDENCIES = $(OBJECTS)
+dummy_DEPENDENCIES = $(OBJECTS) $(top_srcdir)/ocaml-link.sh
 dummy_LINK = \
-	./link.sh \
+	$(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
 	  $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLLINKFLAGS) \
 	  $(OBJECTS) -o $@
 
diff --git a/mllib/link.sh.in b/mllib/link.sh.in
deleted file mode 100644
index 15b6e66..0000000
--- a/mllib/link.sh.in
+++ /dev/null
@@ -1,22 +0,0 @@
-# libguestfs Makefile.am
-# @configure_input@
-# (C) Copyright 2014 Red Hat Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-# Hack automake to link binary properly.  There is no other way to add
-# the -cclib parameter to the end of the command line.
-
-exec "$@" -linkpkg -cclib '-lutils @LIBTINFO_LIBS@ @LIBCRYPT_LIBS@ @LIBVIRT_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu'
diff --git a/ocaml-link.sh b/ocaml-link.sh
new file mode 100755
index 0000000..bbb9b98
--- /dev/null
+++ b/ocaml-link.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+# (C) Copyright 2015 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# Hack automake to link OCaml-based binaries properly.
+# There is no other way to add the -cclib parameter to the end of
+# the command line.
+
+# Usage:
+#   ./ocaml-link.sh -cclib '...' -- ARGS
+# Pass the cclib argument separately, and the rest as separated
+# arguments.
+
+TEMP=`getopt -a -o '' --long 'cclib:' \
+  -n "$(basename $0)" -- "$@"`
+if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
+eval set -- "$TEMP"
+
+cclib=
+
+while true ; do
+  case "$1" in
+    -cclib|--cclib) cclib="$2" ; shift 2 ;;
+    --) shift ; break ;;
+    *) echo "Internal error!" ; exit 1 ;;
+  esac
+done
+
+exec "$@" -linkpkg -cclib "${cclib}"
diff --git a/resize/Makefile.am b/resize/Makefile.am
index 12afd09..657b626 100644
--- a/resize/Makefile.am
+++ b/resize/Makefile.am
@@ -75,6 +75,13 @@ if HAVE_OCAML_PKG_GETTEXT
 OCAMLPACKAGES += -package gettext-stub
 endif
 
+OCAMLCLIBS = \
+	-lutils \
+	$(LIBTINFO_LIBS) \
+	$(LIBXML2_LIBS) \
+	$(LIBINTL) \
+	-lgnu
+
 OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR)
 
 if !HAVE_OCAMLOPT
@@ -87,9 +94,9 @@ BEST    = opt
 OCAMLLINKFLAGS = mlguestfs.cmxa
 endif
 
-virt_resize_DEPENDENCIES = $(OBJECTS)
+virt_resize_DEPENDENCIES = $(OBJECTS) $(top_srcdir)/ocaml-link.sh
 virt_resize_LINK = \
-	./link.sh \
+	$(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
 	  $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLLINKFLAGS) \
 	  $(OBJECTS) -o $@
 
diff --git a/resize/link.sh.in b/resize/link.sh.in
deleted file mode 100644
index 2835f0e..0000000
--- a/resize/link.sh.in
+++ /dev/null
@@ -1,22 +0,0 @@
-# libguestfs Makefile.am
-# @configure_input@
-# (C) Copyright 2014 Red Hat Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-# Hack automake to link binary properly.  There is no other way to add
-# the -cclib parameter to the end of the command line.
-
-exec "$@" -linkpkg -cclib '-lutils @LIBTINFO_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu'
diff --git a/sparsify/Makefile.am b/sparsify/Makefile.am
index 205641d..98ab729 100644
--- a/sparsify/Makefile.am
+++ b/sparsify/Makefile.am
@@ -71,6 +71,9 @@ if HAVE_OCAML_PKG_GETTEXT
 OCAMLPACKAGES += -package gettext-stub
 endif
 
+OCAMLCLIBS = \
+	$(LIBTINFO_LIBS)
+
 OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR)
 
 if !HAVE_OCAMLOPT
@@ -83,10 +86,10 @@ BEST    = opt
 OCAMLLINKFLAGS = mlguestfs.cmxa
 endif
 
-virt_sparsify_DEPENDENCIES = $(OBJECTS)
+virt_sparsify_DEPENDENCIES = $(OBJECTS) $(top_srcdir)/ocaml-link.sh
 
 virt_sparsify_LINK = \
-	./link.sh \
+	$(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
 	  $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLLINKFLAGS) \
 	  $(OBJECTS) -o $@
 
diff --git a/sparsify/link.sh.in b/sparsify/link.sh.in
deleted file mode 100644
index 9892b07..0000000
--- a/sparsify/link.sh.in
+++ /dev/null
@@ -1,22 +0,0 @@
-# libguestfs Makefile.am
-# @configure_input@
-# (C) Copyright 2014 Red Hat Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-# Hack automake to link binary properly.  There is no other way to add
-# the -cclib parameter to the end of the command line.
-
-exec "$@" -linkpkg -cclib '@LIBTINFO_LIBS@'
diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am
index c57060d..c1d1245 100644
--- a/sysprep/Makefile.am
+++ b/sysprep/Makefile.am
@@ -138,6 +138,14 @@ if HAVE_OCAML_PKG_GETTEXT
 OCAMLPACKAGES += -package gettext-stub
 endif
 
+OCAMLCLIBS = \
+	-lutils \
+	$(LIBTINFO_LIBS) \
+	$(LIBCRYPT_LIBS) \
+	$(LIBXML2_LIBS) \
+	$(LIBINTL) \
+	-lgnu
+
 OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR)
 
 if !HAVE_OCAMLOPT
@@ -150,9 +158,9 @@ BEST    = opt
 OCAMLLINKFLAGS = mlguestfs.cmxa
 endif
 
-virt_sysprep_DEPENDENCIES = $(OBJECTS)
+virt_sysprep_DEPENDENCIES = $(OBJECTS) $(top_srcdir)/ocaml-link.sh
 virt_sysprep_LINK = \
-	./link.sh \
+	$(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
 	  $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLLINKFLAGS) \
 	  $(OBJECTS) -o $@
 
diff --git a/sysprep/link.sh.in b/sysprep/link.sh.in
deleted file mode 100644
index 7d8ccec..0000000
--- a/sysprep/link.sh.in
+++ /dev/null
@@ -1,22 +0,0 @@
-# libguestfs Makefile.am
-# @configure_input@
-# (C) Copyright 2014 Red Hat Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-# Hack automake to link binary properly.  There is no other way to add
-# the -cclib parameter to the end of the command line.
-
-exec "$@" -linkpkg -cclib '-lutils @LIBTINFO_LIBS@ @LIBCRYPT_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu'
diff --git a/v2v/Makefile.am b/v2v/Makefile.am
index 8315eb1..03f818c 100644
--- a/v2v/Makefile.am
+++ b/v2v/Makefile.am
@@ -160,6 +160,15 @@ if HAVE_OCAML_PKG_GETTEXT
 OCAMLPACKAGES += -package gettext-stub
 endif
 
+OCAMLCLIBS = \
+	-lutils \
+	$(LIBTINFO_LIBS) \
+	$(LIBCRYPT_LIBS) \
+	$(LIBVIRT_LIBS) \
+	$(LIBXML2_LIBS) \
+	$(LIBINTL) \
+	-lgnu
+
 OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR)
 
 if !HAVE_OCAMLOPT
@@ -172,9 +181,9 @@ BEST    = opt
 OCAMLLINKFLAGS = mlguestfs.cmxa
 endif
 
-virt_v2v_DEPENDENCIES = $(OBJECTS)
+virt_v2v_DEPENDENCIES = $(OBJECTS) $(top_srcdir)/ocaml-link.sh
 virt_v2v_LINK = \
-	./link.sh \
+	$(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
 	  $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLLINKFLAGS) \
 	  $(OBJECTS) -o $@
 
@@ -319,9 +328,9 @@ v2v_unit_tests_THEOBJECTS = $(v2v_unit_tests_XOBJECTS)
 v2v_unit_tests.cmx: OCAMLPACKAGES += -package oUnit
 endif
 
-v2v_unit_tests_DEPENDENCIES = $(v2v_unit_tests_THEOBJECTS)
+v2v_unit_tests_DEPENDENCIES = $(v2v_unit_tests_THEOBJECTS) $(top_srcdir)/ocaml-link.sh
 v2v_unit_tests_LINK = \
-	./link.sh \
+	$(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
 	  $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) \
 	  $(OCAMLPACKAGES) -package oUnit \
 	  $(OCAMLLINKFLAGS) \
diff --git a/v2v/link.sh.in b/v2v/link.sh.in
deleted file mode 100644
index 15b6e66..0000000
--- a/v2v/link.sh.in
+++ /dev/null
@@ -1,22 +0,0 @@
-# libguestfs Makefile.am
-# @configure_input@
-# (C) Copyright 2014 Red Hat Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-# Hack automake to link binary properly.  There is no other way to add
-# the -cclib parameter to the end of the command line.
-
-exec "$@" -linkpkg -cclib '-lutils @LIBTINFO_LIBS@ @LIBCRYPT_LIBS@ @LIBVIRT_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu'
-- 
2.1.0




More information about the Libguestfs mailing list