Skip to content

Commit

Permalink
(#17272) elfutils: Revise the recipe to support Conan V2 and add the …
Browse files Browse the repository at this point in the history
…latest version 0.189

* elfutils: Add the test package for Conan 1.x.

* elfutils: Remove the entry `base_path` from each patch descriptor.

* elfutils: Make the recipe compatible with Conan 2.x.

* elfutils: `gettext` is needed otherwise `autopoint` cannot be found.

* elfutils: Fix an issue that the library `bz2` cannot be found.

* elfutils: Remove unneeded code from the recipe.

* elfutils: Upgrade the dependency `zlib` to 1.2.13.

* elfutils: Upgrade the dependency `sqlite3` to 3.41.2.

* elfutils: Upgrade the dependency `xz_utils` to 5.4.2.

* elfutils: Generate pkg-config deps for `libcurl`.

* elfutils: Upgrade the dependency `libcurl` to 8.0.1.

* elfutils: Make the test package compatible with Conan 2.x.

* elfutils: Export the path to the binary folder for Conan 2.x properly.

* elfutils: Run compiled utilities under the build environment.

* elfutils: Add the latest version 0.189.

* elfutils: Implement the patch in Python for all supported versions.

* elfutils: Use `ConanOutput.warning()` instead of deprecated `ConanOutput.warn()`.

* elfutils: Prevent users from building elfutils on macOS.

* elfutils: Remove version-specific patch files as they are now implemented in Python.

* elfutils: Add the missing entry for version 0.189 in `config.yml`.

* elfutils: Set the library search path for the test environment so that utilities dynamically linked to `libelf`, `libdw` and `libasm` can find the dylibs.

* elfutils: Add the compiler `Visual Studio` to the blacklist.

* elfutils: Add `dl` to the list of system libs of `libdw`.

* elfutils: Use `tool_requires` instead of `build_requires`.

Co-authored-by: Jordan Williams <[email protected]>

* elfutils: Use `tool_requires` instead of `build_requires`.

Co-authored-by: Jordan Williams <[email protected]>

* elfutils: Upgrade the dependency `sqlite3` to 3.42.0.

Co-authored-by: ericLemanissier <[email protected]>

* elfutils: Upgrade the dependency `libcurl` to 8.1.2.

Co-authored-by: ericLemanissier <[email protected]>

* Added patches, and package-type. Fixed bad Version import

* Removed Visual Studio as valid compiler

* Reverted all the patches

* typo

* Added is_msvc check

* renamed

---------

Co-authored-by: Jordan Williams <[email protected]>
Co-authored-by: ericLemanissier <[email protected]>
Co-authored-by: Rubén Rincón Blanco <[email protected]>
Co-authored-by: Francisco Ramirez de Anton <[email protected]>
  • Loading branch information
5 people authored Oct 31, 2023
1 parent 31f1837 commit b48d7fa
Show file tree
Hide file tree
Showing 11 changed files with 248 additions and 124 deletions.
30 changes: 22 additions & 8 deletions recipes/elfutils/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
sources:
"0.189":
url: "https://sourceware.org/elfutils/ftp/0.189/elfutils-0.189.tar.bz2"
sha256: "39bd8f1a338e2b7cd4abc3ff11a0eddc6e690f69578a57478d8179b4148708c8"
"0.186":
url: "https://sourceware.org/elfutils/ftp/0.186/elfutils-0.186.tar.bz2"
sha256: "7f6fb9149b1673d38d9178a0d3e0fb8a1ec4f53a9f4c2ff89469609879641177"
"0.180":
url: "https://sourceware.org/elfutils/ftp/0.180/elfutils-0.180.tar.bz2"
sha256: "b827b6e35c59d188ba97d7cf148fa8dc6f5c68eb6c5981888dfdbb758c0b569d"
patches:
"0.189":
- patch_file: "patches/0.189-0001-remove-werror-configure-option.patch"
patch_description: "Disable -Werror flag."
patch_type: "conan"
- patch_file: "patches/0.189-0002-add-enable-static-option-to-configure.patch"
patch_description: "Enable static library building."
patch_type: "conan"
"0.186":
- base_path: "source_subfolder"
patch_file: "patches/0.186-0001-Add-enable-werror-configure-option.patch"
- base_path: "source_subfolder"
patch_file: "patches/0.186-0002-add-enable-static-option-to-configure.patch"
- patch_file: "patches/0.186-0001-remove-werror-configure-option.patch"
patch_description: "Disable -Werror flag."
patch_type: "conan"
- patch_file: "patches/0.186-0002-add-enable-static-option-to-configure.patch"
patch_description: "Enable static library building."
patch_type: "conan"
"0.180":
- base_path: "source_subfolder"
patch_file: "patches/0.180-0001-Add-enable-werror-configure-option.patch"
- base_path: "source_subfolder"
patch_file: "patches/0.180-0002-add-enable-static-option-to-configure.patch"
- patch_file: "patches/0.180-0001-remove-werror-configure-option.patch"
patch_description: "Disable -Werror flag."
patch_type: "conan"
- patch_file: "patches/0.180-0002-add-enable-static-option-to-configure.patch"
patch_description: "Enable static library building."
patch_type: "conan"
219 changes: 119 additions & 100 deletions recipes/elfutils/all/conanfile.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/config/eu.am b/config/eu.am
index e6c241f..fb92465 100644
--- a/config/eu.am
+++ b/config/eu.am
@@ -99,7 +99,7 @@ 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_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 +109,7 @@ 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_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),) \
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
diff --git a/configure.ac b/configure.ac
index 6e881fa..3b56d3a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -414,8 +414,26 @@ AS_HELP_STRING([--enable-install-elfh],[install elf.h in include dir]),
[install_elfh=$enableval], [install_elfh=no])
AM_CONDITIONAL(INSTALL_ELFH, test "$install_elfh" = yes)

+AC_MSG_CHECKING([whether to build elfutils as a static library])
+AC_ARG_ENABLE([static],
+AS_HELP_STRING([--enable-static],[build elfutils as static libraries]),
+[static_elfutils=$enableval], [static_elfutils=no])
+
+static_elfutils=$static_elfutils
+
+if test "$static_elfutils" = yes ; then
+ AC_MSG_RESULT([yes])
+else
+ if test "$use_gprof" = yes -o "$use_gcov" = yes ; then
+ AC_MSG_ERROR([cannot build a shared elfutils with gprof or gcov enabled])
+ fi
+ AC_MSG_RESULT([no])
+fi
+
+
+
AM_CONDITIONAL(BUILD_STATIC, [dnl
-test "$use_gprof" = yes -o "$use_gcov" = yes])
+test "$static_elfutils" = yes])

AC_ARG_ENABLE([tests-rpath],
AS_HELP_STRING([--enable-tests-rpath],[build $ORIGIN-using rpath into tests]),
5 changes: 2 additions & 3 deletions recipes/elfutils/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
cmake_minimum_required(VERSION 3.1)
project(test_package C)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
find_package(elfutils REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.c)
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
target_link_libraries(${PROJECT_NAME} PRIVATE elfutils::elfutils)
32 changes: 19 additions & 13 deletions recipes/elfutils/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
from conans import ConanFile, CMake, tools
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import CMake, cmake_layout
import os


class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"
test_type = "explicit"

def layout(self):
cmake_layout(self)

def requirements(self):
self.requires(self.tested_reference_str)

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
self.run("eu-ar --version", run_environment=True)

bin_path = os.path.join("bin", "test_package")
self.run("eu-ar --version", env="conanbuild")
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
archive_path = "archive.a"

self.run("eu-ar r {0} {1}".format(archive_path, bin_path), run_environment=True)
self.run("eu-objdump -d {0}".format(bin_path), run_environment=True)
if not tools.cross_building(self.settings):
self.run("{} {}".format(bin_path, bin_path), run_environment=True)

self.run("{} {}".format(bin_path, archive_path), run_environment=True)
self.run(f"eu-ar r {archive_path} {bin_path}", env="conanbuild")
self.run(f"eu-objdump -d {bin_path}", env="conanbuild")
if can_run(self):
self.run(f"{bin_path} {bin_path}", env="conanrun")
self.run(f"{bin_path} {archive_path}", env="conanrun")
8 changes: 8 additions & 0 deletions recipes/elfutils/all/test_v1_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.1)
project(test_package)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package
${CMAKE_CURRENT_BINARY_DIR}/test_package)
22 changes: 22 additions & 0 deletions recipes/elfutils/all/test_v1_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from conans import ConanFile, CMake, tools
import os


class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "cmake", "cmake_find_package_multi"

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
self.run("eu-ar --version", run_environment=True)
bin_path = os.path.join("bin", "test_package")
archive_path = "archive.a"
self.run(f"eu-ar r {archive_path} {bin_path}", run_environment=True)
self.run(f"eu-objdump -d {bin_path}", run_environment=True)
if not tools.cross_building(self):
self.run(f"{bin_path} {bin_path}", run_environment=True)
self.run(f"{bin_path} {archive_path}", run_environment=True)
2 changes: 2 additions & 0 deletions recipes/elfutils/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"0.189":
folder: all
"0.186":
folder: all
"0.180":
Expand Down

0 comments on commit b48d7fa

Please sign in to comment.