mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
Make it possible to build in a separate directory
This patch allows you to do: mkdir build cd build ../configure ... make This will output all generated files to the build directory. Given that autogen automatically runs configure, you can also do: BUILDDIR=./build ./autogen.sh which will do the right thing. Also: * Fix a dependency bug which means that guestfs_protocol.h isn't automatically rebuilt. * Re-running autogen.sh with no arguments won't blow away your previous configure arguments.
This commit is contained in:
@@ -105,6 +105,7 @@ debirf_symlinks = \
|
||||
noinst_DATA = $(debirf_symlinks:%=debian/modules/%)
|
||||
$(debirf_symlinks:%=debian/modules/%): stamp-debirf-modules
|
||||
stamp-debirf-modules:
|
||||
mkdir -p debian/modules
|
||||
for f in $(debirf_symlinks); do \
|
||||
ln -sf /usr/share/debirf/modules/$$f debian/modules/$$f; \
|
||||
done
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
unset CDPATH
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
if [ "@DIST@" = "REDHAT" ]; then
|
||||
cd @top_builddir@
|
||||
@@ -65,8 +66,8 @@ if [ "@DIST@" = "REDHAT" ]; then
|
||||
# Don't need any keyboard maps.
|
||||
@FEBOOTSTRAP_RUN@ initramfs -- rm -rf /lib/kbd
|
||||
|
||||
# Remove anything in home directory. Because this is potentially
|
||||
# liable to monstrous fuck-ups, we don't put a slash before 'home'.
|
||||
# Remove anything in home directory. Because of the potential for disaster
|
||||
# we don't put a slash before 'home'.
|
||||
(cd initramfs && echo home/*) |
|
||||
xargs @FEBOOTSTRAP_RUN@ initramfs -- rm -rf
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ if [ "@DIST@" = "REDHAT" ]; then
|
||||
output=appliance/initramfs.@REPO@.@host_cpu@.img
|
||||
|
||||
# Create the init script.
|
||||
@FEBOOTSTRAP_INSTALL@ initramfs appliance/init /init 0755 root.root
|
||||
@FEBOOTSTRAP_INSTALL@ initramfs appliance/@top_srcdir@/appliance/init /init 0755 root.root
|
||||
|
||||
# Copy the daemon into the filesystem.
|
||||
@FEBOOTSTRAP_INSTALL@ initramfs daemon/guestfsd /sbin/guestfsd 0755 root.root
|
||||
|
||||
26
autogen.sh
26
autogen.sh
@@ -20,12 +20,24 @@
|
||||
|
||||
set -e
|
||||
set -v
|
||||
export AUTOMAKE='automake --foreign'
|
||||
|
||||
mkdir -p daemon/m4
|
||||
aclocal
|
||||
libtoolize
|
||||
autoreconf -i
|
||||
pushd daemon
|
||||
autoreconf -i
|
||||
popd
|
||||
./configure "$@"
|
||||
|
||||
CONFIGUREDIR=.
|
||||
|
||||
# Run configure in BUILDDIR if it's set
|
||||
if [ ! -z "$BUILDDIR" ]; then
|
||||
mkdir -p $BUILDDIR
|
||||
cd $BUILDDIR
|
||||
|
||||
CONFIGUREDIR=..
|
||||
fi
|
||||
|
||||
# If no arguments were specified and configure has run before, use the previous
|
||||
# arguments
|
||||
if [ $# == 0 -a -x ./config.status ]; then
|
||||
./config.status --recheck
|
||||
else
|
||||
$CONFIGUREDIR/configure "$@"
|
||||
fi
|
||||
|
||||
@@ -24,8 +24,7 @@ EXTRA_DIST = \
|
||||
check_PROGRAMS = tests test-command
|
||||
|
||||
tests_SOURCES = tests.c
|
||||
tests_CFLAGS = \
|
||||
-I$(top_builddir)/src -Wall
|
||||
tests_CFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src -Wall
|
||||
tests_LDADD = $(top_builddir)/src/libguestfs.la
|
||||
|
||||
TESTS = tests
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
AC_INIT([libguestfs],[1.0.55])
|
||||
AM_INIT_AUTOMAKE
|
||||
AM_INIT_AUTOMAKE([foreign])
|
||||
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ guestfsd_SOURCES = \
|
||||
wc.c \
|
||||
zero.c \
|
||||
zerofree.c \
|
||||
../src/guestfs_protocol.h \
|
||||
../src/guestfs_protocol.c
|
||||
$(top_builddir)/../src/guestfs_protocol.h \
|
||||
$(top_builddir)/../src/guestfs_protocol.c
|
||||
|
||||
guestfsd_CFLAGS = -Wall
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
AC_INIT([libguestfs-daemon],[1.0.0])
|
||||
AM_INIT_AUTOMAKE
|
||||
AM_INIT_AUTOMAKE([foreign])
|
||||
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
noinst_PROGRAMS = hello to-xml
|
||||
|
||||
hello_SOURCES = hello.c
|
||||
hello_CFLAGS = -I$(top_builddir)/src -Wall
|
||||
hello_CFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src -Wall
|
||||
hello_LDADD = $(top_builddir)/src/libguestfs.la
|
||||
|
||||
to_xml_SOURCES = to-xml.c
|
||||
to_xml_CFLAGS = -I$(top_builddir)/src -Wall
|
||||
to_xml_CFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src -Wall
|
||||
to_xml_LDADD = $(top_builddir)/src/libguestfs.la
|
||||
|
||||
CLEANFILES = $(noinst_PROGRAMS)
|
||||
|
||||
@@ -32,6 +32,6 @@ guestfish_SOURCES = \
|
||||
time.c
|
||||
|
||||
guestfish_CFLAGS = \
|
||||
-I$(top_builddir)/src -Wall \
|
||||
-I$(top_srcdir)/src -I$(top_builddir)/src -Wall \
|
||||
-DGUESTFS_DEFAULT_PATH='"$(libdir)/guestfs"'
|
||||
guestfish_LDADD = $(top_builddir)/src/libguestfs.la $(LIBREADLINE)
|
||||
|
||||
@@ -30,7 +30,7 @@ TESTS = run-bindtests Guestfs005Load Guestfs010Launch Guestfs050LVCreate
|
||||
|
||||
check_DATA = Bindtests
|
||||
|
||||
GHCFLAGS = -I$(abs_top_builddir)/src -L$(abs_top_builddir)/src/.libs
|
||||
GHCFLAGS = -I$(top_builddir)/src -L$(top_builddir)/src/.libs
|
||||
|
||||
Bindtests: Bindtests.hs Guestfs.hs
|
||||
$(GHC) $(GHCFLAGS) -main-is $(shell basename $@) --make -o $@ $< -lguestfs
|
||||
@@ -44,4 +44,4 @@ Guestfs010Launch: Guestfs010Launch.hs Guestfs.hs
|
||||
Guestfs050LVCreate: Guestfs050LVCreate.hs Guestfs.hs
|
||||
$(GHC) $(GHCFLAGS) -main-is $(shell basename $@) --make -o $@ $< -lguestfs
|
||||
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -28,9 +28,23 @@ CLEANFILES = \
|
||||
100kallzeroes 100kallnewlines 100kallspaces 100krandom 10klines \
|
||||
initrd
|
||||
|
||||
squash_files = helloworld.tar helloworld.tar.gz empty known-1 known-2 known-3 \
|
||||
100kallzeroes 100kallnewlines 100kallspaces 100krandom 10klines \
|
||||
initrd
|
||||
squash_files_src = \
|
||||
$(srcdir)/helloworld.tar \
|
||||
$(srcdir)/helloworld.tar.gz \
|
||||
$(srcdir)/empty \
|
||||
$(srcdir)/known-1 \
|
||||
$(srcdir)/known-2 \
|
||||
$(srcdir)/known-3
|
||||
|
||||
squash_files_build = \
|
||||
$(builddir)/100kallzeroes \
|
||||
$(builddir)/100kallnewlines \
|
||||
$(builddir)/100kallspaces \
|
||||
$(builddir)/100krandom \
|
||||
$(builddir)/10klines \
|
||||
$(builddir)/initrd
|
||||
|
||||
squash_files = $(squash_files_src) $(squash_files_build)
|
||||
|
||||
test.sqsh: $(squash_files)
|
||||
rm -f $@
|
||||
|
||||
@@ -23,7 +23,7 @@ if HAVE_INSPECTOR
|
||||
|
||||
man_MANS = virt-inspector.1
|
||||
|
||||
noinst_DATA = ../html/virt-inspector.1.html
|
||||
noinst_DATA = @top_builddir@/html/virt-inspector.1.html
|
||||
|
||||
virt-inspector.1: virt-inspector.pl
|
||||
$(POD2MAN) \
|
||||
@@ -32,8 +32,9 @@ virt-inspector.1: virt-inspector.pl
|
||||
--release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
|
||||
$< > $@
|
||||
|
||||
../html/virt-inspector.1.html: virt-inspector.pl
|
||||
cd .. && pod2html \
|
||||
@top_builddir@/html/virt-inspector.1.html: virt-inspector.pl
|
||||
mkdir -p @top_builddir@/html
|
||||
cd @top_builddir@ && pod2html \
|
||||
--css 'pod.css' \
|
||||
--title 'virt-inspector, display OS version, kernel, drivers, mount points, applications, etc. in a virtual machine' \
|
||||
--htmldir html \
|
||||
|
||||
@@ -15,18 +15,18 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
CPTH = com/redhat/et/libguestfs
|
||||
java_prefix = com/redhat/et/libguestfs
|
||||
|
||||
java_sources = \
|
||||
$(CPTH)/LibGuestFSException.java \
|
||||
$(CPTH)/IntBool.java \
|
||||
$(CPTH)/PV.java \
|
||||
$(CPTH)/VG.java \
|
||||
$(CPTH)/LV.java \
|
||||
$(CPTH)/Stat.java \
|
||||
$(CPTH)/StatVFS.java \
|
||||
$(CPTH)/Dirent.java \
|
||||
$(CPTH)/GuestFS.java
|
||||
$(java_prefix)/LibGuestFSException.java \
|
||||
$(java_prefix)/IntBool.java \
|
||||
$(java_prefix)/PV.java \
|
||||
$(java_prefix)/VG.java \
|
||||
$(java_prefix)/LV.java \
|
||||
$(java_prefix)/Stat.java \
|
||||
$(java_prefix)/StatVFS.java \
|
||||
$(java_prefix)/Dirent.java \
|
||||
$(java_prefix)/GuestFS.java
|
||||
|
||||
java_tests = \
|
||||
Bindtests.java \
|
||||
@@ -50,7 +50,7 @@ libguestfs_jardir = $(JAR_INSTALL_DIR)
|
||||
libguestfs_jar_DATA = libguestfs-${VERSION}.jar
|
||||
libguestfs_jar_class_files = $(java_sources:.java=.class)
|
||||
$(libguestfs_jar_class_files): %.class: %.java
|
||||
$(JAVAC) $(JAVAC_FLAGS) -classpath $(CPTH) $(java_sources)
|
||||
$(JAVAC) $(JAVAC_FLAGS) -d @builddir@ -classpath @srcdir@:@builddir@ -sourcepath @srcdir@:@builddir@ $<
|
||||
|
||||
libguestfs-${VERSION}.jar: $(libguestfs_jar_class_files)
|
||||
$(JAR) cf $@ $^
|
||||
@@ -64,12 +64,12 @@ libguestfs_jni_la_SOURCES = \
|
||||
|
||||
libguestfs_jni_la_LIBADD = $(top_builddir)/src/libguestfs.la
|
||||
libguestfs_jni_la_LDFLAGS = -version-info $(JNI_VERSION_INFO)
|
||||
libguestfs_jni_la_CFLAGS = -Wall -I$(top_builddir)/src $(JNI_CFLAGS)
|
||||
libguestfs_jni_la_CFLAGS = -Wall -I$(top_srcdir)/src -I$(top_builddir)/src $(JNI_CFLAGS)
|
||||
|
||||
BUILT_SOURCES = com_redhat_et_libguestfs_GuestFS.h
|
||||
|
||||
com_redhat_et_libguestfs_GuestFS.h: $(CPTH)/GuestFS.class
|
||||
$(JAVAH) -classpath .:$(CPTH) com.redhat.et.libguestfs.GuestFS
|
||||
com_redhat_et_libguestfs_GuestFS.h: $(java_prefix)/GuestFS.class
|
||||
$(JAVAH) -classpath @srcdir@:@builddir@ com.redhat.et.libguestfs.GuestFS
|
||||
|
||||
# Documentation.
|
||||
|
||||
|
||||
@@ -39,10 +39,10 @@ mlguestfs.cmxa: guestfs_c.o guestfs_c_actions.o guestfs.cmx
|
||||
$(OCAMLMKLIB) -o mlguestfs $^ -L$(top_builddir)/src/.libs -lguestfs
|
||||
|
||||
guestfs_c.o: guestfs_c.c
|
||||
$(CC) $(CFLAGS) -I$(OCAMLLIB) -I$(top_builddir)/src -fPIC -Wall -c $<
|
||||
$(CC) $(CFLAGS) -I$(OCAMLLIB) -I$(top_srcdir)/ocaml -I$(top_srcdir)/src -I$(top_builddir)/src -fPIC -Wall -c $<
|
||||
|
||||
guestfs_c_actions.o: guestfs_c_actions.c
|
||||
$(CC) $(CFLAGS) -I$(OCAMLLIB) -I$(top_builddir)/src -fPIC -Wall -c $<
|
||||
$(CC) $(CFLAGS) -I$(OCAMLLIB) -I$(top_srcdir)/ocaml -I$(top_srcdir)/src -I$(top_builddir)/src -fPIC -Wall -c $<
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
LD_LIBRARY_PATH=$(top_builddir)/src/.libs \
|
||||
@@ -60,15 +60,19 @@ bindtests: bindtests.ml mlguestfs.cmxa
|
||||
$(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . unix.cmxa mlguestfs.cmxa $< -o $@
|
||||
|
||||
t/guestfs_005_load: t/guestfs_005_load.ml mlguestfs.cmxa
|
||||
mkdir -p t
|
||||
$(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . unix.cmxa mlguestfs.cmxa $< -o $@
|
||||
|
||||
t/guestfs_010_launch: t/guestfs_010_launch.ml mlguestfs.cmxa
|
||||
mkdir -p t
|
||||
$(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . unix.cmxa mlguestfs.cmxa $< -o $@
|
||||
|
||||
t/guestfs_050_lvcreate: t/guestfs_050_lvcreate.ml mlguestfs.cmxa
|
||||
mkdir -p t
|
||||
$(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . unix.cmxa mlguestfs.cmxa $< -o $@
|
||||
|
||||
t/guestfs_060_readdir: t/guestfs_060_readdir.ml mlguestfs.cmxa
|
||||
mkdir -p t
|
||||
$(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . unix.cmxa mlguestfs.cmxa $< -o $@
|
||||
|
||||
.mli.cmi:
|
||||
|
||||
@@ -23,7 +23,8 @@ WriteMakefile (
|
||||
NAME => 'Sys::Guestfs',
|
||||
VERSION => '@PACKAGE_VERSION@',
|
||||
|
||||
LIBS => '-L@abs_top_builddir@/src/.libs -lguestfs',
|
||||
INC => '-I@abs_top_builddir@/src',
|
||||
LIBS => '-L@top_builddir@/src/.libs -lguestfs',
|
||||
INC => '-I@top_builddir@/src -I@top_srcdir@/src',
|
||||
TYPEMAPS => [ '@srcdir@/typemap' ],
|
||||
CCFLAGS => '@CFLAGS@',
|
||||
);
|
||||
|
||||
@@ -36,8 +36,8 @@ if HAVE_PERL
|
||||
TESTS = run-bindtests run-perl-tests
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
LD_LIBRARY_PATH=../src/.libs \
|
||||
LIBGUESTFS_PATH=../appliance
|
||||
LD_LIBRARY_PATH=$(top_builddir)/src/.libs \
|
||||
LIBGUESTFS_PATH=$(top_builddir)/appliance
|
||||
|
||||
INSTALLDIRS = site
|
||||
|
||||
|
||||
@@ -32,12 +32,13 @@ python_DATA = guestfs.py
|
||||
python_LTLIBRARIES = libguestfsmod.la
|
||||
|
||||
libguestfsmod_la_SOURCES = guestfs-py.c
|
||||
libguestfsmod_la_CFLAGS = -Wall -I$(PYTHON_INCLUDEDIR) -I$(top_builddir)/src
|
||||
libguestfsmod_la_CFLAGS = -Wall -I$(PYTHON_INCLUDEDIR) \
|
||||
-I$(top_srcdir)/src -I$(top_builddir)/src
|
||||
libguestfsmod_la_LIBADD = $(top_builddir)/src/libguestfs.la
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
LIBGUESTFS_PATH=$(top_builddir)/appliance \
|
||||
PYTHONPATH=$(top_builddir)/python:$(top_builddir)/python/.libs
|
||||
PYTHONPATH=$(builddir):$(builddir)/.libs
|
||||
|
||||
TESTS = run-bindtests run-python-tests
|
||||
|
||||
|
||||
@@ -40,10 +40,10 @@ if HAVE_RUBY
|
||||
TESTS = run-bindtests run-ruby-tests
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
LD_LIBRARY_PATH=../src/.libs \
|
||||
LIBGUESTFS_PATH=../appliance
|
||||
LD_LIBRARY_PATH=$(top_builddir)/src/.libs \
|
||||
LIBGUESTFS_PATH=$(top_builddir)/appliance
|
||||
|
||||
all:
|
||||
rake build
|
||||
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -24,26 +24,24 @@ require 'rake/gempackagetask'
|
||||
PKG_NAME='@PACKAGE_NAME@'
|
||||
PKG_VERSION='@PACKAGE_VERSION@'
|
||||
|
||||
EXT_CONF='ext/guestfs/extconf.rb'
|
||||
MAKEFILE='ext/guestfs/Makefile'
|
||||
GUESTFS_MODULE='ext/guestfs/_guestfs.so'
|
||||
GUESTFS_SRC='ext/guestfs/_guestfs.c'
|
||||
EXT_CONF='@srcdir@/ext/guestfs/extconf.rb'
|
||||
MAKEFILE='@builddir@/ext/guestfs/Makefile'
|
||||
GUESTFS_MODULE='@builddir@/ext/guestfs/_guestfs.so'
|
||||
GUESTFS_SRC='@builddir@/ext/guestfs/_guestfs.c'
|
||||
|
||||
CLEAN.include [ "ext/**/*.o", GUESTFS_MODULE,
|
||||
"ext/**/depend" ]
|
||||
CLEAN.include [ "@builddir@/ext/**/*.o", GUESTFS_MODULE,
|
||||
"@builddir@/ext/**/depend" ]
|
||||
|
||||
CLOBBER.include [ "config.save", "ext/**/mkmf.log",
|
||||
CLOBBER.include [ "@builddir@/config.save", "@builddir@/ext/**/mkmf.log",
|
||||
MAKEFILE ]
|
||||
|
||||
# Build locally
|
||||
|
||||
file MAKEFILE => EXT_CONF do |t|
|
||||
Dir::chdir(File::dirname(EXT_CONF)) do
|
||||
unless sh "ruby #{File::basename(EXT_CONF)} --with-_guestfs-include=../../../src --with-_guestfs-lib=../../../src/.libs"
|
||||
$stderr.puts "Failed to run extconf"
|
||||
break
|
||||
end
|
||||
end
|
||||
unless sh "top_srcdir=$(pwd)/@top_srcdir@; top_builddir=$(pwd)/@top_builddir@; cd #{File::dirname(EXT_CONF)}; ruby #{File::basename(EXT_CONF)} --with-_guestfs-include=$top_srcdir --with-_guestfs-lib=$top_builddir/src/.libs"
|
||||
$stderr.puts "Failed to run extconf"
|
||||
break
|
||||
end
|
||||
end
|
||||
file GUESTFS_MODULE => [ MAKEFILE, GUESTFS_SRC ] do |t|
|
||||
Dir::chdir(File::dirname(EXT_CONF)) do
|
||||
|
||||
@@ -30,8 +30,10 @@ EXTRA_DIST = \
|
||||
noinst_DATA = stamp-generator
|
||||
|
||||
stamp-generator: generator.ml
|
||||
mkdir -p $(top_srcdir)/perl/lib/Sys
|
||||
cd .. && ocaml -warn-error A $(srcdir)/src/$<
|
||||
mkdir -p $(top_builddir)/perl/lib/Sys
|
||||
mkdir -p $(top_builddir)/ruby/ext/guestfs
|
||||
mkdir -p $(top_builddir)/java/com/redhat/et/libguestfs
|
||||
cd $(top_builddir) && ocaml -warn-error A ./src/$<
|
||||
|
||||
guestfs_protocol.x: stamp-generator
|
||||
|
||||
@@ -83,6 +85,8 @@ lib_LTLIBRARIES = libguestfs.la
|
||||
|
||||
BUILT_SOURCES = \
|
||||
guestfs_protocol.x \
|
||||
guestfs_protocol.c \
|
||||
guestfs_protocol.h \
|
||||
guestfs-structs.h \
|
||||
guestfs-actions.h \
|
||||
guestfs-actions.c \
|
||||
|
||||
@@ -8607,7 +8607,7 @@ let output_to filename =
|
||||
let () =
|
||||
check_functions ();
|
||||
|
||||
if not (Sys.file_exists "configure.ac") then (
|
||||
if not (Sys.file_exists "config.status") then (
|
||||
eprintf "\
|
||||
You are probably running this from the wrong directory.
|
||||
Run it from the top source directory using the command
|
||||
|
||||
Reference in New Issue
Block a user