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
|
|
|
|
|
|
|
let
|
2024-04-01 15:15:30 +00:00
|
|
|
inherit (import ./srcs.nix { inherit fetchurl; }) src version;
|
|
|
|
|
2018-01-23 18:48:53 +00:00
|
|
|
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
|
|
|
|
2024-03-25 02:55:27 +00:00
|
|
|
patches = [
|
2024-07-18 18:36:00 +00:00
|
|
|
# Linux-6.10: Use filemap_alloc_folio when avail
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/openafs/openafs/commit/0f6a3a402f4a66114da9231032bd68cdc4dee7bc.patch";
|
|
|
|
hash = "sha256-1D0mijyF4hbd+xCONT50cd6T9eCpeM8Li3nCI7HgLPA=";
|
|
|
|
})
|
|
|
|
# Linux-6.10: define a wrapper for vmalloc
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/openafs/openafs/commit/658942f2791fad5e33ec7542158c16dfc66eed39.patch";
|
|
|
|
hash = "sha256-MhfAUX/eNOEkjO0cGVbnIdObMlGtLdCnnGfJECDwO+A=";
|
|
|
|
})
|
|
|
|
# Linux-6.10: remove includes for asm/ia32_unistd.h
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/openafs/openafs/commit/03b280649f5e22ed74c217d7c98c3416a2fa9052.patch";
|
|
|
|
hash = "sha256-ZdXz2ziuflqz7zNzjepuGvwDAPM31FIzsoEa4iNdLmo=";
|
|
|
|
})
|
|
|
|
# afs: avoid empty-body warning
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/openafs/openafs/commit/d8b56f21994ce66d8daebb7d69e792f34c1a19ed.patch";
|
|
|
|
hash = "sha256-10VUfZdZiOC8xSPM0nq8onqiv7X/Vv4/WwGlkqWkNkQ=";
|
|
|
|
})
|
|
|
|
# Linux 6.10: Move 'inline' before func return type
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/openafs/openafs/commit/7097eec17bc01bcfc12c4d299136b2d3b94ec3d7.patch";
|
|
|
|
hash = "sha256-PZmqeXWJL3EQFD9250YfDwCY1rvSGVCbAhzyHP1pE0Q=";
|
|
|
|
})
|
2024-03-25 02:55:27 +00:00
|
|
|
];
|
2023-10-12 19:03:17 +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
|
|
|
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|