diff options
author | Mark Wielaard <mark@klomp.org> | 2020-06-19 19:41:08 +0200 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2020-07-04 01:30:07 +0200 |
commit | f7f0cdc59a13780938ae3f578955737a75e60ea9 (patch) | |
tree | 415eb0c97ee82aaa4a178ef248bf89b2130f7c9c /debuginfod | |
parent | acb453851c9e6c46531b70fda7396885c0e7e1db (diff) | |
download | elfutils-f7f0cdc59a13780938ae3f578955737a75e60ea9.tar.gz |
debuginfod: Add --disable-libdebuginfod and --enable-libdebuginfod=dummy.
Make it possible to build just the debuginfod client or to create a
dummy libdebuginfod that doesn't link against libcurl. The dummy library
can be used for bootstrapping. For testing purposes you can also build
debuginfod against the dummy libdebuginfod but then the debuginfod
server will not be able to do delegation.
Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'debuginfod')
-rw-r--r-- | debuginfod/ChangeLog | 17 | ||||
-rw-r--r-- | debuginfod/Makefile.am | 32 | ||||
-rw-r--r-- | debuginfod/debuginfod-client.c | 28 |
3 files changed, 73 insertions, 4 deletions
diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog index 2bbd5db5..372173e7 100644 --- a/debuginfod/ChangeLog +++ b/debuginfod/ChangeLog @@ -1,3 +1,20 @@ +2020-06-19 Mark Wielaard <mark@klomp.org> + + * Makefile.am (bin_PROGRAMS): Guard with DEBUGINFOD and + LIBDEBUGINFOD. + (debuginfod_LDADD): Remove libcurl. + (libdebuginfod): When static and DUMMY_LIBDEBUGINFO remove libcurl. + (noinst_LIBRARIES): Guard with LIBDEBUGINFOD. + (AM_CPPFLAGS): Add -Wno-unused-parameter when DUMMY_LIBDEBUGINFOD. + (pkginclude_headers): Guard with LIBDEBUGINFOD + (libdebuginfod_so_LIBS): Likewise. + (+libdebuginfod_so_LDLIBS): Likewise. + (install): Likewise. + (uninstall): Likewise. + * debuginfod-client.c: Include dummy functions when + DUMMY_LIBDEBUGINFOD. + * debuginfod.cxx: Remove curl.h include. + 2020-06-16 Mark Wielaard <mark@klomp.org> * debuginfod-client.c (debuginfod_query_server): Check malloc. diff --git a/debuginfod/Makefile.am b/debuginfod/Makefile.am index 51965f65..2e8a343c 100644 --- a/debuginfod/Makefile.am +++ b/debuginfod/Makefile.am @@ -45,8 +45,12 @@ if BUILD_STATIC libasm = ../libasm/libasm.a libdw = ../libdw/libdw.a -lz $(zip_LIBS) $(libelf) $(libebl) -ldl -lpthread libelf = ../libelf/libelf.a -lz +if DUMMY_LIBDEBUGINFOD libdebuginfod = ./libdebuginfod.a $(libcurl_LIBS) else +libdebuginfod = ./libdebuginfod.a +endif +else libasm = ../libasm/libasm.so libdw = ../libdw/libdw.so libelf = ../libelf/libelf.so @@ -57,24 +61,45 @@ libeu = ../lib/libeu.a AM_LDFLAGS = -Wl,-rpath-link,../libelf:../libdw:. -bin_PROGRAMS = debuginfod debuginfod-find +bin_PROGRAMS = +if DEBUGINFOD +bin_PROGRAMS += debuginfod +endif + +if LIBDEBUGINFOD +bin_PROGRAMS += debuginfod-find +endif + debuginfod_SOURCES = debuginfod.cxx -debuginfod_LDADD = $(libdw) $(libelf) $(libeu) $(libdebuginfod) $(libmicrohttpd_LIBS) $(libcurl_LIBS) $(sqlite3_LIBS) $(libarchive_LIBS) -lpthread -ldl +debuginfod_LDADD = $(libdw) $(libelf) $(libeu) $(libdebuginfod) $(libmicrohttpd_LIBS) $(sqlite3_LIBS) $(libarchive_LIBS) -lpthread -ldl debuginfod_find_SOURCES = debuginfod-find.c debuginfod_find_LDADD = $(libdw) $(libelf) $(libeu) $(libdebuginfod) +if LIBDEBUGINFOD noinst_LIBRARIES = libdebuginfod.a noinst_LIBRARIES += libdebuginfod_pic.a +endif libdebuginfod_a_SOURCES = debuginfod-client.c libdebuginfod_pic_a_SOURCES = debuginfod-client.c am_libdebuginfod_pic_a_OBJECTS = $(libdebuginfod_a_SOURCES:.c=.os) +if DUMMY_LIBDEBUGINFOD +AM_CPPFLAGS += -Wno-unused-parameter +endif + +if LIBDEBUGINFOD pkginclude_HEADERS = debuginfod.h +endif +if LIBDEBUGINFOD libdebuginfod_so_LIBS = libdebuginfod_pic.a +if DUMMY_LIBDEBUGINFOD +libdebuginfod_so_LDLIBS = +else libdebuginfod_so_LDLIBS = $(libcurl_LIBS) +endif libdebuginfod.so$(EXEEXT): $(srcdir)/libdebuginfod.map $(libdebuginfod_so_LIBS) $(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \ -Wl,--soname,$@.$(VERSION) \ @@ -83,7 +108,9 @@ libdebuginfod.so$(EXEEXT): $(srcdir)/libdebuginfod.map $(libdebuginfod_so_LIBS) $(libdebuginfod_so_LDLIBS) @$(textrel_check) $(AM_V_at)ln -fs $@ $@.$(VERSION) +endif +if LIBDEBUGINFOD install: install-am libdebuginfod.so $(mkinstalldirs) $(DESTDIR)$(libdir) $(INSTALL_PROGRAM) libdebuginfod.so $(DESTDIR)$(libdir)/libdebuginfod-$(PACKAGE_VERSION).so @@ -95,6 +122,7 @@ uninstall: uninstall-am rm -f $(DESTDIR)$(libdir)/libdebuginfod.so.$(VERSION) rm -f $(DESTDIR)$(libdir)/libdebuginfod.so rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils +endif EXTRA_DIST = libdebuginfod.map MOSTLYCLEANFILES = $(am_libdebuginfod_pic_a_OBJECTS) libdebuginfod.so.$(VERSION) diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c index c2aa4e10..c2e43f74 100644 --- a/debuginfod/debuginfod-client.c +++ b/debuginfod/debuginfod-client.c @@ -41,13 +41,35 @@ #include "config.h" #include "debuginfod.h" #include "system.h" +#include <errno.h> +#include <stdlib.h> + +/* We might be building a bootstrap dummy library, which is really simple. */ +#ifdef DUMMY_LIBDEBUGINFOD + +debuginfod_client *debuginfod_begin (void) { errno = ENOSYS; return NULL; } +int debuginfod_find_debuginfo (debuginfod_client *c, const unsigned char *b, + int s, char **p) { return -ENOSYS; } +int debuginfod_find_executable (debuginfod_client *c, const unsigned char *b, + int s, char **p) { return -ENOSYS; } +int debuginfod_find_source (debuginfod_client *c, const unsigned char *b, + int s, const char *f, char **p) { return -ENOSYS; } +void debuginfod_set_progressfn(debuginfod_client *c, + debuginfod_progressfn_t fn) { } +void debuginfod_set_user_data (debuginfod_client *c, void *d) { } +void* debuginfod_get_user_data (debuginfod_client *c) { return NULL; } +const char* debuginfod_get_url (debuginfod_client *c) { return NULL; } +int debuginfod_add_http_header (debuginfod_client *c, + const char *h) { return -ENOSYS; } +void debuginfod_end (debuginfod_client *c) { } + +#else /* DUMMY_LIBDEBUGINFOD */ + #include <assert.h> #include <dirent.h> #include <stdio.h> -#include <stdlib.h> #include <errno.h> #include <unistd.h> -#include <errno.h> #include <fcntl.h> #include <fts.h> #include <regex.h> @@ -1090,3 +1112,5 @@ __attribute__((destructor)) attribute_hidden void libdebuginfod_dtor(void) /* ... so don't do this: */ /* curl_global_cleanup(); */ } + +#endif /* DUMMY_LIBDEBUGINFOD */ |