[Pkg-libvirt-commits] [libguestfs] 80/384: customize: Use automake to build the binary.

Hilko Bengen bengen at moszumanska.debian.org
Sun Mar 29 16:55:46 UTC 2015


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch experimental
in repository libguestfs.

commit e87df1d58140b52f0cf48c9adb287655bc76e5a1
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Fri Dec 12 09:43:52 2014 +0000

    customize: Use automake to build the binary.
---
 .gitignore            |   1 +
 builder/Makefile.am   |   4 +-
 configure.ac          |   2 +
 customize/Makefile.am | 155 +++++++++++++++++++++-----------------------------
 customize/link.sh.in  |  22 +++++++
 mllib/uri-c.c         |   2 +
 6 files changed, 93 insertions(+), 93 deletions(-)

diff --git a/.gitignore b/.gitignore
index d90ef8f..e3182a6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -94,6 +94,7 @@ 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
diff --git a/builder/Makefile.am b/builder/Makefile.am
index 7334031..a964ae1 100644
--- a/builder/Makefile.am
+++ b/builder/Makefile.am
@@ -105,9 +105,9 @@ deps = \
 	$(top_builddir)/customize/hostname.cmx \
 	$(top_builddir)/customize/timezone.cmx \
 	$(top_builddir)/customize/firstboot.cmx \
-	$(top_builddir)/customize/perl_edit-c.o \
+	$(top_builddir)/customize/virt_customize-perl_edit-c.o \
 	$(top_builddir)/customize/perl_edit.cmx \
-	$(top_builddir)/customize/crypt-c.o \
+	$(top_builddir)/customize/virt_customize-crypt-c.o \
 	$(top_builddir)/customize/crypt.cmx \
 	$(top_builddir)/customize/password.cmx \
 	$(top_builddir)/customize/ssh_key.cmx \
diff --git a/configure.ac b/configure.ac
index 67f8d84..3e839c3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1665,6 +1665,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([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([p2v/virt-p2v-make-disk],
diff --git a/customize/Makefile.am b/customize/Makefile.am
index a95025d..869a2d7 100644
--- a/customize/Makefile.am
+++ b/customize/Makefile.am
@@ -18,7 +18,7 @@
 include $(top_srcdir)/subdir-rules.mk
 
 EXTRA_DIST = \
-	$(SOURCES) \
+	$(SOURCES_MLI) $(SOURCES_ML) $(SOURCES_C) \
 	test-virt-customize.sh \
 	virt-customize.pod
 
@@ -33,78 +33,68 @@ generator_built = \
 	customize-options.pod \
 	customize-synopsis.pod
 
-# Alphabetical order.
-SOURCES = \
-	crypt.ml \
+SOURCES_MLI = \
 	crypt.mli \
-	crypt-c.c \
-	customize_cmdline.ml \
 	customize_cmdline.mli \
-	customize_run.ml \
 	customize_run.mli \
-	customize_utils.ml \
-	firstboot.ml \
 	firstboot.mli \
-	hostname.ml \
 	hostname.mli \
-	customize_main.ml \
-	password.ml \
 	password.mli \
-	perl_edit-c.c \
-	perl_edit.ml \
 	perl_edit.mli \
-	random_seed.ml \
 	random_seed.mli \
-	ssh_key.ml \
 	ssh_key.mli \
-	timezone.ml \
 	timezone.mli \
-	urandom.ml \
 	urandom.mli
 
-if HAVE_OCAML
+# This list must be in dependency order.
+SOURCES_ML = \
+	customize_utils.ml \
+	crypt.ml \
+	firstboot.ml \
+	hostname.ml \
+	urandom.ml \
+	password.ml \
+	perl_edit.ml \
+	random_seed.ml \
+	ssh_key.ml \
+	timezone.ml \
+	customize_cmdline.ml \
+	customize_run.ml \
+	customize_main.ml
 
-deps = \
-	$(top_builddir)/fish/guestfish-uri.o \
-	$(top_builddir)/fish/guestfish-file-edit.o \
-	$(top_builddir)/mllib/common_gettext.cmx \
-	$(top_builddir)/mllib/common_utils.cmx \
-	$(top_builddir)/mllib/config.cmx \
-	$(top_builddir)/mllib/regedit.cmx \
-	$(top_builddir)/mllib/uri-c.o \
-	$(top_builddir)/mllib/uRI.cmx \
-	crypt-c.o \
-	perl_edit-c.o
+SOURCES_C = \
+	$(top_srcdir)/fish/uri.c \
+	$(top_srcdir)/fish/file-edit.c \
+	$(top_srcdir)/fish/file-edit.h \
+	$(top_srcdir)/mllib/uri-c.c \
+	crypt-c.c \
+	perl_edit-c.c
 
-if HAVE_OCAMLOPT
-OBJECTS = $(deps)
-else
-OBJECTS = $(patsubst %.cmx,%.cmo,$(deps))
-endif
+if HAVE_OCAML
 
-# This list must be in dependency order.
-ocaml_modules = \
-	customize_utils \
-	crypt \
-	firstboot \
-	hostname \
-	urandom \
-	password \
-	perl_edit \
-	random_seed \
-	ssh_key \
-	timezone \
-	customize_cmdline \
-	customize_run \
-	customize_main
+bin_PROGRAMS = virt-customize
 
-if HAVE_OCAMLOPT
-OBJECTS += $(patsubst %,%.cmx,$(ocaml_modules))
-else
-OBJECTS += $(patsubst %,%.cmo,$(ocaml_modules))
-endif
+virt_customize_SOURCES = $(SOURCES_C)
+virt_customize_CPPFLAGS = \
+	-I. \
+	-I$(top_builddir) \
+	-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
+	-I$(shell $(OCAMLC) -where) \
+	-I$(top_srcdir)/src \
+	-I$(top_srcdir)/fish
+virt_customize_CFLAGS = \
+	$(WARN_CFLAGS) $(WERROR_CFLAGS) \
+	$(LIBVIRT_CFLAGS) \
+	$(LIBXML2_CFLAGS)
 
-bin_SCRIPTS = virt-customize
+BOBJECTS = \
+	$(top_builddir)/mllib/common_gettext.cmo \
+	$(top_builddir)/mllib/common_utils.cmo \
+	$(top_builddir)/mllib/config.cmo \
+	$(top_builddir)/mllib/regedit.cmo \
+	$(top_builddir)/mllib/uRI.cmo \
+	$(SOURCES_ML:.ml=.cmo)
+XOBJECTS = $(BOBJECTS:.cmo=.cmx)
 
 # -I $(top_builddir)/src/.libs is a hack which forces corresponding -L
 # option to be passed to gcc, so we don't try linking against an
@@ -112,57 +102,40 @@ bin_SCRIPTS = virt-customize
 OCAMLPACKAGES = \
 	-package str,unix \
 	-I $(top_builddir)/src/.libs \
+	-I $(top_builddir)/gnulib/lib/.libs \
 	-I $(top_builddir)/ocaml \
 	-I $(top_builddir)/mllib
 if HAVE_OCAML_PKG_GETTEXT
 OCAMLPACKAGES += -package gettext-stub
 endif
 
-OCAMLCFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR) $(OCAMLPACKAGES)
-OCAMLOPTFLAGS = $(OCAMLCFLAGS)
-
-OCAMLCLIBS  = \
-	$(LIBXML2_LIBS) $(LIBINTL) $(LIBTINFO_LIBS) -lcrypt \
-	-L../src/.libs -lutils \
-	-L../gnulib/lib/.libs -lgnu
+OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR)
 
-virt-customize: $(OBJECTS)
-if HAVE_OCAMLOPT
-	$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) \
-	  mlguestfs.cmxa -linkpkg $^ \
-	  -cclib '$(OCAMLCLIBS)' \
-	  -o $@
+if !HAVE_OCAMLOPT
+OBJECTS = $(BOBJECTS)
+BEST    = c
+OCAMLLINKFLAGS = mlguestfs.cma -custom
 else
-	$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) \
-	  mlguestfs.cma -linkpkg $^ \
-	  -cclib '$(OCAMLCLIBS)' \
-	  -custom \
-	  -o $@
+OBJECTS = $(XOBJECTS)
+BEST    = opt
+OCAMLLINKFLAGS = mlguestfs.cmxa
 endif
 
+virt_customize_DEPENDENCIES = $(OBJECTS)
+virt_customize_LINK = \
+	./link.sh \
+	  $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLLINKFLAGS) \
+	  $(OBJECTS) -o $@
+
 .mli.cmi:
-	$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
+	$(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
 .ml.cmo:
-	$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
+	$(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
 if HAVE_OCAMLOPT
 .ml.cmx:
-	$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -c $< -o $@
+	$(OCAMLFIND) ocamlopt $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
 endif
 
-# automake will decide we don't need C support in this file.  Really
-# we do, so we have to provide it ourselves.
-
-DEFAULT_INCLUDES = \
-	$(LIBVIRT_CFLAGS) \
-	-I. \
-	-I$(top_builddir) \
-	-I$(shell $(OCAMLC) -where) \
-	-I$(top_srcdir)/src \
-	-I$(top_srcdir)/fish
-
-.c.o:
-	$(CC) $(CFLAGS) $(PROF_CFLAGS) $(DEFAULT_INCLUDES) -c $< -o $@
-
 # Manual pages and HTML files for the website.
 man_MANS = virt-customize.1
 noinst_DATA = $(top_builddir)/html/virt-customize.1.html
diff --git a/customize/link.sh.in b/customize/link.sh.in
new file mode 100644
index 0000000..79dc847
--- /dev/null
+++ b/customize/link.sh.in
@@ -0,0 +1,22 @@
+# 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@ -lcrypt @LIBVIRT_LIBS@ @LIBXML2_LIBS@ @LIBINTL@ -lgnu'
diff --git a/mllib/uri-c.c b/mllib/uri-c.c
index 2ce4021..aa63c48 100644
--- a/mllib/uri-c.c
+++ b/mllib/uri-c.c
@@ -34,6 +34,8 @@
 #include "guestfs-internal-frontend.h"
 #include "uri.h"
 
+extern value virt_resize_parse_uri (value argv);
+
 value
 virt_resize_parse_uri (value argv /* arg value, not an array! */)
 {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list