[elfutils] add new port (#14771)

* [elfutils] add new port

* update

* Update ports/elfutils/configure.ac.patch

Fix missing ZSTD linkage

* Update ports/elfutils/portfile.cmake

Co-authored-by: Phoebe <20694052+PhoebeHui@users.noreply.github.com>

* add eflutils on osx on CI skiplist

Co-authored-by: wangli28 <wangli28@beyondsoft.com>
Co-authored-by: Phoebe <20694052+PhoebeHui@users.noreply.github.com>
This commit is contained in:
Alexander Neumann 2020-12-01 23:03:02 +01:00 committed by GitHub
parent 50e4bb5290
commit 00553d0269
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 109 additions and 0 deletions

6
ports/elfutils/CONTROL Normal file
View File

@ -0,0 +1,6 @@
Source: elfutils
Version: 0.182
Homepage: https://sourceware.org/elfutils/
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.
Build-Depends: bzip2, zlib, liblzma, zstd
Supports: !windows

View File

@ -0,0 +1,49 @@
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)])
+eu_ZIPLIB(lzma,LZMA,[lzma lzmad],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)])
+eu_ZIPLIB(zstd,ZSTD,[zstd zstdd zstd_static zstd_staticd],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,52 @@
vcpkg_from_git(
OUT_SOURCE_PATH SOURCE_PATH
URL https://sourceware.org/git/elfutils
REF 25d048684a82f9ba701c6939b7f28c3543bb7991 #elfutils-0.182
PATCHES configure.ac.patch
)
vcpkg_find_acquire_program(FLEX)
get_filename_component(FLEX_DIR "${FLEX}" DIRECTORY )
vcpkg_add_to_path(PREPEND "${FLEX_DIR}")
vcpkg_find_acquire_program(BISON)
get_filename_component(BISON_DIR "${BISON}" DIRECTORY )
vcpkg_add_to_path(PREPEND "${BISON_DIR}")
vcpkg_configure_make(
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
)
vcpkg_install_make()
file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libdebuginfod.pc" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libdebuginfod.pc") #--disable-debuginfod
vcpkg_fixup_pkgconfig(SYSTEM_LIBRARIES pthread)
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_SHARED_LIBRARY_SUFFIX}")
else()
set(_lib_suffix "${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX}")
endif()
file(GLOB_RECURSE TO_REMOVE "${CURRENT_PACKAGES_DIR}/lib/*${_lib_suffix}" "${CURRENT_PACKAGES_DIR}/debug/lib/*${_lib_suffix}")
file(REMOVE ${TO_REMOVE})
# # 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()

View File

@ -278,6 +278,8 @@ ecsutil:arm-uwp=fail
ecsutil:x64-linux=fail ecsutil:x64-linux=fail
ecsutil:x64-osx=fail ecsutil:x64-osx=fail
ecsutil:x64-uwp=fail ecsutil:x64-uwp=fail
# Checks for gnu extension so only works with gcc.
elfutils:x64-osx=fail
embree2:x64-linux=fail embree2:x64-linux=fail
embree2:x64-osx=fail embree2:x64-osx=fail
embree2:x64-windows-static=fail embree2:x64-windows-static=fail