Merge pull request #92708 from L-as/freeimage
freeimage: Unbundle dependencies, fix aarch64 support, and other fixes
This commit is contained in:
commit
da2562a97c
@ -4949,6 +4949,16 @@
|
|||||||
fingerprint = "5A9A 1C9B 2369 8049 3B48 CF5B 81A1 5409 4816 2372";
|
fingerprint = "5A9A 1C9B 2369 8049 3B48 CF5B 81A1 5409 4816 2372";
|
||||||
}];
|
}];
|
||||||
};
|
};
|
||||||
|
l-as = {
|
||||||
|
email = "las@protonmail.ch";
|
||||||
|
github = "L-as";
|
||||||
|
githubId = 22075344;
|
||||||
|
keys = [{
|
||||||
|
longkeyid = "rsa2048/0xAC458A7D1087D025";
|
||||||
|
fingerprint = "A093 EA17 F450 D4D1 60A0 1194 AC45 8A7D 1087 D025";
|
||||||
|
}];
|
||||||
|
name = "Las Safin";
|
||||||
|
};
|
||||||
laikq = {
|
laikq = {
|
||||||
email = "gwen@quasebarth.de";
|
email = "gwen@quasebarth.de";
|
||||||
github = "laikq";
|
github = "laikq";
|
||||||
|
@ -1,48 +1,40 @@
|
|||||||
{ lib, stdenv, fetchurl, unzip, darwin }:
|
{ lib, stdenv, fetchsvn, darwin, libtiff
|
||||||
|
, libpng, zlib, libwebp, libraw, openexr, openjpeg
|
||||||
# TODO: consider unvendoring various dependencies (libpng, libjpeg,
|
, libjpeg, jxrlib, pkg-config }:
|
||||||
# libwebp, zlib, ...)
|
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = "freeimage-3.18.0";
|
pname = "freeimage";
|
||||||
|
version = "unstable-2020-07-04";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchsvn {
|
||||||
url = "mirror://sourceforge/freeimage/FreeImage3180.zip";
|
url = "svn://svn.code.sf.net/p/freeimage/svn/";
|
||||||
sha256 = "1z9qwi9mlq69d5jipr3v2jika2g0kszqdzilggm99nls5xl7j4zl";
|
rev = "1859";
|
||||||
|
sha256 = "1d94935aqbkb994nqkw7m8xcynyz9rm6k7k59igrbjak8b63qpi6";
|
||||||
};
|
};
|
||||||
|
sourceRoot = "svn-r1859/FreeImage/trunk";
|
||||||
|
|
||||||
patches = lib.optional stdenv.isDarwin ./dylib.patch;
|
# Ensure that the bundled libraries are not used at all
|
||||||
|
prePatch = "rm -rf Source/Lib* Source/OpenEXR Source/ZLib";
|
||||||
|
patches = [ ./unbundle.diff ];
|
||||||
|
|
||||||
buildInputs = [ unzip ] ++ lib.optional stdenv.isDarwin darwin.cctools;
|
nativeBuildInputs = [ pkg-config ] ++ lib.optional stdenv.isDarwin darwin.cctools;
|
||||||
|
buildInputs = [ libtiff libtiff.dev_private libpng zlib libwebp libraw openexr openjpeg libjpeg libjpeg.dev_private jxrlib ];
|
||||||
prePatch = if stdenv.isDarwin then ''
|
|
||||||
sed -e 's/$(shell xcrun -find clang)/clang/g' \
|
|
||||||
-e 's/$(shell xcrun -find clang++)/clang++/g' \
|
|
||||||
-e "s|PREFIX = /usr/local|PREFIX = $out|" \
|
|
||||||
-e 's|-Wl,-syslibroot $(MACOSX_SYSROOT)||g' \
|
|
||||||
-e 's|-isysroot $(MACOSX_SYSROOT)||g' \
|
|
||||||
-e 's| install -d -m 755 -o root -g wheel $(INCDIR) $(INSTALLDIR)||' \
|
|
||||||
-e 's| -m 644 -o root -g wheel||g' \
|
|
||||||
-i ./Makefile.osx
|
|
||||||
# Fix LibJXR performance timers
|
|
||||||
sed 's|^SRCS = \(.*\)$|SRCS = \1 Source/LibJXR/image/sys/perfTimerANSI.c|' -i ./Makefile.srcs
|
|
||||||
'' else ''
|
|
||||||
sed -e s@/usr/@$out/@ \
|
|
||||||
-e 's@-o root -g root@@' \
|
|
||||||
-e 's@ldconfig@echo not running ldconfig@' \
|
|
||||||
-i Makefile.gnu Makefile.fip
|
|
||||||
'';
|
|
||||||
|
|
||||||
postBuild = lib.optionalString (!stdenv.isDarwin) ''
|
postBuild = lib.optionalString (!stdenv.isDarwin) ''
|
||||||
make -f Makefile.fip
|
make -f Makefile.fip
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
INCDIR = "${placeholder "out"}/include";
|
||||||
|
INSTALLDIR = "${placeholder "out"}/lib";
|
||||||
|
|
||||||
preInstall = ''
|
preInstall = ''
|
||||||
mkdir -p $out/include $out/lib
|
mkdir -p $INCDIR $INSTALLDIR
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postInstall = lib.optionalString (!stdenv.isDarwin) ''
|
postInstall = lib.optionalString (!stdenv.isDarwin) ''
|
||||||
make -f Makefile.fip install
|
make -f Makefile.fip install
|
||||||
|
'' + lib.optionalString stdenv.isDarwin ''
|
||||||
|
ln -s $out/lib/libfreeimage.3.dylib $out/lib/libfreeimage.dylib
|
||||||
'';
|
'';
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
@ -51,9 +43,7 @@ stdenv.mkDerivation {
|
|||||||
description = "Open Source library for accessing popular graphics image file formats";
|
description = "Open Source library for accessing popular graphics image file formats";
|
||||||
homepage = "http://freeimage.sourceforge.net/";
|
homepage = "http://freeimage.sourceforge.net/";
|
||||||
license = "GPL";
|
license = "GPL";
|
||||||
maintainers = with lib.maintainers; [viric];
|
maintainers = with lib.maintainers; [viric l-as];
|
||||||
platforms = with lib.platforms; unix;
|
platforms = with lib.platforms; unix;
|
||||||
# see https://github.com/NixOS/nixpkgs/issues/77653
|
|
||||||
broken = stdenv.isAarch64;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
--- a/Makefile.osx
|
|
||||||
+++ b/Makefile.osx
|
|
||||||
@@ -60,1 +60,1 @@
|
|
||||||
-FreeImage: $(STATICLIB)
|
|
||||||
+FreeImage: $(STATICLIB) $(SHAREDLIB)
|
|
||||||
@@ -87,7 +87,7 @@
|
|
||||||
-$(SHAREDLIB): $(SHAREDLIB)-i386 $(SHAREDLIB)-x86_64
|
|
||||||
- $(LIPO) -create $(SHAREDLIB)-i386 $(SHAREDLIB)-x86_64 -output $(SHAREDLIB)
|
|
||||||
+#$(SHAREDLIB): $(SHAREDLIB)-i386 $(SHAREDLIB)-x86_64
|
|
||||||
+# $(LIPO) -create $(SHAREDLIB)-i386 $(SHAREDLIB)-x86_64 -output $(SHAREDLIB)
|
|
||||||
|
|
||||||
$(SHAREDLIB)-i386: $(MODULES_I386)
|
|
||||||
$(CPP_I386) -arch i386 -dynamiclib $(LIBRARIES_I386) -o $@ $(MODULES_I386)
|
|
||||||
|
|
||||||
-$(SHAREDLIB)-x86_64: $(MODULES_X86_64)
|
|
||||||
+$(SHAREDLIB): $(MODULES_X86_64)
|
|
584
pkgs/development/libraries/freeimage/unbundle.diff
Normal file
584
pkgs/development/libraries/freeimage/unbundle.diff
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,104 @@
|
|||||||
|
From 4a0584f7c05641143151ebdc1be1163bebf9d35d 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
|
||||||
|
|
||||||
|
The exported symbols are made weak to not conflict with users
|
||||||
|
of the library that already vendor this functionality.
|
||||||
|
---
|
||||||
|
CMakeLists.txt | 4 ++--
|
||||||
|
transupp.c | 14 +++++++-------
|
||||||
|
2 files changed, 9 insertions(+), 9 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||||
|
index 0ca6f98..a9a0fae 100644
|
||||||
|
--- a/CMakeLists.txt
|
||||||
|
+++ b/CMakeLists.txt
|
||||||
|
@@ -533,7 +533,7 @@ set(JPEG_SOURCES jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c
|
||||||
|
jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c jdicc.c jdinput.c
|
||||||
|
jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c jdpostct.c jdsample.c
|
||||||
|
jdtrans.c jerror.c jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c
|
||||||
|
- jidctint.c jidctred.c jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c)
|
||||||
|
+ jidctint.c jidctred.c jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c transupp.c)
|
||||||
|
|
||||||
|
if(WITH_ARITH_ENC OR WITH_ARITH_DEC)
|
||||||
|
set(JPEG_SOURCES ${JPEG_SOURCES} jaricom.c)
|
||||||
|
@@ -1489,7 +1489,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})
|
||||||
|
|
||||||
|
include(cmakescripts/BuildPackages.cmake)
|
||||||
|
diff --git a/transupp.c b/transupp.c
|
||||||
|
index 6e86077..2da49a7 100644
|
||||||
|
--- a/transupp.c
|
||||||
|
+++ b/transupp.c
|
||||||
|
@@ -1386,7 +1386,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;
|
||||||
|
@@ -1486,7 +1486,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)
|
||||||
|
{
|
||||||
|
@@ -2033,7 +2033,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)
|
||||||
|
@@ -2152,7 +2152,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)
|
||||||
|
@@ -2264,7 +2264,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)
|
||||||
|
@@ -2303,7 +2303,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
|
||||||
|
@@ -2331,7 +2331,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.29.2
|
||||||
|
|
@ -15,11 +15,16 @@ stdenv.mkDerivation rec {
|
|||||||
sha256 = "0njdxfmyk8smj8bbd6fs3lxjaq3lybivwgg16gpnbiyl984dpi9b";
|
sha256 = "0njdxfmyk8smj8bbd6fs3lxjaq3lybivwgg16gpnbiyl984dpi9b";
|
||||||
};
|
};
|
||||||
|
|
||||||
patches =
|
# This is needed by freeimage
|
||||||
stdenv.lib.optional (stdenv.hostPlatform.libc or null == "msvcrt")
|
patches = [ ./0001-Compile-transupp.c-as-part-of-the-library.patch ]
|
||||||
|
++ stdenv.lib.optional (stdenv.hostPlatform.libc or null == "msvcrt")
|
||||||
./mingw-boolean.patch;
|
./mingw-boolean.patch;
|
||||||
|
|
||||||
outputs = [ "bin" "dev" "out" "man" "doc" ];
|
outputs = [ "bin" "dev" "dev_private" "out" "man" "doc" ];
|
||||||
|
|
||||||
|
postFixup = ''
|
||||||
|
moveToOutput include/transupp.h $dev_private
|
||||||
|
'';
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake nasm ];
|
nativeBuildInputs = [ cmake nasm ];
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
, fetchurl
|
, fetchurl
|
||||||
|
|
||||||
, pkgconfig
|
, pkgconfig
|
||||||
|
, cmake
|
||||||
|
|
||||||
, zlib
|
, zlib
|
||||||
, libjpeg
|
, libjpeg
|
||||||
@ -17,15 +18,25 @@ stdenv.mkDerivation rec {
|
|||||||
sha256 = "0d46bdvxdiv59lxnb0xz9ywm8arsr6xsapi5s6y6vnys2wjz6aax";
|
sha256 = "0d46bdvxdiv59lxnb0xz9ywm8arsr6xsapi5s6y6vnys2wjz6aax";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = [ "bin" "dev" "out" "man" "doc" ];
|
# FreeImage needs this patch
|
||||||
|
patches = [ ./headers.patch ];
|
||||||
|
|
||||||
nativeBuildInputs = [ pkgconfig ];
|
outputs = [ "bin" "dev" "dev_private" "out" "man" "doc" ];
|
||||||
|
|
||||||
|
postFixup = ''
|
||||||
|
moveToOutput include/tif_dir.h $dev_private
|
||||||
|
moveToOutput include/tif_config.h $dev_private
|
||||||
|
moveToOutput include/tiffiop.h $dev_private
|
||||||
|
'';
|
||||||
|
|
||||||
|
nativeBuildInputs = [ cmake pkgconfig ];
|
||||||
|
|
||||||
propagatedBuildInputs = [ zlib libjpeg xz ]; #TODO: opengl support (bogus configure detection)
|
propagatedBuildInputs = [ zlib libjpeg xz ]; #TODO: opengl support (bogus configure detection)
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
doCheck = true; # not cross;
|
doInstallCheck = true;
|
||||||
|
installCheckTarget = "test";
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
description = "Library and utilities for working with the TIFF image file format";
|
description = "Library and utilities for working with the TIFF image file format";
|
||||||
|
13
pkgs/development/libraries/libtiff/headers.patch
Normal file
13
pkgs/development/libraries/libtiff/headers.patch
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
diff -ruN a/libtiff/CMakeLists.txt b/libtiff/CMakeLists.txt
|
||||||
|
--- a/libtiff/CMakeLists.txt 2019-05-31 13:05:22.849705817 +0000
|
||||||
|
+++ b/libtiff/CMakeLists.txt 2020-11-27 21:50:03.527831837 +0000
|
||||||
|
@@ -42,6 +42,9 @@
|
||||||
|
libtiffxx.map)
|
||||||
|
|
||||||
|
set(tiff_HEADERS
|
||||||
|
+ tiffiop.h
|
||||||
|
+ ${CMAKE_CURRENT_BINARY_DIR}/tif_config.h
|
||||||
|
+ tif_dir.h
|
||||||
|
tiff.h
|
||||||
|
tiffio.h
|
||||||
|
tiffvers.h)
|
Loading…
x
Reference in New Issue
Block a user