Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1 | SUMMARY = "Utilities and libraries for handling compiled object files" |
| 2 | HOMEPAGE = "https://sourceware.org/elfutils" |
| 3 | DESCRIPTION = "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." |
| 4 | SECTION = "base" |
Patrick Williams | 705982a | 2024-01-12 09:51:57 -0600 | [diff] [blame] | 5 | LICENSE = "( GPL-2.0-or-later | LGPL-3.0-or-later ) & GPL-3.0-or-later" |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 6 | LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \ |
| 7 | file://debuginfod/debuginfod-client.c;endline=28;md5=f0a7c3170776866ee94e8f9225a6ad79 \ |
| 8 | " |
| 9 | DEPENDS = "zlib virtual/libintl" |
Andrew Geissler | 220dafd | 2023-10-04 10:18:08 -0500 | [diff] [blame] | 10 | DEPENDS:append:libc-musl = " argp-standalone fts musl-legacy-error musl-obstack" |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 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 |
| 13 | SRC_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 \ |
Patrick Williams | 03514f1 | 2024-04-05 07:04:11 -0500 | [diff] [blame] | 24 | file://0001-debuginfod-Remove-unused-variable.patch \ |
| 25 | file://0001-srcfiles-fix-unused-variable-BUFFER_SIZE.patch \ |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 26 | " |
| 27 | SRC_URI:append:libc-musl = " \ |
| 28 | file://0003-musl-utils.patch \ |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 29 | " |
Patrick Williams | b58112e | 2024-03-07 11:16:36 -0600 | [diff] [blame] | 30 | SRC_URI[sha256sum] = "df76db71366d1d708365fc7a6c60ca48398f14367eb2b8954efc8897147ad871" |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 31 | |
| 32 | inherit autotools gettext ptest pkgconfig |
| 33 | |
| 34 | EXTRA_OECONF = "--program-prefix=eu-" |
| 35 | |
Andrew Geissler | 220dafd | 2023-10-04 10:18:08 -0500 | [diff] [blame] | 36 | # Only used at runtime for make check but we want deterministic makefiles for ptest so hardcode |
| 37 | CACHED_CONFIGUREVARS += "ac_cv_prog_HAVE_BUNZIP2=yes" |
| 38 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 39 | BUILD_CFLAGS += "-Wno-error=stringop-overflow" |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 40 | |
| 41 | DEPENDS_BZIP2 = "bzip2-replacement-native" |
| 42 | DEPENDS_BZIP2:class-target = "bzip2" |
| 43 | |
Patrick Williams | 169d7bc | 2024-01-05 11:33:25 -0600 | [diff] [blame] | 44 | PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'debuginfod', 'debuginfod libdebuginfod', '', d)} \ |
| 45 | ${@bb.utils.contains('DISTRO_FEATURES', 'minidebuginfo', 'xz', '', d)} \ |
| 46 | " |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 47 | PACKAGECONFIG[bzip2] = "--with-bzlib,--without-bzlib,${DEPENDS_BZIP2}" |
| 48 | PACKAGECONFIG[xz] = "--with-lzma,--without-lzma,xz" |
| 49 | PACKAGECONFIG[zstd] = "--with-zstd,--without-zstd,zstd" |
| 50 | PACKAGECONFIG[libdebuginfod] = "--enable-libdebuginfod,--disable-libdebuginfod,curl" |
| 51 | PACKAGECONFIG[debuginfod] = "--enable-debuginfod,--disable-debuginfod,libarchive sqlite3 libmicrohttpd" |
| 52 | |
| 53 | RDEPENDS:${PN}-ptest += "libasm libelf bash make coreutils ${PN}-binutils iproute2-ss bsdtar gcc-symlinks binutils-symlinks libgcc-dev" |
| 54 | |
| 55 | EXTRA_OECONF:append:class-target = " --disable-tests-rpath" |
| 56 | |
| 57 | # symver functions not currently supported on microblaze |
| 58 | EXTRA_OECONF:append:class-target:microblaze = " --disable-symbol-versioning" |
| 59 | |
| 60 | RDEPENDS:${PN}-ptest:append:libc-glibc = " glibc-utils glibc-dbg glibc-dev" |
| 61 | INSANE_SKIP:${PN}-ptest = "debug-deps dev-deps" |
| 62 | |
| 63 | do_compile_ptest() { |
| 64 | cd ${B}/tests |
| 65 | oe_runmake buildtest-TESTS oecheck |
| 66 | } |
| 67 | PTEST_PARALLEL_MAKE = "" |
| 68 | |
| 69 | do_install_ptest() { |
| 70 | if [ ${PTEST_ENABLED} = "1" ]; then |
| 71 | # copy the files which needed by the cases |
Patrick Williams | b58112e | 2024-03-07 11:16:36 -0600 | [diff] [blame] | 72 | TEST_FILES="strip strip.o addr2line elfcmp objdump readelf size.o nm.o nm elflint elfcompress elfclassify stack unstrip srcfiles" |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 73 | install -d -m 755 ${D}${PTEST_PATH}/src |
| 74 | install -d -m 755 ${D}${PTEST_PATH}/lib |
| 75 | install -d -m 755 ${D}${PTEST_PATH}/libelf |
| 76 | install -d -m 755 ${D}${PTEST_PATH}/libdw |
| 77 | install -d -m 755 ${D}${PTEST_PATH}/libdwfl |
| 78 | install -d -m 755 ${D}${PTEST_PATH}/libdwelf |
| 79 | install -d -m 755 ${D}${PTEST_PATH}/libasm |
| 80 | install -d -m 755 ${D}${PTEST_PATH}/libcpu |
| 81 | install -d -m 755 ${D}${PTEST_PATH}/libebl |
| 82 | for test_file in ${TEST_FILES}; do |
| 83 | if [ -f ${B}/src/${test_file} ]; then |
| 84 | cp -r ${B}/src/${test_file} ${D}${PTEST_PATH}/src |
| 85 | fi |
| 86 | done |
| 87 | cp ${D}${libdir}/libelf-${PV}.so ${D}${PTEST_PATH}/libelf/libelf.so |
| 88 | cp ${D}${libdir}/libdw-${PV}.so ${D}${PTEST_PATH}/libdw/libdw.so |
| 89 | cp ${D}${libdir}/libasm-${PV}.so ${D}${PTEST_PATH}/libasm/libasm.so |
| 90 | cp ${B}/libcpu/libcpu.a ${D}${PTEST_PATH}/libcpu/ |
| 91 | cp ${B}/libebl/libebl.a ${D}${PTEST_PATH}/libebl/ |
| 92 | cp ${B}/lib/libeu.a ${D}${PTEST_PATH}/lib/ |
| 93 | cp ${S}/libelf/*.h ${D}${PTEST_PATH}/libelf/ |
| 94 | cp ${S}/libdw/*.h ${D}${PTEST_PATH}/libdw/ |
| 95 | cp ${S}/libdwfl/*.h ${D}${PTEST_PATH}/libdwfl/ |
| 96 | cp ${S}/libdwelf/*.h ${D}${PTEST_PATH}/libdwelf/ |
| 97 | cp ${S}/libasm/*.h ${D}${PTEST_PATH}/libasm/ |
| 98 | cp -r ${S}/tests/ ${D}${PTEST_PATH} |
| 99 | cp -r ${B}/tests/* ${D}${PTEST_PATH}/tests |
| 100 | cp -r ${B}/config.h ${D}${PTEST_PATH} |
| 101 | cp -r ${B}/backends ${D}${PTEST_PATH} |
| 102 | cp -r ${B}/debuginfod ${D}${PTEST_PATH} |
| 103 | sed -i '/^Makefile:/c Makefile:' ${D}${PTEST_PATH}/tests/Makefile |
| 104 | find ${D}${PTEST_PATH} -type f -name *.[hoc] | xargs -i rm {} |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 105 | fi |
| 106 | } |
| 107 | |
| 108 | EXTRA_OEMAKE:class-native = "" |
| 109 | EXTRA_OEMAKE:class-nativesdk = "" |
| 110 | |
| 111 | BBCLASSEXTEND = "native nativesdk" |
| 112 | |
Patrick Williams | 705982a | 2024-01-12 09:51:57 -0600 | [diff] [blame] | 113 | # Package utilities and libraries are listed separately |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 114 | PACKAGES =+ "${PN}-binutils libelf libasm libdw libdebuginfod" |
| 115 | |
Patrick Williams | 705982a | 2024-01-12 09:51:57 -0600 | [diff] [blame] | 116 | # According to the upstream website https://sourceware.org/elfutils, the latest |
| 117 | # license policy is as follows: |
| 118 | # "License. The libraries and backends are dual GPLv2+/LGPLv3+. The utilities |
| 119 | # are GPLv3+." |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 120 | LICENSE:${PN}-binutils = "GPL-3.0-or-later" |
| 121 | LICENSE:${PN} = "GPL-3.0-or-later" |
Patrick Williams | 705982a | 2024-01-12 09:51:57 -0600 | [diff] [blame] | 122 | LICENSE:libelf = "GPL-2.0-or-later | LGPL-3.0-or-later" |
| 123 | LICENSE:libasm = "GPL-2.0-or-later | LGPL-3.0-or-later" |
| 124 | LICENSE:libdw = "GPL-2.0-or-later | LGPL-3.0-or-later" |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 125 | LICENSE:libdebuginfod = "GPL-2.0-or-later | LGPL-3.0-or-later" |
| 126 | |
| 127 | FILES:${PN}-binutils = "\ |
| 128 | ${bindir}/eu-addr2line \ |
| 129 | ${bindir}/eu-ld \ |
| 130 | ${bindir}/eu-nm \ |
| 131 | ${bindir}/eu-readelf \ |
| 132 | ${bindir}/eu-size \ |
| 133 | ${bindir}/eu-strip" |
| 134 | |
| 135 | FILES:libelf = "${libdir}/libelf-${PV}.so ${libdir}/libelf.so.*" |
| 136 | FILES:libasm = "${libdir}/libasm-${PV}.so ${libdir}/libasm.so.*" |
| 137 | FILES:libdw = "${libdir}/libdw-${PV}.so ${libdir}/libdw.so.* ${libdir}/elfutils/lib*" |
| 138 | FILES:libdebuginfod = "${libdir}/libdebuginfod-${PV}.so ${libdir}/libdebuginfod.so.*" |
| 139 | # Some packages have the version preceeding the .so instead properly |
| 140 | # versioned .so.<version>, so we need to reorder and repackage. |
| 141 | #FILES:${PN} += "${libdir}/*-${PV}.so ${base_libdir}/*-${PV}.so" |
| 142 | #FILES_SOLIBSDEV = "${libdir}/libasm.so ${libdir}/libdw.so ${libdir}/libelf.so" |
| 143 | |
| 144 | # The package contains symlinks that trip up insane |
| 145 | INSANE_SKIP:${MLPREFIX}libdw = "dev-so" |
| 146 | # The nlist binary in the tests uses explicitly minimal compiler flags |
| 147 | INSANE_SKIP:${PN}-ptest += "ldflags" |
| 148 | |
| 149 | # avoid stripping some generated binaries otherwise some of the tests such as test-nlist, |
| 150 | # run-strip-reloc.sh, run-strip-strmerge.sh and so on will fail |
| 151 | INHIBIT_PACKAGE_STRIP_FILES = "\ |
| 152 | ${PKGD}${PTEST_PATH}/tests/test-nlist \ |
| 153 | ${PKGD}${PTEST_PATH}/tests/elfstrmerge \ |
| 154 | ${PKGD}${PTEST_PATH}/tests/backtrace-child \ |
| 155 | ${PKGD}${PTEST_PATH}/tests/backtrace-data \ |
| 156 | ${PKGD}${PTEST_PATH}/tests/backtrace-dwarf \ |
| 157 | ${PKGD}${PTEST_PATH}/tests/deleted \ |
| 158 | ${PKGD}${PTEST_PATH}/tests/dwfllines \ |
| 159 | ${PKGD}${PTEST_PATH}/src/strip \ |
| 160 | ${PKGD}${PTEST_PATH}/src/addr2line \ |
| 161 | ${PKGD}${PTEST_PATH}/src/elfcmp \ |
| 162 | ${PKGD}${PTEST_PATH}/src/objdump \ |
| 163 | ${PKGD}${PTEST_PATH}/src/readelf \ |
| 164 | ${PKGD}${PTEST_PATH}/src/nm \ |
| 165 | ${PKGD}${PTEST_PATH}/src/elflint \ |
| 166 | ${PKGD}${PTEST_PATH}/src/elfclassify \ |
| 167 | ${PKGD}${PTEST_PATH}/src/stack \ |
| 168 | ${PKGD}${PTEST_PATH}/src/unstrip \ |
Patrick Williams | b58112e | 2024-03-07 11:16:36 -0600 | [diff] [blame] | 169 | ${PKGD}${PTEST_PATH}/src/srcfiles \ |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 170 | ${PKGD}${PTEST_PATH}/libelf/libelf.so \ |
| 171 | ${PKGD}${PTEST_PATH}/libdw/libdw.so \ |
| 172 | ${PKGD}${PTEST_PATH}/libasm/libasm.so \ |
| 173 | ${PKGD}${PTEST_PATH}/backends/libebl_i386.so \ |
| 174 | ${PKGD}${PTEST_PATH}/backends/libebl_x86_64.so \ |
| 175 | " |
| 176 | |
| 177 | PRIVATE_LIBS:${PN}-ptest = "libdw.so.1 libelf.so.1 libasm.so.1 libdebuginfod.so.1" |