1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
|
# libguestfs OCaml virt-customize common code
# Copyright (C) 2011-2019 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include $(top_srcdir)/subdir-rules.mk
EXTRA_DIST = \
$(generator_built) \
$(SOURCES_MLI) \
$(SOURCES_ML) \
$(SOURCES_C) \
test-firstboot.sh \
test-selinuxrelabel.sh
# Note: So that I don't have to move many modules from virt-customize
# to here, we don't compile customize_cmdline.ml into the mlcustomize
# library. Instead virt-customize links to these files. They are
# only located here because they have to be placed in common/ because
# they are generated (since the repository split).
generator_built = \
customize_cmdline.mli \
customize_cmdline.ml \
customize-options.pod \
customize-synopsis.pod
SOURCES_MLI = \
firstboot.mli \
guest_packages.mli \
inject_virtio_win.mli \
SELinux_relabel.mli
SOURCES_ML = \
firstboot.ml \
guest_packages.ml \
inject_virtio_win.ml \
SELinux_relabel.ml
if HAVE_OCAML
# We pretend that we're building a C library. automake handles the
# compilation of the C sources for us. At the end we take the C
# objects and OCaml objects and link them into the OCaml library.
# This C library is never used.
noinst_LIBRARIES = libmlcustomize.a
if !HAVE_OCAMLOPT
MLCUSTOMIZE_CMA = mlcustomize.cma
else
MLCUSTOMIZE_CMA = mlcustomize.cmxa
endif
noinst_DATA = $(MLCUSTOMIZE_CMA)
libmlcustomize_a_SOURCES = dummy.c
libmlcustomize_a_CPPFLAGS = \
-DCAML_NAME_SPACE \
-I. \
-I$(top_builddir) \
-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
-I$(shell $(OCAMLC) -where) \
-I$(top_srcdir)/common/utils \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/common/mlstdutils \
-I$(top_srcdir)/common/mlgettext \
-I$(top_srcdir)/common/mlpcre \
-I$(top_srcdir)/common/mltools \
-I$(top_srcdir)/common/mlxml
libmlcustomize_a_CFLAGS = \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
-fPIC
BOBJECTS = $(SOURCES_ML:.ml=.cmo)
XOBJECTS = $(BOBJECTS:.cmo=.cmx)
OCAMLPACKAGES = \
-package str,unix,guestfs \
-I $(top_builddir)/common/utils/.libs \
-I $(top_builddir)/ocaml \
-I $(top_builddir)/common/mlstdutils \
-I $(top_builddir)/common/mlgettext \
-I $(top_builddir)/common/mlpcre \
-I $(top_builddir)/common/mltools \
-I $(top_builddir)/common/mlxml \
-I $(builddir)
OCAMLPACKAGES_TESTS = $(MLCUSTOMIZE_CMA)
if HAVE_OCAML_PKG_GETTEXT
OCAMLPACKAGES += -package gettext-stub
endif
OCAMLCLIBS = \
-lutils \
$(LIBINTL) \
-lgnu
OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR) -ccopt '$(CFLAGS)'
if !HAVE_OCAMLOPT
OBJECTS = $(BOBJECTS)
else
OBJECTS = $(XOBJECTS)
endif
libmlcustomize_a_DEPENDENCIES = $(OBJECTS)
$(MLCUSTOMIZE_CMA): $(OBJECTS) libmlcustomize.a
$(OCAMLFIND) mklib $(OCAMLPACKAGES) \
$(OBJECTS) $(libmlcustomize_a_OBJECTS) -o mlcustomize
# Tests.
TESTS_ENVIRONMENT = $(top_builddir)/run --test
TESTS = $(SLOW_TESTS)
check-valgrind:
$(MAKE) VG="@VG@" check
# Slow tests of virt-customize functionality in real guests.
SLOW_TESTS = \
$(firstboot_test_scripts) \
test-selinuxrelabel.sh
check-slow:
$(MAKE) check TESTS="$(SLOW_TESTS)" SLOW=1
firstboot_test_scripts := \
test-firstboot-rhel-4.9.sh \
test-firstboot-rhel-5.11.sh \
test-firstboot-rhel-6.8.sh \
test-firstboot-rhel-7.2.sh \
test-firstboot-debian-6.sh \
test-firstboot-debian-7.sh \
test-firstboot-debian-8.sh \
test-firstboot-fedora-26.sh \
test-firstboot-fedora-27.sh \
test-firstboot-ubuntu-10.04.sh \
test-firstboot-ubuntu-12.04.sh \
test-firstboot-ubuntu-14.04.sh \
test-firstboot-ubuntu-16.04.sh \
test-firstboot-ubuntu-18.04.sh \
test-firstboot-windows-6.2-server.sh \
test-firstboot-windows-6.3-server.sh \
test-firstboot-windows-10.0-server.sh
# Firstboot is known-broken on RHEL 3:
# test-firstboot-rhel-3.9.sh
test-firstboot-%.sh:
rm -f $@ $@-t
f=`echo "$@" | $(SED) 's/test-firstboot-\(.*\).sh/\1/'`; \
echo 'script=$@ exec $$srcdir/test-firstboot.sh' "$$f" > $@-t
chmod 0755 $@-t
mv $@-t $@
CLEANFILES += \
$(firstboot_test_scripts) \
firstboot-*.img
# Dependencies.
.depend: $(srcdir)/*.mli $(srcdir)/*.ml
$(top_builddir)/ocaml-dep.sh $^
-include .depend
endif
.PHONY: docs
|