diff options
author | Chen Qi <Qi.Chen@windriver.com> | 2023-03-23 16:11:15 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-03-27 15:44:02 +0100 |
commit | 4ffcbe98e82c73c543aa46105413de2586aa1cee (patch) | |
tree | f57162b00c9e866d491e6e8324f1a46fa89f7cfa | |
parent | a94ca827c2066b22c746003f5144b89d28b13a1a (diff) | |
download | poky-4ffcbe98e82c73c543aa46105413de2586aa1cee.tar.gz |
debugedit: add recipe
This recipe provides find-debuginfo which is used by rpm, more
specifically rpmbuild.
RPM upstream removed find-debuginfo and switched to use debugedit
in the following commit.
https://github.com/rpm-software-management/rpm/commit/04b0805a756cdd9466fb9dc717846f5bf15518cc
Without debugedit, rpmbuild fails to generate debuginfo package when
%debug_package is added to spec file.
(From OE-Core rev: f7ada8b4d003473abce5b589cc38aec1e5e5f18a)
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
5 files changed, 252 insertions, 0 deletions
diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc index c76447a25d..682ec2cfdf 100644 --- a/meta/conf/distro/include/maintainers.inc +++ b/meta/conf/distro/include/maintainers.inc | |||
@@ -135,6 +135,7 @@ RECIPE_MAINTAINER:pn-dbus = "Chen Qi <Qi.Chen@windriver.com>" | |||
135 | RECIPE_MAINTAINER:pn-dbus-glib = "Chen Qi <Qi.Chen@windriver.com>" | 135 | RECIPE_MAINTAINER:pn-dbus-glib = "Chen Qi <Qi.Chen@windriver.com>" |
136 | RECIPE_MAINTAINER:pn-dbus-wait = "Chen Qi <Qi.Chen@windriver.com>" | 136 | RECIPE_MAINTAINER:pn-dbus-wait = "Chen Qi <Qi.Chen@windriver.com>" |
137 | RECIPE_MAINTAINER:pn-debianutils = "Yi Zhao <yi.zhao@windriver.com>" | 137 | RECIPE_MAINTAINER:pn-debianutils = "Yi Zhao <yi.zhao@windriver.com>" |
138 | RECIPE_MAINTAINER:pn-debugedit = "Chen Qi <Qi.Chen@windriver.com>" | ||
138 | RECIPE_MAINTAINER:pn-dejagnu = "Nathan Rossi <nathan@nathanrossi.com>" | 139 | RECIPE_MAINTAINER:pn-dejagnu = "Nathan Rossi <nathan@nathanrossi.com>" |
139 | RECIPE_MAINTAINER:pn-depmodwrapper-cross = "Unassigned <unassigned@yoctoproject.org>" | 140 | RECIPE_MAINTAINER:pn-depmodwrapper-cross = "Unassigned <unassigned@yoctoproject.org>" |
140 | RECIPE_MAINTAINER:pn-desktop-file-utils = "Alexander Kanavin <alex.kanavin@gmail.com>" | 141 | RECIPE_MAINTAINER:pn-desktop-file-utils = "Alexander Kanavin <alex.kanavin@gmail.com>" |
diff --git a/meta/recipes-devtools/debugedit/debugedit_5.0.bb b/meta/recipes-devtools/debugedit/debugedit_5.0.bb new file mode 100644 index 0000000000..257238fa24 --- /dev/null +++ b/meta/recipes-devtools/debugedit/debugedit_5.0.bb | |||
@@ -0,0 +1,28 @@ | |||
1 | SUMMARY = "Tools for creating debuginfo and source file distributions" | ||
2 | DESCRIPTION = "debugedit provides programs and scripts for creating \ | ||
3 | debuginfo and source file distributions, collect build-ids and rewrite \ | ||
4 | source paths in DWARF data for debugging, tracing and profiling." | ||
5 | HOMEPAGE = "https://sourceware.org/debugedit/" | ||
6 | |||
7 | LICENSE = "GPL-2.0-only & GPL-3.0-only & LGPL-2.1-only" | ||
8 | LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \ | ||
9 | file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \ | ||
10 | file://COPYING3;md5=d32239bcb673463ab874e80d47fae504" | ||
11 | |||
12 | SRC_URI = "https://sourceware.org/ftp/debugedit/${PV}/debugedit-${PV}.tar.xz" | ||
13 | |||
14 | SRC_URI:append:libc-musl = " \ | ||
15 | file://0001-tools-Add-error.h-for-non-glibc-case.patch \ | ||
16 | file://0002-sepdebugcrcfix.c-do-not-use-64bit-variants.patch \ | ||
17 | file://0003-Makefile.am-do-not-update-manual.patch \ | ||
18 | " | ||
19 | |||
20 | SRC_URI[sha256sum] = "e9ecd7d350bebae1f178ce6776ca19a648b6fe8fa22f5b3044b38d7899aa553e" | ||
21 | |||
22 | DEPENDS = "elfutils" | ||
23 | |||
24 | inherit pkgconfig autotools | ||
25 | |||
26 | RDEPENDS:${PN} += "bash elfutils-binutils" | ||
27 | |||
28 | BBCLASSEXTEND = "native nativesdk" | ||
diff --git a/meta/recipes-devtools/debugedit/files/0001-tools-Add-error.h-for-non-glibc-case.patch b/meta/recipes-devtools/debugedit/files/0001-tools-Add-error.h-for-non-glibc-case.patch new file mode 100644 index 0000000000..f6d64cb4e7 --- /dev/null +++ b/meta/recipes-devtools/debugedit/files/0001-tools-Add-error.h-for-non-glibc-case.patch | |||
@@ -0,0 +1,102 @@ | |||
1 | From 4c797d3b559ba51bd9ccd9a2036245819acce843 Mon Sep 17 00:00:00 2001 | ||
2 | From: Chen Qi <Qi.Chen@windriver.com> | ||
3 | Date: Thu, 23 Mar 2023 10:54:21 +0800 | ||
4 | Subject: [PATCH] tools: Add error.h for non-glibc case | ||
5 | |||
6 | error is glibc specific API, so this patch will mostly not accepted | ||
7 | upstream given that elfutils has been closely tied to glibc | ||
8 | |||
9 | This is a OE specific workaround for musl. | ||
10 | |||
11 | Upstream-Status: Inappropriate [OE Specific] | ||
12 | |||
13 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
14 | --- | ||
15 | tools/debugedit.c | 7 ++++++- | ||
16 | tools/error.h | 27 +++++++++++++++++++++++++++ | ||
17 | tools/sepdebugcrcfix.c | 7 ++++++- | ||
18 | 3 files changed, 39 insertions(+), 2 deletions(-) | ||
19 | create mode 100644 tools/error.h | ||
20 | |||
21 | diff --git a/tools/debugedit.c b/tools/debugedit.c | ||
22 | index 668777a..a72c3c0 100644 | ||
23 | --- a/tools/debugedit.c | ||
24 | +++ b/tools/debugedit.c | ||
25 | @@ -25,7 +25,6 @@ | ||
26 | #include <byteswap.h> | ||
27 | #include <endian.h> | ||
28 | #include <errno.h> | ||
29 | -#include <error.h> | ||
30 | #include <limits.h> | ||
31 | #include <string.h> | ||
32 | #include <stdlib.h> | ||
33 | @@ -40,6 +39,12 @@ | ||
34 | #include <gelf.h> | ||
35 | #include <dwarf.h> | ||
36 | |||
37 | +#ifdef __GLIBC__ | ||
38 | +#include <error.h> | ||
39 | +#else | ||
40 | +#include "error.h" | ||
41 | +#endif | ||
42 | + | ||
43 | #ifndef MAX | ||
44 | #define MAX(m, n) ((m) < (n) ? (n) : (m)) | ||
45 | #endif | ||
46 | diff --git a/tools/error.h b/tools/error.h | ||
47 | new file mode 100644 | ||
48 | index 0000000..9b24418 | ||
49 | --- /dev/null | ||
50 | +++ b/tools/error.h | ||
51 | @@ -0,0 +1,27 @@ | ||
52 | +#ifndef _ERROR_H_ | ||
53 | +#define _ERROR_H_ | ||
54 | + | ||
55 | +#include <stdarg.h> | ||
56 | +#include <stdio.h> | ||
57 | +#include <stdlib.h> | ||
58 | +#include <string.h> | ||
59 | +#include <errno.h> | ||
60 | + | ||
61 | +static unsigned int error_message_count = 0; | ||
62 | + | ||
63 | +static inline void error(int status, int errnum, const char* format, ...) | ||
64 | +{ | ||
65 | + va_list ap; | ||
66 | + fprintf(stderr, "%s: ", program_invocation_name); | ||
67 | + va_start(ap, format); | ||
68 | + vfprintf(stderr, format, ap); | ||
69 | + va_end(ap); | ||
70 | + if (errnum) | ||
71 | + fprintf(stderr, ": %s", strerror(errnum)); | ||
72 | + fprintf(stderr, "\n"); | ||
73 | + error_message_count++; | ||
74 | + if (status) | ||
75 | + exit(status); | ||
76 | +} | ||
77 | + | ||
78 | +#endif /* _ERROR_H_ */ | ||
79 | diff --git a/tools/sepdebugcrcfix.c b/tools/sepdebugcrcfix.c | ||
80 | index da50e6c..c4a9d56 100644 | ||
81 | --- a/tools/sepdebugcrcfix.c | ||
82 | +++ b/tools/sepdebugcrcfix.c | ||
83 | @@ -29,10 +29,15 @@ | ||
84 | #include <endian.h> | ||
85 | #include <stdio.h> | ||
86 | #include <stdlib.h> | ||
87 | -#include <error.h> | ||
88 | #include <libelf.h> | ||
89 | #include <gelf.h> | ||
90 | |||
91 | +#ifdef __GLIBC__ | ||
92 | +#include <error.h> | ||
93 | +#else | ||
94 | +#include "error.h" | ||
95 | +#endif | ||
96 | + | ||
97 | #ifndef _ | ||
98 | #define _(x) x | ||
99 | #endif | ||
100 | -- | ||
101 | 2.17.1 | ||
102 | |||
diff --git a/meta/recipes-devtools/debugedit/files/0002-sepdebugcrcfix.c-do-not-use-64bit-variants.patch b/meta/recipes-devtools/debugedit/files/0002-sepdebugcrcfix.c-do-not-use-64bit-variants.patch new file mode 100644 index 0000000000..4463bd2324 --- /dev/null +++ b/meta/recipes-devtools/debugedit/files/0002-sepdebugcrcfix.c-do-not-use-64bit-variants.patch | |||
@@ -0,0 +1,56 @@ | |||
1 | From 3e05bbc1f7909ab6f529e66f0d0f70fb1e60583a Mon Sep 17 00:00:00 2001 | ||
2 | From: Chen Qi <Qi.Chen@windriver.com> | ||
3 | Date: Thu, 23 Mar 2023 11:55:53 +0800 | ||
4 | Subject: [PATCH 2/2] sepdebugcrcfix.c: do not use 64bit variants | ||
5 | |||
6 | configure.ac checks for largefile support via AC_SYS_LARGEFILE | ||
7 | already, therefore use off_t, open and lseek instead of 64bit | ||
8 | variants. Musl e.g. does not define them without _LARGEFILE64_SOURCE | ||
9 | and error is not seen on glibc because _GNU_SOURCE defines | ||
10 | _LARGEFILE64_SOURCE. | ||
11 | |||
12 | This patch is marked as inappropriate as debugedit obviously only | ||
13 | wants to support glibc or some glibc compatible libcs. We can see | ||
14 | this from the error() usage. And this patch is only for musl. | ||
15 | |||
16 | Upstream-Status: Inappropriate [OE Specific] | ||
17 | |||
18 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
19 | --- | ||
20 | tools/sepdebugcrcfix.c | 6 +++--- | ||
21 | 1 file changed, 3 insertions(+), 3 deletions(-) | ||
22 | |||
23 | diff --git a/tools/sepdebugcrcfix.c b/tools/sepdebugcrcfix.c | ||
24 | index c4a9d56..882e5f5 100644 | ||
25 | --- a/tools/sepdebugcrcfix.c | ||
26 | +++ b/tools/sepdebugcrcfix.c | ||
27 | @@ -144,7 +144,7 @@ crc32 (const char *fname, const char *base_fname, uint32_t *crcp) | ||
28 | error (0, errno, _("cannot open \"%s\""), debugname); | ||
29 | return false; | ||
30 | } | ||
31 | - off64_t size = lseek64 (fd, 0, SEEK_END); | ||
32 | + off_t size = lseek (fd, 0, SEEK_END); | ||
33 | if (size == -1) | ||
34 | { | ||
35 | error (0, errno, _("cannot get size of \"%s\""), debugname); | ||
36 | @@ -289,7 +289,7 @@ process (Elf *elf, int fd, const char *fname) | ||
37 | return true; | ||
38 | } | ||
39 | updated_count++; | ||
40 | - off64_t seekto = (shdr->sh_offset + data->d_off | ||
41 | + off_t seekto = (shdr->sh_offset + data->d_off | ||
42 | + (crcp - (const uint8_t *) data->d_buf)); | ||
43 | uint32_t crc_targetendian = (ehdr->e_ident[EI_DATA] == ELFDATA2LSB | ||
44 | ? htole32 (crc) : htobe32 (crc)); | ||
45 | @@ -361,7 +361,7 @@ main (int argc, char **argv) | ||
46 | error (0, errno, _("cannot chmod \"%s\" to make sure we can read and write"), fname); | ||
47 | |||
48 | bool failed = false; | ||
49 | - int fd = open64 (fname, O_RDWR); | ||
50 | + int fd = open (fname, O_RDWR); | ||
51 | if (fd == -1) | ||
52 | { | ||
53 | error (0, errno, _("cannot open \"%s\""), fname); | ||
54 | -- | ||
55 | 2.17.1 | ||
56 | |||
diff --git a/meta/recipes-devtools/debugedit/files/0003-Makefile.am-do-not-update-manual.patch b/meta/recipes-devtools/debugedit/files/0003-Makefile.am-do-not-update-manual.patch new file mode 100644 index 0000000000..de467f5365 --- /dev/null +++ b/meta/recipes-devtools/debugedit/files/0003-Makefile.am-do-not-update-manual.patch | |||
@@ -0,0 +1,65 @@ | |||
1 | From 4f0d7d2f4900ce8555e09854dc681278b7a3d9a9 Mon Sep 17 00:00:00 2001 | ||
2 | From: Chen Qi <Qi.Chen@windriver.com> | ||
3 | Date: Thu, 23 Mar 2023 13:09:23 +0800 | ||
4 | Subject: [PATCH 3/3] Makefile.am: do not update manual | ||
5 | |||
6 | The tarball ships these manuals, no need to re-generate them. | ||
7 | We have local patches for debugedit.c and sepdebugcrcfix.c, | ||
8 | this will triger re-generation of the manuals, which causes | ||
9 | error of missing help2man. | ||
10 | |||
11 | This is an OE specific patch. If we don't have local patches | ||
12 | patching debugedit.c and sepdebugcrcfix.c, this patch is also | ||
13 | not needed. | ||
14 | |||
15 | Upstream-Status: Inappropriate [OE Specific] | ||
16 | |||
17 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
18 | --- | ||
19 | Makefile.am | 30 ------------------------------ | ||
20 | 1 file changed, 30 deletions(-) | ||
21 | |||
22 | diff --git a/Makefile.am b/Makefile.am | ||
23 | index 98b2f20..f91deea 100644 | ||
24 | --- a/Makefile.am | ||
25 | +++ b/Makefile.am | ||
26 | @@ -52,36 +52,6 @@ sepdebugcrcfix_LDADD = @LIBELF_LIBS@ | ||
27 | # Manual pages are generated for dist | ||
28 | dist_man_MANS = debugedit.1 sepdebugcrcfix.1 find-debuginfo.1 | ||
29 | |||
30 | -# The 'case' ensures the man pages are only generated if the corresponding | ||
31 | -# source script (the first prerequisite) or configure.ac (for the version) | ||
32 | -# has been changed. The executable prerequisite is solely meant to force | ||
33 | -# these docs to be made only after the executable has been compiled. | ||
34 | -# This makes sure help2man is not normally necessary (since the generated | ||
35 | -# man pages are distributed). | ||
36 | -debugedit.1: tools/debugedit.c configure.ac debugedit$(EXEEXT) | ||
37 | - @case '$?' in \ | ||
38 | - *$<* | *configure.ac* ) $(HELP2MAN) -N --output=$@ \ | ||
39 | - --name='debug source path manipulation tool' \ | ||
40 | - ./debugedit$(EXEEXT) ;; \ | ||
41 | - * ) : ;; \ | ||
42 | - esac | ||
43 | - | ||
44 | -sepdebugcrcfix.1: tools/sepdebugcrcfix.c configure.ac sepdebugcrcfix$(EXEEXT) | ||
45 | - @case '$?' in \ | ||
46 | - *$<* | *configure.ac* ) $(HELP2MAN) -N --output=$@ \ | ||
47 | - --name='fixes CRC for separate .debug files' \ | ||
48 | - ./sepdebugcrcfix$(EXEEXT) ;;\ | ||
49 | - * ) : ;; \ | ||
50 | - esac | ||
51 | - | ||
52 | -find-debuginfo.1: $(top_srcdir)/scripts/find-debuginfo.in configure.ac find-debuginfo | ||
53 | - @case '$?' in \ | ||
54 | - *$<* | *configure.ac* ) $(HELP2MAN) -N --output=$@ \ | ||
55 | - --name='finds debuginfo and processes it' \ | ||
56 | - ./find-debuginfo ;;\ | ||
57 | - * ) : ;; \ | ||
58 | - esac | ||
59 | - | ||
60 | noinst_HEADERS= tools/ansidecl.h \ | ||
61 | tools/hashtab.h \ | ||
62 | tools/md5.h \ | ||
63 | -- | ||
64 | 2.17.1 | ||
65 | |||