[DO-983][DO-985] add tiff and zstd packages (!14)
Co-authored-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech> Reviewed-on: https://git.avroid.tech/Conan/conan_build/pulls/14
This commit is contained in:
22
recipes/libdeflate/all/conandata.yml
Normal file
22
recipes/libdeflate/all/conandata.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
sources:
|
||||
"1.22":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/ebiggers/libdeflate/archive/refs/tags/v1.22.tar.gz"
|
||||
sha256: "7f343c7bf2ba46e774d8a632bf073235e1fd27723ef0a12a90f8947b7fe851d6"
|
||||
"1.21":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/ebiggers/libdeflate/archive/refs/tags/v1.21.tar.gz"
|
||||
sha256: "50827d312c0413fbd41b0628590cd54d9ad7ebf88360cba7c0e70027942dbd01"
|
||||
"1.20":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/ebiggers/libdeflate/archive/refs/tags/v1.20.tar.gz"
|
||||
sha256: "ed1454166ced78913ff3809870a4005b7170a6fd30767dc478a09b96847b9c2a"
|
||||
"1.19":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/ebiggers/libdeflate/archive/refs/tags/v1.19.tar.gz"
|
||||
sha256: "27bf62d71cd64728ff43a9feb92f2ac2f2bf748986d856133cc1e51992428c25"
|
||||
"1.18":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/ebiggers/libdeflate/archive/refs/tags/v1.18.tar.gz"
|
||||
sha256: "225d982bcaf553221c76726358d2ea139bb34913180b20823c782cede060affd"
|
||||
"1.17":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/ebiggers/libdeflate/archive/refs/tags/v1.17.tar.gz"
|
||||
sha256: "fa4615af671513fa2a53dc2e7a89ff502792e2bdfc046869ef35160fcc373763"
|
||||
"1.15":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/ebiggers/libdeflate/archive/refs/tags/v1.15.tar.gz"
|
||||
sha256: "58b95040df7383dc0413defb700d9893c194732474283cc4c8f144b00a68154b"
|
||||
78
recipes/libdeflate/all/conanfile.py
Normal file
78
recipes/libdeflate/all/conanfile.py
Normal file
@@ -0,0 +1,78 @@
|
||||
from conan import ConanFile
|
||||
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
|
||||
from conan.tools.files import collect_libs, copy, get, rmdir
|
||||
import os
|
||||
|
||||
required_conan_version = ">=1.53.0"
|
||||
|
||||
|
||||
class LibdeflateConan(ConanFile):
|
||||
name = "libdeflate"
|
||||
description = "Heavily optimized library for DEFLATE/zlib/gzip compression and decompression."
|
||||
license = "MIT"
|
||||
url = "https://github.com/conan-io/conan-center-index"
|
||||
homepage = "https://github.com/ebiggers/libdeflate"
|
||||
topics = ("compression", "decompression", "deflate", "zlib", "gzip")
|
||||
package_type = "library"
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
options = {
|
||||
"shared": [True, False],
|
||||
"fPIC": [True, False],
|
||||
}
|
||||
default_options = {
|
||||
"shared": False,
|
||||
"fPIC": True,
|
||||
}
|
||||
|
||||
def config_options(self):
|
||||
if self.settings.os == "Windows":
|
||||
del self.options.fPIC
|
||||
|
||||
def configure(self):
|
||||
if self.options.shared:
|
||||
self.options.rm_safe("fPIC")
|
||||
self.settings.rm_safe("compiler.cppstd")
|
||||
self.settings.rm_safe("compiler.libcxx")
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self, src_folder="src")
|
||||
|
||||
def source(self):
|
||||
get(self, **self.conan_data["sources"][self.version], strip_root=True)
|
||||
|
||||
def generate(self):
|
||||
tc = CMakeToolchain(self)
|
||||
tc.variables["LIBDEFLATE_BUILD_STATIC_LIB"] = not self.options.shared
|
||||
tc.variables["LIBDEFLATE_BUILD_SHARED_LIB"] = self.options.shared
|
||||
tc.variables["LIBDEFLATE_BUILD_GZIP"] = False
|
||||
tc.variables["LIBDEFLATE_BUILD_TESTS"] = False
|
||||
tc.generate()
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def package(self):
|
||||
copy(self, "COPYING", self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
|
||||
cmake = CMake(self)
|
||||
cmake.install()
|
||||
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
|
||||
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.set_property("cmake_file_name", "libdeflate")
|
||||
target_suffix = "_shared" if self.options.shared else "_static"
|
||||
self.cpp_info.set_property("cmake_target_name", f"libdeflate::libdeflate{target_suffix}")
|
||||
self.cpp_info.set_property("cmake_target_aliases", ["libdeflate::libdeflate"]) # not official, avoid to break users
|
||||
self.cpp_info.set_property("pkg_config_name", "libdeflate")
|
||||
# TODO: back to global scope in conan v2
|
||||
self.cpp_info.components["_libdeflate"].libs = collect_libs(self)
|
||||
if self.settings.os == "Windows" and self.options.shared:
|
||||
self.cpp_info.components["_libdeflate"].defines.append("LIBDEFLATE_DLL")
|
||||
|
||||
# TODO: to remove in conan v2
|
||||
self.cpp_info.components["_libdeflate"].names["cmake_find_package"] = f"libdeflate{target_suffix}"
|
||||
self.cpp_info.components["_libdeflate"].names["cmake_find_package_multi"] = f"libdeflate{target_suffix}"
|
||||
self.cpp_info.components["_libdeflate"].set_property("cmake_target_name", f"libdeflate::libdeflate{target_suffix}")
|
||||
self.cpp_info.components["_libdeflate"].set_property("pkg_config_name", "libdeflate")
|
||||
11
recipes/libdeflate/all/test_package/CMakeLists.txt
Normal file
11
recipes/libdeflate/all/test_package/CMakeLists.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(test_package LANGUAGES C)
|
||||
|
||||
find_package(libdeflate REQUIRED CONFIG)
|
||||
|
||||
add_executable(${PROJECT_NAME} test_package.c)
|
||||
if(TARGET libdeflate::libdeflate_static)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE libdeflate::libdeflate_static)
|
||||
else()
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE libdeflate::libdeflate_shared)
|
||||
endif()
|
||||
26
recipes/libdeflate/all/test_package/conanfile.py
Normal file
26
recipes/libdeflate/all/test_package/conanfile.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from conan import ConanFile
|
||||
from conan.tools.build import can_run
|
||||
from conan.tools.cmake import cmake_layout, CMake
|
||||
import os
|
||||
|
||||
|
||||
class TestPackageConan(ConanFile):
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
generators = "CMakeDeps", "CMakeToolchain", "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):
|
||||
if can_run(self):
|
||||
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
|
||||
self.run(bin_path, env="conanrun")
|
||||
8
recipes/libdeflate/all/test_package/test_package.c
Normal file
8
recipes/libdeflate/all/test_package/test_package.c
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <libdeflate.h>
|
||||
|
||||
int main () {
|
||||
struct libdeflate_compressor *c;
|
||||
c = libdeflate_alloc_compressor(12);
|
||||
libdeflate_free_compressor(c);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user