libjpeg: 3.0.4 -> 3.1.0 (#384224)

This commit is contained in:
Vladimír Čunát
2025-05-22 10:20:54 +02:00
4 changed files with 34 additions and 158 deletions
@@ -1,34 +0,0 @@
From 6442d11617f95d13e2a371bd3e01f5082a9c356d Mon Sep 17 00:00:00 2001
From: Las <las@protonmail.ch>
Date: Sun, 3 Jan 2021 18:35:37 +0000
Subject: [PATCH] Compile transupp.c as part of the library
---
CMakeLists.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index adb0ca45..46fc16dd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -581,7 +581,7 @@ set(JPEG_SOURCES ${JPEG12_SOURCES} jcapimin.c jchuff.c jcicc.c jcinit.c
jclhuff.c jcmarker.c jcmaster.c jcomapi.c jcparam.c jcphuff.c jctrans.c
jdapimin.c jdatadst.c jdatasrc.c jdhuff.c jdicc.c jdinput.c jdlhuff.c
jdmarker.c jdmaster.c jdphuff.c jdtrans.c jerror.c jfdctflt.c jmemmgr.c
- jmemnobs.c jpeg_nbits.c)
+ jmemnobs.c jpeg_nbits.c transupp.c)
if(WITH_ARITH_ENC OR WITH_ARITH_DEC)
set(JPEG_SOURCES ${JPEG_SOURCES} jaricom.c)
@@ -1803,7 +1803,7 @@ install(EXPORT ${CMAKE_PROJECT_NAME}Targets
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/jconfig.h
${CMAKE_CURRENT_SOURCE_DIR}/jerror.h ${CMAKE_CURRENT_SOURCE_DIR}/jmorecfg.h
- ${CMAKE_CURRENT_SOURCE_DIR}/jpeglib.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/jpeglib.h ${CMAKE_CURRENT_SOURCE_DIR}/transupp.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT include)
include(cmakescripts/BuildPackages.cmake)
--
2.43.0
@@ -1,81 +0,0 @@
From 6442d11617f95d13e2a371bd3e01f5082a9c356d Mon Sep 17 00:00:00 2001
From: Las <las@protonmail.ch>
Date: Sun, 3 Jan 2021 18:35:37 +0000
Subject: [PATCH] Make exported symbols in transupp.c weak
The exported symbols are made weak to not conflict with users
of the library that already vendor this functionality.
---
transupp.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/transupp.c b/transupp.c
index 34fbb371..c0ade5a9 100644
--- a/transupp.c
+++ b/transupp.c
@@ -1388,7 +1388,7 @@ jt_read_integer(const char **strptr, JDIMENSION *result)
* This code is loosely based on XParseGeometry from the X11 distribution.
*/
-GLOBAL(boolean)
+GLOBAL(boolean) __attribute__((weak))
jtransform_parse_crop_spec(jpeg_transform_info *info, const char *spec)
{
info->crop = FALSE;
@@ -1488,7 +1488,7 @@ trim_bottom_edge(jpeg_transform_info *info, JDIMENSION full_height)
* and transformation is not perfect. Otherwise returns TRUE.
*/
-GLOBAL(boolean)
+GLOBAL(boolean) __attribute__((weak))
jtransform_request_workspace(j_decompress_ptr srcinfo,
jpeg_transform_info *info)
{
@@ -2035,7 +2035,7 @@ adjust_exif_parameters(JOCTET *data, unsigned int length, JDIMENSION new_width,
* to jpeg_write_coefficients().
*/
-GLOBAL(jvirt_barray_ptr *)
+GLOBAL(jvirt_barray_ptr *) __attribute__((weak))
jtransform_adjust_parameters(j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
jvirt_barray_ptr *src_coef_arrays,
jpeg_transform_info *info)
@@ -2154,7 +2154,7 @@ jtransform_adjust_parameters(j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
* Note that some transformations will modify the source data arrays!
*/
-GLOBAL(void)
+GLOBAL(void) __attribute__((weak))
jtransform_execute_transform(j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
jvirt_barray_ptr *src_coef_arrays,
jpeg_transform_info *info)
@@ -2266,7 +2266,7 @@ jtransform_execute_transform(j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
* (may use custom action then)
*/
-GLOBAL(boolean)
+GLOBAL(boolean) __attribute__((weak))
jtransform_perfect_transform(JDIMENSION image_width, JDIMENSION image_height,
int MCU_width, int MCU_height,
JXFORM_CODE transform)
@@ -2305,7 +2305,7 @@ jtransform_perfect_transform(JDIMENSION image_width, JDIMENSION image_height,
* This must be called before jpeg_read_header() to have the desired effect.
*/
-GLOBAL(void)
+GLOBAL(void) __attribute__((weak))
jcopy_markers_setup(j_decompress_ptr srcinfo, JCOPY_OPTION option)
{
#ifdef SAVE_MARKERS_SUPPORTED
@@ -2337,7 +2337,7 @@ jcopy_markers_setup(j_decompress_ptr srcinfo, JCOPY_OPTION option)
* JFIF APP0 or Adobe APP14 markers if selected.
*/
-GLOBAL(void)
+GLOBAL(void) __attribute__((weak))
jcopy_markers_execute(j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
JCOPY_OPTION option)
{
--
2.43.0
@@ -1,12 +1,11 @@
Ported to updated libjpeg-turbo from
https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-libjpeg-turbo/jpeg-typedefs.patch
--- a/jmorecfg.h 2012-02-10 06:47:55 +0300
+++ b/jmorecfg.h 2012-05-03 10:29:13 +0400
@@ -224,7 +224,13 @@
* Defining HAVE_BOOLEAN before including jpeglib.h should make it work.
--- a/src/jmorecfg.h
+++ b/src/jmorecfg.h
@@ -200,6 +200,13 @@
*/
-#ifndef HAVE_BOOLEAN
#ifndef HAVE_BOOLEAN
+#if defined(_WIN32) && !defined(HAVE_BOOLEAN)
+#ifndef __RPCNDR_H__
+typedef unsigned char boolean;
@@ -16,4 +15,4 @@ https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-libjpeg-turbo/jpeg
+#if !defined(HAVE_BOOLEAN) && !defined(__RPCNDR_H__)
typedef int boolean;
#endif
#ifndef FALSE /* in case these macros already exist */
#ifndef FALSE /* in case these macros already exist */
+29 -37
View File
@@ -14,7 +14,6 @@
# for passthru.tests
dvgrab,
epeg,
freeimage,
gd,
graphicsmagick,
imagemagick,
@@ -26,30 +25,24 @@
python3,
vips,
testers,
nix-update-script,
}:
assert !(enableJpeg7 && enableJpeg8); # pick only one or none, not both
stdenv.mkDerivation (finalAttrs: {
pname = "libjpeg-turbo";
version = "3.0.4";
version = "3.1.0";
src = fetchFromGitHub {
owner = "libjpeg-turbo";
repo = "libjpeg-turbo";
rev = finalAttrs.version;
hash = "sha256-ZNqhOfZtWcMv10VWIUxn7MSy4KhW/jBrgC1tUFKczqs=";
tag = finalAttrs.version;
hash = "sha256-ImDTMObirpw/SouCftlALJoWCbXsRc6bf4IFjYfWpUY=";
};
patches =
[
# This is needed by freeimage
./0001-Compile-transupp.c-as-part-of-the-library.patch
]
++ lib.optionals (!stdenv.hostPlatform.isMinGW) [
./0002-Make-exported-symbols-in-transupp.c-weak.patch
]
[ ]
++ lib.optionals stdenv.hostPlatform.isMinGW [
./mingw-boolean.patch
];
@@ -57,16 +50,11 @@ stdenv.mkDerivation (finalAttrs: {
outputs = [
"bin"
"dev"
"dev_private"
"out"
"man"
"doc"
];
postFixup = ''
moveToOutput include/transupp.h $dev_private
'';
nativeBuildInputs =
[
cmake
@@ -99,36 +87,40 @@ stdenv.mkDerivation (finalAttrs: {
doInstallCheck = true;
installCheckTarget = "test";
passthru.tests = {
inherit
dvgrab
epeg
gd
graphicsmagick
imagemagick
imlib2
jhead
libjxl
mjpegtools
opencv
vips
;
inherit (python3.pkgs) pillow imread pyturbojpeg;
pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
passthru = {
updateScript = nix-update-script { };
dev_private = throw "not supported anymore";
tests = {
inherit
dvgrab
epeg
gd
graphicsmagick
imagemagick
imlib2
jhead
libjxl
mjpegtools
opencv
vips
;
inherit (python3.pkgs) pillow imread pyturbojpeg;
pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
};
};
meta = with lib; {
meta = {
homepage = "https://libjpeg-turbo.org/";
description = "Faster (using SIMD) libjpeg implementation";
license = licenses.ijg; # and some parts under other BSD-style licenses
license = lib.licenses.ijg; # and some parts under other BSD-style licenses
pkgConfigModules = [
"libjpeg"
"libturbojpeg"
];
maintainers = with maintainers; [
maintainers = with lib.maintainers; [
vcunat
kamadorueda
];
platforms = platforms.all;
platforms = lib.platforms.all;
};
})