[elfutils] Update to 0.191, cleanup, fix (#39228)

This commit is contained in:
Kai Pastor 2024-06-12 23:32:20 +02:00 committed by GitHub
parent 710a3478fb
commit 9fcfb7b480
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 261 additions and 90 deletions

View File

@ -1,47 +0,0 @@
diff --git a/src/Makefile.am b/src/Makefile.am
index e462e7d7a..7f68d0348 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -41,8 +41,8 @@ CLEANFILES += make-debug-archive
if BUILD_STATIC
libasm = ../libasm/libasm.a
-libdw = ../libdw/libdw.a -lz $(zip_LIBS) $(libelf) -ldl -lpthread
-libelf = ../libelf/libelf.a -lz
+libdw = ../libdw/libdw.a $(zip_LIBS) $(libelf) -ldl -lpthread
+libelf = ../libelf/libelf.a $(zip_LIBS)
else
libasm = ../libasm/libasm.so
libdw = ../libdw/libdw.so
diff --git a/configure.ac b/configure.ac
index 5a2dc373e..b1928831e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -383,7 +383,7 @@ AM_CONDITIONAL(TESTS_RPATH, test "$tests_use_rpath" = yes)
dnl zlib is mandatory.
save_LIBS="$LIBS"
LIBS=
-eu_ZIPLIB(zlib,ZLIB,z,gzdirect,gzip)
+eu_ZIPLIB(zlib,ZLIB,[z zlib zlibd],gzdirect,gzip)
AS_IF([test "x$with_zlib" = xno], [AC_MSG_ERROR([zlib not found but is required])])
LIBS="$save_LIBS"
@@ -391,13 +391,13 @@ dnl Test for bzlib and xz/lzma, gives BZLIB/LZMALIB .am
dnl conditional and config.h USE_BZLIB/USE_LZMALIB/USE_ZSTD #define.
save_LIBS="$LIBS"
LIBS=
-eu_ZIPLIB(bzlib,BZLIB,bz2,BZ2_bzdopen,bzip2)
+eu_ZIPLIB(bzlib,BZLIB,[bz2 bz2d],BZ2_bzdopen,bzip2)
# We need this since bzip2 doesn't have a pkgconfig file.
BZ2_LIB="$LIBS"
AC_SUBST([BZ2_LIB])
eu_ZIPLIB(lzma,LZMA,lzma,lzma_auto_decoder,[LZMA (xz)])
AS_IF([test "x$with_lzma" = xyes], [LIBLZMA="liblzma"], [LIBLZMA=""])
AC_SUBST([LIBLZMA])
eu_ZIPLIB(zstd,ZSTD,zstd,ZSTD_decompress,[ZSTD (zst)])
AS_IF([test "x$with_zstd" = xyes], [LIBZSTD="libzstd"], [LIBLZSTD=""])
AC_SUBST([LIBZSTD])
-zip_LIBS="$LIBS"
+zip_LIBS="$LIBS $ac_cv_search_lzma_auto_decoder $ac_cv_search_BZ2_bzdopen $ac_cv_search_gzdirect $ac_cv_search_ZSTD_decompress"
LIBS="$save_LIBS"
AC_SUBST([zip_LIBS])

View File

@ -0,0 +1,20 @@
diff --git a/config/eu.am b/config/eu.am
index e6c241f..4136e7c 100644
--- a/config/eu.am
+++ b/config/eu.am
@@ -99,7 +99,6 @@ AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \
$(LOGICAL_OP_WARNING) $(DUPLICATED_COND_WARNING) \
$(NULL_DEREFERENCE_WARNING) $(IMPLICIT_FALLTHROUGH_WARNING) \
$(USE_AFTER_FREE3_WARNING) \
- $(if $($(*F)_no_Werror),,-Werror) \
$(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
$(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
$(if $($(*F)_no_Wpacked_not_aligned),$(NO_PACKED_NOT_ALIGNED_WARNING),) \
@@ -109,7 +108,6 @@ AM_CXXFLAGS = -std=c++11 -Wall -Wshadow \
$(TRAMPOLINES_WARNING) \
$(LOGICAL_OP_WARNING) $(DUPLICATED_COND_WARNING) \
$(NULL_DEREFERENCE_WARNING) $(IMPLICIT_FALLTHROUGH_WARNING) \
- $(if $($(*F)_no_Werror),,-Werror) \
$(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
$(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
$(if $($(*F)_no_Wpacked_not_aligned),$(NO_PACKED_NOT_ALIGNED_WARNING),) \

View File

@ -0,0 +1,97 @@
diff --git a/config/libdw.pc.in b/config/libdw.pc.in
index 2e83a43..bdfc808 100644
--- a/config/libdw.pc.in
+++ b/config/libdw.pc.in
@@ -18,5 +18,4 @@ Requires: libelf = @VERSION@
# We support various compressed ELF images, but don't export any of the
# data structures or functions. zlib (gz) is always required, bzip2 (bz2)
# lzma (xz) and zstd () are optional. But bzip2 doesn't have a pkg-config file.
-Requires.private: zlib @LIBLZMA@ @LIBZSTD@
-Libs.private: @BZ2_LIB@
+Requires.private: zlib @LIBLZMA@ @LIBZSTD@ bzip2
diff --git a/configure.ac b/configure.ac
index 7bb1b0e..09b8d06 100644
--- a/configure.ac
+++ b/configure.ac
@@ -426,6 +426,8 @@ AM_CONDITIONAL(TESTS_RPATH, test "$tests_use_rpath" = yes)
dnl zlib is mandatory.
save_LIBS="$LIBS"
LIBS=
+PKG_PROG_PKG_CONFIG
+PKG_CHECK_MODULES([ZLIB], [zlib], [LIBS="$ZLIB_LIBS $LIBS"], AC_MSG_ERROR([zlib not found]))
eu_ZIPLIB(zlib,ZLIB,z,gzdirect,gzip)
AS_IF([test "x$with_zlib" = xno], [AC_MSG_ERROR([zlib not found but is required])])
LIBS="$save_LIBS"
@@ -434,13 +436,16 @@ dnl Test for bzlib and xz/lzma/zstd, gives BZLIB/LZMALIB/ZSTD .am
dnl conditional and config.h USE_BZLIB/USE_LZMALIB/USE_ZSTD #define.
save_LIBS="$LIBS"
LIBS=
+PKG_CHECK_MODULES([BZLIB], [bzip2], [LIBS="$BZLIB_LIBS $LIBS"], AC_MSG_ERROR([bzip2 not found]))
eu_ZIPLIB(bzlib,BZLIB,bz2,BZ2_bzdopen,bzip2)
# We need this since bzip2 doesn't have a pkgconfig file.
BZ2_LIB="$LIBS"
AC_SUBST([BZ2_LIB])
+PKG_CHECK_MODULES([LZMA], [liblzma], [LIBS="$LZMA_LIBS $LIBS"], AC_MSG_ERROR([liblzma not found]))
eu_ZIPLIB(lzma,LZMA,lzma,lzma_auto_decoder,[LZMA (xz)])
AS_IF([test "x$with_lzma" = xyes], [LIBLZMA="liblzma"], [LIBLZMA=""])
AC_SUBST([LIBLZMA])
+PKG_CHECK_MODULES([ZSTD], [libzstd], [LIBS="$ZSTDLIBS $LIBS"], AC_MSG_ERROR([libzstd not found]))
eu_ZIPLIB(zstd,ZSTD,zstd,ZSTD_decompress,[ZSTD (zst)])
AS_IF([test "x$with_zstd" = xyes], [LIBZSTD="libzstd"], [LIBLZSTD=""])
AC_SUBST([LIBZSTD])
diff --git a/debuginfod/Makefile.am b/debuginfod/Makefile.am
index 0a129fa..b90ed23 100644
--- a/debuginfod/Makefile.am
+++ b/debuginfod/Makefile.am
@@ -42,8 +42,8 @@ program_transform_name = s,x,x,
if BUILD_STATIC
libasm = ../libasm/libasm.a
-libdw = ../libdw/libdw.a -lz $(zip_LIBS) $(libelf) $(libebl) -ldl -lpthread
-libelf = ../libelf/libelf.a -lz
+libdw = ../libdw/libdw.a $(ZLIB_LIBS) $(zip_LIBS) $(libelf) $(libebl) -ldl -lpthread
+libelf = ../libelf/libelf.a $(ZLIB_LIBS) $(zip_LIBS)
if DUMMY_LIBDEBUGINFOD
libdebuginfod = ./libdebuginfod.a
else
diff --git a/libdw/Makefile.am b/libdw/Makefile.am
index 5363c02..045cde5 100644
--- a/libdw/Makefile.am
+++ b/libdw/Makefile.am
@@ -110,7 +110,7 @@ libdw_so_LIBS = ../libebl/libebl_pic.a ../backends/libebl_backends_pic.a \
../libcpu/libcpu_pic.a libdw_pic.a ../libdwelf/libdwelf_pic.a \
../libdwfl/libdwfl_pic.a
libdw_so_DEPS = ../lib/libeu.a ../libelf/libelf.so
-libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(fts_LIBS) $(obstack_LIBS) $(zip_LIBS) -pthread
+libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl $(ZLIB_LIBS) $(argp_LDADD) $(fts_LIBS) $(obstack_LIBS) $(zip_LIBS) -pthread
libdw.so: $(srcdir)/libdw.map $(libdw_so_LIBS) $(libdw_so_DEPS)
$(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \
-Wl,--soname,$@.$(VERSION),--enable-new-dtags \
diff --git a/libelf/Makefile.am b/libelf/Makefile.am
index 3402863..30a331e 100644
--- a/libelf/Makefile.am
+++ b/libelf/Makefile.am
@@ -106,7 +106,7 @@ libelf_pic_a_SOURCES =
am_libelf_pic_a_OBJECTS = $(libelf_a_SOURCES:.c=.os)
libelf_so_DEPS = ../lib/libeu.a
-libelf_so_LDLIBS = $(libelf_so_DEPS) -lz $(zstd_LIBS)
+libelf_so_LDLIBS = $(libelf_so_DEPS) $(ZLIB_LIBS) $(zstd_LIBS)
if USE_LOCKS
libelf_so_LDLIBS += -lpthread
endif
diff --git a/src/Makefile.am b/src/Makefile.am
index 69620db..33f7f4b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -41,8 +41,8 @@ CLEANFILES += make-debug-archive
if BUILD_STATIC
libasm = ../libasm/libasm.a
-libdw = ../libdw/libdw.a -lz $(zip_LIBS) $(libelf) -ldl -lpthread
-libelf = ../libelf/libelf.a -lz $(zstd_LIBS)
+libdw = ../libdw/libdw.a $(ZLIB_LIBS) $(zip_LIBS) $(libelf) -ldl -lpthread
+libelf = ../libelf/libelf.a $(ZLIB_LIBS) $(zstd_LIBS)
if LIBDEBUGINFOD
libdebuginfod = ../debuginfod/libdebuginfod.a -lpthread $(libcurl_LIBS)
else

View File

@ -1,9 +1,17 @@
vcpkg_from_git(
OUT_SOURCE_PATH SOURCE_PATH
URL https://sourceware.org/git/elfutils
REF ca4a785fc3061c7d136b198e9ffe0b14cf90c2be #elfutils-0.186
vcpkg_download_distfile(ARCHIVE
URLS "https://sourceware.org/pub/elfutils/${VERSION}/elfutils-${VERSION}.tar.bz2"
"https://www.mirrorservice.org/sites/sourceware.org/pub/elfutils/${VERSION}/elfutils-${VERSION}.tar.bz2"
FILENAME "elfutils-${VERSION}.tar.bz2"
SHA512 e22d85f25317a79b36d370347e50284c9120c86f9830f08791b7b6a7b4ad89b9bf4c7c71129133b8d193a0edffb2a2c17987b7e48428b9670aff5ce918777e04
)
PATCHES configure.ac.patch
vcpkg_extract_source_archive(SOURCE_PATH
ARCHIVE "${ARCHIVE}"
PATCHES
disable-werror.diff
link-libs.diff
rpath-link.diff
static-tools.diff
)
vcpkg_find_acquire_program(FLEX)
@ -13,48 +21,74 @@ vcpkg_find_acquire_program(BISON)
get_filename_component(BISON_DIR "${BISON}" DIRECTORY )
vcpkg_add_to_path(PREPEND "${BISON_DIR}")
set(options "")
if(NOT "libdebuginfod" IN_LIST FEATURES)
list(APPEND options "--enable-libdebuginfod=no")
endif()
if("nls" IN_LIST FEATURES)
vcpkg_add_to_path(PREPEND "${CURRENT_HOST_INSTALLED_DIR}/tools/gettext/bin")
else()
set(ENV{AUTOPOINT} true) # the program
list(APPEND options "--enable-nls=no")
endif()
vcpkg_configure_make(
SOURCE_PATH ${SOURCE_PATH}
SOURCE_PATH "${SOURCE_PATH}"
AUTOCONFIG
OPTIONS --disable-debuginfod
--enable-libdebuginfod=dummy
--with-zlib
--with-bzlib
--with-lzma
--with-zstd
--enable-maintainer-mode
OPTIONS_RELEASE
ac_cv_null_dereference=no # deactivating Werror due to null dereferences since NDEBUG is passed and asserts thus disabled/removed
OPTIONS
${options}
--enable-debuginfod=no
--with-bzlib
--with-lzma
--with-zlib
--with-zstd
)
vcpkg_install_make()
file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libdebuginfod.pc" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libdebuginfod.pc") #--disable-debuginfod
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/etc/debuginfod" "${CURRENT_PACKAGES_DIR}/etc/debuginfod")
vcpkg_fixup_pkgconfig()
vcpkg_fixup_pkgconfig(SYSTEM_LIBRARIES pthread)
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/etc"
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
"${CURRENT_PACKAGES_DIR}/etc/debuginfod"
"${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug"
)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/locale)
# Remove files with wrong linkage
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(_lib_suffix "${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX}")
set(wrong_suffix "${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX}")
else()
set(_lib_suffix "${VCPKG_TARGET_SHARED_LIBRARY_SUFFIX}")
set(wrong_suffix "${VCPKG_TARGET_SHARED_LIBRARY_SUFFIX}")
endif()
file(GLOB_RECURSE TO_REMOVE "${CURRENT_PACKAGES_DIR}/lib/*${_lib_suffix}" "${CURRENT_PACKAGES_DIR}/debug/lib/*${_lib_suffix}" "${CURRENT_PACKAGES_DIR}/lib/*${_lib_suffix}.*" "${CURRENT_PACKAGES_DIR}/debug/lib/*${_lib_suffix}.*")
file(REMOVE ${TO_REMOVE})
file(GLOB wrong_libs
"${CURRENT_PACKAGES_DIR}/lib/*${wrong_suffix}"
"${CURRENT_PACKAGES_DIR}/lib/*${wrong_suffix}.*"
"${CURRENT_PACKAGES_DIR}/debug/lib/*${wrong_suffix}"
"${CURRENT_PACKAGES_DIR}/debug/lib/*${wrong_suffix}.*"
)
file(REMOVE ${wrong_libs})
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/etc/profile.d/debuginfod.sh" "${CURRENT_INSTALLED_DIR}" "`dirname $0`/../..")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/etc")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/elfutils/bin/eu-make-debug-archive" "${CURRENT_INSTALLED_DIR}" "`dirname $0`/../../..")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/tools/elfutils/debug")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin/eu-make-debug-archive" "${CURRENT_INSTALLED_DIR}" "`dirname $0`/../../..")
if("libdebuginfod" IN_LIST FEATURES)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/etc/profile.d/debuginfod.sh" "${CURRENT_INSTALLED_DIR}" "`dirname $0`/../..")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/etc/profile.d/debuginfod.csh" "${CURRENT_INSTALLED_DIR}" "`dirname $0`/../..")
endif()
# # Handle copyright
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
if(VCPKG_LIBRARY_LINKAGE STREQUAL static OR NOT VCPKG_TARGET_IS_WINDOWS)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
vcpkg_install_copyright(
COMMENT [[
The libraries are subject to LGPL-3.0-or-later OR GPL-2.0-or-later (cf. COPYING-LGPLV3, COPYING-GPLV2).
The tools are subject to GPL-3.0-or-later (cf. COPYING).
For additional terms, see the following source files:
- doc/readelf.1 (GFDL-NIV-1.3)
- lib/stdatomic-fbsd.h (BSD-2-Clause)
- libcpu/i386_parse.* (GPL-3+ with Bison exception)
- libelf/dl-hash.h (LGPL-2.1+)
- libelf/elf.h (LGPL-2.1+)
]]
FILE_LIST
"${SOURCE_PATH}/COPYING-LGPLV3"
"${SOURCE_PATH}/COPYING"
"${SOURCE_PATH}/COPYING-GPLV2"
)

View File

@ -0,0 +1,26 @@
diff --git a/debuginfod/Makefile.am b/debuginfod/Makefile.am
index db27b2a..b90ed23 100644
--- a/debuginfod/Makefile.am
+++ b/debuginfod/Makefile.am
@@ -58,7 +58,7 @@ endif
libebl = ../libebl/libebl.a
libeu = ../lib/libeu.a
-AM_LDFLAGS = -Wl,-rpath-link,../libelf:../libdw:.
+AM_LDFLAGS = -Wl,-rpath-link,../libelf:../libdw:.:$(libdir)
bin_PROGRAMS =
if DEBUGINFOD
diff --git a/src/Makefile.am b/src/Makefile.am
index 8e35512..33f7f4b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -23,7 +23,7 @@ AM_CPPFLAGS += -I$(srcdir)/../libelf -I$(srcdir)/../libebl \
-I$(srcdir)/../libdw -I$(srcdir)/../libdwelf \
-I$(srcdir)/../libdwfl -I$(srcdir)/../libasm -I../debuginfod
-AM_LDFLAGS = -Wl,-rpath-link,../libelf:../libdw $(STACK_USAGE_NO_ERROR)
+AM_LDFLAGS = -Wl,-rpath-link,../libelf:../libdw:$(libdir) $(STACK_USAGE_NO_ERROR)
bin_PROGRAMS = readelf nm size strip elflint findtextrel addr2line \
elfcmp objdump ranlib strings ar unstrip stack elfcompress \

View File

@ -0,0 +1,12 @@
diff --git a/configure.ac b/configure.ac
index bbe8673..7bb1b0e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -415,6 +415,7 @@ AS_HELP_STRING([--enable-install-elfh],[install elf.h in include dir]),
AM_CONDITIONAL(INSTALL_ELFH, test "$install_elfh" = yes)
AM_CONDITIONAL(BUILD_STATIC, [dnl
+test "$enable_static" = yes ||
test "$use_gprof" = yes -o "$use_gcov" = yes])
AC_ARG_ENABLE([tests-rpath],

View File

@ -1,7 +1,6 @@
{
"name": "elfutils",
"version": "0.186",
"port-version": 4,
"version": "0.191",
"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.",
"homepage": "https://sourceware.org/elfutils/",
"license": null,
@ -11,5 +10,30 @@
"liblzma",
"zlib",
"zstd"
]
],
"features": {
"libdebuginfod": {
"description": "Build the debuginfod library.",
"dependencies": [
{
"name": "curl",
"default-features": false
}
]
},
"nls": {
"description": "Enable native language support",
"dependencies": [
{
"name": "gettext",
"host": true,
"default-features": false,
"features": [
"tools"
]
},
"gettext-libintl"
]
}
}
}

View File

@ -2505,8 +2505,8 @@
"port-version": 0
},
"elfutils": {
"baseline": "0.186",
"port-version": 4
"baseline": "0.191",
"port-version": 0
},
"embree3": {
"baseline": "3.13.5",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "68e8ad67d63cbd8f4d0588a361bd498a675595cd",
"version": "0.191",
"port-version": 0
},
{
"git-tree": "6f16a19e22e33e89ff809c74983035b93a50038e",
"version": "0.186",