blob: 182229becf9281e6c05d70394c50bf0934fe48c3 [file] [log] [blame]
Andrew Geissler517393d2023-01-13 08:55:19 -06001SUMMARY = "Utilities and libraries for handling compiled object files"
2HOMEPAGE = "https://sourceware.org/elfutils"
3DESCRIPTION = "elfutils is a collection of utilities and libraries to read, create and modify ELF binary files, find and handle DWARF debug data, symbols, thread state and stacktraces for processes and core files on GNU/Linux."
4SECTION = "base"
5LICENSE = "GPL-2.0-only & GPL-2.0-or-later & LGPL-3.0-or-later & GPL-3.0-or-later"
6LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \
7 file://debuginfod/debuginfod-client.c;endline=28;md5=f0a7c3170776866ee94e8f9225a6ad79 \
8 "
9DEPENDS = "zlib virtual/libintl"
10DEPENDS:append:libc-musl = " argp-standalone fts musl-obstack "
11# The Debian patches below are from:
12# http://ftp.de.debian.org/debian/pool/main/e/elfutils/elfutils_0.176-1.debian.tar.xz
13SRC_URI = "https://sourceware.org/elfutils/ftp/${PV}/${BP}.tar.bz2 \
14 file://run-ptest \
15 file://0001-dso-link-change.patch \
16 file://0002-Fix-elf_cvt_gunhash-if-dest-and-src-are-same.patch \
17 file://0003-fixheadercheck.patch \
18 file://0006-Fix-build-on-aarch64-musl.patch \
19 file://0001-libasm-may-link-with-libbz2-if-found.patch \
20 file://0001-libelf-elf_end.c-check-data_list.data.d.d_buf-before.patch \
21 file://0001-skip-the-test-when-gcc-not-deployed.patch \
22 file://ptest.patch \
23 file://0001-tests-Makefile.am-compile-test_nlist-with-standard-C.patch \
Andrew Geisslerc5535c92023-01-27 16:10:19 -060024 file://0001-PR29926-debuginfod-Fix-usage-of-deprecated-CURLINFO_.patch \
25 file://0002-debuginfod-client-Use-CURLOPT_PROTOCOLS_STR-for-libc.patch \
Andrew Geissler517393d2023-01-13 08:55:19 -060026 "
27SRC_URI:append:libc-musl = " \
28 file://0003-musl-utils.patch \
29 file://0015-config-eu.am-do-not-use-Werror.patch \
30 "
31SRC_URI[sha256sum] = "fb8b0e8d0802005b9a309c60c1d8de32dd2951b56f0c3a3cb56d21ce01595dff"
32
33inherit autotools gettext ptest pkgconfig
34
35EXTRA_OECONF = "--program-prefix=eu-"
36
37BUILD_CFLAGS += "-Wno-error=stringop-overflow"
Andrew Geissler517393d2023-01-13 08:55:19 -060038
39DEPENDS_BZIP2 = "bzip2-replacement-native"
40DEPENDS_BZIP2:class-target = "bzip2"
41
42PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'debuginfod', 'debuginfod libdebuginfod', '', d)}"
43PACKAGECONFIG[bzip2] = "--with-bzlib,--without-bzlib,${DEPENDS_BZIP2}"
44PACKAGECONFIG[xz] = "--with-lzma,--without-lzma,xz"
45PACKAGECONFIG[zstd] = "--with-zstd,--without-zstd,zstd"
46PACKAGECONFIG[libdebuginfod] = "--enable-libdebuginfod,--disable-libdebuginfod,curl"
47PACKAGECONFIG[debuginfod] = "--enable-debuginfod,--disable-debuginfod,libarchive sqlite3 libmicrohttpd"
48
49RDEPENDS:${PN}-ptest += "libasm libelf bash make coreutils ${PN}-binutils iproute2-ss bsdtar gcc-symlinks binutils-symlinks libgcc-dev"
50
51EXTRA_OECONF:append:class-target = " --disable-tests-rpath"
52
53# symver functions not currently supported on microblaze
54EXTRA_OECONF:append:class-target:microblaze = " --disable-symbol-versioning"
55
56RDEPENDS:${PN}-ptest:append:libc-glibc = " glibc-utils glibc-dbg glibc-dev"
57INSANE_SKIP:${PN}-ptest = "debug-deps dev-deps"
58
59do_compile_ptest() {
60 cd ${B}/tests
61 oe_runmake buildtest-TESTS oecheck
62}
63PTEST_PARALLEL_MAKE = ""
64
65do_install_ptest() {
66 if [ ${PTEST_ENABLED} = "1" ]; then
67 # copy the files which needed by the cases
68 TEST_FILES="strip strip.o addr2line elfcmp objdump readelf size.o nm.o nm elflint elfcompress elfclassify stack unstrip"
69 install -d -m 755 ${D}${PTEST_PATH}/src
70 install -d -m 755 ${D}${PTEST_PATH}/lib
71 install -d -m 755 ${D}${PTEST_PATH}/libelf
72 install -d -m 755 ${D}${PTEST_PATH}/libdw
73 install -d -m 755 ${D}${PTEST_PATH}/libdwfl
74 install -d -m 755 ${D}${PTEST_PATH}/libdwelf
75 install -d -m 755 ${D}${PTEST_PATH}/libasm
76 install -d -m 755 ${D}${PTEST_PATH}/libcpu
77 install -d -m 755 ${D}${PTEST_PATH}/libebl
78 for test_file in ${TEST_FILES}; do
79 if [ -f ${B}/src/${test_file} ]; then
80 cp -r ${B}/src/${test_file} ${D}${PTEST_PATH}/src
81 fi
82 done
83 cp ${D}${libdir}/libelf-${PV}.so ${D}${PTEST_PATH}/libelf/libelf.so
84 cp ${D}${libdir}/libdw-${PV}.so ${D}${PTEST_PATH}/libdw/libdw.so
85 cp ${D}${libdir}/libasm-${PV}.so ${D}${PTEST_PATH}/libasm/libasm.so
86 cp ${B}/libcpu/libcpu.a ${D}${PTEST_PATH}/libcpu/
87 cp ${B}/libebl/libebl.a ${D}${PTEST_PATH}/libebl/
88 cp ${B}/lib/libeu.a ${D}${PTEST_PATH}/lib/
89 cp ${S}/libelf/*.h ${D}${PTEST_PATH}/libelf/
90 cp ${S}/libdw/*.h ${D}${PTEST_PATH}/libdw/
91 cp ${S}/libdwfl/*.h ${D}${PTEST_PATH}/libdwfl/
92 cp ${S}/libdwelf/*.h ${D}${PTEST_PATH}/libdwelf/
93 cp ${S}/libasm/*.h ${D}${PTEST_PATH}/libasm/
94 cp -r ${S}/tests/ ${D}${PTEST_PATH}
95 cp -r ${B}/tests/* ${D}${PTEST_PATH}/tests
96 cp -r ${B}/config.h ${D}${PTEST_PATH}
97 cp -r ${B}/backends ${D}${PTEST_PATH}
98 cp -r ${B}/debuginfod ${D}${PTEST_PATH}
99 sed -i '/^Makefile:/c Makefile:' ${D}${PTEST_PATH}/tests/Makefile
100 find ${D}${PTEST_PATH} -type f -name *.[hoc] | xargs -i rm {}
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600101 # TODO: remove below filter after https://sourceware.org/bugzilla/show_bug.cgi?id=30047 is fixed
102 sed -i -e '/funcretval/d' ${D}${PTEST_PATH}/tests/run-native-test.sh
Andrew Geissler517393d2023-01-13 08:55:19 -0600103 fi
104}
105
106EXTRA_OEMAKE:class-native = ""
107EXTRA_OEMAKE:class-nativesdk = ""
108
109BBCLASSEXTEND = "native nativesdk"
110
111# Package utilities separately
112PACKAGES =+ "${PN}-binutils libelf libasm libdw libdebuginfod"
113
114# Shared libraries are licensed GPL-2.0-only or GPL-3.0-or-later, binaries
115# GPL-3.0-or-later. According to NEWS file:
116# "The license is now GPLv2/LGPLv3+ for the libraries and GPLv3+ for stand-alone
117# programs. There is now also a formal CONTRIBUTING document describing how to
118# submit patches."
119LICENSE:${PN}-binutils = "GPL-3.0-or-later"
120LICENSE:${PN} = "GPL-3.0-or-later"
121LICENSE:libelf = "GPL-2.0-only | LGPL-3.0-or-later"
122LICENSE:libasm = "GPL-2.0-only | LGPL-3.0-or-later"
123LICENSE:libdw = "GPL-2.0-only | LGPL-3.0-or-later"
124LICENSE:libdebuginfod = "GPL-2.0-or-later | LGPL-3.0-or-later"
125
126FILES:${PN}-binutils = "\
127 ${bindir}/eu-addr2line \
128 ${bindir}/eu-ld \
129 ${bindir}/eu-nm \
130 ${bindir}/eu-readelf \
131 ${bindir}/eu-size \
132 ${bindir}/eu-strip"
133
134FILES:libelf = "${libdir}/libelf-${PV}.so ${libdir}/libelf.so.*"
135FILES:libasm = "${libdir}/libasm-${PV}.so ${libdir}/libasm.so.*"
136FILES:libdw = "${libdir}/libdw-${PV}.so ${libdir}/libdw.so.* ${libdir}/elfutils/lib*"
137FILES:libdebuginfod = "${libdir}/libdebuginfod-${PV}.so ${libdir}/libdebuginfod.so.*"
138# Some packages have the version preceeding the .so instead properly
139# versioned .so.<version>, so we need to reorder and repackage.
140#FILES:${PN} += "${libdir}/*-${PV}.so ${base_libdir}/*-${PV}.so"
141#FILES_SOLIBSDEV = "${libdir}/libasm.so ${libdir}/libdw.so ${libdir}/libelf.so"
142
143# The package contains symlinks that trip up insane
144INSANE_SKIP:${MLPREFIX}libdw = "dev-so"
145# The nlist binary in the tests uses explicitly minimal compiler flags
146INSANE_SKIP:${PN}-ptest += "ldflags"
147
148# avoid stripping some generated binaries otherwise some of the tests such as test-nlist,
149# run-strip-reloc.sh, run-strip-strmerge.sh and so on will fail
150INHIBIT_PACKAGE_STRIP_FILES = "\
151 ${PKGD}${PTEST_PATH}/tests/test-nlist \
152 ${PKGD}${PTEST_PATH}/tests/elfstrmerge \
153 ${PKGD}${PTEST_PATH}/tests/backtrace-child \
154 ${PKGD}${PTEST_PATH}/tests/backtrace-data \
155 ${PKGD}${PTEST_PATH}/tests/backtrace-dwarf \
156 ${PKGD}${PTEST_PATH}/tests/deleted \
157 ${PKGD}${PTEST_PATH}/tests/dwfllines \
158 ${PKGD}${PTEST_PATH}/src/strip \
159 ${PKGD}${PTEST_PATH}/src/addr2line \
160 ${PKGD}${PTEST_PATH}/src/elfcmp \
161 ${PKGD}${PTEST_PATH}/src/objdump \
162 ${PKGD}${PTEST_PATH}/src/readelf \
163 ${PKGD}${PTEST_PATH}/src/nm \
164 ${PKGD}${PTEST_PATH}/src/elflint \
165 ${PKGD}${PTEST_PATH}/src/elfclassify \
166 ${PKGD}${PTEST_PATH}/src/stack \
167 ${PKGD}${PTEST_PATH}/src/unstrip \
168 ${PKGD}${PTEST_PATH}/libelf/libelf.so \
169 ${PKGD}${PTEST_PATH}/libdw/libdw.so \
170 ${PKGD}${PTEST_PATH}/libasm/libasm.so \
171 ${PKGD}${PTEST_PATH}/backends/libebl_i386.so \
172 ${PKGD}${PTEST_PATH}/backends/libebl_x86_64.so \
173"
174
175PRIVATE_LIBS:${PN}-ptest = "libdw.so.1 libelf.so.1 libasm.so.1 libdebuginfod.so.1"