mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-21 19:44:09 +00:00

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" ```
106 lines
2.0 KiB
Nix
106 lines
2.0 KiB
Nix
{ lib
|
|
, stdenv
|
|
, fetchFromGitHub
|
|
, cmake
|
|
, doxygen
|
|
, gettext
|
|
, graphviz
|
|
, libxslt
|
|
, removeReferencesTo
|
|
, libiconv
|
|
, brotli
|
|
, expat
|
|
, inih
|
|
, zlib
|
|
, libxml2
|
|
, python3
|
|
, which
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "exiv2";
|
|
version = "0.28.3";
|
|
|
|
outputs = [ "out" "lib" "dev" "doc" "man" ];
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "exiv2";
|
|
repo = "exiv2";
|
|
rev = "v${version}";
|
|
hash = "sha256-KD3kkIQXPcjCVZZrmbn93xYbJ8ryG0mLFbkO5AVqnTw=";
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
cmake
|
|
doxygen
|
|
gettext
|
|
graphviz
|
|
libxslt
|
|
removeReferencesTo
|
|
];
|
|
|
|
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
|
|
libiconv
|
|
];
|
|
|
|
propagatedBuildInputs = [
|
|
brotli
|
|
expat
|
|
inih
|
|
zlib
|
|
];
|
|
|
|
nativeCheckInputs = [
|
|
libxml2.bin
|
|
python3
|
|
which
|
|
];
|
|
|
|
cmakeFlags = [
|
|
"-DEXIV2_ENABLE_NLS=ON"
|
|
"-DEXIV2_BUILD_DOC=ON"
|
|
"-DEXIV2_ENABLE_BMFF=ON"
|
|
];
|
|
|
|
buildFlags = [
|
|
"all"
|
|
"doc"
|
|
];
|
|
|
|
doCheck = true;
|
|
|
|
preCheck = ''
|
|
patchShebangs ../test/
|
|
mkdir ../test/tmp
|
|
'' + lib.optionalString stdenv.hostPlatform.isAarch32 ''
|
|
# Fix tests on arm
|
|
# https://github.com/Exiv2/exiv2/issues/933
|
|
rm -f ../tests/bugfixes/github/test_CVE_2018_12265.py
|
|
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
|
|
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH''${DYLD_LIBRARY_PATH:+:}$PWD/lib
|
|
export LC_ALL=C
|
|
|
|
# disable tests that requires loopback networking
|
|
substituteInPlace ../tests/bash_tests/testcases.py \
|
|
--replace "def io_test(self):" "def io_disabled(self):"
|
|
'';
|
|
|
|
preFixup = ''
|
|
remove-references-to -t ${stdenv.cc.cc} $lib/lib/*.so.*.*.* $out/bin/exiv2
|
|
'';
|
|
|
|
disallowedReferences = [ stdenv.cc.cc ];
|
|
|
|
# causes redefinition of _FORTIFY_SOURCE
|
|
hardeningDisable = [ "fortify3" ];
|
|
|
|
meta = with lib; {
|
|
homepage = "https://exiv2.org";
|
|
description = "Library and command-line utility to manage image metadata";
|
|
mainProgram = "exiv2";
|
|
platforms = platforms.all;
|
|
license = licenses.gpl2Plus;
|
|
maintainers = with maintainers; [ wegank ];
|
|
};
|
|
}
|