Hilko Bengen
2013-Feb-18 21:43 UTC
[Libguestfs] Some fixes for building the Debian package for 1.20.2
I needed to add a few patches to be able to build libguestfs 1.20.2 out of tree. Mostly srcdir/builddir issues -- I think that I had posted something for building the daemon before. As mentioned on IRC, I found that compiling (Ruby bindings) caused config.h file shipped with the Ruby headers to be included rather than ${builddir}/config.h. This can be fixed because the relevant checks can be performed in the extconf.rb script as well. Cheers, -Hilko
CC guestfsd-9p.o In file included from ../../../daemon/9p.c:32:0: ../../../daemon/daemon.h:33:34: fatal error: guestfs-internal-all.h: No such file or directory --- daemon/Makefile.am | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/daemon/Makefile.am b/daemon/Makefile.am index a57b7f3..99259a6 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -19,8 +19,6 @@ include $(top_srcdir)/subdir-rules.mk CLEANFILES = stamp-guestfsd.pod -libsrcdir = $(top_builddir)/src - generator_built = \ actions.h \ stubs.c \ @@ -42,7 +40,7 @@ EXTRA_DIST = \ $(BUILT_SOURCES) \ guestfsd.pod -$(shared_with_library): %: $(libsrcdir)/% +$(shared_with_library): %: $(top_srcdir)/src/% rm -f $@ ln $< $@ @@ -53,10 +51,10 @@ noinst_LIBRARIES = libprotocol.a libprotocol_a_SOURCES = guestfs_protocol.c guestfs_protocol.h libprotocol_a_CFLAGS = -Wall -Wno-unused -fno-strict-aliasing -$(libsrcdir)/guestfs_protocol.c: force - $(MAKE) -C $(libsrcdir) guestfs_protocol.c -$(libsrcdir)/guestfs_protocol.h: force - $(MAKE) -C $(libsrcdir) guestfs_protocol.h +$(top_builddir)/src/guestfs_protocol.c: force + $(MAKE) -C $(top_builddir)/src guestfs_protocol.c +$(top_builddir)/src/guestfs_protocol.h: force + $(MAKE) -C $(top_builddir)/src guestfs_protocol.h # Build the errnostring perfect hash code. The generated code has lots # of warnings so we must compile it in a separate mini-library. @@ -197,6 +195,7 @@ guestfsd_LDADD = \ guestfsd_CPPFLAGS = \ -I$(top_srcdir)/gnulib/lib \ -I$(top_builddir)/gnulib/lib \ + -I$(top_srcdir)/src \ -I$(top_builddir)/src guestfsd_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ -- 1.7.10.4
Hilko Bengen
2013-Feb-18 21:43 UTC
[Libguestfs] [PATCH 2/4] out-of-tree build: fix test-tool
(Not entirely sure whether using Gnulib to replace standard functions is a good idea at all.) link with libgnu: CCLD libguestfs-test-tool libguestfs_test_tool-test-tool.o: In function `main': /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:103: undefined reference to `rpl_getopt_long' /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:113: undefined reference to `rpl_optarg' /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:125: undefined reference to `rpl_optarg' /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:126: undefined reference to `rpl_optarg' /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:109: undefined reference to `rpl_optarg' libguestfs_test_tool-test-tool.o: In function `set_qemu': /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:382: undefined reference to `rpl_perror' /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:366: undefined reference to `rpl_perror' libguestfs_test_tool-test-tool.o: In function `make_files': /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:416: undefined reference to `rpl_perror' /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/test-tool/../../../test-tool/test-tool.c:428: undefined reference to `rpl_perror' --- test-tool/Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test-tool/Makefile.am b/test-tool/Makefile.am index 200f2cb..bb2e03c 100644 --- a/test-tool/Makefile.am +++ b/test-tool/Makefile.am @@ -37,7 +37,8 @@ libguestfs_test_tool_CFLAGS = \ $(GPROF_CFLAGS) $(GCOV_CFLAGS) libguestfs_test_tool_LDADD = \ - $(top_builddir)/src/libguestfs.la + $(top_builddir)/src/libguestfs.la \ + $(top_builddir)/gnulib/lib/libgnu.la libguestfs-test-tool.1 $(top_builddir)/html/libguestfs-test-tool.1.html: stamp-libguestfs-test-tool.pod -- 1.7.10.4
Hilko Bengen
2013-Feb-18 21:43 UTC
[Libguestfs] [PATCH 3/4] ruby: remove non-template extconf.rb; don't compile with -Werror.
Otherwise, _guestfs.c can't be compiled due to many strict-prototype warnings turned into errors: compiling /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-default/../.. /ruby/ext/guestfs/_guestfs.c In file included from /usr/include/ruby-1.9.1/ruby.h:32:0, from /home/bengen/src/deb/pkg-libvirt/libguestfs/debian/build-d efault/../../ruby/ext/guestfs/_guestfs.c:29: /usr/include/ruby-1.9.1/ruby/ruby.h:1093:1: error: function declaration isn?t a prototype [-Werror=strict-prototypes] [...] --- ruby/Makefile.am | 1 - ruby/ext/guestfs/extconf.rb.in | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/ruby/Makefile.am b/ruby/Makefile.am index 5b755e5..2ecb6a8 100644 --- a/ruby/Makefile.am +++ b/ruby/Makefile.am @@ -29,7 +29,6 @@ EXTRA_DIST = \ Rakefile.in \ README.rdoc \ doc/site/index.html \ - ext/guestfs/extconf.rb \ lib/guestfs.rb \ run-bindtests \ run-ruby-tests \ diff --git a/ruby/ext/guestfs/extconf.rb.in b/ruby/ext/guestfs/extconf.rb.in index e358551..c638a85 100644 --- a/ruby/ext/guestfs/extconf.rb.in +++ b/ruby/ext/guestfs/extconf.rb.in @@ -31,7 +31,7 @@ end $CFLAGS "#{$CFLAGS} @CFLAGS@ -DGUESTFS_PRIVATE=1 " << - "@WARN_CFLAGS@ @WERROR_CFLAGS@" + "@WARN_CFLAGS@" create_header -create_makefile(extension_name) +create_makefile(extension_name, "@abs_srcdir@") -- 1.7.10.4
Hilko Bengen
2013-Feb-18 21:43 UTC
[Libguestfs] [PATCH 4/4] ruby: Move checks from autoconf to mkmf; add extra check for rb_alloc_func_t
--- configure.ac | 8 -------- generator/ruby.ml | 5 +++-- ruby/ext/guestfs/extconf.rb.in | 4 ++++ 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index 5129f4f..4c06d32 100644 --- a/configure.ac +++ b/configure.ac @@ -1143,14 +1143,6 @@ AS_IF([test "x$enable_ruby" != "xno"],[ AC_MSG_RESULT([-l$libruby]) AC_CHECK_LIB([$libruby],[ruby_init], [have_libruby=1],[have_libruby=]) - - dnl Symbols that we substitute when missing. - AS_IF([test -n "$have_libruby"],[ - old_LIBS="$LIBS" - LIBS="$LIBS -l$libruby" - AC_CHECK_FUNCS([rb_hash_lookup]) - LIBS="$old_LIBS" - ]) ],[ AC_MSG_RESULT([not found]) ]) diff --git a/generator/ruby.ml b/generator/ruby.ml index 4f2c60b..2b15d8c 100644 --- a/generator/ruby.ml +++ b/generator/ruby.ml @@ -35,8 +35,6 @@ let rec generate_ruby_c () generate_header CStyle LGPLv2plus; pr "\ -#include <config.h> - #include <stdio.h> #include <stdlib.h> #include <stdint.h> @@ -693,6 +691,9 @@ Init__guestfs (void) e_Error = rb_define_class_under (m_guestfs, \"Error\", rb_eStandardError); #ifdef HAVE_RB_DEFINE_ALLOC_FUNC +#ifndef HAVE_TYPE_RB_ALLOC_FUNC_T +#define rb_alloc_func_t void* +#endif rb_define_alloc_func (c_guestfs, (rb_alloc_func_t) ruby_guestfs_create); #endif diff --git a/ruby/ext/guestfs/extconf.rb.in b/ruby/ext/guestfs/extconf.rb.in index c638a85..afd76ba 100644 --- a/ruby/ext/guestfs/extconf.rb.in +++ b/ruby/ext/guestfs/extconf.rb.in @@ -33,5 +33,9 @@ $CFLAGS "#{$CFLAGS} @CFLAGS@ -DGUESTFS_PRIVATE=1 " << "@WARN_CFLAGS@" +have_func("rb_hash_lookup") +have_func("rb_define_alloc_func") +have_type("rb_alloc_func_t") + create_header create_makefile(extension_name, "@abs_srcdir@") -- 1.7.10.4