2023-10-19 13:55:26 +00:00
|
|
|
{ lib, stdenv, fetchurl, file, zlib, libgnurx
|
2024-06-20 14:57:18 +00:00
|
|
|
, updateAutotoolsGnuConfigScriptsHook
|
2023-10-19 13:55:26 +00:00
|
|
|
, testers
|
|
|
|
}:
|
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.
|
|
|
|
|
2023-10-19 13:55:26 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "file";
|
2023-10-09 19:29:22 +00:00
|
|
|
version = "5.45";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
urls = [
|
2023-10-19 13:55:26 +00:00
|
|
|
"https://astron.com/pub/file/${finalAttrs.pname}-${finalAttrs.version}.tar.gz"
|
|
|
|
"https://distfiles.macports.org/file/${finalAttrs.pname}-${finalAttrs.version}.tar.gz"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
2023-10-09 19:29:22 +00:00
|
|
|
hash = "sha256-/Jf1ECm7DiyfTjv/79r2ePDgOe6HK53lwAKm0Jx4TYI=";
|
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 = [
|
2023-10-09 19:29:22 +00:00
|
|
|
# Upstream patch to fix 32-bit tests.
|
|
|
|
# Will be included in 5.46+ releases.
|
|
|
|
./32-bit-time_t.patch
|
2023-03-04 12:14:45 +00:00
|
|
|
];
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
strictDeps = true;
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ]
|
|
|
|
++ 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
|
|
|
|
2023-10-19 13:55:26 +00:00
|
|
|
passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://darwinsys.com/file";
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "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;
|
2023-10-19 13:55:26 +00:00
|
|
|
pkgConfigModules = [ "libmagic" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.all;
|
2023-08-04 22:07:22 +00:00
|
|
|
mainProgram = "file";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2023-10-19 13:55:26 +00:00
|
|
|
})
|