From bc4c975df7f32565c86a9c855d9611155b8c95dd Mon Sep 17 00:00:00 2001 From: Joachim Danmayr <46405460+joda01@users.noreply.github.com> Date: Sun, 15 Sep 2024 20:26:48 +0200 Subject: [PATCH 1/6] fix: build failure using mingw Fixed missing include which allows to use getenv --- recipes/libelf/all/conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/libelf/all/conanfile.py b/recipes/libelf/all/conanfile.py index c93a47a212b33..e66c3c4ec1052 100644 --- a/recipes/libelf/all/conanfile.py +++ b/recipes/libelf/all/conanfile.py @@ -83,6 +83,7 @@ def generate(self): def build(self): if self.settings.os == "Windows": + replace_in_file(self, os.path.join(self.source_folder, "lib", "version.c"), "#include ", "#include \n#include ") cmake = CMake(self) cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() From 63da6c8eee1ca18894679344957db71aacfa7328 Mon Sep 17 00:00:00 2001 From: Joachim Danmayr <46405460+joda01@users.noreply.github.com> Date: Sun, 15 Sep 2024 21:32:36 +0200 Subject: [PATCH 2/6] chore: Added 001-getenv-fix.patch file --- .../libelf/all/patches/001-getenv-fix.patch | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 recipes/libelf/all/patches/001-getenv-fix.patch diff --git a/recipes/libelf/all/patches/001-getenv-fix.patch b/recipes/libelf/all/patches/001-getenv-fix.patch new file mode 100644 index 0000000000000..43411221cf5d8 --- /dev/null +++ b/recipes/libelf/all/patches/001-getenv-fix.patch @@ -0,0 +1,23 @@ +From: Joachim Danmayr +Date: Sun, 15 Sep 2024 21:29:53 +0200 +Subject: [PATCH] fix: Add #include + +--- + version.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/version.c b/version.c +index 7a901d3..8dc1920 100644 +--- a/version.c ++++ b/version.c +@@ -18,6 +18,7 @@ + */ + + #include ++#include + + #ifndef lint + static const char rcsid[] = "@(#) $Id: version.c,v 1.8 2008/05/23 08:15:35 michael Exp $"; +-- +2.43.0 + From 81bbf58d0e2be7ee206f03deaec349a9da889cca Mon Sep 17 00:00:00 2001 From: Joachim Danmayr <46405460+joda01@users.noreply.github.com> Date: Sun, 15 Sep 2024 21:39:21 +0200 Subject: [PATCH 3/6] chore: Apply patch file in conan.py --- recipes/libelf/all/conanfile.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/recipes/libelf/all/conanfile.py b/recipes/libelf/all/conanfile.py index e66c3c4ec1052..d2c778f2bc49b 100644 --- a/recipes/libelf/all/conanfile.py +++ b/recipes/libelf/all/conanfile.py @@ -2,7 +2,7 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.env import VirtualBuildEnv -from conan.tools.files import copy, get, replace_in_file, rm, rmdir +from conan.tools.files import copy, get, replace_in_file, rm, rmdir, patch from conan.tools.gnu import Autotools, AutotoolsToolchain from conan.tools.layout import basic_layout from conan.tools.microsoft import unix_path @@ -29,7 +29,7 @@ class LibelfConan(ConanFile): "fPIC": True, } - exports_sources = "CMakeLists.txt" + exports_sources = "CMakeLists.txt", "*.patch" @property def _settings_build(self): @@ -65,6 +65,8 @@ def build_requirements(self): def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) + patch_file = os.path.join(self.export_sources_folder, "001-getenv-fix.patch") + patch(self, patch_file=patch_file) def generate(self): if self.settings.os == "Windows": @@ -82,8 +84,7 @@ def generate(self): tc.generate() def build(self): - if self.settings.os == "Windows": - replace_in_file(self, os.path.join(self.source_folder, "lib", "version.c"), "#include ", "#include \n#include ") + if self.settings.os == "Windows": cmake = CMake(self) cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() From 1ca9cc191c1c4e8d6181ec882e1de653e4747d83 Mon Sep 17 00:00:00 2001 From: Joachim Danmayr <46405460+joda01@users.noreply.github.com> Date: Fri, 20 Sep 2024 22:29:35 +0200 Subject: [PATCH 4/6] Update and rename 001-getenv-fix.patch to 0001-getenv-fix.diff --- .../all/patches/{001-getenv-fix.patch => 0001-getenv-fix.diff} | 2 -- 1 file changed, 2 deletions(-) rename recipes/libelf/all/patches/{001-getenv-fix.patch => 0001-getenv-fix.diff} (81%) diff --git a/recipes/libelf/all/patches/001-getenv-fix.patch b/recipes/libelf/all/patches/0001-getenv-fix.diff similarity index 81% rename from recipes/libelf/all/patches/001-getenv-fix.patch rename to recipes/libelf/all/patches/0001-getenv-fix.diff index 43411221cf5d8..f6ab608e46e5a 100644 --- a/recipes/libelf/all/patches/001-getenv-fix.patch +++ b/recipes/libelf/all/patches/0001-getenv-fix.diff @@ -1,5 +1,3 @@ -From: Joachim Danmayr -Date: Sun, 15 Sep 2024 21:29:53 +0200 Subject: [PATCH] fix: Add #include --- From 2ddfedf9380ec59df4bcedbcb437026e43a8fbe3 Mon Sep 17 00:00:00 2001 From: Joachim Danmayr <46405460+joda01@users.noreply.github.com> Date: Fri, 20 Sep 2024 22:30:52 +0200 Subject: [PATCH 5/6] chore: Use patches in conandata.yml --- recipes/libelf/all/conandata.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/recipes/libelf/all/conandata.yml b/recipes/libelf/all/conandata.yml index 68a80e3aa9464..5264c91478e50 100644 --- a/recipes/libelf/all/conandata.yml +++ b/recipes/libelf/all/conandata.yml @@ -5,3 +5,8 @@ sources: "https://fossies.org/linux/misc/old/libelf-0.8.13.tar.gz", ] sha256: "591a9b4ec81c1f2042a97aa60564e0cb79d041c52faa7416acb38bc95bd2c76d" + +patches: + "0.8.13": + - patch_file: "patches/0001-getenv-fix.diff" + base_path: "source_subfolder" From 5c6229b84ca67189b92d3690a14a70637c37d2f6 Mon Sep 17 00:00:00 2001 From: Joachim Danmayr <46405460+joda01@users.noreply.github.com> Date: Fri, 20 Sep 2024 22:33:57 +0200 Subject: [PATCH 6/6] chore: Reverted patch files from conanfile.py --- recipes/libelf/all/conanfile.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/recipes/libelf/all/conanfile.py b/recipes/libelf/all/conanfile.py index d2c778f2bc49b..4d2feab794cd5 100644 --- a/recipes/libelf/all/conanfile.py +++ b/recipes/libelf/all/conanfile.py @@ -2,7 +2,7 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.env import VirtualBuildEnv -from conan.tools.files import copy, get, replace_in_file, rm, rmdir, patch +from conan.tools.files import copy, get, replace_in_file, rm, rmdir from conan.tools.gnu import Autotools, AutotoolsToolchain from conan.tools.layout import basic_layout from conan.tools.microsoft import unix_path @@ -29,7 +29,7 @@ class LibelfConan(ConanFile): "fPIC": True, } - exports_sources = "CMakeLists.txt", "*.patch" + exports_sources = "CMakeLists.txt" @property def _settings_build(self): @@ -65,8 +65,6 @@ def build_requirements(self): def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) - patch_file = os.path.join(self.export_sources_folder, "001-getenv-fix.patch") - patch(self, patch_file=patch_file) def generate(self): if self.settings.os == "Windows":