17 autoSignDarwinBinariesHook,
20 stdenv.mkDerivation (finalAttrs: {
22 version = "unstable-2021-11-01";
25 url = "svn://svn.code.sf.net/p/freeimage/svn/";
27 sha256 = "rWoNlU/BWKZBPzRb1HqU6T0sT7aK6dpqKPe88+o/4sA=";
30 sourceRoot = "${finalAttrs.src.name}/FreeImage/trunk";
32 # Ensure that the bundled libraries are not used at all
34 rm -rf Source/Lib* Source/OpenEXR Source/ZLib
43 # To support cross compilation, use the correct `pkg-config`.
44 substituteInPlace Makefile.fip \
45 --replace "pkg-config" "$PKG_CONFIG"
46 substituteInPlace Makefile.gnu \
47 --replace "pkg-config" "$PKG_CONFIG"
49 + lib.optionalString (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) ''
50 # Upstream Makefile hardcodes i386 and x86_64 architectures only
51 substituteInPlace Makefile.osx --replace "x86_64" "arm64"
58 ++ lib.optionals stdenv.hostPlatform.isDarwin [
62 ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
63 autoSignDarwinBinariesHook
79 postBuild = lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
83 INCDIR = "${placeholder "out"}/include";
84 INSTALLDIR = "${placeholder "out"}/lib";
88 mkdir -p $INCDIR $INSTALLDIR
90 # Workaround for Makefiles.osx not using ?=
91 + lib.optionalString stdenv.hostPlatform.isDarwin ''
92 makeFlagsArray+=( "INCDIR=$INCDIR" "INSTALLDIR=$INSTALLDIR" )
96 lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
97 make -f Makefile.fip install
99 + lib.optionalString stdenv.hostPlatform.isDarwin ''
100 ln -s $out/lib/libfreeimage.3.dylib $out/lib/libfreeimage.dylib
103 enableParallelBuilding = true;
106 description = "Open Source library for accessing popular graphics image file formats";
107 homepage = "http://freeimage.sourceforge.net/";
109 knownVulnerabilities = [
123 maintainers = with lib.maintainers; [ l-as ];
124 platforms = with lib.platforms; unix;