View | Details | Raw Unified | Return to bug 25509
Collapse All | Expand All

(-)a/ChangeLog (+6 lines)
Lines 1-3 Link Here
1
2020-06-19  Mark Wielaard  <mark@klomp.org>
2
3
	* Makefile.am (SUBDIRS): Always add debuginfod.
4
	* configure.ac (debuginfod): Split off...
5
	(libdebuginfod): ... this. Also add DUMME_DEBUGINFOD.
6
1
2020-06-15  Sergei Trofimovich <slyfox@gentoo.org>
7
2020-06-15  Sergei Trofimovich <slyfox@gentoo.org>
2
8
3
	* configure.ac: Use READELF in build-id check.
9
	* configure.ac: Use READELF in build-id check.
(-)a/Makefile.am (-5 / +1 lines)
Lines 27-37 AM_MAKEFLAGS = --no-print-directory Link Here
27
pkginclude_HEADERS = version.h
27
pkginclude_HEADERS = version.h
28
28
29
SUBDIRS = config m4 lib libelf libcpu backends libebl libdwelf libdwfl libdw \
29
SUBDIRS = config m4 lib libelf libcpu backends libebl libdwelf libdwfl libdw \
30
	  libasm src po doc tests
30
	  libasm debuginfod src po doc tests
31
32
if DEBUGINFOD
33
SUBDIRS += debuginfod
34
endif
35
31
36
EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING \
32
EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING \
37
	     COPYING COPYING-GPLV2 COPYING-LGPLV3
33
	     COPYING COPYING-GPLV2 COPYING-LGPLV3
(-)a/configure.ac (-6 / +28 lines)
Lines 676-694 if test "$HAVE_BUNZIP2" = "no"; then Link Here
676
  AC_MSG_WARN([No bunzip2, needed to run make check])
676
  AC_MSG_WARN([No bunzip2, needed to run make check])
677
fi
677
fi
678
678
679
# Look for libmicrohttpd, libcurl, libarchive, sqlite for debuginfo server
679
# Look for libcurl for libdebuginfod minimum version as per rhel7.
680
# minimum versions as per rhel7.  Single --enable-* option arranges to build
680
AC_ARG_ENABLE([libdebuginfod],AC_HELP_STRING([--enable-libdebuginfod], [Build debuginfod client library (can be =dummy)]))
681
# both client and server.
681
AS_IF([test "x$enable_libdebuginfod" != "xno"], [
682
AC_ARG_ENABLE([debuginfod],AC_HELP_STRING([--enable-debuginfod], [Build debuginfod server and client]))
682
    if test "x$enable_libdebuginfod" != "xdummy"; then
683
      AC_MSG_NOTICE([checking libdebuginfod dependencies, --disable-libdebuginfod or --enable-libdebuginfo=dummy to skip])
684
      enable_libdebuginfod=yes # presume success
685
      PKG_PROG_PKG_CONFIG
686
      PKG_CHECK_MODULES([libcurl],[libcurl >= 7.29.0],[],[enable_libdebuginfod=no])
687
      if test "x$enable_libdebuginfod" = "xno"; then
688
        AC_MSG_ERROR([dependencies not found, use --disable-libdebuginfod to disable or --enable-libdebuginfod=dummy to build a (bootstrap) dummy library.])
689
      fi
690
    else
691
      AC_MSG_NOTICE([building (bootstrap) dummy libdebuginfo library])
692
    fi
693
])
694
695
AS_IF([test "x$enable_libdebuginfod" = "xdummy"],AC_DEFINE([DUMMY_LIBDEBUGINFOD],[1],[Build dummy libdebuginfod]))
696
AM_CONDITIONAL([LIBDEBUGINFOD],[test "x$enable_libdebuginfod" = "xyes" || test "x$enable_libdebuginfod" = "xdummy"])
697
AM_CONDITIONAL([DUMMY_LIBDEBUGINFOD],[test "x$enable_libdebuginfod" = "xdummy"])
698
699
# Look for libmicrohttpd, libarchive, sqlite for debuginfo server
700
# minimum versions as per rhel7.
701
AC_ARG_ENABLE([debuginfod],AC_HELP_STRING([--enable-debuginfod], [Build debuginfod server]))
683
AC_PROG_CXX
702
AC_PROG_CXX
684
AS_IF([test "x$enable_debuginfod" != "xno"], [
703
AS_IF([test "x$enable_debuginfod" != "xno"], [
685
    AC_MSG_NOTICE([checking debuginfod C++11 support, --disable-debuginfod to skip])
704
    AC_MSG_NOTICE([checking debuginfod C++11 support, --disable-debuginfod to skip])
686
    AX_CXX_COMPILE_STDCXX(11, noext, mandatory)
705
    AX_CXX_COMPILE_STDCXX(11, noext, mandatory)
687
    AC_MSG_NOTICE([checking debuginfod dependencies, --disable-debuginfod to skip])
706
    AC_MSG_NOTICE([checking debuginfod dependencies, --disable-debuginfod to skip])
707
    if test "x$enable_libdebuginfod" = "xno"; then
708
      AC_MSG_ERROR([need libdebuginfod (or dummy), use --disable-debuginfod to disable.])
709
    fi
688
    enable_debuginfod=yes # presume success
710
    enable_debuginfod=yes # presume success
689
    PKG_PROG_PKG_CONFIG
711
    PKG_PROG_PKG_CONFIG
690
    PKG_CHECK_MODULES([libmicrohttpd],[libmicrohttpd >= 0.9.33],[],[enable_debuginfod=no])
712
    PKG_CHECK_MODULES([libmicrohttpd],[libmicrohttpd >= 0.9.33],[],[enable_debuginfod=no])
691
    PKG_CHECK_MODULES([libcurl],[libcurl >= 7.29.0],[],[enable_debuginfod=no])
692
    PKG_CHECK_MODULES([sqlite3],[sqlite3 >= 3.7.17],[],[enable_debuginfod=no])
713
    PKG_CHECK_MODULES([sqlite3],[sqlite3 >= 3.7.17],[],[enable_debuginfod=no])
693
    PKG_CHECK_MODULES([libarchive],[libarchive >= 3.1.2],[],[enable_debuginfod=no])
714
    PKG_CHECK_MODULES([libarchive],[libarchive >= 3.1.2],[],[enable_debuginfod=no])
694
    if test "x$enable_debuginfod" = "xno"; then
715
    if test "x$enable_debuginfod" = "xno"; then
Lines 729-735 AC_MSG_NOTICE([ Link Here
729
    Deterministic archives by default  : ${default_ar_deterministic}
750
    Deterministic archives by default  : ${default_ar_deterministic}
730
    Native language support            : ${USE_NLS}
751
    Native language support            : ${USE_NLS}
731
    Extra Valgrind annotations         : ${use_vg_annotations}
752
    Extra Valgrind annotations         : ${use_vg_annotations}
732
    Debuginfod client/server support   : ${enable_debuginfod}
753
    libdebuginfod client support       : ${enable_libdebuginfod}
754
    Debuginfod server support          : ${enable_debuginfod}
733
755
734
  EXTRA TEST FEATURES (used with make check)
756
  EXTRA TEST FEATURES (used with make check)
735
    have bunzip2 installed (required)  : ${HAVE_BUNZIP2}
757
    have bunzip2 installed (required)  : ${HAVE_BUNZIP2}
(-)a/debuginfod/ChangeLog (+17 lines)
Lines 1-3 Link Here
1
2020-06-19  Mark Wielaard  <mark@klomp.org>
2
3
	* Makefile.am (bin_PROGRAMS): Guard with DEBUGINFOD and
4
	LIBDEBUGINFOD.
5
	(debuginfod_LDADD): Remove libcurl.
6
	(libdebuginfod): When static and DUMMY_LIBDEBUGINFO remove libcurl.
7
	(noinst_LIBRARIES): Guard with LIBDEBUGINFOD.
8
	(AM_CPPFLAGS): Add -Wno-unused-parameter when DUMMY_LIBDEBUGINFOD.
9
	(pkginclude_headers): Guard with LIBDEBUGINFOD
10
	(libdebuginfod_so_LIBS): Likewise.
11
	(+libdebuginfod_so_LDLIBS): Likewise.
12
	(install): Likewise.
13
	(uninstall): Likewise.
14
	* debuginfod-client.c: Include dummy functions when
15
	DUMMY_LIBDEBUGINFOD.
16
	* debuginfod.cxx: Remove curl.h include.
17
1
2020-03-29  Mark Wielaard  <mark@klomp.org>
18
2020-03-29  Mark Wielaard  <mark@klomp.org>
2
19
3
	* debuginfod-client.c (debuginfod_add_http_header): Check header
20
	* debuginfod-client.c (debuginfod_add_http_header): Check header
(-)a/debuginfod/Makefile.am (-2 / +30 lines)
Lines 45-52 if BUILD_STATIC Link Here
45
libasm = ../libasm/libasm.a
45
libasm = ../libasm/libasm.a
46
libdw = ../libdw/libdw.a -lz $(zip_LIBS) $(libelf) $(libebl) -ldl -lpthread
46
libdw = ../libdw/libdw.a -lz $(zip_LIBS) $(libelf) $(libebl) -ldl -lpthread
47
libelf = ../libelf/libelf.a -lz
47
libelf = ../libelf/libelf.a -lz
48
if DUMMY_LIBDEBUGINFOD
48
libdebuginfod = ./libdebuginfod.a $(libcurl_LIBS)
49
libdebuginfod = ./libdebuginfod.a $(libcurl_LIBS)
49
else
50
else
51
libdebuginfod = ./libdebuginfod.a
52
endif
53
else
50
libasm = ../libasm/libasm.so
54
libasm = ../libasm/libasm.so
51
libdw = ../libdw/libdw.so
55
libdw = ../libdw/libdw.so
52
libelf = ../libelf/libelf.so
56
libelf = ../libelf/libelf.so
Lines 57-80 libeu = ../lib/libeu.a Link Here
57
61
58
AM_LDFLAGS = -Wl,-rpath-link,../libelf:../libdw:.
62
AM_LDFLAGS = -Wl,-rpath-link,../libelf:../libdw:.
59
63
60
bin_PROGRAMS = debuginfod debuginfod-find
64
bin_PROGRAMS =
65
if DEBUGINFOD
66
bin_PROGRAMS += debuginfod
67
endif
68
69
if LIBDEBUGINFOD
70
bin_PROGRAMS += debuginfod-find
71
endif
72
61
debuginfod_SOURCES = debuginfod.cxx
73
debuginfod_SOURCES = debuginfod.cxx
62
debuginfod_LDADD = $(libdw) $(libelf) $(libeu) $(libdebuginfod) $(libmicrohttpd_LIBS) $(libcurl_LIBS) $(sqlite3_LIBS) $(libarchive_LIBS) -lpthread -ldl
74
debuginfod_LDADD = $(libdw) $(libelf) $(libeu) $(libdebuginfod) $(libmicrohttpd_LIBS) $(sqlite3_LIBS) $(libarchive_LIBS) -lpthread -ldl
63
75
64
debuginfod_find_SOURCES = debuginfod-find.c
76
debuginfod_find_SOURCES = debuginfod-find.c
65
debuginfod_find_LDADD = $(libdw) $(libelf) $(libeu) $(libdebuginfod)
77
debuginfod_find_LDADD = $(libdw) $(libelf) $(libeu) $(libdebuginfod)
66
78
79
if LIBDEBUGINFOD
67
noinst_LIBRARIES = libdebuginfod.a
80
noinst_LIBRARIES = libdebuginfod.a
68
noinst_LIBRARIES += libdebuginfod_pic.a
81
noinst_LIBRARIES += libdebuginfod_pic.a
82
endif
69
83
70
libdebuginfod_a_SOURCES = debuginfod-client.c
84
libdebuginfod_a_SOURCES = debuginfod-client.c
71
libdebuginfod_pic_a_SOURCES = debuginfod-client.c
85
libdebuginfod_pic_a_SOURCES = debuginfod-client.c
72
am_libdebuginfod_pic_a_OBJECTS = $(libdebuginfod_a_SOURCES:.c=.os)
86
am_libdebuginfod_pic_a_OBJECTS = $(libdebuginfod_a_SOURCES:.c=.os)
73
87
88
if DUMMY_LIBDEBUGINFOD
89
AM_CPPFLAGS += -Wno-unused-parameter
90
endif
91
92
if LIBDEBUGINFOD
74
pkginclude_HEADERS = debuginfod.h
93
pkginclude_HEADERS = debuginfod.h
94
endif
75
95
96
if LIBDEBUGINFOD
76
libdebuginfod_so_LIBS = libdebuginfod_pic.a
97
libdebuginfod_so_LIBS = libdebuginfod_pic.a
98
if DUMMY_LIBDEBUGINFOD
99
libdebuginfod_so_LDLIBS =
100
else
77
libdebuginfod_so_LDLIBS = $(libcurl_LIBS)
101
libdebuginfod_so_LDLIBS = $(libcurl_LIBS)
102
endif
78
libdebuginfod.so$(EXEEXT): $(srcdir)/libdebuginfod.map $(libdebuginfod_so_LIBS)
103
libdebuginfod.so$(EXEEXT): $(srcdir)/libdebuginfod.map $(libdebuginfod_so_LIBS)
79
	$(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \
104
	$(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \
80
		-Wl,--soname,$@.$(VERSION) \
105
		-Wl,--soname,$@.$(VERSION) \
Lines 83-89 libdebuginfod.so$(EXEEXT): $(srcdir)/libdebuginfod.map $(libdebuginfod_so_LIBS) Link Here
83
		$(libdebuginfod_so_LDLIBS)
108
		$(libdebuginfod_so_LDLIBS)
84
	@$(textrel_check)
109
	@$(textrel_check)
85
	$(AM_V_at)ln -fs $@ $@.$(VERSION)
110
	$(AM_V_at)ln -fs $@ $@.$(VERSION)
111
endif
86
112
113
if LIBDEBUGINFOD
87
install: install-am libdebuginfod.so
114
install: install-am libdebuginfod.so
88
	$(mkinstalldirs) $(DESTDIR)$(libdir)
115
	$(mkinstalldirs) $(DESTDIR)$(libdir)
89
	$(INSTALL_PROGRAM) libdebuginfod.so $(DESTDIR)$(libdir)/libdebuginfod-$(PACKAGE_VERSION).so
116
	$(INSTALL_PROGRAM) libdebuginfod.so $(DESTDIR)$(libdir)/libdebuginfod-$(PACKAGE_VERSION).so
Lines 95-100 uninstall: uninstall-am Link Here
95
	rm -f $(DESTDIR)$(libdir)/libdebuginfod.so.$(VERSION)
122
	rm -f $(DESTDIR)$(libdir)/libdebuginfod.so.$(VERSION)
96
	rm -f $(DESTDIR)$(libdir)/libdebuginfod.so
123
	rm -f $(DESTDIR)$(libdir)/libdebuginfod.so
97
	rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils
124
	rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils
125
endif
98
126
99
EXTRA_DIST = libdebuginfod.map
127
EXTRA_DIST = libdebuginfod.map
100
MOSTLYCLEANFILES = $(am_libdebuginfod_pic_a_OBJECTS) libdebuginfod.so.$(VERSION)
128
MOSTLYCLEANFILES = $(am_libdebuginfod_pic_a_OBJECTS) libdebuginfod.so.$(VERSION)
(-)a/debuginfod/debuginfod-client.c (-4 / +27 lines)
Lines 26-32 Link Here
26
   the GNU Lesser General Public License along with this program.  If
26
   the GNU Lesser General Public License along with this program.  If
27
   not, see <http://www.gnu.org/licenses/>.  */
27
   not, see <http://www.gnu.org/licenses/>.  */
28
28
29
30
/* cargo-cult from libdwfl linux-kernel-modules.c */
29
/* cargo-cult from libdwfl linux-kernel-modules.c */
31
/* In case we have a bad fts we include this before config.h because it
30
/* In case we have a bad fts we include this before config.h because it
32
   can't handle _FILE_OFFSET_BITS.
31
   can't handle _FILE_OFFSET_BITS.
Lines 39-53 Link Here
39
#endif
38
#endif
40
39
41
#include "config.h"
40
#include "config.h"
42
#include "debuginfod.h"
43
#include "system.h"
41
#include "system.h"
42
#include <errno.h>
43
#include <stdlib.h>
44
#include "debuginfod.h"
45
46
/* We might be building a bootstrap dummy library, which is really simple. */
47
#ifdef DUMMY_LIBDEBUGINFOD
48
49
debuginfod_client *debuginfod_begin (void) { errno = ENOSYS; return NULL; }
50
int debuginfod_find_debuginfo (debuginfod_client *c, const unsigned char *b,
51
                               int s, char **p) { return -ENOSYS; }
52
int debuginfod_find_executable (debuginfod_client *c, const unsigned char *b,
53
                                int s, char **p) { return -ENOSYS; }
54
int debuginfod_find_source (debuginfod_client *c, const unsigned char *b,
55
                            int s, const char *f, char **p)  { return -ENOSYS; }
56
void debuginfod_set_progressfn(debuginfod_client *c,
57
			       debuginfod_progressfn_t fn) { }
58
void debuginfod_set_user_data (debuginfod_client *c, void *d) { }
59
void* debuginfod_get_user_data (debuginfod_client *c) { return NULL; }
60
const char* debuginfod_get_url (debuginfod_client *c) { return NULL; }
61
int debuginfod_add_http_header (debuginfod_client *c,
62
				const char*h) { return -ENOSYS; }
63
void debuginfod_end (debuginfod_client *c) { }
64
65
#else /* DUMMY_LIBDEBUGINFOD */
66
44
#include <assert.h>
67
#include <assert.h>
45
#include <dirent.h>
68
#include <dirent.h>
46
#include <stdio.h>
69
#include <stdio.h>
47
#include <stdlib.h>
48
#include <errno.h>
70
#include <errno.h>
49
#include <unistd.h>
71
#include <unistd.h>
50
#include <errno.h>
51
#include <fcntl.h>
72
#include <fcntl.h>
52
#include <fts.h>
73
#include <fts.h>
53
#include <regex.h>
74
#include <regex.h>
Lines 1079-1081 __attribute__((destructor)) attribute_hidden void libdebuginfod_dtor(void) Link Here
1079
  /* ... so don't do this: */
1100
  /* ... so don't do this: */
1080
  /* curl_global_cleanup(); */
1101
  /* curl_global_cleanup(); */
1081
}
1102
}
1103
1104
#endif /* DUMMY_LIBDEBUGINFOD */
(-)a/debuginfod/debuginfod.cxx (-1 lines)
Lines 92-98 using namespace std; Link Here
92
#include <libdwelf.h>
92
#include <libdwelf.h>
93
93
94
#include <microhttpd.h>
94
#include <microhttpd.h>
95
#include <curl/curl.h>
96
#include <archive.h>
95
#include <archive.h>
97
#include <archive_entry.h>
96
#include <archive_entry.h>
98
#include <sqlite3.h>
97
#include <sqlite3.h>
(-)a/doc/ChangeLog (+4 lines)
Lines 1-3 Link Here
1
2020-06-19  Mark Wielaard  <mark@klomp.org>
2
3
	* Makefile.am: Guard all client manpages with LIBDEBUGINFOD.
4
1
2020-03-29  Mark Wielaard  <mark@klomp.org>
5
2020-03-29  Mark Wielaard  <mark@klomp.org>
2
6
3
	* debuginfod_find_debuginfo.3 (HTTP HEADER): Document the expected
7
	* debuginfod_find_debuginfo.3 (HTTP HEADER): Document the expected
(-)a/doc/Makefile.am (-1 / +3 lines)
Lines 24-29 notrans_dist_man1_MANS= Link Here
24
24
25
if DEBUGINFOD
25
if DEBUGINFOD
26
notrans_dist_man8_MANS += debuginfod.8
26
notrans_dist_man8_MANS += debuginfod.8
27
endif
28
29
if LIBDEBUGINFOD
27
notrans_dist_man3_MANS += debuginfod_add_http_header.3
30
notrans_dist_man3_MANS += debuginfod_add_http_header.3
28
notrans_dist_man3_MANS += debuginfod_begin.3
31
notrans_dist_man3_MANS += debuginfod_begin.3
29
notrans_dist_man3_MANS += debuginfod_end.3
32
notrans_dist_man3_MANS += debuginfod_end.3
Lines 36-39 notrans_dist_man3_MANS += debuginfod_set_progressfn.3 Link Here
36
notrans_dist_man3_MANS += debuginfod_set_user_data.3
39
notrans_dist_man3_MANS += debuginfod_set_user_data.3
37
notrans_dist_man1_MANS += debuginfod-find.1
40
notrans_dist_man1_MANS += debuginfod-find.1
38
endif
41
endif
39
(-)a/tests/ChangeLog (+5 lines)
Lines 1-3 Link Here
1
2020-06-19  Mark Wielaard  <mark@klomp.org>
2
3
	* Makefile.am (TESTS): Don't add run-debuginfod-find.sh when
4
	DUMMY_LIBDEBUGINFOD.
5
1
2020-06-16  Mark Wielaard  <mark@klomp.org>
6
2020-06-16  Mark Wielaard  <mark@klomp.org>
2
7
3
	* coverage.sh: Use /usr/bin/env bash.
8
	* coverage.sh: Use /usr/bin/env bash.
(-)a/tests/Makefile.am (-1 / +3 lines)
Lines 210-217 endif Link Here
210
210
211
if DEBUGINFOD
211
if DEBUGINFOD
212
check_PROGRAMS += debuginfod_build_id_find
212
check_PROGRAMS += debuginfod_build_id_find
213
# With the dummy delegation doesn't work
214
if !DUMMY_LIBDEBUGINFOD
213
TESTS += run-debuginfod-find.sh
215
TESTS += run-debuginfod-find.sh
214
endif
216
endif
217
endif
215
218
216
EXTRA_DIST = run-arextract.sh run-arsymtest.sh run-ar.sh \
219
EXTRA_DIST = run-arextract.sh run-arsymtest.sh run-ar.sh \
217
	     run-show-die-info.sh run-get-files.sh run-get-lines.sh \
220
	     run-show-die-info.sh run-get-files.sh run-get-lines.sh \
218
- 

Return to bug 25509