2021-03-14 18:50:12 +01:00
|
|
|
{ lib, stdenv, fetchurl, which, autoconf, automake, flex, bison
|
2021-11-03 02:06:09 +01:00
|
|
|
, kernel, glibc, perl, libtool_2, libkrb5, fetchpatch }:
|
2018-01-23 19:48:53 +01:00
|
|
|
|
2020-05-21 23:46:44 +02:00
|
|
|
with (import ./srcs.nix {
|
|
|
|
inherit fetchurl;
|
|
|
|
});
|
2018-01-23 19:48:53 +01:00
|
|
|
|
|
|
|
let
|
|
|
|
modDestDir = "$out/lib/modules/${kernel.modDirVersion}/extra/openafs";
|
|
|
|
kernelBuildDir = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build";
|
|
|
|
|
2019-08-13 23:52:01 +02:00
|
|
|
in stdenv.mkDerivation {
|
2018-10-15 15:48:19 +02:00
|
|
|
name = "openafs-${version}-${kernel.modDirVersion}";
|
2018-01-23 19:48:53 +01:00
|
|
|
inherit version src;
|
|
|
|
|
2021-03-14 18:50:12 +01:00
|
|
|
nativeBuildInputs = [ autoconf automake flex libtool_2 perl which bison ]
|
2018-06-30 00:34:35 +02:00
|
|
|
++ kernel.moduleBuildDependencies;
|
|
|
|
|
2021-03-14 17:11:48 +01:00
|
|
|
buildInputs = [ libkrb5 ];
|
2018-01-23 19:48:53 +01:00
|
|
|
|
2021-11-03 02:06:09 +01:00
|
|
|
patches = [
|
|
|
|
# LINUX 5.14: explicitly set set_page_dirty to default
|
|
|
|
((fetchpatch {
|
|
|
|
url = "https://gerrit.openafs.org/changes/14830/revisions/20b8a37950b3718b85a4a3d21b23469a5176eb6a/patch";
|
|
|
|
sha256 = "1mkfwq0pbwvfjspsy2lxhi0f09hljgc6xyn3y97sai0dyivn05jp";
|
|
|
|
}).overrideAttrs (o: {
|
|
|
|
postFetch = "mv $out p; base64 -d p > $out; " + o.postFetch;
|
|
|
|
}))
|
|
|
|
# Linux 5.15: Convert osi_Msg macro to a function
|
|
|
|
((fetchpatch {
|
|
|
|
url = "https://gerrit.openafs.org/changes/14831/revisions/6cfa9046229d90c0625687e3fddb7877f21fbcff/patch";
|
|
|
|
sha256 = "18rip9a1krxf47fizf3f12ddq55apzb2w3wjj5qs7n3sh2nwks7g";
|
|
|
|
}).overrideAttrs (o: {
|
|
|
|
postFetch = "mv $out p; base64 -d p > $out; " + o.postFetch;
|
|
|
|
}))
|
|
|
|
];
|
|
|
|
|
2018-01-23 19:48:53 +01:00
|
|
|
hardeningDisable = [ "pic" ];
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--with-linux-kernel-build=${kernelBuildDir}"
|
|
|
|
"--sysconfdir=/etc"
|
|
|
|
"--localstatedir=/var"
|
2018-06-30 00:34:35 +02:00
|
|
|
"--with-gssapi"
|
2018-01-23 19:48:53 +01:00
|
|
|
"--disable-linux-d_splice-alias-extra-iput"
|
|
|
|
];
|
|
|
|
|
|
|
|
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-21 00:22:46 +02:00
|
|
|
cp src/libafs/MODLOAD-*/libafs-${kernel.modDirVersion}.* ${modDestDir}/libafs.ko
|
2018-01-23 19:48:53 +01:00
|
|
|
xz -f ${modDestDir}/libafs.ko
|
|
|
|
'';
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2018-01-23 19:48:53 +01:00
|
|
|
description = "Open AFS client kernel module";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://www.openafs.org";
|
2018-01-23 19:48:53 +01:00
|
|
|
license = licenses.ipl10;
|
|
|
|
platforms = platforms.linux;
|
2021-08-02 10:00:56 +02:00
|
|
|
maintainers = with maintainers; [ maggesi spacefrogg ];
|
2021-11-03 02:06:09 +01:00
|
|
|
broken = versionOlder kernel.version "3.18" || kernel.isHardened;
|
2018-01-23 19:48:53 +01:00
|
|
|
};
|
|
|
|
}
|