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)

+189 -17
+54 -16
pkgs/servers/openafs/default.nix
··· 1 - { stdenv, fetchurl, fetchgit, which, autoconf, automake, flex, yacc, 2 - kernel, glibc, ncurses, perl, kerberos, fetchpatch }: 3 4 stdenv.mkDerivation rec { 5 - name = "openafs-${version}-${kernel.version}"; 6 - version = "1.6.22.1"; 7 8 - src = fetchurl { 9 - url = "http://www.openafs.org/dl/openafs/${version}/openafs-${version}-src.tar.bz2"; 10 - sha256 = "19nfbksw7b34jc3mxjk7cbz26zg9k5myhzpv2jf0fnmznr47jqaw"; 11 - }; 12 - 13 - nativeBuildInputs = [ autoconf automake flex yacc perl which ] ++ kernel.moduleBuildDependencies; 14 15 buildInputs = [ ncurses ]; 16 17 - hardeningDisable = [ "pic" ]; 18 19 preConfigure = '' 20 - ln -s "${kernel.dev}/lib/modules/"*/build $TMP/linux 21 22 patchShebangs . 23 for i in `grep -l -R '/usr/\(include\|src\)' .`; do ··· 27 --replace "/usr/src" "$TMP" 28 done 29 30 ./regen.sh 31 32 ${stdenv.lib.optionalString (kerberos != null) 33 "export KRB5_CONFIG=${kerberos.dev}/bin/krb5-config"} 34 35 configureFlagsArray=( 36 - "--with-linux-kernel-build=$TMP/linux" 37 ${stdenv.lib.optionalString (kerberos != null) "--with-krb5"} 38 - "--sysconfdir=/etc/static" 39 "--disable-linux-d_splice-alias-extra-iput" 40 ) 41 ''; 42 43 meta = with stdenv.lib; { 44 description = "Open AFS client"; 45 homepage = https://www.openafs.org; 46 license = licenses.ipl10; 47 platforms = platforms.linux; 48 - maintainers = [ maintainers.z77z ]; 49 - broken = versionOlder kernel.version "3.18"; 50 }; 51 }
··· 1 + { stdenv, fetchurl, fetchgit, which, autoconf, automake, flex, yacc 2 + , glibc, perl, kerberos, libxslt, docbook_xsl, docbook_xml_dtd_43 3 + , ncurses # Extra ncurses utilities. Only needed for debugging. 4 + , tsmbac ? null # Tivoli Storage Manager Backup Client from IBM 5 + }: 6 + 7 + with (import ./srcs.nix { inherit fetchurl; }); 8 9 stdenv.mkDerivation rec { 10 + name = "openafs-${version}"; 11 + inherit version srcs; 12 13 + nativeBuildInputs = [ autoconf automake flex yacc perl which libxslt ]; 14 15 buildInputs = [ ncurses ]; 16 17 + patches = stdenv.lib.optional (tsmbac != null) ./tsmbac.patch; 18 + 19 + outputs = [ "out" "dev" "man" "doc" ]; 20 21 preConfigure = '' 22 23 patchShebangs . 24 for i in `grep -l -R '/usr/\(include\|src\)' .`; do ··· 28 --replace "/usr/src" "$TMP" 29 done 30 31 + for i in ./doc/xml/{AdminGuide,QuickStartUnix,UserGuide}/*.xml; do 32 + substituteInPlace "''${i}" --replace "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" \ 33 + "${docbook_xml_dtd_43}/xml/dtd/docbook/docbookx.dtd" 34 + done 35 + 36 ./regen.sh 37 38 ${stdenv.lib.optionalString (kerberos != null) 39 "export KRB5_CONFIG=${kerberos.dev}/bin/krb5-config"} 40 41 + export AFS_SYSKVERS=26 42 + 43 configureFlagsArray=( 44 ${stdenv.lib.optionalString (kerberos != null) "--with-krb5"} 45 + "--sysconfdir=/etc" 46 + "--localstatedir=/var" 47 + "--disable-kernel-module" 48 + "--disable-fuse-client" 49 + "--with-html-xsl=${docbook_xsl}/share/xml/docbook-xsl/html/chunk.xsl" 50 + ${stdenv.lib.optionalString (tsmbac != null) "--enable-tivoli-tsm"} 51 + ${stdenv.lib.optionalString (ncurses == null) "--disable-gtx"} 52 "--disable-linux-d_splice-alias-extra-iput" 53 ) 54 + '' + stdenv.lib.optionalString (tsmbac != null) '' 55 + export XBSA_CFLAGS="-Dxbsa -DNEW_XBSA -I${tsmbac}/lib64/sample -DXBSA_TSMLIB=\\\"${tsmbac}/lib64/libApiTSM64.so\\\"" 56 + export XBSA_XLIBS="-ldl" 57 + ''; 58 + 59 + buildFlags = [ "all_nolibafs" ]; 60 + 61 + postBuild = '' 62 + for d in doc/xml/{AdminGuide,QuickStartUnix,UserGuide}; do 63 + make -C "''${d}" html 64 + done 65 + ''; 66 + 67 + postInstall = '' 68 + mkdir -p $doc/share/doc/openafs/{AdminGuide,QuickStartUnix,UserGuide} 69 + cp -r doc/{arch,examples,pdf,protocol,txt} README NEWS $doc/share/doc/openafs 70 + for d in AdminGuide QuickStartUnix UserGuide ; do 71 + cp "doc/xml/''${d}"/*.html "$doc/share/doc/openafs/''${d}" 72 + done 73 + 74 + rm -r $out/lib/{openafs,afs,*.a} 75 + rm $out/bin/kpasswd 76 + rm $out/sbin/{kas,kdb,ka-forwarder,kadb_check} 77 + rm $out/libexec/openafs/kaserver 78 + rm $man/share/man/man{1/kpasswd*,5/kaserver*,8/{ka*,kdb*}} 79 ''; 80 81 meta = with stdenv.lib; { 82 + outputsToInstall = [ "out" "doc" "man" ]; 83 description = "Open AFS client"; 84 homepage = https://www.openafs.org; 85 license = licenses.ipl10; 86 platforms = platforms.linux; 87 + maintainers = [ maintainers.z77z maintainers.spacefrogg ]; 88 }; 89 }
+57
pkgs/servers/openafs/module.nix
···
··· 1 + { stdenv, fetchurl, which, autoconf, automake, flex, yacc 2 + , kernel, glibc, perl }: 3 + 4 + with (import ./srcs.nix { inherit fetchurl; }); 5 + 6 + let 7 + modDestDir = "$out/lib/modules/${kernel.modDirVersion}/extra/openafs"; 8 + kernelBuildDir = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"; 9 + 10 + in stdenv.mkDerivation rec { 11 + name = "openafs-${version}-${kernel.version}"; 12 + inherit version src; 13 + 14 + nativeBuildInputs = [ autoconf automake flex perl yacc which ] ++ kernel.moduleBuildDependencies; 15 + 16 + hardeningDisable = [ "pic" ]; 17 + 18 + configureFlags = [ 19 + "--with-linux-kernel-build=${kernelBuildDir}" 20 + "--sysconfdir=/etc" 21 + "--localstatedir=/var" 22 + "--disable-linux-d_splice-alias-extra-iput" 23 + ]; 24 + 25 + preConfigure = '' 26 + patchShebangs . 27 + for i in `grep -l -R '/usr/\(include\|src\)' .`; do 28 + echo "Patch /usr/include and /usr/src in $i" 29 + substituteInPlace $i \ 30 + --replace "/usr/include" "${glibc.dev}/include" \ 31 + --replace "/usr/src" "${kernelBuildDir}" 32 + done 33 + 34 + ./regen.sh -q 35 + 36 + ''; 37 + 38 + buildPhase = '' 39 + make V=1 only_libafs 40 + ''; 41 + 42 + installPhase = '' 43 + mkdir -p ${modDestDir} 44 + cp src/libafs/MODLOAD-*/libafs-${kernel.version}.* ${modDestDir}/libafs.ko 45 + xz -f ${modDestDir}/libafs.ko 46 + ''; 47 + 48 + meta = with stdenv.lib; { 49 + description = "Open AFS client kernel module"; 50 + homepage = https://www.openafs.org; 51 + license = licenses.ipl10; 52 + platforms = platforms.linux; 53 + maintainers = [ maintainers.z77z maintainers.spacefrogg ]; 54 + broken = versionOlder kernel.version "3.18"; 55 + }; 56 + 57 + }
+14
pkgs/servers/openafs/srcs.nix
···
··· 1 + { fetchurl }: 2 + rec { 3 + version = "1.6.22.1"; 4 + src = fetchurl { 5 + url = "http://www.openafs.org/dl/openafs/${version}/openafs-${version}-src.tar.bz2"; 6 + sha256 = "19nfbksw7b34jc3mxjk7cbz26zg9k5myhzpv2jf0fnmznr47jqaw"; 7 + }; 8 + 9 + srcs = [ src 10 + (fetchurl { 11 + url = "http://www.openafs.org/dl/openafs/${version}/openafs-${version}-doc.tar.bz2"; 12 + sha256 = "1875hn8rvlxj4icja8k6hprxprvp2k1f3iilb15lsafhmfz1scg3"; 13 + })]; 14 + }
+62
pkgs/servers/openafs/tsmbac.patch
···
··· 1 + diff -ru3 openafs-1.6.18.1/acinclude.m4 openafs-1.6.18.1.new/acinclude.m4 2 + --- openafs-1.6.18.1/acinclude.m4 2016-06-21 17:13:39.000000000 +0200 3 + +++ openafs-1.6.18.1.new/acinclude.m4 2016-11-02 18:44:30.423039662 +0100 4 + @@ -1373,45 +1373,7 @@ 5 + 6 + dnl check for tivoli 7 + AC_MSG_CHECKING(for tivoli tsm butc support) 8 + -XBSA_CFLAGS="" 9 + -if test "$enable_tivoli_tsm" = "yes"; then 10 + - XBSADIR1=/usr/tivoli/tsm/client/api/bin/xopen 11 + - XBSADIR2=/opt/tivoli/tsm/client/api/bin/xopen 12 + - XBSADIR3=/usr/tivoli/tsm/client/api/bin/sample 13 + - XBSADIR4=/opt/tivoli/tsm/client/api/bin/sample 14 + - XBSADIR5=/usr/tivoli/tsm/client/api/bin64/sample 15 + - XBSADIR6=/opt/tivoli/tsm/client/api/bin64/sample 16 + - 17 + - if test -r "$XBSADIR3/dsmapifp.h"; then 18 + - XBSA_CFLAGS="-Dxbsa -DNEW_XBSA -I$XBSADIR3" 19 + - XBSA_XLIBS="-ldl" 20 + - AC_MSG_RESULT([yes, $XBSA_CFLAGS]) 21 + - elif test -r "$XBSADIR4/dsmapifp.h"; then 22 + - XBSA_CFLAGS="-Dxbsa -DNEW_XBSA -I$XBSADIR4" 23 + - XBSA_XLIBS="-ldl" 24 + - AC_MSG_RESULT([yes, $XBSA_CFLAGS]) 25 + - elif test -r "$XBSADIR5/dsmapifp.h"; then 26 + - XBSA_CFLAGS="-Dxbsa -DNEW_XBSA -I$XBSADIR5" 27 + - XBSA_XLIBS="-ldl" 28 + - AC_MSG_RESULT([yes, $XBSA_CFLAGS]) 29 + - elif test -r "$XBSADIR6/dsmapifp.h"; then 30 + - XBSA_CFLAGS="-Dxbsa -DNEW_XBSA -I$XBSADIR6" 31 + - XBSA_XLIBS="-ldl" 32 + - AC_MSG_RESULT([yes, $XBSA_CFLAGS]) 33 + - elif test -r "$XBSADIR1/xbsa.h"; then 34 + - XBSA_CFLAGS="-Dxbsa -I$XBSADIR1" 35 + - XBSA_XLIBS="" 36 + - AC_MSG_RESULT([yes, $XBSA_CFLAGS]) 37 + - elif test -r "$XBSADIR2/xbsa.h"; then 38 + - XBSA_CFLAGS="-Dxbsa -I$XBSADIR2" 39 + - XBSA_XLIBS="" 40 + - AC_MSG_RESULT([yes, $XBSA_CFLAGS]) 41 + - else 42 + - AC_MSG_RESULT([no, missing xbsa.h and dsmapifp.h header files]) 43 + - fi 44 + -else 45 + - AC_MSG_RESULT([no]) 46 + -fi 47 + +AC_MSG_RESULT([yes]) 48 + AC_SUBST(XBSA_CFLAGS) 49 + AC_SUBST(XBSA_XLIBS) 50 + 51 + diff -ru3 openafs-1.6.18.1/src/butc/afsxbsa.c openafs-1.6.18.1.new/src/butc/afsxbsa.c 52 + --- openafs-1.6.18.1/src/butc/afsxbsa.c 2016-06-21 17:13:39.000000000 +0200 53 + +++ openafs-1.6.18.1.new/src/butc/afsxbsa.c 2016-11-02 18:45:10.734662987 +0100 54 + @@ -651,7 +651,7 @@ 55 + #if defined(AFS_AIX_ENV) 56 + dynlib = dlopen("/usr/lib/libApiDS.a(dsmapish.o)", RTLD_NOW | RTLD_LOCAL | RTLD_MEMBER); 57 + #elif defined (AFS_AMD64_LINUX26_ENV) 58 + - dynlib = dlopen("/usr/lib64/libApiTSM64.so", RTLD_NOW | RTLD_LOCAL); 59 + + dynlib = dlopen(XBSA_TSMLIB, RTLD_NOW | RTLD_LOCAL); 60 + #elif defined(AFS_SUN5_ENV) || defined(AFS_LINUX26_ENV) 61 + dynlib = dlopen("/usr/lib/libApiDS.so", RTLD_NOW | RTLD_LOCAL); 62 + #else
+2 -1
pkgs/top-level/all-packages.nix
··· 12055 12056 oauth2_proxy = callPackage ../servers/oauth2_proxy { }; 12057 12058 openpts = callPackage ../servers/openpts { }; 12059 12060 openresty = callPackage ../servers/http/openresty { }; ··· 13022 13023 rtlwifi_new = callPackage ../os-specific/linux/rtlwifi_new { }; 13024 13025 - openafs = callPackage ../servers/openafs { }; 13026 13027 facetimehd = callPackage ../os-specific/linux/facetimehd { }; 13028
··· 12055 12056 oauth2_proxy = callPackage ../servers/oauth2_proxy { }; 12057 12058 + openafs = callPackage ../servers/openafs { tsmbac = null; ncurses = null; }; 12059 openpts = callPackage ../servers/openpts { }; 12060 12061 openresty = callPackage ../servers/http/openresty { }; ··· 13023 13024 rtlwifi_new = callPackage ../os-specific/linux/rtlwifi_new { }; 13025 13026 + openafs = callPackage ../servers/openafs/module.nix { }; 13027 13028 facetimehd = callPackage ../os-specific/linux/facetimehd { }; 13029