Hilko Bengen
2011-Aug-11 15:24 UTC
[Libguestfs] [PATCH] hivex: A few tweaks to enable building in a separate directory
--- configure.ac | 2 +- images/Makefile.am | 5 +++-- lib/Makefile.am | 14 +++++++------- ocaml/Makefile.am | 3 ++- ocaml/t/hivex_300_fold.ml | 3 +-- python/run-python-tests | 25 ------------------------- python/run-python-tests.in | 25 +++++++++++++++++++++++++ 7 files changed, 39 insertions(+), 38 deletions(-) delete mode 100755 python/run-python-tests create mode 100755 python/run-python-tests.in diff --git a/configure.ac b/configure.ac index 22b806f..31d20ff 100644 --- a/configure.ac +++ b/configure.ac @@ -434,7 +434,7 @@ AC_CONFIG_FILES([Makefile lib/tools/Makefile ocaml/Makefile ocaml/META perl/Makefile perl/Makefile.PL - python/Makefile + python/Makefile python/run-python-tests po/Makefile.in regedit/Makefile sh/Makefile diff --git a/images/Makefile.am b/images/Makefile.am index 2adaed3..e176d3c 100644 --- a/images/Makefile.am +++ b/images/Makefile.am @@ -29,7 +29,8 @@ mklarge_LDADD = ../lib/libhivex.la noinst_DATA = large -large: mklarge - ./mklarge $(srcdir)/minimal large +large: minimal mklarge + cp -u $(srcdir)/minimal $(builddir)/minimal + ./mklarge $(builddir)/minimal $(builddir)/large CLEANFILES = $(noinst_DATA) diff --git a/lib/Makefile.am b/lib/Makefile.am index d54aaee..7e5b92b 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -33,11 +33,11 @@ libhivex_la_SOURCES = \ libhivex_la_LIBADD = ../gnulib/lib/libgnu.la libhivex_la_LDFLAGS = \ -version-info 0:0:0 \ - $(VERSION_SCRIPT_FLAGS)hivex.syms \ + $(VERSION_SCRIPT_FLAGS)$(srcdir)/hivex.syms \ $(LTLIBINTL) \ $(LTLIBTHREAD) libhivex_la_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) -libhivex_la_CPPFLAGS = -I$(top_srcdir)/gnulib/lib +libhivex_la_CPPFLAGS = -I$(top_srcdir)/gnulib/lib -I$(srcdir) include_HEADERS = hivex.h @@ -56,10 +56,10 @@ noinst_DATA = \ $(top_builddir)/html/hivex.3.html: hivex.pod mkdir -p $(top_builddir)/html - cd $(top_builddir) && pod2html \ - --css 'pod.css' \ - --htmldir html \ - --outfile html/hivex.3.html \ - lib/hivex.pod + pod2html \ + --css $(top_srcdir)/css/pod.css \ + --htmldir $(top_builddir)/html \ + --outfile $(top_builddir)/html/hivex.3.html \ + $< CLEANFILES = $(man_MANS) diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am index c688df0..89a59cd 100644 --- a/ocaml/Makefile.am +++ b/ocaml/Makefile.am @@ -64,7 +64,8 @@ TESTS = \ noinst_DATA += $(TESTS) # https://www.redhat.com/archives/libguestfs/2011-May/thread.html#00015 -t/%: t/%.cmo mlhivex.cma +t/%: $(srcdir)/t/%.cmo mlhivex.cma + mkdir -p t $(LIBTOOL) --mode=execute -dlopen $(top_builddir)/lib/libhivex.la \ $(OCAMLFIND) ocamlc -dllpath $(abs_builddir) -package unix \ -linkpkg mlhivex.cma $< -o $@ diff --git a/ocaml/t/hivex_300_fold.ml b/ocaml/t/hivex_300_fold.ml index 0c7bc4f..c8de6e8 100644 --- a/ocaml/t/hivex_300_fold.ml +++ b/ocaml/t/hivex_300_fold.ml @@ -21,7 +21,6 @@ open Unix open Printf let (//) = Filename.concat -let srcdir = try Sys.getenv "srcdir" with Not_found -> "." (* This is a generic function to fold over hives. * fn : 'a -> node -> 'a is called for each node @@ -36,7 +35,7 @@ let hive_fold h fn fv a root fold a root let () - let h = Hivex.open_file (srcdir // "../images/large") [] in + let h = Hivex.open_file ("../images/large") [] in (* Count the number of nodes and values in the hive. *) let count_node (nodes, values) _ = (nodes+1, values) in diff --git a/python/run-python-tests b/python/run-python-tests deleted file mode 100755 index e8c8c14..0000000 --- a/python/run-python-tests +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -# hivex Python bindings -# Copyright (C) 2009-2011 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., 675 Mass Ave, Cambridge, MA 02139, USA. - -set -e -shopt -s nullglob - -for f in t/*.py; do - basename "$f" - python "$f" -done diff --git a/python/run-python-tests.in b/python/run-python-tests.in new file mode 100755 index 0000000..af51080 --- /dev/null +++ b/python/run-python-tests.in @@ -0,0 +1,25 @@ +#!/bin/bash - +# hivex Python bindings +# Copyright (C) 2009-2011 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., 675 Mass Ave, Cambridge, MA 02139, USA. + +set -e +shopt -s nullglob + +for f in $(srcdir)t/*.py; do + basename "$f" + @PYTHON@ "$f" +done -- 1.7.5.4
Richard W.M. Jones
2011-Aug-11 18:40 UTC
[Libguestfs] [PATCH] hivex: A few tweaks to enable building in a separate directory
On Thu, Aug 11, 2011 at 05:24:05PM +0200, Hilko Bengen wrote:> --- > configure.ac | 2 +- > images/Makefile.am | 5 +++-- > lib/Makefile.am | 14 +++++++------- > ocaml/Makefile.am | 3 ++- > ocaml/t/hivex_300_fold.ml | 3 +-- > python/run-python-tests | 25 ------------------------- > python/run-python-tests.in | 25 +++++++++++++++++++++++++ > 7 files changed, 39 insertions(+), 38 deletions(-) > delete mode 100755 python/run-python-tests > create mode 100755 python/run-python-tests.in > > diff --git a/configure.ac b/configure.ac > index 22b806f..31d20ff 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -434,7 +434,7 @@ AC_CONFIG_FILES([Makefile > lib/tools/Makefile > ocaml/Makefile ocaml/META > perl/Makefile perl/Makefile.PL > - python/Makefile > + python/Makefile python/run-python-tests > po/Makefile.in > regedit/Makefile > sh/Makefile > diff --git a/images/Makefile.am b/images/Makefile.am > index 2adaed3..e176d3c 100644 > --- a/images/Makefile.am > +++ b/images/Makefile.am > @@ -29,7 +29,8 @@ mklarge_LDADD = ../lib/libhivex.la > > noinst_DATA = large > > -large: mklarge > - ./mklarge $(srcdir)/minimal large > +large: minimal mklarge > + cp -u $(srcdir)/minimal $(builddir)/minimal > + ./mklarge $(builddir)/minimal $(builddir)/large > > CLEANFILES = $(noinst_DATA) > diff --git a/lib/Makefile.am b/lib/Makefile.am > index d54aaee..7e5b92b 100644 > --- a/lib/Makefile.am > +++ b/lib/Makefile.am > @@ -33,11 +33,11 @@ libhivex_la_SOURCES = \ > libhivex_la_LIBADD = ../gnulib/lib/libgnu.la > libhivex_la_LDFLAGS = \ > -version-info 0:0:0 \ > - $(VERSION_SCRIPT_FLAGS)hivex.syms \ > + $(VERSION_SCRIPT_FLAGS)$(srcdir)/hivex.syms \ > $(LTLIBINTL) \ > $(LTLIBTHREAD) > libhivex_la_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) > -libhivex_la_CPPFLAGS = -I$(top_srcdir)/gnulib/lib > +libhivex_la_CPPFLAGS = -I$(top_srcdir)/gnulib/lib -I$(srcdir) > > include_HEADERS = hivex.h > > @@ -56,10 +56,10 @@ noinst_DATA = \ > > $(top_builddir)/html/hivex.3.html: hivex.pod > mkdir -p $(top_builddir)/html > - cd $(top_builddir) && pod2html \ > - --css 'pod.css' \ > - --htmldir html \ > - --outfile html/hivex.3.html \ > - lib/hivex.pod > + pod2html \ > + --css $(top_srcdir)/css/pod.css \ > + --htmldir $(top_builddir)/html \ > + --outfile $(top_builddir)/html/hivex.3.html \ > + $< > > CLEANFILES = $(man_MANS) > diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am > index c688df0..89a59cd 100644 > --- a/ocaml/Makefile.am > +++ b/ocaml/Makefile.am > @@ -64,7 +64,8 @@ TESTS = \ > noinst_DATA += $(TESTS) > > # https://www.redhat.com/archives/libguestfs/2011-May/thread.html#00015 > -t/%: t/%.cmo mlhivex.cma > +t/%: $(srcdir)/t/%.cmo mlhivex.cma > + mkdir -p t > $(LIBTOOL) --mode=execute -dlopen $(top_builddir)/lib/libhivex.la \ > $(OCAMLFIND) ocamlc -dllpath $(abs_builddir) -package unix \ > -linkpkg mlhivex.cma $< -o $@ > diff --git a/ocaml/t/hivex_300_fold.ml b/ocaml/t/hivex_300_fold.ml > index 0c7bc4f..c8de6e8 100644 > --- a/ocaml/t/hivex_300_fold.ml > +++ b/ocaml/t/hivex_300_fold.ml > @@ -21,7 +21,6 @@ > open Unix > open Printf > let (//) = Filename.concat > -let srcdir = try Sys.getenv "srcdir" with Not_found -> "." > > (* This is a generic function to fold over hives. > * fn : 'a -> node -> 'a is called for each node > @@ -36,7 +35,7 @@ let hive_fold h fn fv a root > fold a root > > let () > - let h = Hivex.open_file (srcdir // "../images/large") [] in > + let h = Hivex.open_file ("../images/large") [] in > > (* Count the number of nodes and values in the hive. *) > let count_node (nodes, values) _ = (nodes+1, values) in > diff --git a/python/run-python-tests b/python/run-python-tests > deleted file mode 100755 > index e8c8c14..0000000 > --- a/python/run-python-tests > +++ /dev/null > @@ -1,25 +0,0 @@ > -#!/bin/bash - > -# hivex Python bindings > -# Copyright (C) 2009-2011 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., 675 Mass Ave, Cambridge, MA 02139, USA. > - > -set -e > -shopt -s nullglob > - > -for f in t/*.py; do > - basename "$f" > - python "$f" > -done > diff --git a/python/run-python-tests.in b/python/run-python-tests.in > new file mode 100755 > index 0000000..af51080 > --- /dev/null > +++ b/python/run-python-tests.in > @@ -0,0 +1,25 @@ > +#!/bin/bash - > +# hivex Python bindings > +# Copyright (C) 2009-2011 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., 675 Mass Ave, Cambridge, MA 02139, USA. > + > +set -e > +shopt -s nullglob > + > +for f in $(srcdir)t/*.py; do > + basename "$f" > + @PYTHON@ "$f" > +done > -- > 1.7.5.4Thanks. I will push this shortly. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://et.redhat.com/~rjones/virt-df/
Apparently Analagous Threads
- [PATCH] Don't rely on OCaml native compiler for tests
- [PATCH hivex] ocaml: Link the C bindings with LDFLAGS (RHBZ#1548536).
- [PATCH 1/2] hivex: Use OCaml bytecode compiler for caml_raise_with_args check
- [PATCH 1/3] hivex: Use OCaml bytecode compiler for caml_raise_with_args check
- [hivex] [PATCH 4/8] ocaml: Add unit test for new RLenValue type