96b23c36e8
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
79 lines
1.7 KiB
Nix
79 lines
1.7 KiB
Nix
{ lib
|
|
, stdenv
|
|
, fetchurl
|
|
, which
|
|
, autoconf
|
|
, automake
|
|
, flex
|
|
, bison
|
|
, kernel
|
|
, glibc
|
|
, perl
|
|
, libtool_2
|
|
, libkrb5
|
|
, fetchpatch
|
|
}:
|
|
|
|
with (import ./srcs.nix {
|
|
inherit fetchurl;
|
|
});
|
|
|
|
let
|
|
modDestDir = "$out/lib/modules/${kernel.modDirVersion}/extra/openafs";
|
|
kernelBuildDir = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build";
|
|
|
|
fetchBase64Patch = args: (fetchpatch args).overrideAttrs (o: {
|
|
postFetch = "mv $out p; base64 -d p > $out; " + o.postFetch;
|
|
});
|
|
|
|
in
|
|
stdenv.mkDerivation {
|
|
pname = "openafs";
|
|
version = "${version}-${kernel.modDirVersion}";
|
|
inherit src;
|
|
|
|
nativeBuildInputs = [ autoconf automake flex libtool_2 perl which bison ]
|
|
++ kernel.moduleBuildDependencies;
|
|
|
|
buildInputs = [ libkrb5 ];
|
|
|
|
hardeningDisable = [ "pic" ];
|
|
|
|
configureFlags = [
|
|
"--with-linux-kernel-build=${kernelBuildDir}"
|
|
"--sysconfdir=/etc"
|
|
"--localstatedir=/var"
|
|
"--with-gssapi"
|
|
];
|
|
|
|
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
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Open AFS client kernel module";
|
|
homepage = "https://www.openafs.org";
|
|
license = licenses.ipl10;
|
|
platforms = platforms.linux;
|
|
maintainers = with maintainers; [ andersk maggesi spacefrogg ];
|
|
broken = kernel.isHardened;
|
|
};
|
|
}
|