From 42625c65c07ca8bd8bf473e498225d85cb2c0903 Mon Sep 17 00:00:00 2001 From: toge Date: Wed, 14 Dec 2022 10:05:09 +0900 Subject: [PATCH] (#14694) libspng: add version 0.7.3 --- recipes/libspng/all/conandata.yml | 14 ++++ recipes/libspng/all/conanfile.py | 2 +- .../patches/0.7.3-0001-fix-dll-install.patch | 18 ++++++ .../all/patches/0.7.3-0002-allow-miniz.patch | 64 +++++++++++++++++++ recipes/libspng/config.yml | 2 + 5 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 recipes/libspng/all/patches/0.7.3-0001-fix-dll-install.patch create mode 100644 recipes/libspng/all/patches/0.7.3-0002-allow-miniz.patch diff --git a/recipes/libspng/all/conandata.yml b/recipes/libspng/all/conandata.yml index 7ca9b017ec..20e5a777bf 100644 --- a/recipes/libspng/all/conandata.yml +++ b/recipes/libspng/all/conandata.yml @@ -1,8 +1,22 @@ sources: + "0.7.3": + url: "https://github.com/randy408/libspng/archive/refs/tags/v0.7.3.tar.gz" + sha256: "a50cadbe808ffda1a7fab17d145f52a23b163f34b3eb3696c7ecb5a52340fc1d" "0.7.2": url: "https://github.com/randy408/libspng/archive/refs/tags/v0.7.2.tar.gz" sha256: "4acf25571d31f540d0b7ee004f5461d68158e0a13182505376805da99f4ccc4e" patches: + "0.7.3": + - patch_file: "patches/0.7.3-0001-fix-dll-install.patch" + patch_description: "fix install path" + patch_type: "portability" + - patch_file: "patches/0.7.3-0002-allow-miniz.patch" + patch_description: "add miniz option which is written in docs/BUILD.md" + patch_type: "portability" "0.7.2": - patch_file: "patches/0.7.2-0001-fix-dll-install.patch" + patch_description: "fix install path" + patch_type: "portability" - patch_file: "patches/0.7.2-0002-allow-miniz.patch" + patch_description: "add miniz option which is written in docs/BUILD.md" + patch_type: "portability" diff --git a/recipes/libspng/all/conanfile.py b/recipes/libspng/all/conanfile.py index f75595db03..fda5245bb0 100644 --- a/recipes/libspng/all/conanfile.py +++ b/recipes/libspng/all/conanfile.py @@ -43,7 +43,7 @@ class LibspngConan(ConanFile): def requirements(self): if self.options.with_miniz: - self.requires("miniz/2.2.0") + self.requires("miniz/3.0.1") else: self.requires("zlib/1.2.13") diff --git a/recipes/libspng/all/patches/0.7.3-0001-fix-dll-install.patch b/recipes/libspng/all/patches/0.7.3-0001-fix-dll-install.patch new file mode 100644 index 0000000000..4178460de5 --- /dev/null +++ b/recipes/libspng/all/patches/0.7.3-0001-fix-dll-install.patch @@ -0,0 +1,18 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e6630a0..fff5d68 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -40,7 +40,12 @@ if(SPNG_SHARED) + add_library(spng SHARED ${spng_SOURCES}) + target_include_directories(spng PUBLIC ${PROJECT_SOURCE_DIR}/spng) + target_link_libraries(spng ${spng_LIBS}) +- install(TARGETS spng DESTINATION lib) ++ install( ++ TARGETS spng ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ) + + if(BUILD_EXAMPLES) + add_executable(example examples/example.c) diff --git a/recipes/libspng/all/patches/0.7.3-0002-allow-miniz.patch b/recipes/libspng/all/patches/0.7.3-0002-allow-miniz.patch new file mode 100644 index 0000000000..88dd663603 --- /dev/null +++ b/recipes/libspng/all/patches/0.7.3-0002-allow-miniz.patch @@ -0,0 +1,64 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index fff5d68..5ed4ad0 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -12,6 +12,7 @@ set(SPNG_VERSION ${SPNG_MAJOR}.${SPNG_MINOR}.${SPNG_REVISION}) + option(ENABLE_OPT "Enable architecture-specific optimizations" ON) + option(SPNG_SHARED "Build shared lib" ON) + option(SPNG_STATIC "Build static lib" ON) ++option(SPNG_USE_MINIZ "Use Miniz instead of zlib" OFF) + option(BUILD_EXAMPLES "Build examples" ON) + + include(GNUInstallDirs) +@@ -21,15 +22,19 @@ if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.12") + cmake_policy(SET CMP0074 NEW) + endif() + +-find_package(ZLIB REQUIRED) +-include_directories(${ZLIB_INCLUDE_DIRS}) ++if(SPNG_USE_MINIZ) ++ find_package(miniz REQUIRED) ++ set(spng_LIBS miniz::miniz) ++else() ++ find_package(ZLIB REQUIRED) ++ set(spng_LIBS ZLIB::ZLIB) ++endif() + + set(spng_SOURCES spng/spng.c) + +-if(NOT CMAKE_HOST_WIN32) +- set(spng_LIBS -lm ${ZLIB_LIBRARIES}) +-else() +- set(spng_LIBS ${ZLIB_LIBRARIES}) ++find_library(LIBM NAMES m) ++if(LIBM) ++ list(APPEND spng_LIBS ${LIBM}) + endif() + + if(NOT ENABLE_OPT) +@@ -39,7 +44,10 @@ endif() + if(SPNG_SHARED) + add_library(spng SHARED ${spng_SOURCES}) + target_include_directories(spng PUBLIC ${PROJECT_SOURCE_DIR}/spng) +- target_link_libraries(spng ${spng_LIBS}) ++ target_link_libraries(spng PRIVATE ${spng_LIBS}) ++ if(SPNG_USE_MINIZ) ++ target_compile_definitions(spng PRIVATE SPNG_USE_MINIZ) ++ endif() + install( + TARGETS spng + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +@@ -56,7 +64,12 @@ endif() + + if(SPNG_STATIC) + add_library(spng_static STATIC ${spng_SOURCES}) +- target_include_directories(spng PUBLIC ${PROJECT_SOURCE_DIR}/spng) ++ target_link_libraries(spng_static PRIVATE ${spng_LIBS}) ++ if(SPNG_USE_MINIZ) ++ target_compile_definitions(spng_static PRIVATE SPNG_USE_MINIZ) ++ endif() ++ ++ target_include_directories(spng_static PUBLIC ${PROJECT_SOURCE_DIR}/spng) + target_compile_definitions(spng_static PUBLIC SPNG_STATIC) + install(TARGETS spng_static DESTINATION lib) + endif() diff --git a/recipes/libspng/config.yml b/recipes/libspng/config.yml index eb766ff2f0..ed848445a9 100644 --- a/recipes/libspng/config.yml +++ b/recipes/libspng/config.yml @@ -1,3 +1,5 @@ versions: + "0.7.3": + folder: all "0.7.2": folder: all