Skip to content

Commit

Permalink
(#15586) libjpeg-turbo: add 2.1.5 + download official tarballs + no m…
Browse files Browse the repository at this point in the history
…anual injection of CMAKE_SYSTEM_PROCESSOR

* modernize more

* download official tarballs

* remove manual injection of CMAKE_SYSTEM_PROCESSOR since it's managed by CMakeToolchain

* add libjpeg-turbo/2.1.5
  • Loading branch information
SpaceIm authored Feb 3, 2023
1 parent 3701df1 commit a7f6500
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 87 deletions.
8 changes: 0 additions & 8 deletions recipes/libjpeg-turbo/all/CMakeLists.txt

This file was deleted.

36 changes: 17 additions & 19 deletions recipes/libjpeg-turbo/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
sources:
"2.1.5":
url: "https://sourceforge.net/projects/libjpeg-turbo/files/2.1.5/libjpeg-turbo-2.1.5.tar.gz"
sha256: "bc12bc9dce55300c6bf4342bc233bcc26bd38bf289eedf147360d731c668ddaf"
"2.1.4":
url: "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/2.1.4.tar.gz"
sha256: "a78b05c0d8427a90eb5b4eb08af25309770c8379592bb0b8a863373128e6143f"
url: "https://sourceforge.net/projects/libjpeg-turbo/files/2.1.4/libjpeg-turbo-2.1.4.tar.gz"
sha256: "d3ed26a1131a13686dfca4935e520eb7c90ae76fbc45d98bb50a8dc86230342b"
"2.1.3":
url: "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/2.1.3.tar.gz"
sha256: "dbda0c685942aa3ea908496592491e5ec8160d2cf1ec9d5fd5470e50768e7859"
url: "https://sourceforge.net/projects/libjpeg-turbo/files/2.1.3/libjpeg-turbo-2.1.3.tar.gz"
sha256: "467b310903832b033fe56cd37720d1b73a6a3bd0171dbf6ff0b620385f4f76d0"
"2.1.2":
url: "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/2.1.2.tar.gz"
sha256: "e7fdc8a255c45bc8fbd9aa11c1a49c23092fcd7379296aeaeb14d3343a3d1bed"
url: "https://sourceforge.net/projects/libjpeg-turbo/files/2.1.2/libjpeg-turbo-2.1.2.tar.gz"
sha256: "09b96cb8cbff9ea556a9c2d173485fd19488844d55276ed4f42240e1e2073ce5"
"2.1.1":
url: "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/2.1.1.tar.gz"
sha256: "20e9cd3e5f517950dfb7a300ad344543d88719c254407ffb5ad88d891bf701c4"
url: "https://sourceforge.net/projects/libjpeg-turbo/files/2.1.1/libjpeg-turbo-2.1.1.tar.gz"
sha256: "b76aaedefb71ba882cbad4e9275b30c2ae493e3195be0a099425b5c6b99bd510"
"2.1.0":
url: "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/2.1.0.tar.gz"
sha256: "d6b7790927d658108dfd3bee2f0c66a2924c51ee7f9dc930f62c452f4a638c52"
url: "https://sourceforge.net/projects/libjpeg-turbo/files/2.1.0/libjpeg-turbo-2.1.0.tar.gz"
sha256: "bef89803e506f27715c5627b1e3219c95b80fc31465d4452de2a909d382e4444"
"2.0.6":
url: "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/2.0.6.tar.gz"
sha256: "005aee2fcdca252cee42271f7f90574dda64ca6505d9f8b86ae61abc2b426371"
url: "https://sourceforge.net/projects/libjpeg-turbo/files/2.0.6/libjpeg-turbo-2.0.6.tar.gz"
sha256: "d74b92ac33b0e3657123ddcf6728788c90dc84dcb6a52013d758af3c4af481bb"
"2.0.5":
url: "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/2.0.5.tar.gz"
sha256: "b3090cd37b5a8b3e4dbd30a1311b3989a894e5d3c668f14cbc6739d77c9402b7"
patches:
"2.1.4":
- patch_file: "patches/2.1.3-0001-fix-cmake.patch"
"2.1.3":
- patch_file: "patches/2.1.3-0001-fix-cmake.patch"
url: "https://sourceforge.net/projects/libjpeg-turbo/files/2.0.5/libjpeg-turbo-2.0.5.tar.gz"
sha256: "16f8f6f2715b3a38ab562a84357c793dd56ae9899ce130563c72cd93d8357b5d"
44 changes: 10 additions & 34 deletions recipes/libjpeg-turbo/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import cross_building
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.tools.env import VirtualBuildEnv
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir
from conan.tools.files import copy, get, replace_in_file, rm, rmdir
from conan.tools.microsoft import is_msvc, is_msvc_static_runtime
from conan.tools.scm import Version
import os

required_conan_version = ">=1.52.0"
required_conan_version = ">=1.53.0"


class LibjpegTurboConan(ConanFile):
Expand Down Expand Up @@ -47,28 +46,15 @@ class LibjpegTurboConan(ConanFile):
"enable12bit": False,
}

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:
try:
del self.options.fPIC
except Exception:
pass
try:
del self.settings.compiler.libcxx
except Exception:
pass
try:
del self.settings.compiler.cppstd
except Exception:
pass
self.options.rm_safe("fPIC")
self.settings.rm_safe("compiler.cppstd")
self.settings.rm_safe("compiler.libcxx")

if self.options.enable12bit:
del self.options.java
Expand All @@ -85,20 +71,19 @@ def layout(self):
cmake_layout(self, src_folder="src")

def validate(self):
if self.info.options.enable12bit and (self.info.options.libjpeg7_compatibility or self.info.options.libjpeg8_compatibility):
if self.options.enable12bit and (self.options.libjpeg7_compatibility or self.options.libjpeg8_compatibility):
raise ConanInvalidConfiguration("12-bit samples is not allowed with libjpeg v7/v8 API/ABI")
if self.info.options.get_safe("java") and not self.info.options.shared:
if self.options.get_safe("java") and not self.options.shared:
raise ConanInvalidConfiguration("java wrapper requires shared libjpeg-turbo")
if self.info.options.shared and is_msvc(self) and is_msvc_static_runtime(self):
if self.options.shared and is_msvc(self) and is_msvc_static_runtime(self):
raise ConanInvalidConfiguration(f"{self.ref} shared can't be built with static vc runtime")

def build_requirements(self):
if self.options.get_safe("SIMD") and self.settings.arch in ["x86", "x86_64"]:
self.tool_requires("nasm/2.15.05")

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

@property
def _is_arithmetic_encoding_enabled(self):
Expand Down Expand Up @@ -130,18 +115,9 @@ def generate(self):
tc.variables["WITH_CRT_DLL"] = True # avoid replacing /MD by /MT in compiler flags
if Version(self.version) <= "2.1.0":
tc.variables["CMAKE_MACOSX_BUNDLE"] = False # avoid configuration error if building for iOS/tvOS/watchOS
if cross_building(self):
# TODO: too specific and error prone, should be delegated to a conan helper function
cmake_system_processor = {
"armv8": "aarch64",
"armv8.3": "aarch64",
}.get(str(self.settings.arch), str(self.settings.arch))
tc.variables["CONAN_LIBJPEG_TURBO_SYSTEM_PROCESSOR"] = cmake_system_processor
tc.generate()

def _patch_sources(self):
apply_conandata_patches(self)

# use standard GNUInstallDirs.cmake - custom one is broken
replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"),
"include(cmakescripts/GNUInstallDirs.cmake)",
Expand All @@ -154,7 +130,7 @@ def _patch_sources(self):
def build(self):
self._patch_sources()
cmake = CMake(self)
cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir))
cmake.configure()
cmake.build()

def package(self):
Expand Down
26 changes: 0 additions & 26 deletions recipes/libjpeg-turbo/all/patches/2.1.3-0001-fix-cmake.patch

This file was deleted.

2 changes: 2 additions & 0 deletions recipes/libjpeg-turbo/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"2.1.5":
folder: all
"2.1.4":
folder: all
"2.1.3":
Expand Down

0 comments on commit a7f6500

Please sign in to comment.