[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:
34
recipes/jbig/all/CMakeLists.txt
Normal file
34
recipes/jbig/all/CMakeLists.txt
Normal file
@@ -0,0 +1,34 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
project(jbig LANGUAGES C)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
if(MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
add_library(jbig
|
||||
${JBIG_SRC_DIR}/libjbig/jbig.c
|
||||
${JBIG_SRC_DIR}/libjbig/jbig_tab.c
|
||||
)
|
||||
target_include_directories(jbig PUBLIC ${JBIG_SRC_DIR}/libjbig)
|
||||
if(MSVC AND BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(jbig PUBLIC _JBIGDLL_)
|
||||
endif()
|
||||
|
||||
install(TARGETS jbig
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
|
||||
install(FILES ${JBIG_SRC_DIR}/libjbig/jbig.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
|
||||
if(BUILD_EXECUTABLES)
|
||||
add_executable(pbmtojbg ${JBIG_SRC_DIR}/pbmtools/pbmtojbg.c)
|
||||
target_link_libraries(pbmtojbg PRIVATE jbig)
|
||||
|
||||
add_executable(jbgtopbm ${JBIG_SRC_DIR}/pbmtools/jbgtopbm.c)
|
||||
target_link_libraries(jbgtopbm PRIVATE jbig)
|
||||
|
||||
install(TARGETS pbmtojbg jbgtopbm DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
endif()
|
||||
8
recipes/jbig/all/conandata.yml
Normal file
8
recipes/jbig/all/conandata.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
sources:
|
||||
"20160605":
|
||||
sha256: "2669b49ee000150af7709b21c7656f1f6cbea09fd33116c40b41310adeb2b73e"
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/ImageMagick/jbig/archive/5d8f5f6fa71766ced5e828bf7bfff642ddb8a6ad.zip"
|
||||
patches:
|
||||
"20160605":
|
||||
- patch_file: patches/0001-add-missing-export.patch
|
||||
- patch_file: patches/0002-fix-msvc-export.patch
|
||||
74
recipes/jbig/all/conanfile.py
Normal file
74
recipes/jbig/all/conanfile.py
Normal file
@@ -0,0 +1,74 @@
|
||||
from conan import ConanFile
|
||||
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
|
||||
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get
|
||||
from conan.tools.microsoft import is_msvc
|
||||
import os
|
||||
|
||||
required_conan_version = ">=1.53.0"
|
||||
|
||||
|
||||
class JBigConan(ConanFile):
|
||||
name = "jbig"
|
||||
url = "https://github.com/conan-io/conan-center-index"
|
||||
homepage = "https://github.com/ImageMagick/jbig"
|
||||
description = "jbig for the Windows build of ImageMagick"
|
||||
topics = ("jbig", "imagemagick", "window", "graphic")
|
||||
license = "GPL-2.0"
|
||||
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
options = {
|
||||
"shared": [True, False],
|
||||
"fPIC": [True, False],
|
||||
"build_executables": [True, False],
|
||||
}
|
||||
default_options = {
|
||||
"shared": False,
|
||||
"fPIC": True,
|
||||
"build_executables": True,
|
||||
}
|
||||
|
||||
def export_sources(self):
|
||||
copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder)
|
||||
export_conandata_patches(self)
|
||||
|
||||
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["JBIG_SRC_DIR"] = self.source_folder.replace("\\", "/")
|
||||
tc.variables["BUILD_EXECUTABLES"] = self.options.build_executables
|
||||
tc.generate()
|
||||
|
||||
def build(self):
|
||||
apply_conandata_patches(self)
|
||||
cmake = CMake(self)
|
||||
cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir))
|
||||
cmake.build()
|
||||
|
||||
def package(self):
|
||||
copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
|
||||
cmake = CMake(self)
|
||||
cmake.install()
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.libs = ["jbig"]
|
||||
if self.options.shared and is_msvc(self):
|
||||
self.cpp_info.defines = ["_JBIGDLL_"]
|
||||
|
||||
# TODO: to remove in conan v2
|
||||
if self.options.build_executables:
|
||||
self.env_info.PATH.append(os.path.join(self.package_folder, "bin"))
|
||||
9
recipes/jbig/all/patches/0001-add-missing-export.patch
Normal file
9
recipes/jbig/all/patches/0001-add-missing-export.patch
Normal file
@@ -0,0 +1,9 @@
|
||||
--- a/libjbig/jbig.h
|
||||
+++ b/libjbig/jbig.h
|
||||
@@ -307,5 +309,6 @@
|
||||
const unsigned char *src, unsigned char **dest,
|
||||
int use_graycode);
|
||||
extern JBIGEXPORT int jbg_newlen(unsigned char *bie, size_t len);
|
||||
+extern JBIGEXPORT unsigned char *jbg_next_pscdms(unsigned char *p, size_t len);
|
||||
|
||||
#endif /* JBG_H */
|
||||
41
recipes/jbig/all/patches/0002-fix-msvc-export.patch
Normal file
41
recipes/jbig/all/patches/0002-fix-msvc-export.patch
Normal file
@@ -0,0 +1,41 @@
|
||||
diff --git a/libjbig/jbig.h b/libjbig/jbig.h
|
||||
index 214105a..a4f7781 100644
|
||||
--- a/libjbig/jbig.h
|
||||
+++ b/libjbig/jbig.h
|
||||
@@ -246,24 +246,26 @@ struct jbg_dec_state {
|
||||
* Under VISUALC we have single threaded static libraries, or
|
||||
* multi-threaded DLLs using the multithreaded runtime DLLs.
|
||||
**/
|
||||
-
|
||||
-#if defined(_MT) && defined(_DLL) && !defined(_JBIGDLL_) && !defined(_LIB)
|
||||
-# define _JBIGDLL_
|
||||
+
|
||||
+#if defined(_MSC_VER)
|
||||
+# if defined(jbig_EXPORTS)
|
||||
+# define SHARED_EXPORT_PREFIX __declspec(dllexport)
|
||||
+# else
|
||||
+# define SHARED_EXPORT_PREFIX __declspec(dllimport)
|
||||
+# endif
|
||||
+#else
|
||||
+# define SHARED_EXPORT_PREFIX
|
||||
#endif
|
||||
#if defined(_JBIGDLL_)
|
||||
-# if defined(_VISUALC_)
|
||||
+# if defined(_MSC_VER)
|
||||
# pragma warning( disable : 4273 )
|
||||
# endif
|
||||
-# if !defined(_JBIGLIB_)
|
||||
-# define JBIGEXPORT __declspec(dllimport)
|
||||
-# else
|
||||
-# define JBIGEXPORT __declspec(dllexport)
|
||||
-# endif
|
||||
+# define JBIGEXPORT SHARED_EXPORT_PREFIX
|
||||
#else
|
||||
# define JBIGEXPORT
|
||||
#endif
|
||||
|
||||
-#if defined(_VISUALC_)
|
||||
+#if defined(_MSC_VER)
|
||||
# pragma warning( disable : 4018 )
|
||||
# pragma warning( disable : 4244 )
|
||||
# pragma warning( disable : 4142 )
|
||||
7
recipes/jbig/all/test_package/CMakeLists.txt
Normal file
7
recipes/jbig/all/test_package/CMakeLists.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(test_package LANGUAGES C)
|
||||
|
||||
find_package(jbig REQUIRED CONFIG)
|
||||
|
||||
add_executable(${PROJECT_NAME} test_package.c)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE jbig::jbig)
|
||||
26
recipes/jbig/all/test_package/conanfile.py
Normal file
26
recipes/jbig/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, cmake_layout
|
||||
import os
|
||||
|
||||
|
||||
class TestPackageConan(ConanFile):
|
||||
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):
|
||||
if can_run(self):
|
||||
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
|
||||
self.run(bin_path, env="conanrun")
|
||||
13
recipes/jbig/all/test_package/test_package.c
Normal file
13
recipes/jbig/all/test_package/test_package.c
Normal file
@@ -0,0 +1,13 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "jbig.h"
|
||||
|
||||
int main() {
|
||||
struct jbg_dec_state state;
|
||||
|
||||
jbg_dec_init(&state);
|
||||
jbg_dec_getplanes(&state);
|
||||
jbg_dec_free(&state);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user