mirror of
git://sourceware.org/git/libabigail.git
synced 2025-03-05 14:18:11 +00:00
Make zip archive support optional
* configure.ac: Support a new --enable-zip-archive option. By default its value is set to the 'auto', meaning that if libzip is installed, that turns the option on -- just like if --enable-zip-archive was called with the value 'yes'; if libzip is not installed, that turns the option off -- just like if --enable-zip-archive was called with the value 'no'. If libzip is detected, the pre-processor macro HAVE_LIBZIP is set to 1. If --enable-zip-archive is turned on, the pre-processor macro WITH_ZIP_ARCHIVE is set to 1. * config.h.in (HAVE_LIBZIP, WITH_ZIP): New define. * src/abg-corpus.cc: Include config.h. Guard the inclusion of abg-libzip-utils.h with the WITH_ZIP_ARCHIVE macro. Likewise for the use of declarations coming from abg-libzip-utils.h. * src/abg-libzip-utils.cc: Include config.h. Guard the file's content with the WITH_ZIP_ARCHIVE macro. * src/abg-reader.cc: Include config.h. Guard the inclusion of abg-libzip-utils.h with the WITH_ZIP_ARCHIVE. Likewise for the use of declarations coming from abg-libzip-utils.h. * src/abg-writer.cc: Likewise. * tests/Makefile.am: Build runtestwritereadarchive and runtestdot only if zip archives are supported. * tools/Makefile.am: The biar program is built only if zip archives are supported. * tools/bidiff.cc: Handle zip archives only if the WITH_ZIP_ARCHIVE macros is defined. * tools/bilint.cc: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
parent
89564d516a
commit
36ed6e0583
@ -6,6 +6,9 @@
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Defined to 1 if the libzip library is available */
|
||||
#undef HAVE_LIBZIP
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
@ -83,6 +86,9 @@
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* compile the zip archive support */
|
||||
#undef WITH_ZIP_ARCHIVE
|
||||
|
||||
/* Define to 1 if on MINIX. */
|
||||
#undef _MINIX
|
||||
|
||||
|
50
configure.ac
50
configure.ac
@ -26,6 +26,14 @@ AC_SUBST(VERSION_MAJOR)
|
||||
AC_SUBST(VERSION_MINOR)
|
||||
AC_SUBST(VERSION_REVISION)
|
||||
|
||||
ENABLE_ZIP_ARCHIVE=auto
|
||||
AC_ARG_ENABLE(zip-archive,
|
||||
AS_HELP_STRING([--enable-zip-archive=yes|no|auto],
|
||||
[enable bundling of TUs in zip archives (default is auto)]),
|
||||
ENABLE_ZIP_ARCHIVE=$enableval,
|
||||
ENABLE_ZIP_ARCHIVE=auto)
|
||||
|
||||
|
||||
dnl *************************************************
|
||||
dnl Here is the list of versions of the dependencies
|
||||
dnl *************************************************
|
||||
@ -63,12 +71,46 @@ AC_SUBST(XML_CFLAGS)
|
||||
|
||||
dnl Check for dependency: libzip
|
||||
LIBZIP_VERSION=0.10
|
||||
PKG_CHECK_MODULES(LIBZIP, libzip >= $LIBZIP_VERSION)
|
||||
|
||||
AC_SUBST(LIBZIP_VERSION)
|
||||
AC_SUBST(LIBZIP_LIBS)
|
||||
AC_SUBST(LIBZIP_CFLAGS)
|
||||
HAS_LIBZIP=no
|
||||
# The below doesn't seem to work on my box for a reason. Let's write
|
||||
# the damn thing by hand:
|
||||
# PKG_CHECK_EXISTS([libzip >= $LIBZIP_VERSION], [HAS_LIBZIP=yes], [HAS_LIBZIP=no])
|
||||
|
||||
if $PKG_CONFIG --exists --print-errors "libzip >= $LIBZIP_VERSION"; then
|
||||
AC_MSG_NOTICE(found libzip version $LIBZIP_VERSION)
|
||||
HAS_LIBZIP=yes
|
||||
else
|
||||
AC_MSG_NOTICE(no libzip >= $LIBZIP_VERSION has been found)
|
||||
HAS_LIBZIP=no
|
||||
fi
|
||||
|
||||
if test x$ENABLE_ZIP_ARCHIVE = xauto; then
|
||||
if test x$HAS_LIBZIP = xyes; then
|
||||
ENABLE_ZIP_ARCHIVE=yes;
|
||||
else
|
||||
ENABLE_ZIP_ARCHIVE=no
|
||||
fi
|
||||
fi
|
||||
|
||||
if test x$ENABLE_ZIP_ARCHIVE = xyes; then
|
||||
AC_MSG_NOTICE(the zip-archive feature is enabled)
|
||||
else
|
||||
AC_MSG_NOTICE(the zip-archive feature is disabled)
|
||||
fi
|
||||
|
||||
FOUND_LIBZIP=no
|
||||
if test x$ENABLE_ZIP_ARCHIVE = xyes; then
|
||||
PKG_CHECK_MODULES(LIBZIP, libzip >= $LIBZIP_VERSION)
|
||||
FOUND_LIBZIP=yes
|
||||
AC_SUBST(LIBZIP_VERSION)
|
||||
AC_SUBST(LIBZIP_LIBS)
|
||||
AC_SUBST(LIBZIP_CFLAGS)
|
||||
AC_DEFINE([WITH_ZIP_ARCHIVE], 1, [compile the zip archive support])
|
||||
AC_DEFINE([HAVE_LIBZIP], 1, [Defined to 1 if the libzip library is available])
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(ENABLE_ZIP_ARCHIVE, test x$ENABLE_ZIP_ARCHIVE = xyes)
|
||||
DEPS_CPPFLAGS="$XML_CFLAGS $LIBZIP_CFLAGS"
|
||||
AC_SUBST(DEPS_CPPFLAGS)
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
/// @file
|
||||
|
||||
#include "config.h"
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <cassert>
|
||||
@ -32,7 +33,10 @@
|
||||
#include "abg-corpus.h"
|
||||
#include "abg-reader.h"
|
||||
#include "abg-writer.h"
|
||||
|
||||
#if WITH_ZIP_ARCHIVE
|
||||
#include "abg-libzip-utils.h"
|
||||
#endif
|
||||
|
||||
namespace abigail
|
||||
{
|
||||
@ -74,10 +78,14 @@ using std::ostringstream;
|
||||
using std::tr1::unordered_map;
|
||||
using std::list;
|
||||
using std::vector;
|
||||
|
||||
#if WITH_ZIP_ARCHIVE
|
||||
using zip_utils::zip_sptr;
|
||||
using zip_utils::zip_file_sptr;
|
||||
using zip_utils::open_archive;
|
||||
using zip_utils::open_file_in_archive;
|
||||
#endif // WITH_ZIP_ARCHIVE
|
||||
|
||||
using sptr_utils::regex_t_sptr;
|
||||
|
||||
struct corpus::priv
|
||||
|
@ -20,6 +20,9 @@
|
||||
|
||||
/// @file
|
||||
|
||||
#include "config.h"
|
||||
#ifdef WITH_ZIP_ARCHIVE
|
||||
|
||||
#include <string>
|
||||
#include "abg-libzip-utils.h"
|
||||
|
||||
@ -71,3 +74,5 @@ open_file_in_archive(zip_sptr archive,
|
||||
|
||||
}// end namespace zip
|
||||
}// end namespace abigail
|
||||
|
||||
#endif //WITH_ZIP_ARCHIVE
|
||||
|
@ -24,6 +24,7 @@
|
||||
/// de-serialize an instance of @ref abigail::translation_unit from an
|
||||
/// ABI Instrumentation file in libabigail native XML format.
|
||||
|
||||
#include "config.h"
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
#include <tr1/unordered_map>
|
||||
@ -34,7 +35,10 @@
|
||||
#include <libxml/xmlreader.h>
|
||||
#include "abg-libxml-utils.h"
|
||||
#include "abg-corpus.h"
|
||||
|
||||
#ifdef WITH_ZIP_ARCHIVE
|
||||
#include "abg-libzip-utils.h"
|
||||
#endif
|
||||
|
||||
namespace abigail
|
||||
{
|
||||
@ -50,11 +54,12 @@ using std::tr1::unordered_map;
|
||||
using std::tr1::dynamic_pointer_cast;
|
||||
using std::vector;
|
||||
using std::istream;
|
||||
#ifdef WITH_ZIP_ARCHIVE
|
||||
using zip_utils::zip_sptr;
|
||||
using zip_utils::zip_file_sptr;
|
||||
using zip_utils::open_archive;
|
||||
using zip_utils::open_file_in_archive;
|
||||
|
||||
#endif //WITH_ZIP_ARCHIVE
|
||||
class read_context;
|
||||
|
||||
/// This abstracts the context in which the current ABI
|
||||
@ -3546,6 +3551,7 @@ struct array_deleter
|
||||
}
|
||||
};//end array_deleter
|
||||
|
||||
#ifdef WITH_ZIP_ARCHIVE
|
||||
/// Deserialize an ABI Instrumentation XML file at a given index in a
|
||||
/// zip archive, and populate a given @ref translation_unit object
|
||||
/// with the result of that de-serialization.
|
||||
@ -3691,6 +3697,8 @@ read_corpus_from_file(const string& path)
|
||||
return corp;
|
||||
}
|
||||
|
||||
#endif //WITH_ZIP_ARCHIVE
|
||||
|
||||
/// De-serialize an ABI corpus from an input XML document which root
|
||||
/// node is 'abi-corpus'.
|
||||
///
|
||||
|
@ -24,6 +24,7 @@
|
||||
/// de-serialize an instance of @ref abigail::translation_unit to an
|
||||
/// ABI Instrumentation file in libabigail native XML format.
|
||||
|
||||
#include "config.h"
|
||||
#include <assert.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
@ -32,7 +33,11 @@
|
||||
#include <tr1/unordered_map>
|
||||
#include "abg-config.h"
|
||||
#include "abg-corpus.h"
|
||||
|
||||
#if WITH_ZIP_ARCHIVE
|
||||
#include "abg-libzip-utils.h"
|
||||
#endif
|
||||
|
||||
#include "abg-writer.h"
|
||||
#include "abg-libxml-utils.h"
|
||||
|
||||
@ -49,10 +54,12 @@ using std::list;
|
||||
using std::vector;
|
||||
using std::tr1::unordered_map;
|
||||
|
||||
#if WITH_ZIP_ARCHIVE
|
||||
using zip_utils::zip_sptr;
|
||||
using zip_utils::zip_file_sptr;
|
||||
using zip_utils::open_archive;
|
||||
using zip_utils::open_file_in_archive;
|
||||
#endif // WITH_ZIP_ARCHIVE
|
||||
|
||||
/// Internal namespace for writer.
|
||||
namespace xml_writer
|
||||
@ -2224,6 +2231,9 @@ write_class_tdecl(const shared_ptr<class_tdecl> decl,
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef WITH_ZIP_ARCHIVE
|
||||
|
||||
/// A context used by functions that write a corpus out to disk in a
|
||||
/// ZIP archive of ABI Instrumentation XML files.
|
||||
///
|
||||
@ -2405,6 +2415,8 @@ bool
|
||||
write_corpus_to_archive(const corpus_sptr corp)
|
||||
{return write_corpus_to_archive(*corp);}
|
||||
|
||||
#endif //WITH_ZIP_ARCHIVE
|
||||
|
||||
/// Serialize an ABI corpus to a single native xml document. The root
|
||||
/// note of the resulting XML document is 'abi-corpus'.
|
||||
///
|
||||
|
@ -2,9 +2,15 @@ AUTOMAKE_OPTIONS=subdir-objects
|
||||
|
||||
h=$(abs_srcdir)
|
||||
|
||||
if ENABLE_ZIP_ARCHIVE
|
||||
ZIP_ARCHIVE_TESTS = runtestwritereadarchive runtestdot
|
||||
else
|
||||
ZIP_ARCHIVE_TESTS =
|
||||
endif
|
||||
|
||||
TESTS= \
|
||||
runtestreadwrite \
|
||||
runtestwritereadarchive \
|
||||
${ZIP_ARCHIVE_TESTS} \
|
||||
runtestreaddwarf \
|
||||
runtestlookupsyms \
|
||||
runtestaltdwarf \
|
||||
@ -12,8 +18,8 @@ runtestcorediff \
|
||||
runtestbidiff \
|
||||
runtestdiffdwarf \
|
||||
runtestdifffilter \
|
||||
runtestsvg \
|
||||
runtestdot
|
||||
runtestsvg
|
||||
|
||||
|
||||
noinst_PROGRAMS= $(TESTS) testirwalker testdiff2
|
||||
|
||||
|
@ -7,12 +7,19 @@ libtoolsutils_la_SOURCES= \
|
||||
abg-tools-utils.h \
|
||||
abg-tools-utils.cc
|
||||
|
||||
bin_PROGRAMS = biar bidiff bilint bidw bisym
|
||||
if ENABLE_ZIP_ARCHIVE
|
||||
bin_PROGRAMS = biar bidiff bilint bidw bisym
|
||||
else
|
||||
bin_PROGRAMS = bidiff bilint bidw bisym
|
||||
endif
|
||||
|
||||
|
||||
if ENABLE_ZIP_ARCHIVE
|
||||
biar_SOURCES = biar.cc
|
||||
biardir = $(bindir)
|
||||
biar_LDFLAGS = $(abs_top_builddir)/src/libabigail.la $(abs_top_builddir)/tools/libtoolsutils.la
|
||||
biar_DEPENDENCIES = libtoolsutils.la
|
||||
endif
|
||||
|
||||
bidiff_SOURCES = bidiff.cc
|
||||
bidiffdir = $(bindir)
|
||||
|
@ -485,7 +485,9 @@ main(int argc, char* argv[])
|
||||
abigail::xml_reader::read_corpus_from_native_xml_file(opts.file1);
|
||||
break;
|
||||
case abigail::tools::FILE_TYPE_ZIP_CORPUS:
|
||||
#ifdef WITH_ZIP_ARCHIVE
|
||||
c1 = abigail::xml_reader::read_corpus_from_file(opts.file1);
|
||||
#endif //WITH_ZIP_ARCHIVE
|
||||
break;
|
||||
}
|
||||
|
||||
@ -509,7 +511,9 @@ main(int argc, char* argv[])
|
||||
abigail::xml_reader::read_corpus_from_native_xml_file(opts.file2);
|
||||
break;
|
||||
case abigail::tools::FILE_TYPE_ZIP_CORPUS:
|
||||
#ifdef WITH_ZIP_ARCHIVE
|
||||
c2 = abigail::xml_reader::read_corpus_from_file(opts.file2);
|
||||
#endif //WITH_ZIP_ARCHIVE
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,9 @@ main(int argc, char* argv[])
|
||||
corp = read_corpus_from_native_xml_file(opts.file_path);
|
||||
break;
|
||||
case abigail::tools::FILE_TYPE_ZIP_CORPUS:
|
||||
#if WITH_ZIP_ARCHIVE
|
||||
corp = read_corpus_from_file(opts.file_path);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
@ -286,8 +288,10 @@ main(int argc, char* argv[])
|
||||
}
|
||||
else if (type == abigail::tools::FILE_TYPE_ZIP_CORPUS)
|
||||
{
|
||||
#ifdef WITH_ZIP_ARCHIVE
|
||||
if (!opts.noout)
|
||||
r = write_corpus_to_archive(*corp, ofile_name);
|
||||
#endif //WITH_ZIP_ARCHIVE
|
||||
of.close();
|
||||
}
|
||||
else if (type == abigail::tools::FILE_TYPE_ELF)
|
||||
|
Loading…
Reference in New Issue
Block a user