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 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476
|
# libguestfs virt-builder tool
# Copyright (C) 2013-2025 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
AM_YFLAGS = -d
EXTRA_DIST = \
$(SOURCES_MLI) $(SOURCES_ML) $(SOURCES_C) \
$(REPOSITORY_SOURCES_ML) \
$(REPOSITORY_SOURCES_MLI) \
index_parser_tests.ml \
libguestfs.gpg \
opensuse.gpg \
test-console.sh \
test-index \
test-simplestreams/streams/v1/index.json \
test-simplestreams/streams/v1/net.cirros-cloud_released_download.json \
test-virt-builder.sh \
test-docs.sh \
test-virt-builder-cacheall.sh \
test-virt-builder-list.sh \
test-virt-builder-list-simplestreams.sh \
test-virt-builder-planner.sh \
test-virt-builder-repository.sh \
test-virt-index-validate.sh \
test-virt-index-validate-bad-1 \
test-virt-index-validate-good-1 \
test-virt-index-validate-good-2 \
test-virt-index-validate-good-3 \
test-virt-index-validate-good-4 \
virt-builder.pod \
virt-builder-repository.pod \
virt-index-validate.pod
SOURCES_MLI = \
builder.mli \
cache.mli \
cmdline.mli \
downloader.mli \
index.mli \
index_parser.mli \
ini_reader.mli \
languages.mli \
list_entries.mli \
osinfo.mli \
osinfo_config.mli \
paths.mli \
pxzcat.mli \
repository_main.mli \
setlocale.mli \
sigchecker.mli \
simplestreams_parser.mli \
sources.mli \
utils.mli
SOURCES_ML = \
utils.ml \
osinfo_config.ml \
osinfo.ml \
pxzcat.ml \
setlocale.ml \
index.ml \
ini_reader.ml \
paths.ml \
languages.ml \
cache.ml \
sources.ml \
downloader.ml \
sigchecker.ml \
index_parser.ml \
simplestreams_parser.ml \
list_entries.ml \
cmdline.ml \
builder.ml
SOURCES_C = \
index-scan.c \
index-struct.c \
index-parse.c \
index-parser-c.c \
pxzcat-c.c \
setlocale-c.c
REPOSITORY_SOURCES_ML = \
utils.ml \
index.ml \
cache.ml \
downloader.ml \
sigchecker.ml \
ini_reader.ml \
index_parser.ml \
paths.ml \
sources.ml \
osinfo_config.ml \
osinfo.ml \
repository_main.ml
REPOSITORY_SOURCES_MLI = \
cache.mli \
downloader.mli \
index.mli \
index_parser.mli \
ini_reader.mli \
sigchecker.mli \
sources.mli
REPOSITORY_SOURCES_C = \
index-scan.c \
index-struct.c \
index-parse.c \
index-parser-c.c
man_MANS =
noinst_DATA =
bin_PROGRAMS =
if HAVE_OCAML
bin_PROGRAMS += virt-builder virt-builder-repository
virt_builder_SOURCES = $(SOURCES_C)
virt_builder_CPPFLAGS = \
-DCAML_NAME_SPACE \
-I$(builddir) -I$(srcdir) \
-I$(top_builddir) \
-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
-I$(shell $(OCAMLC) -where) \
-I$(top_srcdir)/gnulib/lib \
-I$(top_builddir)/common/utils \
-I$(top_srcdir)/common/utils \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/include
virt_builder_CFLAGS = \
-pthread \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
-Wno-unused-macros \
$(LIBGUESTFS_CFLAGS) \
$(LIBLZMA_CFLAGS) \
$(LIBTINFO_CFLAGS) \
$(LIBXML2_CFLAGS) \
$(LIBOSINFO_CFLAGS)
BOBJECTS = $(SOURCES_ML:.ml=.cmo)
XOBJECTS = $(BOBJECTS:.cmo=.cmx)
virt_builder_repository_SOURCES = $(REPOSITORY_SOURCES_C)
virt_builder_repository_CPPFLAGS = \
-DCAML_NAME_SPACE \
-I$(builddir) -I$(srcdir) \
-I$(top_builddir) \
-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
-I$(shell $(OCAMLC) -where) \
-I$(top_srcdir)/gnulib/lib \
-I$(top_srcdir)/lib
virt_builder_repository_CFLAGS = \
-pthread \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
-Wno-unused-macros \
$(LIBTINFO_CFLAGS) \
$(LIBXML2_CFLAGS)
REPOSITORY_BOBJECTS = $(REPOSITORY_SOURCES_ML:.ml=.cmo)
REPOSITORY_XOBJECTS = $(REPOSITORY_BOBJECTS:.cmo=.cmx)
OCAMLPACKAGES = \
-package str,unix,guestfs \
-I $(top_builddir)/common/utils/.libs \
-I $(top_builddir)/common/mlxml \
-I $(top_builddir)/gnulib/lib/.libs \
-I $(top_builddir)/ocaml \
-I $(top_builddir)/common/mlstdutils \
-I $(top_builddir)/common/mlutils \
-I $(top_builddir)/common/mlgettext \
-I $(top_builddir)/common/mlpcre \
-I $(top_builddir)/common/mltools \
-I $(top_builddir)/common/mlcustomize
OCAMLPACKAGES_TESTS =
if HAVE_OCAML_PKG_GETTEXT
OCAMLPACKAGES += -package gettext-stub
endif
OCAMLCLIBS = \
-pthread -lpthread \
-lutils \
$(LIBTINFO_LIBS) \
$(LIBCRYPT_LIBS) \
$(LIBGUESTFS_LIBS) \
$(LIBLZMA_LIBS) \
$(LIBXML2_LIBS) \
$(LIBOSINFO_LIBS) \
$(JSON_C_LIBS) \
$(LIBINTL) \
-lgnu
OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR) -ccopt '$(CFLAGS)'
if !HAVE_OCAMLOPT
OBJECTS = $(BOBJECTS)
REPOSITORY_OBJECTS = $(REPOSITORY_BOBJECTS)
else
OBJECTS = $(XOBJECTS)
REPOSITORY_OBJECTS = $(REPOSITORY_XOBJECTS)
endif
OCAMLLINKFLAGS = \
mlgettext.$(MLARCHIVE) \
mlpcre.$(MLARCHIVE) \
mlxml.$(MLARCHIVE) \
mlstdutils.$(MLARCHIVE) \
mlguestfs.$(MLARCHIVE) \
mlcutils.$(MLARCHIVE) \
mltools.$(MLARCHIVE) \
mlcustomize.$(MLARCHIVE) \
$(LINK_CUSTOM_OCAMLC_ONLY)
virt_builder_DEPENDENCIES = \
$(OBJECTS) \
../common/mlpcre/mlpcre.$(MLARCHIVE) \
../common/mlxml/mlxml.$(MLARCHIVE) \
../common/mlgettext/mlgettext.$(MLARCHIVE) \
../common/mlstdutils/mlstdutils.$(MLARCHIVE) \
../common/mlutils/mlcutils.$(MLARCHIVE) \
../common/mltools/mltools.$(MLARCHIVE) \
../common/mlcustomize/mlcustomize.$(MLARCHIVE) \
$(top_builddir)/ocaml-link.sh
virt_builder_LINK = \
$(top_builddir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
$(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLLINKFLAGS) \
$(OBJECTS) -o $@
virt_builder_repository_DEPENDENCIES = \
$(REPOSITORY_OBJECTS) \
../common/mltools/mltools.$(MLARCHIVE) \
../common/mlxml/mlxml.$(MLARCHIVE) \
$(top_builddir)/ocaml-link.sh
virt_builder_repository_LINK = \
$(top_builddir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
$(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLLINKFLAGS) \
$(REPOSITORY_OBJECTS) -o $@
# Manual pages and HTML files for the website.
man_MANS += virt-builder.1
noinst_DATA += $(top_builddir)/website/virt-builder.1.html
virt-builder.1 $(top_builddir)/website/virt-builder.1.html: stamp-virt-builder.pod
stamp-virt-builder.pod: virt-builder.pod $(top_srcdir)/common/mlcustomize/customize-synopsis.pod $(top_srcdir)/common/mlcustomize/customize-options.pod
$(PODWRAPPER) \
--man virt-builder.1 \
--html $(top_builddir)/website/virt-builder.1.html \
--insert $(top_srcdir)/common/mlcustomize/customize-synopsis.pod:__CUSTOMIZE_SYNOPSIS__ \
--insert $(top_srcdir)/common/mlcustomize/customize-options.pod:__CUSTOMIZE_OPTIONS__ \
--license GPLv2+ \
--warning safe \
$<
touch $@
man_MANS += virt-builder-repository.1
noinst_DATA += $(top_builddir)/website/virt-builder-repository.1.html
virt-builder-repository.1 $(top_builddir)/website/virt-builder-repository.1.html: stamp-virt-builder-repository.pod
stamp-virt-builder-repository.pod: virt-builder-repository.pod
$(PODWRAPPER) \
--man virt-builder-repository.1 \
--html $(top_builddir)/website/virt-builder-repository.1.html \
--license GPLv2+ \
--warning safe \
$<
touch $@
# Tests.
TESTS_ENVIRONMENT = $(top_builddir)/run --test
disk_images := \
$(shell for f in debian fedora ubuntu windows; do if [ -s "../test-data/phony-guests/$$f.img" ]; then echo $$f.xz; fi; done) \
$(shell if [ -s "../test-data/phony-guests/fedora.img" ]; then echo fedora.qcow2 fedora.qcow2.xz; fi)
CLEANFILES += *.qcow2 *.xz
check_DATA = $(disk_images)
osinfo_config.ml: Makefile
echo 'let libosinfo_db_path = "$(datadir)/libosinfo/db"' > $@-t
mv $@-t $@
fedora.qcow2: ../test-data/phony-guests/fedora.img
rm -f $@ $@-t
qemu-img convert -f raw -O qcow2 $< $@-t
mv $@-t $@
fedora.qcow2.xz: fedora.qcow2
rm -f $@ $@-t
xz --best -c $< > $@-t
mv $@-t $@
%.xz: ../test-data/phony-guests/%.img
rm -f $@ $@-t
xz --best -c $< > $@-t
mv $@-t $@
index_parser_tests_SOURCES = \
index-scan.c \
index-struct.c \
index-parser-c.c \
index-parse.c
index_parser_tests_CPPFLAGS = $(virt_builder_CPPFLAGS)
index_parser_tests_BOBJECTS = \
utils.cmo \
index.cmo \
cache.cmo \
downloader.cmo \
sigchecker.cmo \
ini_reader.cmo \
index_parser.cmo \
index_parser_tests.cmo
index_parser_tests_XOBJECTS = $(index_parser_tests_BOBJECTS:.cmo=.cmx)
# Can't call the following as <test>_OBJECTS because automake gets confused.
if HAVE_OCAMLOPT
index_parser_tests_THEOBJECTS = $(index_parser_tests_XOBJECTS)
index_parser_tests.cmx: OCAMLPACKAGES += $(OCAMLPACKAGES_TESTS)
else
index_parser_tests_THEOBJECTS = $(index_parser_tests_BOBJECTS)
index_parser_tests.cmo: OCAMLPACKAGES += $(OCAMLPACKAGES_TESTS)
endif
index_parser_tests_DEPENDENCIES = \
$(index_parser_tests_THEOBJECTS) \
../common/mltools/mltools.$(MLARCHIVE) \
$(top_builddir)/ocaml-link.sh
index_parser_tests_LINK = \
$(top_builddir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
$(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLPACKAGES_TESTS) $(OCAMLLINKFLAGS) \
$(index_parser_tests_THEOBJECTS) -o $@
TESTS = \
test-docs.sh \
test-virt-builder-cacheall.sh \
test-virt-builder-list.sh \
test-virt-index-validate.sh \
test-virt-builder-list-simplestreams.sh \
test-virt-builder.sh \
index_parser_tests \
$(SLOW_TESTS)
check_PROGRAMS = \
index_parser_tests
check-valgrind:
$(MAKE) VG="@VG@" check
# Slow tests.
SLOW_TESTS = \
$(console_test_scripts) \
test-virt-builder-planner.sh \
test-virt-builder-repository.sh
check-slow:
$(MAKE) check TESTS="$(SLOW_TESTS)" SLOW=1
# Test that the supplied guests boot with a serial console.
#
# Note that in future we might decide to make the serial console a
# feature, eg. `virt-builder --add-serial-console' or `virt-builder
# --remove-serial-console', so don't assume that having these tests
# means that a serial console is a requirement.
console_test_scripts := \
test-console-centos-7.2.sh \
test-console-rhel-6.8.sh \
test-console-rhel-7.2.sh \
test-console-debian-7.sh \
test-console-debian-8.sh \
test-console-fedora-24.sh \
test-console-ubuntu-12.04.sh \
test-console-ubuntu-14.04.sh \
test-console-ubuntu-16.04.sh \
test-console-ubuntu-18.04.sh \
test-console-ubuntu-20.04.sh
test-console-%.sh:
rm -f $@ $@-t
f=`echo "$@" | $(SED) 's/test-console-\(.*\).sh/\1/'`; \
echo 'script=$@ exec $$srcdir/test-console.sh' "$$f" > $@-t
chmod 0755 $@-t
mv $@-t $@
DISTCLEANFILES += \
$(console_test_scripts)
CLEANFILES += \
console-*.img \
console-*.out
# OCaml dependencies.
.depend: $(srcdir)/*.mli $(srcdir)/*.ml osinfo_config.mli osinfo_config.ml
$(top_builddir)/ocaml-dep.sh $^
-include .depend
endif
.PHONY: docs
# virt-builder's default repository
repoconfdir = $(sysconfdir)/virt-builder/repos.d
repoconf_DATA = libguestfs.conf libguestfs.gpg opensuse.conf opensuse.gpg
# Build a small C index validator program.
bin_PROGRAMS += virt-index-validate
virt_index_validate_SOURCES = \
index-parse.y \
index-scan.l \
index-struct.h \
index-struct.c \
index-validate.c
virt_index_validate_CPPFLAGS = \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-I. \
-I$(top_builddir) \
-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
-I$(top_srcdir)/common/utils \
-I$(top_srcdir)/common/options \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/include
virt_index_validate_CFLAGS = \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
-Wno-unused-macros \
$(LIBGUESTFS_CFLAGS)
virt_index_validate_LDADD = \
$(LTLIBINTL) \
../gnulib/lib/libgnu.la
man_MANS += virt-index-validate.1
noinst_DATA += $(top_builddir)/website/virt-index-validate.1.html
virt-index-validate.1 $(top_builddir)/website/virt-index-validate.1.html: stamp-virt-index-validate.pod
stamp-virt-index-validate.pod: virt-index-validate.pod
$(PODWRAPPER) \
--man virt-index-validate.1 \
--html $(top_builddir)/website/virt-index-validate.1.html \
--license GPLv2+ \
--warning safe \
$<
touch $@
CLEANFILES += \
index-parse.c \
index-parse.h \
index-scan.c
BUILT_SOURCES = index-parse.h
# Apparently there's no clean way with Automake to not have them
# in the distribution, so just remove them from the distdir.
dist-hook:
rm -f $(distdir)/index-parse.c $(distdir)/index-parse.h $(distdir)/index-scan.c
|