Pino Toscano
2014-May-02 10:29 UTC
[Libguestfs] [PATCH 1/3] build: fix srcdir!=builddir builds
Fix the build system to support a build directory different than the source directory: - fix the include path to gnulib - properly depend on and use files in the source directory - fix the ocaml dependency calculation, making sure it picks the files from all the places --- src/Makefile.am | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 932881b..77aa611 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -99,7 +99,7 @@ supermin_SOURCES = $(SOURCES_C) supermin_CFLAGS = \ -I$(shell $(OCAMLC) -where) \ $(EXT2FS_CFLAGS) $(COM_ERR_CFLAGS) \ - -I$(srcdir)/lib -I../lib + -I$(top_srcdir)/lib -I../lib BOBJECTS = $(SOURCES_ML:.ml=.cmo) XOBJECTS = $(SOURCES_ML:.ml=.cmx) @@ -148,16 +148,16 @@ ext2init-bin.S: init strip --strip-all $< @file $< | grep -isq static || \ (echo "*** error: init is not staticly linked"; exit 1) - ./bin2s.pl $< $@ + $(srcdir)/bin2s.pl $< $@ depend: .depend -.depend: $(SOURCES) +.depend: $(wildcard $(abs_srcdir)/*.mli) $(wildcard $(abs_srcdir)/*.ml) config.ml rm -f $@ $@-t - $(OCAMLFIND) ocamldep $^ | \ + $(OCAMLFIND) ocamldep -I $(abs_srcdir) -I $(builddir) $^ | \ $(SED) 's/ *$$//' | \ $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \ - $(SED) 's/ :/:/' | \ + $(SED) -e 's,$(abs_srcdir)/,$(builddir)/,g' | \ sort > $@-t mv $@-t $@ @@ -167,7 +167,7 @@ SUFFIXES = .cmo .cmi .cmx .ml .mli .mll .mly if HAVE_PERLDOC -supermin.1: supermin.pod +supermin.1: $(srcdir)/supermin.pod pod2man \ -u \ --section 1 \ @@ -178,12 +178,12 @@ supermin.1: supermin.pod noinst_DATA = \ ../html/supermin.1.html -../html/supermin.1.html: supermin.pod +../html/supermin.1.html: $(srcdir)/supermin.pod mkdir -p ../html pod2html \ --css 'pod.css' \ --htmldir ../html \ --outfile ../html/supermin.1.html \ - supermin.pod + $< endif -- 1.9.0
Pino Toscano
2014-May-02 10:29 UTC
[Libguestfs] [PATCH 2/3] tests: fix srcdir!=builddir runs
Export $(srcdir) for the tests, so a test script which invokes other script(s) can locate them properly. --- tests/Makefile.am | 2 ++ tests/test-binaries-exist-network.sh | 2 +- tests/test-build-bash-network.sh | 2 +- tests/test-harder-network.sh | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 03c97b3..dc73737 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -33,3 +33,5 @@ TESTS += \ test-binaries-exist-network.sh \ test-harder-network.sh endif + +TESTS_ENVIRONMENT = srcdir='$(srcdir)' diff --git a/tests/test-binaries-exist-network.sh b/tests/test-binaries-exist-network.sh index 19c3830..3fba38e 100755 --- a/tests/test-binaries-exist-network.sh +++ b/tests/test-binaries-exist-network.sh @@ -1,2 +1,2 @@ #!/bin/sh -USE_NETWORK=1 ./test-binaries-exist.sh +USE_NETWORK=1 $srcdir/test-binaries-exist.sh diff --git a/tests/test-build-bash-network.sh b/tests/test-build-bash-network.sh index a80da4d..5c55243 100755 --- a/tests/test-build-bash-network.sh +++ b/tests/test-build-bash-network.sh @@ -1,3 +1,3 @@ #!/bin/sh -USE_NETWORK=1 ./test-build-bash.sh +USE_NETWORK=1 $srcdir/test-build-bash.sh diff --git a/tests/test-harder-network.sh b/tests/test-harder-network.sh index d1c1e99..0acdabd 100755 --- a/tests/test-harder-network.sh +++ b/tests/test-harder-network.sh @@ -1,3 +1,3 @@ #!/bin/sh -USE_NETWORK=1 ./test-harder.sh +USE_NETWORK=1 $srcdir/test-harder.sh -- 1.9.0
Pino Toscano
2014-May-02 10:29 UTC
[Libguestfs] [PATCH 3/3] build: depend on bin2s.pl for ext2init-bin.S
--- src/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile.am b/src/Makefile.am index 77aa611..bada3bb 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -144,7 +144,7 @@ CLEANFILES += ext2init-bin.S ext2init-bin.o: ext2init-bin.S $(CC) -o $@ -c $< -ext2init-bin.S: init +ext2init-bin.S: init $(srcdir)/bin2s.pl strip --strip-all $< @file $< | grep -isq static || \ (echo "*** error: init is not staticly linked"; exit 1) -- 1.9.0
Richard W.M. Jones
2014-May-07 08:58 UTC
Re: [Libguestfs] [PATCH 2/3] tests: fix srcdir!=builddir runs
On Fri, May 02, 2014 at 12:29:08PM +0200, Pino Toscano wrote:> Export $(srcdir) for the tests, so a test script which invokes other > script(s) can locate them properly.Part of this patch should not be needed. According to automake.info: Test programs that need data files should look for them in 'srcdir' (which is both a make variable and an environment variable made available to the tests), so that they work when building in a separate directory (*note Build Directories: (autoconf)Build Directories.), and in particular for the 'distcheck' rule (*note Checking the Distribution::). Rich.> tests/Makefile.am | 2 ++ > tests/test-binaries-exist-network.sh | 2 +- > tests/test-build-bash-network.sh | 2 +- > tests/test-harder-network.sh | 2 +- > 4 files changed, 5 insertions(+), 3 deletions(-) > > diff --git a/tests/Makefile.am b/tests/Makefile.am > index 03c97b3..dc73737 100644 > --- a/tests/Makefile.am > +++ b/tests/Makefile.am > @@ -33,3 +33,5 @@ TESTS += \ > test-binaries-exist-network.sh \ > test-harder-network.sh > endif > + > +TESTS_ENVIRONMENT = srcdir='$(srcdir)' > diff --git a/tests/test-binaries-exist-network.sh b/tests/test-binaries-exist-network.sh > index 19c3830..3fba38e 100755 > --- a/tests/test-binaries-exist-network.sh > +++ b/tests/test-binaries-exist-network.sh > @@ -1,2 +1,2 @@ > #!/bin/sh > -USE_NETWORK=1 ./test-binaries-exist.sh > +USE_NETWORK=1 $srcdir/test-binaries-exist.sh > diff --git a/tests/test-build-bash-network.sh b/tests/test-build-bash-network.sh > index a80da4d..5c55243 100755 > --- a/tests/test-build-bash-network.sh > +++ b/tests/test-build-bash-network.sh > @@ -1,3 +1,3 @@ > #!/bin/sh > > -USE_NETWORK=1 ./test-build-bash.sh > +USE_NETWORK=1 $srcdir/test-build-bash.sh > diff --git a/tests/test-harder-network.sh b/tests/test-harder-network.sh > index d1c1e99..0acdabd 100755 > --- a/tests/test-harder-network.sh > +++ b/tests/test-harder-network.sh > @@ -1,3 +1,3 @@ > #!/bin/sh > > -USE_NETWORK=1 ./test-harder.sh > +USE_NETWORK=1 $srcdir/test-harder.sh > -- > 1.9.0 > > _______________________________________________ > Libguestfs mailing list > Libguestfs@redhat.com > https://www.redhat.com/mailman/listinfo/libguestfs-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
Richard W.M. Jones
2014-May-07 08:59 UTC
Re: [Libguestfs] [PATCH 1/3] build: fix srcdir!=builddir builds
This patch series is fine, minus the bits setting srcdir in TESTS_ENVIRONMENT. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW
Pino Toscano
2014-May-07 12:53 UTC
Re: [Libguestfs] [PATCH 1/3] build: fix srcdir!=builddir builds
On Wednesday 07 May 2014 09:59:17 Richard W.M. Jones wrote:> This patch series is fine, minus the bits setting srcdir in > TESTS_ENVIRONMENT.Removed the srcdir addition to TESTS_ENVIRONMENT, and pushed. Thanks for the review, -- Pino Toscano
Reasonably Related Threads
- [supermin 1/2] chroot: Fix corner case introduced with dpkg-divert support
- [PATCH] febootstrap-supermin-helper: Replace objcopy call for embedding init binary
- [PATCH 0/3] Miscellaneous improvements to supermin.
- [PATCH supermin 0/2] Allow an alternate libc to be used for init.
- Re: How make check with test-harder.sh screw my box !!!!!