3
0
Fork 0
forked from mirrors/nixpkgs

openafs: Break into multiple packages with multiple outputs

Two packages:
- pkgs.linuxPackages.openafs (only kernel module)
- pkgs.openafs (client/server programs, manpages, docs)

Disable `ncurses` by default
- Only needed for debugging tools

Introduce but disable `tsmbac` by default
- IBM's on-site backup service called Tivoli Storage Manager Backup
  Client
- Make openafs ready to use tsmbac when supplied via local overlay
  (needs special patching)
- TSM is not in nixpkgs due to unclear/unfree licensing. (Binaries need
  to be modified to work with nixos)
This commit is contained in:
Michael Raitza 2018-01-23 19:48:53 +01:00
parent 8a77ae81ad
commit 44a4844744
5 changed files with 189 additions and 17 deletions

View file

@ -1,23 +1,24 @@
{ stdenv, fetchurl, fetchgit, which, autoconf, automake, flex, yacc,
kernel, glibc, ncurses, perl, kerberos, fetchpatch }:
{ stdenv, fetchurl, fetchgit, which, autoconf, automake, flex, yacc
, glibc, perl, kerberos, libxslt, docbook_xsl, docbook_xml_dtd_43
, ncurses # Extra ncurses utilities. Only needed for debugging.
, tsmbac ? null # Tivoli Storage Manager Backup Client from IBM
}:
with (import ./srcs.nix { inherit fetchurl; });
stdenv.mkDerivation rec {
name = "openafs-${version}-${kernel.version}";
version = "1.6.22.1";
name = "openafs-${version}";
inherit version srcs;
src = fetchurl {
url = "http://www.openafs.org/dl/openafs/${version}/openafs-${version}-src.tar.bz2";
sha256 = "19nfbksw7b34jc3mxjk7cbz26zg9k5myhzpv2jf0fnmznr47jqaw";
};
nativeBuildInputs = [ autoconf automake flex yacc perl which ] ++ kernel.moduleBuildDependencies;
nativeBuildInputs = [ autoconf automake flex yacc perl which libxslt ];
buildInputs = [ ncurses ];
hardeningDisable = [ "pic" ];
patches = stdenv.lib.optional (tsmbac != null) ./tsmbac.patch;
outputs = [ "out" "dev" "man" "doc" ];
preConfigure = ''
ln -s "${kernel.dev}/lib/modules/"*/build $TMP/linux
patchShebangs .
for i in `grep -l -R '/usr/\(include\|src\)' .`; do
@ -27,25 +28,62 @@ stdenv.mkDerivation rec {
--replace "/usr/src" "$TMP"
done
for i in ./doc/xml/{AdminGuide,QuickStartUnix,UserGuide}/*.xml; do
substituteInPlace "''${i}" --replace "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" \
"${docbook_xml_dtd_43}/xml/dtd/docbook/docbookx.dtd"
done
./regen.sh
${stdenv.lib.optionalString (kerberos != null)
"export KRB5_CONFIG=${kerberos.dev}/bin/krb5-config"}
export AFS_SYSKVERS=26
configureFlagsArray=(
"--with-linux-kernel-build=$TMP/linux"
${stdenv.lib.optionalString (kerberos != null) "--with-krb5"}
"--sysconfdir=/etc/static"
"--sysconfdir=/etc"
"--localstatedir=/var"
"--disable-kernel-module"
"--disable-fuse-client"
"--with-html-xsl=${docbook_xsl}/share/xml/docbook-xsl/html/chunk.xsl"
${stdenv.lib.optionalString (tsmbac != null) "--enable-tivoli-tsm"}
${stdenv.lib.optionalString (ncurses == null) "--disable-gtx"}
"--disable-linux-d_splice-alias-extra-iput"
)
'' + stdenv.lib.optionalString (tsmbac != null) ''
export XBSA_CFLAGS="-Dxbsa -DNEW_XBSA -I${tsmbac}/lib64/sample -DXBSA_TSMLIB=\\\"${tsmbac}/lib64/libApiTSM64.so\\\""
export XBSA_XLIBS="-ldl"
'';
buildFlags = [ "all_nolibafs" ];
postBuild = ''
for d in doc/xml/{AdminGuide,QuickStartUnix,UserGuide}; do
make -C "''${d}" html
done
'';
postInstall = ''
mkdir -p $doc/share/doc/openafs/{AdminGuide,QuickStartUnix,UserGuide}
cp -r doc/{arch,examples,pdf,protocol,txt} README NEWS $doc/share/doc/openafs
for d in AdminGuide QuickStartUnix UserGuide ; do
cp "doc/xml/''${d}"/*.html "$doc/share/doc/openafs/''${d}"
done
rm -r $out/lib/{openafs,afs,*.a}
rm $out/bin/kpasswd
rm $out/sbin/{kas,kdb,ka-forwarder,kadb_check}
rm $out/libexec/openafs/kaserver
rm $man/share/man/man{1/kpasswd*,5/kaserver*,8/{ka*,kdb*}}
'';
meta = with stdenv.lib; {
outputsToInstall = [ "out" "doc" "man" ];
description = "Open AFS client";
homepage = https://www.openafs.org;
license = licenses.ipl10;
platforms = platforms.linux;
maintainers = [ maintainers.z77z ];
broken = versionOlder kernel.version "3.18";
maintainers = [ maintainers.z77z maintainers.spacefrogg ];
};
}

View file

@ -0,0 +1,57 @@
{ stdenv, fetchurl, which, autoconf, automake, flex, yacc
, kernel, glibc, perl }:
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 rec {
name = "openafs-${version}-${kernel.version}";
inherit version src;
nativeBuildInputs = [ autoconf automake flex perl yacc which ] ++ kernel.moduleBuildDependencies;
hardeningDisable = [ "pic" ];
configureFlags = [
"--with-linux-kernel-build=${kernelBuildDir}"
"--sysconfdir=/etc"
"--localstatedir=/var"
"--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.version}.* ${modDestDir}/libafs.ko
xz -f ${modDestDir}/libafs.ko
'';
meta = with stdenv.lib; {
description = "Open AFS client kernel module";
homepage = https://www.openafs.org;
license = licenses.ipl10;
platforms = platforms.linux;
maintainers = [ maintainers.z77z maintainers.spacefrogg ];
broken = versionOlder kernel.version "3.18";
};
}

View file

@ -0,0 +1,14 @@
{ fetchurl }:
rec {
version = "1.6.22.1";
src = fetchurl {
url = "http://www.openafs.org/dl/openafs/${version}/openafs-${version}-src.tar.bz2";
sha256 = "19nfbksw7b34jc3mxjk7cbz26zg9k5myhzpv2jf0fnmznr47jqaw";
};
srcs = [ src
(fetchurl {
url = "http://www.openafs.org/dl/openafs/${version}/openafs-${version}-doc.tar.bz2";
sha256 = "1875hn8rvlxj4icja8k6hprxprvp2k1f3iilb15lsafhmfz1scg3";
})];
}

View file

@ -0,0 +1,62 @@
diff -ru3 openafs-1.6.18.1/acinclude.m4 openafs-1.6.18.1.new/acinclude.m4
--- openafs-1.6.18.1/acinclude.m4 2016-06-21 17:13:39.000000000 +0200
+++ openafs-1.6.18.1.new/acinclude.m4 2016-11-02 18:44:30.423039662 +0100
@@ -1373,45 +1373,7 @@
dnl check for tivoli
AC_MSG_CHECKING(for tivoli tsm butc support)
-XBSA_CFLAGS=""
-if test "$enable_tivoli_tsm" = "yes"; then
- XBSADIR1=/usr/tivoli/tsm/client/api/bin/xopen
- XBSADIR2=/opt/tivoli/tsm/client/api/bin/xopen
- XBSADIR3=/usr/tivoli/tsm/client/api/bin/sample
- XBSADIR4=/opt/tivoli/tsm/client/api/bin/sample
- XBSADIR5=/usr/tivoli/tsm/client/api/bin64/sample
- XBSADIR6=/opt/tivoli/tsm/client/api/bin64/sample
-
- if test -r "$XBSADIR3/dsmapifp.h"; then
- XBSA_CFLAGS="-Dxbsa -DNEW_XBSA -I$XBSADIR3"
- XBSA_XLIBS="-ldl"
- AC_MSG_RESULT([yes, $XBSA_CFLAGS])
- elif test -r "$XBSADIR4/dsmapifp.h"; then
- XBSA_CFLAGS="-Dxbsa -DNEW_XBSA -I$XBSADIR4"
- XBSA_XLIBS="-ldl"
- AC_MSG_RESULT([yes, $XBSA_CFLAGS])
- elif test -r "$XBSADIR5/dsmapifp.h"; then
- XBSA_CFLAGS="-Dxbsa -DNEW_XBSA -I$XBSADIR5"
- XBSA_XLIBS="-ldl"
- AC_MSG_RESULT([yes, $XBSA_CFLAGS])
- elif test -r "$XBSADIR6/dsmapifp.h"; then
- XBSA_CFLAGS="-Dxbsa -DNEW_XBSA -I$XBSADIR6"
- XBSA_XLIBS="-ldl"
- AC_MSG_RESULT([yes, $XBSA_CFLAGS])
- elif test -r "$XBSADIR1/xbsa.h"; then
- XBSA_CFLAGS="-Dxbsa -I$XBSADIR1"
- XBSA_XLIBS=""
- AC_MSG_RESULT([yes, $XBSA_CFLAGS])
- elif test -r "$XBSADIR2/xbsa.h"; then
- XBSA_CFLAGS="-Dxbsa -I$XBSADIR2"
- XBSA_XLIBS=""
- AC_MSG_RESULT([yes, $XBSA_CFLAGS])
- else
- AC_MSG_RESULT([no, missing xbsa.h and dsmapifp.h header files])
- fi
-else
- AC_MSG_RESULT([no])
-fi
+AC_MSG_RESULT([yes])
AC_SUBST(XBSA_CFLAGS)
AC_SUBST(XBSA_XLIBS)
diff -ru3 openafs-1.6.18.1/src/butc/afsxbsa.c openafs-1.6.18.1.new/src/butc/afsxbsa.c
--- openafs-1.6.18.1/src/butc/afsxbsa.c 2016-06-21 17:13:39.000000000 +0200
+++ openafs-1.6.18.1.new/src/butc/afsxbsa.c 2016-11-02 18:45:10.734662987 +0100
@@ -651,7 +651,7 @@
#if defined(AFS_AIX_ENV)
dynlib = dlopen("/usr/lib/libApiDS.a(dsmapish.o)", RTLD_NOW | RTLD_LOCAL | RTLD_MEMBER);
#elif defined (AFS_AMD64_LINUX26_ENV)
- dynlib = dlopen("/usr/lib64/libApiTSM64.so", RTLD_NOW | RTLD_LOCAL);
+ dynlib = dlopen(XBSA_TSMLIB, RTLD_NOW | RTLD_LOCAL);
#elif defined(AFS_SUN5_ENV) || defined(AFS_LINUX26_ENV)
dynlib = dlopen("/usr/lib/libApiDS.so", RTLD_NOW | RTLD_LOCAL);
#else

View file

@ -12055,6 +12055,7 @@ with pkgs;
oauth2_proxy = callPackage ../servers/oauth2_proxy { };
openafs = callPackage ../servers/openafs { tsmbac = null; ncurses = null; };
openpts = callPackage ../servers/openpts { };
openresty = callPackage ../servers/http/openresty { };
@ -13022,7 +13023,7 @@ with pkgs;
rtlwifi_new = callPackage ../os-specific/linux/rtlwifi_new { };
openafs = callPackage ../servers/openafs { };
openafs = callPackage ../servers/openafs/module.nix { };
facetimehd = callPackage ../os-specific/linux/facetimehd { };