blob: 7aebaf1b6d594ed1097a84b61c4a4659778fc80d [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001SUMMARY = "Utilities and libraries for handling compiled object files"
2HOMEPAGE = "https://sourceware.org/elfutils"
Andrew Geissler90fd73c2021-03-05 15:25:55 -06003DESCRIPTION = "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."
Andrew Geissler82c905d2020-04-13 13:39:40 -05004SECTION = "base"
Andrew Geisslerd1e89492021-02-12 15:35:20 -06005LICENSE = "GPLv2 & GPLv2+ & LGPLv3+ & GPLv3+"
6LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \
7 file://debuginfod/debuginfod-client.c;endline=27;md5=f8e9d171c401c493ec45a0b2992ea2ed \
8 "
Andrew Geissler82c905d2020-04-13 13:39:40 -05009DEPENDS = "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 \
Andrew Geissler82c905d2020-04-13 13:39:40 -050017 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 \
Andrew Geissler82c905d2020-04-13 13:39:40 -050020 file://0001-skip-the-test-when-gcc-not-deployed.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050021 file://run-ptest \
22 file://ptest.patch \
Andrew Geissler475cb722020-07-10 16:00:51 -050023 file://0001-tests-Makefile.am-compile-test_nlist-with-standard-C.patch \
Andrew Geisslerd1e89492021-02-12 15:35:20 -060024 file://0001-add-support-for-ipkg-to-debuginfod.cxx.patch \
Andrew Geisslerc926e172021-05-07 16:11:35 -050025 file://0001-debuginfod-debuginfod-client.c-correct-string-format.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050026 "
27SRC_URI_append_libc-musl = " \
Andrew Geissler82c905d2020-04-13 13:39:40 -050028 file://0002-musl-libs.patch \
29 file://0003-musl-utils.patch \
30 file://0004-Fix-error-on-musl.patch \
Andrew Geissler475cb722020-07-10 16:00:51 -050031 file://0015-config-eu.am-do-not-use-Werror.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050032 "
Andrew Geissler90fd73c2021-03-05 15:25:55 -060033SRC_URI[sha256sum] = "c3637c208d309d58714a51e61e63f1958808fead882e9b607506a29e5474f2c5"
Andrew Geissler82c905d2020-04-13 13:39:40 -050034
35inherit autotools gettext ptest pkgconfig
36
Andrew Geisslerd1e89492021-02-12 15:35:20 -060037EXTRA_OECONF = "--program-prefix=eu-"
Andrew Geissler82c905d2020-04-13 13:39:40 -050038
39DEPENDS_BZIP2 = "bzip2-replacement-native"
40DEPENDS_BZIP2_class-target = "bzip2"
41
Andrew Geisslerc926e172021-05-07 16:11:35 -050042PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'debuginfod', 'debuginfod libdebuginfod', '', d)}"
Andrew Geissler82c905d2020-04-13 13:39:40 -050043PACKAGECONFIG[bzip2] = "--with-bzlib,--without-bzlib,${DEPENDS_BZIP2}"
44PACKAGECONFIG[xz] = "--with-lzma,--without-lzma,xz"
Andrew Geissler6ce62a22020-11-30 19:58:47 -060045PACKAGECONFIG[libdebuginfod] = "--enable-libdebuginfod,--disable-libdebuginfod,curl"
Andrew Geisslerd1e89492021-02-12 15:35:20 -060046PACKAGECONFIG[debuginfod] = "--enable-debuginfod,--disable-debuginfod,libarchive sqlite3 libmicrohttpd"
Andrew Geissler82c905d2020-04-13 13:39:40 -050047
Andrew Geisslerc926e172021-05-07 16:11:35 -050048RDEPENDS_${PN}-ptest += "libasm libelf bash make coreutils ${PN}-binutils iproute2-ss bsdtar"
Andrew Geissler82c905d2020-04-13 13:39:40 -050049
50EXTRA_OECONF_append_class-target = " --disable-tests-rpath"
51
52RDEPENDS_${PN}-ptest_append_libc-glibc = " glibc-utils"
53
54do_compile_ptest() {
55 cd ${B}/tests
56 oe_runmake buildtest-TESTS oecheck
57}
58
59do_install_ptest() {
60 if [ ${PTEST_ENABLED} = "1" ]; then
61 # copy the files which needed by the cases
62 TEST_FILES="strip strip.o addr2line elfcmp objdump readelf size.o nm.o nm elflint elfcompress elfclassify stack unstrip"
63 install -d -m 755 ${D}${PTEST_PATH}/src
64 install -d -m 755 ${D}${PTEST_PATH}/libelf
65 install -d -m 755 ${D}${PTEST_PATH}/libdw
Andrew Geissler6ce62a22020-11-30 19:58:47 -060066 install -d -m 755 ${D}${PTEST_PATH}/libdwfl
67 install -d -m 755 ${D}${PTEST_PATH}/libdwelf
Andrew Geissler82c905d2020-04-13 13:39:40 -050068 install -d -m 755 ${D}${PTEST_PATH}/libasm
Andrew Geissler90fd73c2021-03-05 15:25:55 -060069 install -d -m 755 ${D}${PTEST_PATH}/libcpu
70 install -d -m 755 ${D}${PTEST_PATH}/libebl
Andrew Geissler82c905d2020-04-13 13:39:40 -050071 for test_file in ${TEST_FILES}; do
72 if [ -f ${B}/src/${test_file} ]; then
73 cp -r ${B}/src/${test_file} ${D}${PTEST_PATH}/src
74 fi
75 done
76 cp ${D}${libdir}/libelf-${PV}.so ${D}${PTEST_PATH}/libelf/libelf.so
77 cp ${D}${libdir}/libdw-${PV}.so ${D}${PTEST_PATH}/libdw/libdw.so
78 cp ${D}${libdir}/libasm-${PV}.so ${D}${PTEST_PATH}/libasm/libasm.so
Andrew Geissler90fd73c2021-03-05 15:25:55 -060079 cp ${B}/libcpu/libcpu.a ${D}${PTEST_PATH}/libcpu/
80 cp ${B}/libebl/libebl.a ${D}${PTEST_PATH}/libebl/
Andrew Geissler6ce62a22020-11-30 19:58:47 -060081 cp ${S}/libelf/*.h ${D}${PTEST_PATH}/libelf/
82 cp ${S}/libdw/*.h ${D}${PTEST_PATH}/libdw/
83 cp ${S}/libdwfl/*.h ${D}${PTEST_PATH}/libdwfl/
84 cp ${S}/libdwelf/*.h ${D}${PTEST_PATH}/libdwelf/
85 cp ${S}/libasm/*.h ${D}${PTEST_PATH}/libasm/
Andrew Geissler82c905d2020-04-13 13:39:40 -050086 cp -r ${S}/tests/ ${D}${PTEST_PATH}
87 cp -r ${B}/tests/* ${D}${PTEST_PATH}/tests
88 cp -r ${B}/config.h ${D}${PTEST_PATH}
89 cp -r ${B}/backends ${D}${PTEST_PATH}
Andrew Geisslerc926e172021-05-07 16:11:35 -050090 cp -r ${B}/debuginfod ${D}${PTEST_PATH}
Andrew Geissler82c905d2020-04-13 13:39:40 -050091 sed -i '/^Makefile:/c Makefile:' ${D}${PTEST_PATH}/tests/Makefile
92 find ${D}${PTEST_PATH} -type f -name *.[hoc] | xargs -i rm {}
93 fi
94}
95
96EXTRA_OEMAKE_class-native = ""
97EXTRA_OEMAKE_class-nativesdk = ""
98
99BBCLASSEXTEND = "native nativesdk"
100
101# Package utilities separately
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600102PACKAGES =+ "${PN}-binutils libelf libasm libdw libdebuginfod"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500103
104# shared libraries are licensed GPLv2 or GPLv3+, binaries GPLv3+
105# according to NEWS file:
106# "The license is now GPLv2/LGPLv3+ for the libraries and GPLv3+ for stand-alone
107# programs. There is now also a formal CONTRIBUTING document describing how to
108# submit patches."
109LICENSE_${PN}-binutils = "GPLv3+"
110LICENSE_${PN} = "GPLv3+"
111LICENSE_libelf = "GPLv2 | LGPLv3+"
112LICENSE_libasm = "GPLv2 | LGPLv3+"
113LICENSE_libdw = "GPLv2 | LGPLv3+"
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600114LICENSE_libdebuginfod = "GPLv2+ | LGPLv3+"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500115
116FILES_${PN}-binutils = "\
117 ${bindir}/eu-addr2line \
118 ${bindir}/eu-ld \
119 ${bindir}/eu-nm \
120 ${bindir}/eu-readelf \
121 ${bindir}/eu-size \
122 ${bindir}/eu-strip"
123
124FILES_libelf = "${libdir}/libelf-${PV}.so ${libdir}/libelf.so.*"
125FILES_libasm = "${libdir}/libasm-${PV}.so ${libdir}/libasm.so.*"
126FILES_libdw = "${libdir}/libdw-${PV}.so ${libdir}/libdw.so.* ${libdir}/elfutils/lib*"
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600127FILES_libdebuginfod = "${libdir}/libdebuginfod-${PV}.so ${libdir}/libdebuginfod.so.*"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500128# Some packages have the version preceeding the .so instead properly
129# versioned .so.<version>, so we need to reorder and repackage.
130#FILES_${PN} += "${libdir}/*-${PV}.so ${base_libdir}/*-${PV}.so"
131#FILES_SOLIBSDEV = "${libdir}/libasm.so ${libdir}/libdw.so ${libdir}/libelf.so"
132
133# The package contains symlinks that trip up insane
134INSANE_SKIP_${MLPREFIX}libdw = "dev-so"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500135# The nlist binary in the tests uses explicitly minimal compiler flags
136INSANE_SKIP_${PN}-ptest += "ldflags"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500137
138# avoid stripping some generated binaries otherwise some of the tests such as test-nlist,
139# run-strip-reloc.sh, run-strip-strmerge.sh and so on will fail
140INHIBIT_PACKAGE_STRIP_FILES = "\
141 ${PKGD}${PTEST_PATH}/tests/test-nlist \
142 ${PKGD}${PTEST_PATH}/tests/elfstrmerge \
143 ${PKGD}${PTEST_PATH}/tests/backtrace-child \
144 ${PKGD}${PTEST_PATH}/tests/backtrace-data \
145 ${PKGD}${PTEST_PATH}/tests/backtrace-dwarf \
146 ${PKGD}${PTEST_PATH}/tests/deleted \
Andrew Geisslerc926e172021-05-07 16:11:35 -0500147 ${PKGD}${PTEST_PATH}/tests/dwfllines \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500148 ${PKGD}${PTEST_PATH}/src/strip \
149 ${PKGD}${PTEST_PATH}/src/addr2line \
150 ${PKGD}${PTEST_PATH}/src/elfcmp \
151 ${PKGD}${PTEST_PATH}/src/objdump \
152 ${PKGD}${PTEST_PATH}/src/readelf \
153 ${PKGD}${PTEST_PATH}/src/nm \
154 ${PKGD}${PTEST_PATH}/src/elflint \
155 ${PKGD}${PTEST_PATH}/src/elfclassify \
156 ${PKGD}${PTEST_PATH}/src/stack \
157 ${PKGD}${PTEST_PATH}/src/unstrip \
158 ${PKGD}${PTEST_PATH}/libelf/libelf.so \
159 ${PKGD}${PTEST_PATH}/libdw/libdw.so \
160 ${PKGD}${PTEST_PATH}/libasm/libasm.so \
161 ${PKGD}${PTEST_PATH}/backends/libebl_i386.so \
162 ${PKGD}${PTEST_PATH}/backends/libebl_x86_64.so \
163"
164
Andrew Geisslerc926e172021-05-07 16:11:35 -0500165PRIVATE_LIBS_${PN}-ptest = "libdw.so.1 libelf.so.1 libasm.so.1 libdebuginfod.so.1"