blob: 561112c580efff43a170727665b14858b6753d7b [file] [log] [blame]
Andrew Geissler595f6302022-01-24 19:11:47 +00001SUMMARY = "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"
Andrew Geissler7e0e3c02022-02-25 20:34:39 +00005LICENSE = "GPL-2.0-only & GPL-2.0-or-later & LGPL-3.0-or-later & GPL-3.0-or-later"
Andrew Geissler595f6302022-01-24 19:11:47 +00006LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \
Andrew Geisslerd5838332022-05-27 11:33:10 -05007 file://debuginfod/debuginfod-client.c;endline=28;md5=f0a7c3170776866ee94e8f9225a6ad79 \
Andrew Geissler595f6302022-01-24 19:11:47 +00008 "
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://0001-dso-link-change.patch \
15 file://0002-Fix-elf_cvt_gunhash-if-dest-and-src-are-same.patch \
16 file://0003-fixheadercheck.patch \
17 file://0006-Fix-build-on-aarch64-musl.patch \
18 file://0001-libasm-may-link-with-libbz2-if-found.patch \
19 file://0001-libelf-elf_end.c-check-data_list.data.d.d_buf-before.patch \
20 file://0001-skip-the-test-when-gcc-not-deployed.patch \
21 file://run-ptest \
22 file://ptest.patch \
23 file://0001-tests-Makefile.am-compile-test_nlist-with-standard-C.patch \
Andrew Geissler595f6302022-01-24 19:11:47 +000024 "
25SRC_URI:append:libc-musl = " \
26 file://0003-musl-utils.patch \
27 file://0015-config-eu.am-do-not-use-Werror.patch \
28 "
Andrew Geisslerd5838332022-05-27 11:33:10 -050029SRC_URI[sha256sum] = "e70b0dfbe610f90c4d1fe0d71af142a4e25c3c4ef9ebab8d2d72b65159d454c8"
Andrew Geissler595f6302022-01-24 19:11:47 +000030
31inherit autotools gettext ptest pkgconfig
32PTEST_ENABLED:libc-musl = "0"
33
34EXTRA_OECONF = "--program-prefix=eu-"
35
Andrew Geisslerd5838332022-05-27 11:33:10 -050036BUILD_CFLAGS += "-Wno-error=stringop-overflow"
37
Andrew Geissler595f6302022-01-24 19:11:47 +000038DEPENDS_BZIP2 = "bzip2-replacement-native"
39DEPENDS_BZIP2:class-target = "bzip2"
40
41PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'debuginfod', 'debuginfod libdebuginfod', '', d)}"
42PACKAGECONFIG[bzip2] = "--with-bzlib,--without-bzlib,${DEPENDS_BZIP2}"
43PACKAGECONFIG[xz] = "--with-lzma,--without-lzma,xz"
44PACKAGECONFIG[zstd] = "--with-zstd,--without-zstd,zstd"
45PACKAGECONFIG[libdebuginfod] = "--enable-libdebuginfod,--disable-libdebuginfod,curl"
46PACKAGECONFIG[debuginfod] = "--enable-debuginfod,--disable-debuginfod,libarchive sqlite3 libmicrohttpd"
47
48RDEPENDS:${PN}-ptest += "libasm libelf bash make coreutils ${PN}-binutils iproute2-ss bsdtar gcc-symlinks binutils-symlinks libgcc-dev"
49
50EXTRA_OECONF:append:class-target = " --disable-tests-rpath"
51
Patrick Williamsdb4c27e2022-08-05 08:10:29 -050052# symver functions not currently supported on microblaze
53EXTRA_OECONF:append:class-target:microblaze = " --disable-symbol-versioning"
54
Andrew Geissler595f6302022-01-24 19:11:47 +000055RDEPENDS:${PN}-ptest:append:libc-glibc = " glibc-utils glibc-dbg glibc-dev"
56INSANE_SKIP:${PN}-ptest = "debug-deps dev-deps"
57
58do_compile_ptest() {
59 cd ${B}/tests
60 oe_runmake buildtest-TESTS oecheck
61}
Andrew Geissler615f2f12022-07-15 14:00:58 -050062PTEST_PARALLEL_MAKE = ""
Andrew Geissler595f6302022-01-24 19:11:47 +000063
64do_install_ptest() {
65 if [ ${PTEST_ENABLED} = "1" ]; then
66 # copy the files which needed by the cases
67 TEST_FILES="strip strip.o addr2line elfcmp objdump readelf size.o nm.o nm elflint elfcompress elfclassify stack unstrip"
68 install -d -m 755 ${D}${PTEST_PATH}/src
69 install -d -m 755 ${D}${PTEST_PATH}/libelf
70 install -d -m 755 ${D}${PTEST_PATH}/libdw
71 install -d -m 755 ${D}${PTEST_PATH}/libdwfl
72 install -d -m 755 ${D}${PTEST_PATH}/libdwelf
73 install -d -m 755 ${D}${PTEST_PATH}/libasm
74 install -d -m 755 ${D}${PTEST_PATH}/libcpu
75 install -d -m 755 ${D}${PTEST_PATH}/libebl
76 for test_file in ${TEST_FILES}; do
77 if [ -f ${B}/src/${test_file} ]; then
78 cp -r ${B}/src/${test_file} ${D}${PTEST_PATH}/src
79 fi
80 done
81 cp ${D}${libdir}/libelf-${PV}.so ${D}${PTEST_PATH}/libelf/libelf.so
82 cp ${D}${libdir}/libdw-${PV}.so ${D}${PTEST_PATH}/libdw/libdw.so
83 cp ${D}${libdir}/libasm-${PV}.so ${D}${PTEST_PATH}/libasm/libasm.so
84 cp ${B}/libcpu/libcpu.a ${D}${PTEST_PATH}/libcpu/
85 cp ${B}/libebl/libebl.a ${D}${PTEST_PATH}/libebl/
86 cp ${S}/libelf/*.h ${D}${PTEST_PATH}/libelf/
87 cp ${S}/libdw/*.h ${D}${PTEST_PATH}/libdw/
88 cp ${S}/libdwfl/*.h ${D}${PTEST_PATH}/libdwfl/
89 cp ${S}/libdwelf/*.h ${D}${PTEST_PATH}/libdwelf/
90 cp ${S}/libasm/*.h ${D}${PTEST_PATH}/libasm/
91 cp -r ${S}/tests/ ${D}${PTEST_PATH}
92 cp -r ${B}/tests/* ${D}${PTEST_PATH}/tests
93 cp -r ${B}/config.h ${D}${PTEST_PATH}
94 cp -r ${B}/backends ${D}${PTEST_PATH}
95 cp -r ${B}/debuginfod ${D}${PTEST_PATH}
96 sed -i '/^Makefile:/c Makefile:' ${D}${PTEST_PATH}/tests/Makefile
97 find ${D}${PTEST_PATH} -type f -name *.[hoc] | xargs -i rm {}
98 fi
99}
100
101EXTRA_OEMAKE:class-native = ""
102EXTRA_OEMAKE:class-nativesdk = ""
103
104BBCLASSEXTEND = "native nativesdk"
105
106# Package utilities separately
107PACKAGES =+ "${PN}-binutils libelf libasm libdw libdebuginfod"
108
Andrew Geissler9aee5002022-03-30 16:27:02 +0000109# Shared libraries are licensed GPL-2.0-only or GPL-3.0-or-later, binaries
110# GPL-3.0-or-later. According to NEWS file:
Andrew Geissler595f6302022-01-24 19:11:47 +0000111# "The license is now GPLv2/LGPLv3+ for the libraries and GPLv3+ for stand-alone
112# programs. There is now also a formal CONTRIBUTING document describing how to
113# submit patches."
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000114LICENSE:${PN}-binutils = "GPL-3.0-or-later"
115LICENSE:${PN} = "GPL-3.0-or-later"
116LICENSE:libelf = "GPL-2.0-only | LGPL-3.0-or-later"
117LICENSE:libasm = "GPL-2.0-only | LGPL-3.0-or-later"
118LICENSE:libdw = "GPL-2.0-only | LGPL-3.0-or-later"
119LICENSE:libdebuginfod = "GPL-2.0-or-later | LGPL-3.0-or-later"
Andrew Geissler595f6302022-01-24 19:11:47 +0000120
121FILES:${PN}-binutils = "\
122 ${bindir}/eu-addr2line \
123 ${bindir}/eu-ld \
124 ${bindir}/eu-nm \
125 ${bindir}/eu-readelf \
126 ${bindir}/eu-size \
127 ${bindir}/eu-strip"
128
129FILES:libelf = "${libdir}/libelf-${PV}.so ${libdir}/libelf.so.*"
130FILES:libasm = "${libdir}/libasm-${PV}.so ${libdir}/libasm.so.*"
131FILES:libdw = "${libdir}/libdw-${PV}.so ${libdir}/libdw.so.* ${libdir}/elfutils/lib*"
132FILES:libdebuginfod = "${libdir}/libdebuginfod-${PV}.so ${libdir}/libdebuginfod.so.*"
133# Some packages have the version preceeding the .so instead properly
134# versioned .so.<version>, so we need to reorder and repackage.
135#FILES:${PN} += "${libdir}/*-${PV}.so ${base_libdir}/*-${PV}.so"
136#FILES_SOLIBSDEV = "${libdir}/libasm.so ${libdir}/libdw.so ${libdir}/libelf.so"
137
138# The package contains symlinks that trip up insane
139INSANE_SKIP:${MLPREFIX}libdw = "dev-so"
140# The nlist binary in the tests uses explicitly minimal compiler flags
141INSANE_SKIP:${PN}-ptest += "ldflags"
142
143# avoid stripping some generated binaries otherwise some of the tests such as test-nlist,
144# run-strip-reloc.sh, run-strip-strmerge.sh and so on will fail
145INHIBIT_PACKAGE_STRIP_FILES = "\
146 ${PKGD}${PTEST_PATH}/tests/test-nlist \
147 ${PKGD}${PTEST_PATH}/tests/elfstrmerge \
148 ${PKGD}${PTEST_PATH}/tests/backtrace-child \
149 ${PKGD}${PTEST_PATH}/tests/backtrace-data \
150 ${PKGD}${PTEST_PATH}/tests/backtrace-dwarf \
151 ${PKGD}${PTEST_PATH}/tests/deleted \
152 ${PKGD}${PTEST_PATH}/tests/dwfllines \
153 ${PKGD}${PTEST_PATH}/src/strip \
154 ${PKGD}${PTEST_PATH}/src/addr2line \
155 ${PKGD}${PTEST_PATH}/src/elfcmp \
156 ${PKGD}${PTEST_PATH}/src/objdump \
157 ${PKGD}${PTEST_PATH}/src/readelf \
158 ${PKGD}${PTEST_PATH}/src/nm \
159 ${PKGD}${PTEST_PATH}/src/elflint \
160 ${PKGD}${PTEST_PATH}/src/elfclassify \
161 ${PKGD}${PTEST_PATH}/src/stack \
162 ${PKGD}${PTEST_PATH}/src/unstrip \
163 ${PKGD}${PTEST_PATH}/libelf/libelf.so \
164 ${PKGD}${PTEST_PATH}/libdw/libdw.so \
165 ${PKGD}${PTEST_PATH}/libasm/libasm.so \
166 ${PKGD}${PTEST_PATH}/backends/libebl_i386.so \
167 ${PKGD}${PTEST_PATH}/backends/libebl_x86_64.so \
168"
169
170PRIVATE_LIBS:${PN}-ptest = "libdw.so.1 libelf.so.1 libasm.so.1 libdebuginfod.so.1"