2021-03-14 17:50:12 +00:00
|
|
|
{ lib, stdenv, fetchurl, which, autoconf, automake, flex, bison
|
2021-03-14 16:11:48 +00:00
|
|
|
, kernel, glibc, perl, libtool_2, libkrb5, fetchpatch }:
|
2020-11-17 22:32:21 +00:00
|
|
|
|
|
|
|
with (import ./srcs.nix {
|
|
|
|
inherit fetchurl;
|
|
|
|
});
|
|
|
|
|
|
|
|
let
|
|
|
|
modDestDir = "$out/lib/modules/${kernel.modDirVersion}/extra/openafs";
|
|
|
|
kernelBuildDir = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build";
|
|
|
|
|
|
|
|
in stdenv.mkDerivation {
|
|
|
|
name = "openafs-${version}-${kernel.modDirVersion}";
|
|
|
|
inherit version src;
|
|
|
|
|
2021-03-14 17:50:12 +00:00
|
|
|
nativeBuildInputs = [ autoconf automake flex libtool_2 perl which bison ]
|
2020-11-17 22:32:21 +00:00
|
|
|
++ kernel.moduleBuildDependencies;
|
|
|
|
|
2021-03-14 16:11:48 +00:00
|
|
|
buildInputs = [ libkrb5 ];
|
2020-11-17 22:32:21 +00:00
|
|
|
|
|
|
|
patches = [];
|
|
|
|
|
|
|
|
hardeningDisable = [ "pic" ];
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--with-linux-kernel-build=${kernelBuildDir}"
|
|
|
|
"--sysconfdir=/etc"
|
|
|
|
"--localstatedir=/var"
|
|
|
|
"--with-gssapi"
|
|
|
|
"--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}
|
|
|
|
cp src/libafs/MODLOAD-*/libafs-${kernel.modDirVersion}.* ${modDestDir}/libafs.ko
|
|
|
|
xz -f ${modDestDir}/libafs.ko
|
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2020-11-17 22:32:21 +00:00
|
|
|
description = "Open AFS client kernel module";
|
|
|
|
homepage = "https://www.openafs.org";
|
|
|
|
license = licenses.ipl10;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = [ maintainers.maggesi maintainers.spacefrogg ];
|
2021-11-06 10:54:59 +00:00
|
|
|
broken = versionOlder kernel.version "3.18" || kernel.kernelAtLeast "5.15" || kernel.isHardened;
|
2020-11-17 22:32:21 +00:00
|
|
|
};
|
|
|
|
}
|