From 04f986643e7cf4a9b3a06e2ee7827f6949258aea Mon Sep 17 00:00:00 2001 From: Jeremy Rifkin <51220084+jeremy-rifkin@users.noreply.github.com> Date: Mon, 19 Feb 2024 05:48:10 -0600 Subject: [PATCH] (#22629) libdwarf: Add 0.9.0 and 0.9.1 * Add libdwarf 0.9.0 and 0.9.1 * Correction for the test package * Try to fix 0.9.0 * comment out remaining 0.9.1 references temporarily * Patch off_t * Try to get 0.9.1 good to go * Update recipes/libdwarf/all/conanfile.py Co-authored-by: Uilian Ries * Remove libdwarf 20191104 * Handle dwarfdump license * Update patches to use lowercasae zstd --------- Co-authored-by: Uilian Ries --- recipes/libdwarf/all/conandata.yml | 21 ++- recipes/libdwarf/all/conanfile.py | 41 ++-- .../all/patches/0.9.0-0001-fixes.patch | 105 +++++++++++ .../all/patches/0.9.1-0001-fixes.patch | 86 +++++++++ .../all/patches/20191104-0001-patch.patch | 178 ------------------ .../libdwarf/all/test_package/CMakeLists.txt | 4 +- .../libdwarf/all/test_package/test_package.c | 8 +- recipes/libdwarf/config.yml | 6 +- 8 files changed, 236 insertions(+), 213 deletions(-) create mode 100644 recipes/libdwarf/all/patches/0.9.0-0001-fixes.patch create mode 100644 recipes/libdwarf/all/patches/0.9.1-0001-fixes.patch delete mode 100644 recipes/libdwarf/all/patches/20191104-0001-patch.patch diff --git a/recipes/libdwarf/all/conandata.yml b/recipes/libdwarf/all/conandata.yml index 6abc97da6d65a..1a5e4c96d2caf 100644 --- a/recipes/libdwarf/all/conandata.yml +++ b/recipes/libdwarf/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "0.9.1": + url: "https://github.com/davea42/libdwarf-code/archive/refs/tags/v0.9.1.tar.gz" + sha256: "6da3f46a9f92b4e284c97c733851879d9b91b16642bede90c7614860a946824e" + "0.9.0": + url: "https://github.com/davea42/libdwarf-code/archive/refs/tags/v0.9.0.tar.gz" + sha256: "6d4c0ee8a869e68dfeb15c99b869cafca7a5f715ecfc699cbf4fd30729b33226" "0.8.0": url: "https://github.com/davea42/libdwarf-code/archive/refs/tags/v0.8.0.tar.gz" sha256: "8ef0dbfb0816b02aac97b87426689ebaa4efb8ec2ca2c759ea34c5e4678dff3f" @@ -8,10 +14,15 @@ sources: "0.5.0": url: "https://www.prevanders.net/libdwarf-0.5.0.tar.xz" sha256: "11fa822c60317fa00e1a01a2ac9e8388f6693e8662ab72d352c5f50c7e0112a9" - "20191104": - url: "https://www.prevanders.net/libdwarf-20191104.tar.gz" - sha256: "45f50a966314421b7dab525859853616df6c9680f0ccf2f44b030c505236eaba" patches: + "0.9.1": + - patch_file: "patches/0.9.1-0001-fixes.patch" + patch_description: "fix DW_API definition and cmake" + patch_type: "portability" + "0.9.0": + - patch_file: "patches/0.9.0-0001-fixes.patch" + patch_description: "fix DW_API definition and cmake" + patch_type: "portability" "0.8.0": - patch_file: "patches/0.8.0-0001-fixes.patch" patch_description: "fix DW_API definition and cmake" @@ -30,7 +41,3 @@ patches: - patch_file: "patches/0.5.0-0001-fix-DW_API.patch" patch_description: "fix DW_API definition" patch_type: "portability" - "20191104": - - patch_file: "patches/20191104-0001-patch.patch" - patch_description: "use cci package, remove lib64/bin64 install folders" - patch_type: "conan" diff --git a/recipes/libdwarf/all/conanfile.py b/recipes/libdwarf/all/conanfile.py index 0149255b7e4f0..8eab28c0da9ce 100644 --- a/recipes/libdwarf/all/conanfile.py +++ b/recipes/libdwarf/all/conanfile.py @@ -2,6 +2,7 @@ from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, rename from conan.tools.build import cross_building from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.scm import Version import os required_conan_version = ">=1.53.0" @@ -9,7 +10,7 @@ class LibdwarfConan(ConanFile): name = "libdwarf" description = "A library and a set of command-line tools for reading and writing DWARF2" - license = ("LGPL-2.1-only", "BSD-2-Clause-Views") + license = ("LGPL-2.1-only", "BSD-2-Clause-Views", "GPL-2.0-only") url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.prevanders.net/dwarf.html" topics = ("debug", "dwarf", "dwarf2", "elf") @@ -20,11 +21,13 @@ class LibdwarfConan(ConanFile): "shared": [True, False], "fPIC": [True, False], "with_dwarfgen": [True, False], + "with_dwarfdump": [True, False], } default_options = { "shared": False, "fPIC": True, "with_dwarfgen": False, + "with_dwarfdump": False, } def export_sources(self): @@ -41,15 +44,19 @@ def configure(self): self.settings.rm_safe("compiler.cppstd") if not self.options.with_dwarfgen: - self.license = "LGPL-2.1-only" + self.license = (l for l in self.license if l != "BSD-2-Clause-Views") + if not self.options.with_dwarfdump: + self.license = (l for l in self.license if l != "GPL-2.0-only") def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - if self.options.with_dwarfgen or self.version == "20191104": + if self.options.with_dwarfgen: self.requires("libelf/0.8.13") self.requires("zlib/[>=1.2.11 <2]") + if Version(self.version) >= Version("0.9.0"): + self.requires("zstd/1.5.5") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) @@ -60,6 +67,7 @@ def generate(self): tc.variables["BUILD_NON_SHARED"] = not self.options.shared tc.variables["BUILD_SHARED"] = self.options.shared tc.variables["BUILD_DWARFGEN"] = self.options.with_dwarfgen + tc.variables["BUILD_DWARFDUMP"] = self.options.with_dwarfdump tc.variables["BUILD_DWARFEXAMPLE"] = False if cross_building(self): tc.variables["HAVE_UNUSED_ATTRIBUTE_EXITCODE"] = "0" @@ -76,20 +84,15 @@ def build(self): cmake.build() def package(self): - if self.version == "20191104": - copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=os.path.join(self.source_folder, "libdwarf")) - rename(self, os.path.join(self.package_folder, "licenses", "COPYING"), os.path.join(self.package_folder, "licenses", "COPYING-libdwarf")) - if self.options.with_dwarfgen: - copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=os.path.join(self.source_folder, "dwarfgen")) - rename(self, os.path.join(self.package_folder, "licenses", "COPYING"), os.path.join(self.package_folder, "licenses", "COPYING-dwarfgen")) - copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) - else: - copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=os.path.join(self.source_folder, "src", "lib", "libdwarf")) - rename(self, os.path.join(self.package_folder, "licenses", "COPYING"), os.path.join(self.package_folder, "licenses", "COPYING-libdwarf")) - if self.options.with_dwarfgen: - copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=os.path.join(self.source_folder, "src", "bin", "dwarfgen")) - rename(self, os.path.join(self.package_folder, "licenses", "COPYING"), os.path.join(self.package_folder, "licenses", "COPYING-dwarfgen")) - copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=os.path.join(self.source_folder, "src", "lib", "libdwarf")) + rename(self, os.path.join(self.package_folder, "licenses", "COPYING"), os.path.join(self.package_folder, "licenses", "COPYING-libdwarf")) + if self.options.with_dwarfgen: + copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=os.path.join(self.source_folder, "src", "bin", "dwarfgen")) + rename(self, os.path.join(self.package_folder, "licenses", "COPYING"), os.path.join(self.package_folder, "licenses", "COPYING-dwarfgen")) + if self.options.with_dwarfdump: + copy(self, pattern="GPL.txt", dst=os.path.join(self.package_folder, "licenses"), src=os.path.join(self.source_folder, "src", "bin", "dwarfdump")) + rename(self, os.path.join(self.package_folder, "licenses", "GPL.txt"), os.path.join(self.package_folder, "licenses", "COPYING-dwarfdump")) + copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) cmake = CMake(self) cmake.install() @@ -103,6 +106,4 @@ def package_info(self): bindir = os.path.join(self.package_folder, "bin") self.output.info(f'Appending PATH environment variable: {bindir}') self.env_info.PATH.append(bindir) - - if self.version != "20191104": - self.cpp_info.libs.append("dwarfp") + self.cpp_info.libs.append("dwarfp") diff --git a/recipes/libdwarf/all/patches/0.9.0-0001-fixes.patch b/recipes/libdwarf/all/patches/0.9.0-0001-fixes.patch new file mode 100644 index 0000000000000..5c91298881e9c --- /dev/null +++ b/recipes/libdwarf/all/patches/0.9.0-0001-fixes.patch @@ -0,0 +1,105 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f444af27..5c9390d1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -181,14 +181,20 @@ endif() + + # Zlib and ZSTD need to be found otherwise disable it + find_package(ZLIB) +-find_package(ZSTD) +-if (ZLIB_FOUND AND ZSTD_FOUND ) ++find_package(zstd) ++if (ZLIB_FOUND AND zstd_FOUND ) + set(HAVE_ZLIB TRUE) + set(HAVE_ZLIB_H TRUE) + set(HAVE_ZSTD TRUE) + set(HAVE_ZSTD_H TRUE) + endif() + ++if(TARGET zstd::libzstd_shared) ++ set(ZSTD_LIB zstd::libzstd_shared) ++else() ++ set(ZSTD_LIB zstd::libzstd_static) ++endif() ++ + message(STATUS "CMAKE_SIZEOF_VOID_P ... " ${CMAKE_SIZEOF_VOID_P} ) + + # DW_FWALLXX are gnu C++ options. +diff --git a/src/bin/dwarfdump/CMakeLists.txt b/src/bin/dwarfdump/CMakeLists.txt +index 6d2c328b..bc105813 100644 +--- a/src/bin/dwarfdump/CMakeLists.txt ++++ b/src/bin/dwarfdump/CMakeLists.txt +@@ -68,7 +68,7 @@ target_compile_options(dwarfdump PRIVATE ${DW_FWALL}) + + target_link_libraries(dwarfdump PRIVATE dwarf) + +-if(${CMAKE_SIZEOF_VOID_P} EQUAL 8) ++if(0) + set(SUFFIX 64) + endif() + set(LIBDIR lib${SUFFIX}) +diff --git a/src/lib/libdwarf/CMakeLists.txt b/src/lib/libdwarf/CMakeLists.txt +index 4ad5c4fb..052208a1 100644 +--- a/src/lib/libdwarf/CMakeLists.txt ++++ b/src/lib/libdwarf/CMakeLists.txt +@@ -107,11 +107,10 @@ target_include_directories(dwarf PUBLIC + $ + $ + ) +-if(ZLIB_FOUND AND ZSTD_FOUND) +- target_link_libraries(dwarf PRIVATE ZLIB::ZLIB ZSTD::ZSTD ) ++if(ZLIB_FOUND AND zstd_FOUND) ++ target_link_libraries(dwarf PRIVATE ZLIB::ZLIB ${ZSTD_LIB} ) + endif() + +-set(SUFFIX $<$:64>) + set(LIBDIR lib${SUFFIX}) + set(BINDIR bin${SUFFIX}) + +@@ -120,7 +119,7 @@ install(TARGETS dwarf + LIBRARY DESTINATION ${LIBDIR} + ARCHIVE DESTINATION ${LIBDIR}) + +-configure_file(libdwarf.pc.cmake libdwarf.pc @ONLY ) ++# configure_file(libdwarf.pc.cmake libdwarf.pc @ONLY ) + + # The install has to be here, not in + # another CMakeLists.txt to make install work properly +@@ -145,6 +144,8 @@ install( + install( + FILES ${CMAKE_CURRENT_SOURCE_DIR}/dwarf.h + DESTINATION include/libdwarf) ++if(0) + install( FILES ${PROJECT_BINARY_DIR}/src/lib/libdwarf/libdwarf.pc + DESTINATION lib/pkgconfig + ) ++endif() +diff --git a/src/lib/libdwarf/libdwarf.h b/src/lib/libdwarf/libdwarf.h +index ed3d1d0b..91f2fd8b 100644 +--- a/src/lib/libdwarf/libdwarf.h ++++ b/src/lib/libdwarf/libdwarf.h +@@ -51,7 +51,7 @@ + #endif /* DW_API */ + + #ifndef LIBDWARF_STATIC +-# if defined(_WIN32) || defined(__CYGWIN__) ++# if defined(LIBDWARF_SHARED) && (defined(_WIN32) || defined(__CYGWIN__)) + # ifdef LIBDWARF_BUILD + # define DW_API __declspec(dllexport) + # else /* !LIBDWARF_BUILD */ +diff --git a/src/lib/libdwarf/libdwarf_private.h b/src/lib/libdwarf/libdwarf_private.h +index b37ae994..7fa89256 100644 +--- a/src/lib/libdwarf/libdwarf_private.h ++++ b/src/lib/libdwarf/libdwarf_private.h +@@ -26,11 +26,7 @@ + #ifdef _MSC_VER /* Macro to select VS compiler */ + #include + typedef SSIZE_T ssize_t; +-#ifdef _WIN64 +-typedef long long off_t; +-#else + typedef long off_t; +-#endif + #endif /* _MSC_VER */ + + #ifndef TRUE diff --git a/recipes/libdwarf/all/patches/0.9.1-0001-fixes.patch b/recipes/libdwarf/all/patches/0.9.1-0001-fixes.patch new file mode 100644 index 0000000000000..c7952f7107937 --- /dev/null +++ b/recipes/libdwarf/all/patches/0.9.1-0001-fixes.patch @@ -0,0 +1,86 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 70839abd..972a2b9e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -188,14 +188,20 @@ if (ENABLE_DECOMPRESSION) + find_package(ZLIB) + endif() + if(NOT TARGET ZSTD::ZSTD) +- find_package(ZSTD) ++ find_package(zstd) + endif() +- if (ZLIB_FOUND AND ZSTD_FOUND ) ++ if (ZLIB_FOUND AND zstd_FOUND ) + set(HAVE_ZLIB TRUE) + set(HAVE_ZLIB_H TRUE) + set(HAVE_ZSTD TRUE) + set(HAVE_ZSTD_H TRUE) + endif() ++ find_package(zstd CONFIG REQUIRED) ++ if(TARGET zstd::libzstd_shared) ++ set(ZSTD_LIB zstd::libzstd_shared) ++ else() ++ set(ZSTD_LIB zstd::libzstd_static) ++ endif() + endif () + + message(STATUS "CMAKE_SIZEOF_VOID_P ... " ${CMAKE_SIZEOF_VOID_P} ) +diff --git a/src/lib/libdwarf/CMakeLists.txt b/src/lib/libdwarf/CMakeLists.txt +index 7500c9f4..ce1461fb 100644 +--- a/src/lib/libdwarf/CMakeLists.txt ++++ b/src/lib/libdwarf/CMakeLists.txt +@@ -104,8 +104,8 @@ target_include_directories(dwarf PUBLIC + $ + $ + ) +-if(ZLIB_FOUND AND ZSTD_FOUND) +- target_link_libraries(dwarf PRIVATE ZLIB::ZLIB ZSTD::ZSTD ) ++if(ZLIB_FOUND AND zstd_FOUND) ++ target_link_libraries(dwarf PRIVATE ZLIB::ZLIB ${ZSTD_LIB} ) + endif() + set_target_properties(dwarf PROPERTIES PUBLIC_HEADER "libdwarf.h;dwarf.h") + +@@ -116,7 +116,7 @@ install(TARGETS dwarf + PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + ) + +-configure_file(libdwarf.pc.cmake libdwarf.pc @ONLY) ++# configure_file(libdwarf.pc.cmake libdwarf.pc @ONLY) + + # The install has to be here, not in + # another CMakeLists.txt to make install work properly +@@ -131,4 +131,4 @@ install(EXPORT libdwarfTargets + NAMESPACE libdwarf:: + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/libdwarf") + install(FILES cmake/libdwarf-config.cmake DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/libdwarf") +-install(FILES "${PROJECT_BINARY_DIR}/src/lib/libdwarf/libdwarf.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") ++# install(FILES "${PROJECT_BINARY_DIR}/src/lib/libdwarf/libdwarf.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") +diff --git a/src/lib/libdwarf/libdwarf.h b/src/lib/libdwarf/libdwarf.h +index 380d2ef7..8c62ee7e 100644 +--- a/src/lib/libdwarf/libdwarf.h ++++ b/src/lib/libdwarf/libdwarf.h +@@ -51,7 +51,7 @@ + #endif /* DW_API */ + + #ifndef LIBDWARF_STATIC +-# if defined(_WIN32) || defined(__CYGWIN__) ++# if defined(LIBDWARF_SHARED) && (defined(_WIN32) || defined(__CYGWIN__)) + # ifdef LIBDWARF_BUILD + # define DW_API __declspec(dllexport) + # else /* !LIBDWARF_BUILD */ +diff --git a/src/lib/libdwarf/libdwarf_private.h b/src/lib/libdwarf/libdwarf_private.h +index b37ae994..7fa89256 100644 +--- a/src/lib/libdwarf/libdwarf_private.h ++++ b/src/lib/libdwarf/libdwarf_private.h +@@ -26,11 +26,7 @@ + #ifdef _MSC_VER /* Macro to select VS compiler */ + #include + typedef SSIZE_T ssize_t; +-#ifdef _WIN64 +-typedef long long off_t; +-#else + typedef long off_t; +-#endif + #endif /* _MSC_VER */ + + #ifndef TRUE diff --git a/recipes/libdwarf/all/patches/20191104-0001-patch.patch b/recipes/libdwarf/all/patches/20191104-0001-patch.patch deleted file mode 100644 index aadcac9dfe8fd..0000000000000 --- a/recipes/libdwarf/all/patches/20191104-0001-patch.patch +++ /dev/null @@ -1,178 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 2607e56..3ca4ac5 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -73,9 +73,9 @@ check_include_file( "unistd.h" HAVE_UNISTD_H ) - check_include_file( "sgidefs.h" HAVE_SGIDEFS_H ) - check_include_file( "stdafx.h" HAVE_STDAFX_H ) - check_include_file( "Windows.h" HAVE_WINDOWS_H ) --check_include_file( "elf.h" HAVE_ELF_H ) --check_include_file( "libelf.h" HAVE_LIBELF_H ) --check_include_file( "libelf/libelf.h" HAVE_LIBELF_LIBELF_H) -+set(HAVE_ELF_H FALSE) -+set(HAVE_LIBELF_H FALSE) -+set(HAVE_LIBELF_LIBELF_H TRUE) - check_include_file( "alloca.h" HAVE_ALLOCA_H ) - check_include_file( "elfaccess.h" HAVE_ELFACCESS_H) - check_include_file( "sys/elf_386.h" HAVE_SYS_ELF_386_H ) -@@ -128,6 +128,8 @@ endif() - # It's not really setting the location of libelfheader, - # it is really # either elf.h, or if that is missing - # it is assuming elf.h data is in the supplied libelf. -+find_package(libelf REQUIRED CONFIG) -+find_package(ZLIB REQUIRED CONFIG) - - if(HAVE_ELF_H) - set(HAVE_LOCATION_OF_LIBELFHEADER "") -@@ -146,12 +148,13 @@ elseif(HAVE_LIBELF_LIBELF_H) - endif() - - if (HAVE_LIBELF_H OR HAVE_LIBELF_LIBELF_H) -- set (CMAKE_REQUIRED_LIBRARIES elf) -+ set (CMAKE_REQUIRED_DEFINITIONS -D__LIBELF64=1) - message(STATUS "libelf header ${PLAIN_JUST_LIBELF} checking for elf64_getehdr") - check_symbol_exists( elf64_getehdr ${PLAIN_JUST_LIBELF} HAVE_ELF64_GETEHDR) - message(STATUS "libelf header ${PLAIN_JUST_LIBELF} checking for elf64_getshdr") - check_symbol_exists( elf64_getshdr ${PLAIN_JUST_LIBELF} HAVE_ELF64_GETSHDR) - set (CMAKE_REQUIRED_LIBRARIES) -+ set (CMAKE_REQUIRED_DEFINITIONS) - endif() - - option(DWARF_WITH_LIBELF "Use libelf (default is YES)" TRUE) -@@ -166,6 +169,9 @@ if (DWARF_WITH_LIBELF) - message(STATUS "checking using HAVE_ELF_H ... ${HAVE_ELF_H}") - message(STATUS "checking using elf header ... ${HAVE_LOCATION_OF_LIBELFHEADER}") - message(STATUS "checking using libelf header ... ${JUST_LIBELF}") -+ -+ set (CMAKE_REQUIRED_DEFINITIONS -D__LIBELF64=1) -+ - check_c_source_compiles(" - #include ${HAVE_LOCATION_OF_LIBELFHEADER} - int main() -@@ -202,7 +208,7 @@ if (DWARF_WITH_LIBELF) - # to set HAVE_LIBELF_OFF64_OK at present. - check_c_source_compiles(" - #define _GNU_SOURCE 1 -- #include ${JUST_LIBELF} -+ #include <${JUST_LIBELF}> - int main() - { - off64_t p; p = 0; -@@ -210,7 +216,7 @@ if (DWARF_WITH_LIBELF) - }" HAVE_LIBELF_OFF64_OK) - - check_c_source_compiles(" -- #include ${JUST_LIBELF} -+ #include <${JUST_LIBELF}> - /* This must be at global scope */ - struct _Elf; - typedef struct _Elf Elf; -@@ -220,6 +226,10 @@ if (DWARF_WITH_LIBELF) - int i = 12; - return 0; - }" HAVE_STRUCT_UNDERSCORE_ELF) -+ -+ set (CMAKE_REQUIRED_LIBRARIES) -+ set (CMAKE_REQUIRED_DEFINITIONS) -+ - endif() - message(STATUS "Assuming struct Elf for the default libdwarf.h") - # Because cmake treats ; in an interesting way attempting -@@ -378,10 +388,9 @@ message(STATUS "Checking producer generates only 32bit... ${HAVE_STRICT_DWARF2_3 - - - # This references cmake/FindLibElf.cmake. See cmake documentation. --find_package(LibElf REQUIRED) - list(APPEND CMAKE_REQUIRED_INCLUDES ${LIBELF_INCLUDE_DIRS}) - --configure_file(config.h.in.cmake config.h) -+configure_file(${CMAKE_SOURCE_DIR}/config.h.in.cmake ${CMAKE_BINARY_DIR}/config.h) - - if(BUILD_NON_SHARED) - set(DWARF_TARGETS dwarf-static) -@@ -395,7 +404,6 @@ if(BUILD_SHARED) - endif() - - add_subdirectory(libdwarf) --add_subdirectory(dwarfdump) - if ( BUILD_DWARFGEN ) - if ( DWARF_WITH_LIBELF ) - add_subdirectory(dwarfgen) -diff --git a/dwarfdump/CMakeLists.txt b/dwarfdump/CMakeLists.txt -index b94f6c8..6bdb57f 100644 ---- a/dwarfdump/CMakeLists.txt -+++ b/dwarfdump/CMakeLists.txt -@@ -31,7 +31,7 @@ set_source_group(CONFIGURATION_FILES "Configuration Files" - ${CMAKE_SOURCE_DIR}/config.h.in.cmake - ${CMAKE_BINARY_DIR}/config.h) - --add_executable(dwarfdump ${SOURCES} ${HEADERS} ${CONFIGURATION_FILES}) -+add_executable(dwarfdump ${SOURCES} ${HEADERS} ${CONFIGURATION_FILES} ${libelf_LIBRARIES}) - - set_folder(dwarfdump dwarfdump) - -diff --git a/dwarfgen/CMakeLists.txt b/dwarfgen/CMakeLists.txt -index 488b820..5bde9eb 100644 ---- a/dwarfgen/CMakeLists.txt -+++ b/dwarfgen/CMakeLists.txt -@@ -20,16 +20,16 @@ set_folder(dwarfgen dwarfgen) - - target_compile_options(dwarfgen PRIVATE ${DW_FWALLXX}) - --target_link_libraries(dwarfgen PRIVATE ${dwarf-target} ${DW_FZLIB}) -+target_link_libraries(dwarfgen PRIVATE ${dwarf-target} ${DW_FZLIB} ${libelf_LIBRARIES}) - - set(SUFFIX $<$:64>) - set(LIBDIR lib${SUFFIX}) - set(BINDIR bin${SUFFIX}) - - install(TARGETS dwarfgen DESTINATION -- RUNTIME DESTINATION ${BINDIR} -- LIBRARY DESTINATION ${LIBDIR} -- ARCHIVE DESTINATION ${LIBDIR}) -+ RUNTIME DESTINATION bin -+ LIBRARY DESTINATION lib -+ ARCHIVE DESTINATION lib) - - #install(FILES dwarfgen.conf DESTINATION lib) - -diff --git a/libdwarf/CMakeLists.txt b/libdwarf/CMakeLists.txt -index c610522..3a69533 100644 ---- a/libdwarf/CMakeLists.txt -+++ b/libdwarf/CMakeLists.txt -@@ -81,12 +81,9 @@ foreach(i RANGE ${targetCount}) - ${GENNAMES_OUTPUT} ${CONFIGURATION_FILES}) - - set_folder(${target} libdwarf) -- target_include_directories(${target} PUBLIC -- ${LIBELF_INCLUDE_DIRS}) -- target_compile_options(${target} PRIVATE ${DW_FWALL}) - msvc_posix(${target}) - -- target_link_libraries(${target} PUBLIC ${LIBELF_LIBRARIES}) -+ target_link_libraries(${target} PUBLIC ${libelf_LIBRARIES} ${ZLIB_LIBRARIES}) - - set_target_properties(${target} PROPERTIES OUTPUT_NAME dwarf) - -@@ -95,15 +92,14 @@ foreach(i RANGE ${targetCount}) - set(BINDIR bin${SUFFIX}) - - install(TARGETS ${target} -- RUNTIME DESTINATION ${BINDIR} -- LIBRARY DESTINATION ${LIBDIR} -- ARCHIVE DESTINATION ${LIBDIR}) -+ RUNTIME DESTINATION bin -+ LIBRARY DESTINATION lib -+ ARCHIVE DESTINATION lib) - endforeach() - --if(UNIX AND BUILD_SHARED) -- target_link_libraries(dwarf-shared PUBLIC z) --endif() -- -+install(FILES ${CMAKE_BINARY_DIR}/libdwarf/libdwarf.h DESTINATION include) -+install(FILES dwarf.h DESTINATION include) -+ - if (DO_TESTING) - set_source_group(TESTLEB "Source Files" dwarf_leb_test.c - dwarf_leb.c pro_encode_nm.c ) diff --git a/recipes/libdwarf/all/test_package/CMakeLists.txt b/recipes/libdwarf/all/test_package/CMakeLists.txt index a2fbbf0a474e1..8abbd68a6f049 100644 --- a/recipes/libdwarf/all/test_package/CMakeLists.txt +++ b/recipes/libdwarf/all/test_package/CMakeLists.txt @@ -6,6 +6,6 @@ find_package(libdwarf REQUIRED) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} PRIVATE libdwarf::libdwarf) -if(NOT libdwarf_VERSION MATCHES "^[0-9]*$") - target_compile_definitions(${PROJECT_NAME} PRIVATE "LIBDWARF_NEW_STRUCTURE") +if(${libdwarf_VERSION} VERSION_LESS "0.9.1") + target_compile_definitions(${PROJECT_NAME} PRIVATE "LIBDWARF_NESTED_INCLUDE") endif() diff --git a/recipes/libdwarf/all/test_package/test_package.c b/recipes/libdwarf/all/test_package/test_package.c index 27d0d196b5a8d..287828193ab29 100644 --- a/recipes/libdwarf/all/test_package/test_package.c +++ b/recipes/libdwarf/all/test_package/test_package.c @@ -3,12 +3,12 @@ #include #include -#ifndef LIBDWARF_NEW_STRUCTURE - #include "dwarf.h" - #include "libdwarf.h" -#else +#ifdef LIBDWARF_NESTED_INCLUDE #include "libdwarf/dwarf.h" #include "libdwarf/libdwarf.h" +#else + #include "dwarf.h" + #include "libdwarf.h" #endif void example1(Dwarf_Die somedie) { diff --git a/recipes/libdwarf/config.yml b/recipes/libdwarf/config.yml index 2bad80aa2207b..b5a49fc99b335 100644 --- a/recipes/libdwarf/config.yml +++ b/recipes/libdwarf/config.yml @@ -1,9 +1,11 @@ versions: + "0.9.1": + folder: all + "0.9.0": + folder: all "0.8.0": folder: all "0.7.0": folder: all "0.5.0": folder: all - "20191104": - folder: all