2021-12-06 16:07:01 +00:00
|
|
|
{ lib, stdenv, fetchurl, file, zlib, libgnurx }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-06-26 10:26:21 +00:00
|
|
|
# Note: this package is used for bootstrapping fetchurl, and thus
|
|
|
|
# cannot use fetchpatch! All mutable patches (generated by GitHub or
|
|
|
|
# cgit) that are needed here should be included directly in Nixpkgs as
|
|
|
|
# files.
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "file";
|
2023-02-16 17:41:37 +00:00
|
|
|
version = "5.44";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
urls = [
|
2022-07-14 12:49:19 +00:00
|
|
|
"https://astron.com/pub/file/${pname}-${version}.tar.gz"
|
2020-04-24 23:36:52 +00:00
|
|
|
"https://distfiles.macports.org/file/${pname}-${version}.tar.gz"
|
|
|
|
];
|
2023-02-16 17:41:37 +00:00
|
|
|
sha256 = "sha256-N1HH+6jbyDHLjXzIr/IQNUWbjOUVXviwiAon0ChHXzs=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
outputs = [ "out" "dev" "man" ];
|
|
|
|
|
2023-03-04 12:14:45 +00:00
|
|
|
patches = [
|
|
|
|
# Backport fix to identification for pyzip files.
|
|
|
|
# Needed for strip-nondeterminism.
|
|
|
|
# https://salsa.debian.org/reproducible-builds/strip-nondeterminism/-/issues/20
|
|
|
|
./pyzip.patch
|
|
|
|
|
|
|
|
# Backport fix for --uncompress always detecting contents as "empty"
|
|
|
|
(fetchurl {
|
|
|
|
url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/sys-apps/file/files/file-5.44-decompress-empty.patch?h=dfc57da515a2aaf085bea68267cc727f1bfaa691";
|
|
|
|
hash = "sha256-fUzRQAlLWczBmR5iA1Gk66mHjP40MJcMdgCtm2+u1SQ=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
strictDeps = true;
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
nativeBuildInputs = lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) file;
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [ zlib ]
|
2021-08-08 23:34:03 +00:00
|
|
|
++ lib.optional stdenv.hostPlatform.isWindows libgnurx;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
# https://bugs.astron.com/view.php?id=382
|
2022-10-30 15:09:59 +00:00
|
|
|
doCheck = !stdenv.buildPlatform.isMusl;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
makeFlags = lib.optional stdenv.hostPlatform.isWindows "FILE_COMPILE=file";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://darwinsys.com/file";
|
|
|
|
description = "A program that shows the type of files";
|
2021-12-06 16:07:01 +00:00
|
|
|
maintainers = with maintainers; [ doronbehar ];
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.bsd2;
|
|
|
|
platforms = platforms.all;
|
2023-08-04 22:07:22 +00:00
|
|
|
mainProgram = "file";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|