Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jasper: Bump dependencies + update imports #14291

Merged
merged 7 commits into from
Dec 2, 2022
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 23 additions & 18 deletions recipes/jasper/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
from conans import ConanFile, CMake, tools
from conans import CMake
from conan import ConanFile
from conan.tools.files import get, rmdir, rm, replace_in_file, apply_conandata_patches, export_conandata_patches
from conan.tools.scm import Version
from conan.errors import ConanInvalidConfiguration
import os
import textwrap

required_conan_version = ">=1.43.0"
required_conan_version = ">=1.53.0"


class JasperConan(ConanFile):
name = "jasper"
license = "JasPer License Version 2.0"
license = "JasPer-2.0"
homepage = "https://jasper-software.github.io/jasper"
url = "https://github.com/conan-io/conan-center-index"
topics = ("jasper", "tool-kit", "coding")
topics = ("tool-kit", "coding")
description = "JasPer Image Processing/Coding Tool Kit"

settings = "os", "arch", "compiler", "build_type"
Expand Down Expand Up @@ -38,27 +42,30 @@ def _build_subfolder(self):

def export_sources(self):
self.copy("CMakeLists.txt")
for patch in self.conan_data.get("patches", {}).get(self.version, []):
self.copy(patch["patch_file"])
export_conandata_patches(self)

def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC

def configure(self):
if self.options.shared:
del self.options.fPIC
del self.settings.compiler.cppstd
del self.settings.compiler.libcxx
self.options.rm_safe("fPIC")
self.settings.rm_safe("compiler.cppstd")
self.settings.rm_safe("compiler.libcxx")

def requirements(self):
if self.options.with_libjpeg == "libjpeg-turbo":
self.requires("libjpeg-turbo/2.1.2")
elif self.options.with_libjpeg == "libjpeg":
self.requires("libjpeg/9d")
self.requires("libjpeg/9e")

def validate(self):
if self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) >= "16":
prince-chrismc marked this conversation as resolved.
Show resolved Hide resolved
raise ConanInvalidConfiguration(f"{self.name} Current can not build in CCI due to windows SDK version. See https://github.com/conan-io/conan-center-index/pull/13285 for the solution hopefully")
prince-chrismc marked this conversation as resolved.
Show resolved Hide resolved

def source(self):
tools.get(**self.conan_data["sources"][self.version],
get(self, **self.conan_data["sources"][self.version],
destination=self._source_subfolder, strip_root=True)

def _configure_cmake(self):
Expand All @@ -74,8 +81,7 @@ def _configure_cmake(self):
return self._cmake

def _patch_sources(self):
for patch in self.conan_data.get("patches", {}).get(self.version, []):
tools.patch(**patch)
apply_conandata_patches(self)
# Clean rpath in installed shared lib
cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt")
cmds_to_remove = [
Expand All @@ -84,7 +90,7 @@ def _patch_sources(self):
"set(CMAKE_INSTALL_RPATH\n \"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}\")",
]
for cmd_to_remove in cmds_to_remove:
tools.replace_in_file(cmakelists, cmd_to_remove, "")
replace_in_file(self, cmakelists, cmd_to_remove, "")

def build(self):
self._patch_sources()
Expand All @@ -95,12 +101,11 @@ def package(self):
self.copy("LICENSE", src=self._source_subfolder, dst="licenses")
cmake = self._configure_cmake()
cmake.install()
tools.rmdir(os.path.join(self.package_folder, "share"))
tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
rmdir(self, os.path.join(self.package_folder, "share"))
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
if self.settings.os == "Windows":
for dll_prefix in ["concrt", "msvcp", "vcruntime"]:
tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"),
"{}*.dll".format(dll_prefix))
rm(self, f"{dll_prefix}*.dll", os.path.join(self.package_folder, "bin"))
self._create_cmake_module_variables(
os.path.join(self.package_folder, self._module_file_rel_path)
)
Expand Down