Skip to content

Commit d725fdf

Browse files
committed
Add/adapt all the files to build
Add various files, and adapt the existing Makefile.am, to make virt-p2v build: - add all the various autotools files for bootstrapping, configuring, and building - add the POD build & checking scripts (imported from libguestfs) - add the scripts for testing (run script, and test macros)
1 parent bdb6f11 commit d725fdf

15 files changed

+1949
-19
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Makefile
88
Makefile.in
99

1010
/about-authors.c
11-
/AUTHORS
1211
/blank-part.img
1312
/config.c
1413
/dependencies.archlinux

AUTHORS

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Cédric Bosdonnat
2+
John Eckersberg
3+
Junqin Zhou
4+
Kean Li
5+
Kun Wei
6+
Laura Bailey
7+
Matthew Booth
8+
Mike Latimer
9+
Ming Xie
10+
Pino Toscano
11+
Richard W.M. Jones
12+
Roman Kagan
13+
Shahar Havivi
14+
Tingting Zheng
15+
Xiang Hua Chen
16+
Yehuda Zimmerman

Makefile.am

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,19 @@
1717

1818
include $(top_srcdir)/subdir-rules.mk
1919

20-
generator_built = \
21-
AUTHORS
20+
ACLOCAL_AMFLAGS = -I m4
2221

23-
BUILT_SOURCES = \
24-
$(generator_built)
22+
SUBDIRS = gnulib/lib
23+
if ENABLE_GNULIB_TESTS
24+
SUBDIRS += gnulib/tests
25+
endif
2526

2627
EXTRA_DIST = \
2728
$(BUILT_SOURCES) \
28-
$(TESTS) $(APPLIANCE_TESTS) $(SLOW_TESTS) \
29+
$(TESTS) $(LIBGUESTFS_TESTS) $(SLOW_TESTS) \
30+
AUTHORS \
31+
autogen.sh \
32+
bootstrap \
2933
contrib/aux-scripts/do-build.sh \
3034
contrib/build-p2v-iso.sh \
3135
contrib/patches/0001-RHEL-5-ONLY-DISABLE-AUTOMATIC-REMOTE-PORT-ALLOCATION.patch \
@@ -42,6 +46,8 @@ EXTRA_DIST = \
4246
miniexpect/README \
4347
p2v.ks.in \
4448
p2v.service \
49+
podcheck.pl \
50+
test-functions.sh \
4551
test-virt-p2v-docs.sh \
4652
test-virt-p2v-pxe.sshd_config.in \
4753
test-virt-p2v-scp.sh \
@@ -70,7 +76,8 @@ CLEANFILES += \
7076
test-virt-p2v-pxe.sshd_config \
7177
virt-p2v.img \
7278
virt-p2v-kernel-config.pod \
73-
virt-p2v.xz
79+
virt-p2v.xz \
80+
website/*.html
7481

7582
# Although virt-p2v is a regular binary, it is not usually installed
7683
# in /usr/bin since it only functions when contained in an ISO or PXE
@@ -90,6 +97,14 @@ virt-p2v.xz: virt-p2v
9097
noinst_PROGRAMS = virt-p2v
9198

9299
virt_p2v_SOURCES = \
100+
miniexpect/miniexpect.c \
101+
miniexpect/miniexpect.h \
102+
libguestfs/cleanups.c \
103+
libguestfs/cleanups.h \
104+
libguestfs/guestfs-utils.c \
105+
libguestfs/guestfs-utils.h \
106+
libguestfs/libxml2-cleanups.c \
107+
libguestfs/libxml2-writer-macros.h \
93108
conversion.c \
94109
cpuid.c \
95110
gui.c \
@@ -119,10 +134,9 @@ nodist_virt_p2v_SOURCES = \
119134

120135
virt_p2v_CPPFLAGS = \
121136
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
122-
-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
123-
-I$(top_srcdir)/lib -I$(top_builddir)/lib \
124-
-I$(top_srcdir)/common/miniexpect -I$(top_builddir)/common/miniexpect \
125-
-I$(srcdir)/../gnulib/lib -I../gnulib/lib
137+
-I$(srcdir)/libguestfs \
138+
-I$(srcdir)/miniexpect \
139+
-I$(srcdir)/gnulib/lib -Ignulib/lib
126140

127141
virt_p2v_CFLAGS = \
128142
-pthread \
@@ -133,13 +147,11 @@ virt_p2v_CFLAGS = \
133147
$(DBUS_CFLAGS)
134148

135149
virt_p2v_LDADD = \
136-
$(top_builddir)/common/utils/libutils.la \
137-
$(top_builddir)/common/miniexpect/libminiexpect.la \
138150
$(PCRE_LIBS) \
139151
$(LIBXML2_LIBS) \
140152
$(GTK_LIBS) \
141153
$(DBUS_LIBS) \
142-
../gnulib/lib/libgnu.la \
154+
gnulib/lib/libgnu.a \
143155
-lm
144156

145157
$(generated_sources) virt-p2v-kernel-config.pod: $(srcdir)/generate-p2v-config.pl
@@ -157,7 +169,7 @@ dependencies_files = \
157169
dependencies.redhat \
158170
dependencies.suse
159171

160-
$(dependencies_files): dependencies.m4 ../config.status
172+
$(dependencies_files): dependencies.m4 config.status
161173
define=`echo $@ | $(SED) 's/dependencies.//;y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
162174
m4 -D$$define=1 -DGTK_VERSION=$(GTK_VERSION) $< > $@-t
163175
mv $@-t $@
@@ -239,8 +251,12 @@ PHYSICAL_MACHINE = $(abs_builddir)/fedora.img
239251
BLANK_DISK = blank-part.img
240252

241253
check_DATA = \
254+
$(NULL)
255+
if HAVE_LIBGUESTFS
256+
check_DATA += \
242257
$(PHYSICAL_MACHINE) \
243258
$(BLANK_DISK)
259+
endif HAVE_LIBGUESTFS
244260

245261
run-virt-p2v-directly: $(PHYSICAL_MACHINE)
246262
$(top_builddir)/run virt-p2v --test-disk=$(PHYSICAL_MACHINE)
@@ -290,15 +306,15 @@ TESTS = \
290306
test-virt-p2v-cmdline.sh \
291307
test-virt-p2v-docs.sh
292308

293-
APPLIANCE_TESTS = \
309+
LIBGUESTFS_TESTS = \
294310
test-virt-p2v.sh \
295311
test-virt-p2v-nbdkit.sh
296312

297-
if ENABLE_APPLIANCE
313+
if HAVE_LIBGUESTFS
298314
TESTS += \
299-
$(APPLIANCE_TESTS) \
315+
$(LIBGUESTFS_TESTS) \
300316
$(SLOW_TESTS)
301-
endif ENABLE_APPLIANCE
317+
endif HAVE_LIBGUESTFS
302318

303319
check-valgrind:
304320
make VG="@VG@" check

autogen.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash -
2+
# libguestfs
3+
# Copyright (C) 2009 Red Hat Inc.
4+
#
5+
# This program is free software; you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License as published by
7+
# the Free Software Foundation; either version 2 of the License, or
8+
# (at your option) any later version.
9+
#
10+
# This program is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with this program; if not, write to the Free Software
17+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18+
#
19+
# Rebuild the autotools environment.
20+
21+
set -e
22+
set -v
23+
24+
# Ensure that whenever we pull in a gnulib update or otherwise change to a
25+
# different version (i.e., when switching branches), we also rerun ./bootstrap.
26+
curr_status=.git-module-status
27+
t=$(git submodule status|sed 's/^[ +-]//;s/ .*//')
28+
if test "$t" = "$(cat $curr_status 2>/dev/null)"; then
29+
: # good, it's up to date
30+
else
31+
echo running bootstrap...
32+
./bootstrap && echo "$t" > $curr_status
33+
fi
34+
35+
CONFIGUREDIR=.
36+
37+
# Run configure in BUILDDIR if it's set
38+
if [ ! -z "$BUILDDIR" ]; then
39+
mkdir -p $BUILDDIR
40+
cd $BUILDDIR
41+
42+
CONFIGUREDIR=..
43+
fi
44+
45+
# If no arguments were specified and configure has run before, use the previous
46+
# arguments
47+
if test $# -eq 0 && test -x ./config.status; then
48+
./config.status --recheck
49+
else
50+
$CONFIGUREDIR/configure "$@"
51+
fi

bootstrap

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
#!/bin/sh
2+
3+
usage() {
4+
echo >&2 "\
5+
Usage: $0 [OPTION]...
6+
Bootstrap this package from the checked-out sources.
7+
8+
Options:
9+
--gnulib-srcdir=DIRNAME specify the local directory where gnulib
10+
sources reside. Use this if you already
11+
have gnulib sources on your machine, and
12+
do not want to waste your bandwidth downloading
13+
them again. Defaults to \$GNULIB_SRCDIR
14+
"
15+
}
16+
17+
for option
18+
do
19+
case $option in
20+
--help)
21+
usage
22+
exit;;
23+
--gnulib-srcdir=*)
24+
GNULIB_SRCDIR=${option#--gnulib-srcdir=};;
25+
*)
26+
echo >&2 "$0: $option: unknown option"
27+
exit 1;;
28+
esac
29+
done
30+
31+
cleanup_gnulib() {
32+
status=$?
33+
rm -fr "$gnulib_path"
34+
exit $status
35+
}
36+
37+
git_modules_config () {
38+
test -f .gitmodules && git config --file .gitmodules "$@"
39+
}
40+
41+
gnulib_path=$(git_modules_config submodule.gnulib.path)
42+
test -z "$gnulib_path" && gnulib_path=gnulib
43+
44+
# Get gnulib files. Populate $GNULIB_SRCDIR, possibly updating a
45+
# submodule, for use in the rest of the script.
46+
47+
case ${GNULIB_SRCDIR--} in
48+
-)
49+
if git_modules_config submodule.gnulib.url >/dev/null; then
50+
echo "$0: getting gnulib files..."
51+
git submodule init -- "$gnulib_path" || exit $?
52+
git submodule update -- "$gnulib_path" || exit $?
53+
54+
elif [ ! -d "$gnulib_path" ]; then
55+
echo "$0: getting gnulib files..."
56+
57+
trap cleanup_gnulib 1 2 13 15
58+
59+
shallow=
60+
git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
61+
git clone $shallow git://git.sv.gnu.org/gnulib "$gnulib_path" ||
62+
cleanup_gnulib
63+
64+
trap - 1 2 13 15
65+
fi
66+
GNULIB_SRCDIR=$gnulib_path
67+
;;
68+
*)
69+
# Use GNULIB_SRCDIR directly or as a reference.
70+
if test -d "$GNULIB_SRCDIR"/.git && \
71+
git_modules_config submodule.gnulib.url >/dev/null; then
72+
echo "$0: getting gnulib files..."
73+
if git submodule -h|grep -- --reference > /dev/null; then
74+
# Prefer the one-liner available in git 1.6.4 or newer.
75+
git submodule update --init --reference "$GNULIB_SRCDIR" \
76+
"$gnulib_path" || exit $?
77+
else
78+
# This fallback allows at least git 1.5.5.
79+
if test -f "$gnulib_path"/gnulib-tool; then
80+
# Since file already exists, assume submodule init already complete.
81+
git submodule update -- "$gnulib_path" || exit $?
82+
else
83+
# Older git can't clone into an empty directory.
84+
rmdir "$gnulib_path" 2>/dev/null
85+
git clone --reference "$GNULIB_SRCDIR" \
86+
"$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
87+
&& git submodule init -- "$gnulib_path" \
88+
&& git submodule update -- "$gnulib_path" \
89+
|| exit $?
90+
fi
91+
fi
92+
GNULIB_SRCDIR=$gnulib_path
93+
fi
94+
;;
95+
esac
96+
97+
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
98+
<$gnulib_tool || exit
99+
100+
modules='
101+
c-ctype
102+
error
103+
getprogname
104+
ignore-value
105+
manywarnings
106+
ptsname_r
107+
sys_types
108+
xstrtoll
109+
'
110+
111+
# If any tests fail, avoid including them by adding them to
112+
# this list.
113+
avoid=""
114+
115+
$gnulib_tool \
116+
$avoid \
117+
--with-tests \
118+
--m4-base=m4 \
119+
--source-base=gnulib/lib \
120+
--tests-base=gnulib/tests \
121+
--import $modules
122+
123+
# Disable autopoint, since it was already done above.
124+
AUTOPOINT=true autoreconf --verbose --install

0 commit comments

Comments
 (0)