e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
73 lines
1.6 KiB
Nix
73 lines
1.6 KiB
Nix
{ lib
|
|
, stdenv
|
|
, fetchurl
|
|
, cmake
|
|
, libjpeg
|
|
, libpng
|
|
, libmng
|
|
, lcms1
|
|
, libtiff
|
|
, openexr
|
|
, libGL
|
|
, libX11
|
|
, pkg-config
|
|
, OpenGL
|
|
, runtimeShell
|
|
, withXorg ? true
|
|
, testers
|
|
, mesa
|
|
}:
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "libdevil";
|
|
version = "1.8.0";
|
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
src = fetchurl {
|
|
url = "mirror://sourceforge/openil/DevIL-${finalAttrs.version}.tar.gz";
|
|
hash = "sha256-AHWXPufdifBQeHPiWArHgzZFLSnTSgcTSyCPROL+twk=";
|
|
};
|
|
|
|
sourceRoot = "DevIL/DevIL";
|
|
|
|
nativeBuildInputs = [ cmake pkg-config ];
|
|
|
|
buildInputs = [ libjpeg libpng libmng lcms1 libtiff openexr ]
|
|
++ lib.optionals withXorg [ libX11 libGL ]
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [ OpenGL ];
|
|
|
|
configureFlags = [ "--enable-ILU" "--enable-ILUT" ];
|
|
|
|
CXXFLAGS = lib.optionalString stdenv.cc.isClang "-Wno-register";
|
|
|
|
preConfigure = ''
|
|
sed -i 's,malloc.h,stdlib.h,g' src-ILU/ilur/ilur.c
|
|
'';
|
|
|
|
patches = [
|
|
./0001-il_endian.h-Fix-endian-handling.patch
|
|
];
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
postPatch = ''
|
|
for a in test/Makefile.am test/format_test/format_checks.sh.in ; do
|
|
substituteInPlace $a \
|
|
--replace /bin/bash ${runtimeShell}
|
|
done
|
|
'';
|
|
|
|
passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
|
|
|
|
meta = with lib; {
|
|
homepage = "https://openil.sourceforge.net/";
|
|
description = "Image library which can can load, save, convert, manipulate, filter and display a wide variety of image formats";
|
|
mainProgram = "ilur";
|
|
license = licenses.lgpl2;
|
|
pkgConfigModules = [ "IL" ];
|
|
inherit (mesa.meta) platforms;
|
|
maintainers = [ ];
|
|
};
|
|
})
|