From 5fecff85282c68fae05e776fb330779bdb94a6e8 Mon Sep 17 00:00:00 2001 From: Raven Szewczyk Date: Mon, 18 Nov 2024 17:20:34 +0000 Subject: [PATCH] giflib: Fix build issue on recent Android NDK versions (#25956) * giflib: Fix build issue on recent Android NDK versions * Apply suggestions from code review Co-authored-by: Martin Valgur * Conan v2 refactor * WIP: Revert 5.1.x changes --------- Co-authored-by: Martin Valgur Co-authored-by: PerseoGI --- .../5.1.x/test_v1_package/CMakeLists.txt | 8 ----- .../giflib/5.1.x/test_v1_package/conanfile.py | 29 ------------------- recipes/giflib/5.2.x/CMakeLists.txt | 2 +- recipes/giflib/5.2.x/conandata.yml | 4 +++ recipes/giflib/5.2.x/conanfile.py | 7 +---- .../5.2.x/test_v1_package/CMakeLists.txt | 8 ----- .../giflib/5.2.x/test_v1_package/conanfile.py | 21 -------------- 7 files changed, 6 insertions(+), 73 deletions(-) delete mode 100644 recipes/giflib/5.1.x/test_v1_package/CMakeLists.txt delete mode 100644 recipes/giflib/5.1.x/test_v1_package/conanfile.py delete mode 100644 recipes/giflib/5.2.x/test_v1_package/CMakeLists.txt delete mode 100644 recipes/giflib/5.2.x/test_v1_package/conanfile.py diff --git a/recipes/giflib/5.1.x/test_v1_package/CMakeLists.txt b/recipes/giflib/5.1.x/test_v1_package/CMakeLists.txt deleted file mode 100644 index 91630d79f4abb..0000000000000 --- a/recipes/giflib/5.1.x/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 3.15) -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/) diff --git a/recipes/giflib/5.1.x/test_v1_package/conanfile.py b/recipes/giflib/5.1.x/test_v1_package/conanfile.py deleted file mode 100644 index 2b12681e5d894..0000000000000 --- a/recipes/giflib/5.1.x/test_v1_package/conanfile.py +++ /dev/null @@ -1,29 +0,0 @@ -from conan.tools.apple import is_apple_os -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_requirements(self): - if is_apple_os(self) and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") - - def build(self): - cmake = CMake(self) - cmake.configure() - cmake.build() - - def test(self): - if not tools.cross_building(self): - img_name = os.path.join(self.source_folder, "testimg.gif") - bin_path = os.path.join("bin", "test_package") - command = "{} {}".format(bin_path, img_name) - self.run(command, run_environment=True) diff --git a/recipes/giflib/5.2.x/CMakeLists.txt b/recipes/giflib/5.2.x/CMakeLists.txt index 2d4e86b610d29..e676b16d18f06 100644 --- a/recipes/giflib/5.2.x/CMakeLists.txt +++ b/recipes/giflib/5.2.x/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(gif LANGUAGES C) include(GNUInstallDirs) diff --git a/recipes/giflib/5.2.x/conandata.yml b/recipes/giflib/5.2.x/conandata.yml index ea8a0bcf52687..5833d90506e97 100644 --- a/recipes/giflib/5.2.x/conandata.yml +++ b/recipes/giflib/5.2.x/conandata.yml @@ -18,4 +18,8 @@ patches: patch_description: "Use strtok_s instead of strtok_r with MSVC" patch_type: "portability" - patch_file: "patches/0001-msvc-unistd.patch" + patch_description: "import unistd in non windows os" + patch_type: "portability" - patch_file: "patches/5.2.1-0002-msvc-export.patch" + patch_description: "export symbols with MSVC" + patch_type: "portability" diff --git a/recipes/giflib/5.2.x/conanfile.py b/recipes/giflib/5.2.x/conanfile.py index 439c512e9402a..4a1ab9027e884 100644 --- a/recipes/giflib/5.2.x/conanfile.py +++ b/recipes/giflib/5.2.x/conanfile.py @@ -4,7 +4,7 @@ from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=2.0.9" class GiflibConan(ConanFile): @@ -79,8 +79,3 @@ def package_info(self): self.cpp_info.libs = ["gif"] if is_msvc(self): self.cpp_info.defines.append("USE_GIF_DLL" if self.options.shared else "USE_GIF_LIB") - - # TODO: to remove in conan v2 - self.cpp_info.names["cmake_find_package"] = "GIF" - self.cpp_info.names["cmake_find_package_multi"] = "GIF" - self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/giflib/5.2.x/test_v1_package/CMakeLists.txt b/recipes/giflib/5.2.x/test_v1_package/CMakeLists.txt deleted file mode 100644 index b21cc49efde95..0000000000000 --- a/recipes/giflib/5.2.x/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 3.15) -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) diff --git a/recipes/giflib/5.2.x/test_v1_package/conanfile.py b/recipes/giflib/5.2.x/test_v1_package/conanfile.py deleted file mode 100644 index 1b567782d0d2e..0000000000000 --- a/recipes/giflib/5.2.x/test_v1_package/conanfile.py +++ /dev/null @@ -1,21 +0,0 @@ -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): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(f"{bin_path} testimg.gif", run_environment=True) - assert os.path.isfile("testimg.gif") - if self.options["giflib"].utils: - self.run("gif2rgb -o testimg.rgb testimg.gif", run_environment=True) - assert os.path.isfile("testimg.rgb.R")