2021-03-14 18:50:12 +01:00
|
|
|
{ lib, stdenv, fetchurl, which, autoconf, automake, flex, bison
|
2021-03-14 17:11:48 +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
|
|
|
|
2020-09-28 06:36:20 +02:00
|
|
|
patches = [
|
2021-02-19 03:50:26 +01:00
|
|
|
# LINUX 5.8: Replace kernel_setsockopt with new funcs
|
2020-09-28 06:36:20 +02:00
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/openafs/openafs/commit/d7fc5bf9bf031089d80703c48daf30d5b15a80ca.patch";
|
|
|
|
sha256 = "0469ydzgvyvrl1b2s1qbl9cd8c5c1nb99c3z52z5i685da5z6pab";
|
|
|
|
})
|
2021-02-19 03:50:26 +01:00
|
|
|
# LINUX 5.8: do not set name field in backing_dev_info
|
2020-09-28 06:36:20 +02:00
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/openafs/openafs/commit/335f37be13d2ff954e4aeea617ee66502170805e.patch";
|
|
|
|
sha256 = "0jr6cgplnip61cjlcd3fvgsc6n3jhfk93mm9m7ak04w1vc26dk9x";
|
|
|
|
})
|
2021-02-19 03:50:26 +01:00
|
|
|
# LINUX 5.8: use lru_cache_add
|
2020-09-28 06:36:20 +02:00
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/openafs/openafs/commit/facff58b840a47853592510617ba7a1da2e3eaa9.patch";
|
|
|
|
sha256 = "0izafg6bi5iaigq3jjx0zlg1cxwaddz3238hk0s08fcb6nyhkvx1";
|
|
|
|
})
|
2021-02-19 03:50:26 +01:00
|
|
|
# LINUX 5.9: Remove HAVE_UNLOCKED_IOCTL/COMPAT_IOCTL
|
2020-09-28 06:36:20 +02:00
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/openafs/openafs/commit/e7902252f15acfc28453c531f6fa3b29c9c91b92.patch";
|
|
|
|
sha256 = "1jy4v8yx8p6mhma6b3h3g94mb38bw7hg7q6lnyc8bijkbnl0d1rl";
|
|
|
|
})
|
2021-02-19 03:50:26 +01:00
|
|
|
# Linux: Refactor test for 32bit compat
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/openafs/openafs/commit/4ad1057ab8fd206c9fa8d5e3bdde4f1a8417afdb.patch";
|
|
|
|
sha256 = "0v2537wkav78yi8lv6fkd1n6rf2g17igf44rpa3kd0kkidxv5lqr";
|
|
|
|
})
|
|
|
|
# Linux 5.11: Test 32bit compat with in_compat_syscall
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/openafs/openafs/commit/ee53dd3bc087a05e22fc4111297a51ddb30013f0.patch";
|
|
|
|
sha256 = "0dfab3zk0dmf6iksna5n09lf5dn4f8w43q4irl2yf5dgqm35shkr";
|
|
|
|
})
|
2020-09-28 06:36:20 +02:00
|
|
|
];
|
|
|
|
|
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;
|
2019-10-07 16:44:58 +02:00
|
|
|
maintainers = [ maintainers.maggesi maintainers.spacefrogg ];
|
2020-11-17 21:00:40 +01:00
|
|
|
broken = versionOlder kernel.version "3.18" || kernel.isHardened;
|
2018-01-23 19:48:53 +01:00
|
|
|
};
|
|
|
|
}
|