2021-12-13 18:14:46 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
|
|
|
, which
|
|
|
|
, autoconf
|
|
|
|
, automake
|
|
|
|
, flex
|
|
|
|
, bison
|
|
|
|
, kernel
|
|
|
|
, glibc
|
|
|
|
, perl
|
|
|
|
, libtool_2
|
|
|
|
, libkrb5
|
2022-04-07 02:38:27 +00:00
|
|
|
, fetchpatch
|
2021-12-13 18:14:46 +00:00
|
|
|
}:
|
2018-01-23 18:48:53 +00:00
|
|
|
|
2020-05-21 21:46:44 +00:00
|
|
|
with (import ./srcs.nix {
|
|
|
|
inherit fetchurl;
|
|
|
|
});
|
2018-01-23 18:48:53 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
modDestDir = "$out/lib/modules/${kernel.modDirVersion}/extra/openafs";
|
|
|
|
kernelBuildDir = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build";
|
|
|
|
|
2022-04-07 02:38:27 +00:00
|
|
|
fetchBase64Patch = args: (fetchpatch args).overrideAttrs (o: {
|
|
|
|
postFetch = "mv $out p; base64 -d p > $out; " + o.postFetch;
|
|
|
|
});
|
|
|
|
|
2021-12-13 18:14:46 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
2021-12-07 19:40:23 +00:00
|
|
|
pname = "openafs";
|
|
|
|
version = "${version}-${kernel.modDirVersion}";
|
|
|
|
inherit src;
|
2018-01-23 18:48:53 +00:00
|
|
|
|
2021-03-14 17:50:12 +00:00
|
|
|
nativeBuildInputs = [ autoconf automake flex libtool_2 perl which bison ]
|
2018-06-29 22:34:35 +00:00
|
|
|
++ kernel.moduleBuildDependencies;
|
|
|
|
|
2021-03-14 16:11:48 +00:00
|
|
|
buildInputs = [ libkrb5 ];
|
2018-01-23 18:48:53 +00:00
|
|
|
|
2023-02-22 20:40:09 +00:00
|
|
|
patches = [
|
|
|
|
# LINUX: Run the 'sparse' checker if available
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://git.openafs.org/?p=openafs.git;a=patch;h=2cf76b31ce4c912b1151c141818f6e8c5cddcab2";
|
|
|
|
hash = "sha256-//7HSlotx70vWDEMB8P8or4ZmmXZthgioUOkvOcJpgk=";
|
|
|
|
})
|
|
|
|
# cf: Detect how to pass CFLAGS to linux kbuild
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://git.openafs.org/?p=openafs.git;a=patch;h=57df4dff496ca9bea04510759b8fdd9cd2cc0009";
|
|
|
|
hash = "sha256-pJnW9bVz2ZQZUvZ+PcZ5gEgCL5kcbTGxsyMNvM2IseU=";
|
|
|
|
})
|
|
|
|
# cf: Handle autoconf linux checks with -Werror
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://git.openafs.org/?p=openafs.git;a=patch;h=b17625959386459059f6f43875d8817383554481";
|
|
|
|
hash = "sha256-Kqx5QEX1p4UoIsWxqvJVX4IyCQFiWxtAOgvAtk+ULuQ=";
|
|
|
|
})
|
|
|
|
# Linux: Fix functions without prototypes
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://git.openafs.org/?p=openafs.git;a=patch;h=3084117f10bd62acb1182cb54fc85b1d96738f70";
|
|
|
|
hash = "sha256-nNyqDQfS9zzlS2i3dbfud2tQOaTQ1x/rZcQEsaLu3qc=";
|
|
|
|
})
|
|
|
|
# Linux: Check for block_dirty_folio
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://git.openafs.org/?p=openafs.git;a=patch;h=f0fee2c7752d18ff183d60bcfba4c98c3348cd5f";
|
|
|
|
hash = "sha256-tnNlVjZ5exC+jo78HC/y8yp0L8KQroFvVRzTC+O6vlY=";
|
|
|
|
})
|
|
|
|
# Linux: Replace lru_cache_add with folio_add_lru
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://git.openafs.org/?p=openafs.git;a=patch;h=b885159cc2bc6c746aec1d54cdd8a515d1115d14";
|
|
|
|
hash = "sha256-ptPALSbZPSGu8PMmZiOkHUd5x0UItqIM7U7wJlxtSL8=";
|
|
|
|
})
|
|
|
|
# LINUX 5.13: set .proc_lseek in proc_ops
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://git.openafs.org/?p=openafs.git;a=patch;h=cba2b88851c3ae0ab1b18ea3ce77f7f5e8200b2f";
|
|
|
|
hash = "sha256-suj7n0U0odHXZHLPqeB/k96gyBh52uoS3AuHvOzPyd8=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2018-01-23 18:48:53 +00:00
|
|
|
hardeningDisable = [ "pic" ];
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--with-linux-kernel-build=${kernelBuildDir}"
|
|
|
|
"--sysconfdir=/etc"
|
|
|
|
"--localstatedir=/var"
|
2018-06-29 22:34:35 +00:00
|
|
|
"--with-gssapi"
|
2018-01-23 18:48:53 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
patchShebangs .
|
|
|
|
for i in `grep -l -R '/usr/\(include\|src\)' .`; do
|
|
|
|
echo "Patch /usr/include and /usr/src in $i"
|
|
|
|
substituteInPlace $i \
|
|
|
|
--replace "/usr/include" "${glibc.dev}/include" \
|
|
|
|
--replace "/usr/src" "${kernelBuildDir}"
|
|
|
|
done
|
|
|
|
|
|
|
|
./regen.sh -q
|
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
make V=1 only_libafs
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p ${modDestDir}
|
2018-08-20 22:22:46 +00:00
|
|
|
cp src/libafs/MODLOAD-*/libafs-${kernel.modDirVersion}.* ${modDestDir}/libafs.ko
|
2018-01-23 18:48:53 +00:00
|
|
|
xz -f ${modDestDir}/libafs.ko
|
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2018-01-23 18:48:53 +00:00
|
|
|
description = "Open AFS client kernel module";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://www.openafs.org";
|
2018-01-23 18:48:53 +00:00
|
|
|
license = licenses.ipl10;
|
|
|
|
platforms = platforms.linux;
|
2022-06-28 03:04:58 +00:00
|
|
|
maintainers = with maintainers; [ andersk maggesi spacefrogg ];
|
2022-12-18 02:02:53 +00:00
|
|
|
broken = kernel.isHardened;
|
2018-01-23 18:48:53 +00:00
|
|
|
};
|
|
|
|
}
|