nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 callPackage,
4 stdenv,
5 buildPackages,
6 fetchurl,
7 which,
8 autoconf,
9 automake,
10 flex,
11 bison,
12 glibc,
13 perl,
14 libkrb5,
15 libxslt,
16 docbook_xsl,
17 file,
18 docbook_xml_dtd_43,
19 libtool_2,
20 withDevdoc ? false,
21 doxygen,
22 dblatex, # Extra developer documentation
23 withNcurses ? false,
24 ncurses, # Extra ncurses utilities. Needed for debugging and monitoring.
25 withTsm ? false,
26 tsm-client, # Tivoli Storage Manager Backup Client from IBM
27}:
28
29with (import ./srcs.nix { inherit fetchurl; });
30let
31 inherit (lib) optional optionalString optionals;
32
33in
34stdenv.mkDerivation {
35 pname = "openafs";
36 inherit version srcs;
37
38 depsBuildBuild = [ buildPackages.stdenv.cc ];
39 nativeBuildInputs = [
40 autoconf
41 automake
42 flex
43 libxslt
44 libtool_2
45 perl
46 which
47 bison
48 ]
49 ++ optionals withDevdoc [
50 doxygen
51 dblatex
52 ];
53
54 buildInputs = [ libkrb5 ] ++ optional withNcurses ncurses;
55
56 patches = [
57 ./bosserver.patch
58 ./cross-build.patch
59 ]
60 ++ optional withTsm ./tsmbac.patch;
61
62 outputs = [
63 "out"
64 "dev"
65 "man"
66 "doc"
67 ]
68 ++ optional withDevdoc "devdoc";
69
70 enableParallelBuilding = false;
71
72 setOutputFlags = false;
73
74 # Makefiles don't include install targets for all new shared libs, yet.
75 dontDisableStatic = true;
76
77 preConfigure = ''
78 patchShebangs .
79 for i in `grep -l -R '/usr/\(include\|src\)' .`; do
80 echo "Patch /usr/include and /usr/src in $i"
81 substituteInPlace $i \
82 --replace "/usr/include" "${glibc.dev}/include" \
83 --replace "/usr/src" "$TMP"
84 done
85
86 for i in ./doc/xml/{AdminGuide,QuickStartUnix,UserGuide}/*.xml; do
87 substituteInPlace "''${i}" --replace "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" \
88 "${docbook_xml_dtd_43}/xml/dtd/docbook/docbookx.dtd"
89 done
90
91 ./regen.sh
92
93
94 configureFlagsArray=(
95 "--with-krb5"
96 "--sysconfdir=/etc"
97 "--localstatedir=/var"
98 "--disable-kernel-module"
99 "--disable-fuse-client"
100 "--with-docbook-stylesheets=${docbook_xsl}/share/xml/docbook-xsl"
101 ${optionalString withTsm "--enable-tivoli-tsm"}
102 ${optionalString (!withNcurses) "--disable-gtx"}
103 "--disable-linux-d_splice-alias-extra-iput"
104 )
105 ''
106 + optionalString withTsm ''
107 export XBSA_CFLAGS="-Dxbsa -DNEW_XBSA -I${tsm-client}/opt/tivoli/tsm/client/api/bin64/sample -DXBSA_TSMLIB=\\\"${tsm-client}/lib64/libApiTSM64.so\\\""
108 '';
109
110 buildFlags = [ "all_nolibafs" ];
111
112 postBuild = ''
113 for d in doc/xml/{AdminGuide,QuickStartUnix,UserGuide}; do
114 make -C "''${d}" index.html
115 done
116 ''
117 + optionalString withDevdoc ''
118 make dox
119 '';
120
121 postInstall = ''
122 mkdir -p $doc/share/doc/openafs/{AdminGuide,QuickStartUnix,UserGuide}
123 cp -r doc/txt README LICENSE $doc/share/doc/openafs
124 for d in AdminGuide QuickStartUnix UserGuide ; do
125 cp "doc/xml/''${d}"/*.html "$doc/share/doc/openafs/''${d}"
126 done
127
128 cp src/tools/dumpscan/{afsdump_dirlist,afsdump_extract,afsdump_scan,dumptool} $out/bin
129
130 rm -r $out/lib/openafs
131 ''
132 + optionalString withDevdoc ''
133 mkdir -p $devdoc/share/devhelp/openafs/doxygen
134 cp -r doc/{pdf,protocol} $devdoc/share/devhelp/openafs
135 cp -r doc/doxygen/output/html $devdoc/share/devhelp/openafs/doxygen
136 '';
137
138 # remove forbidden references to $TMPDIR
139 preFixup = ''
140 for f in "$out"/bin/*; do
141 if isELF "$f"; then
142 patchelf --shrink-rpath --allowed-rpath-prefixes "$NIX_STORE" "$f"
143 fi
144 done
145 '';
146
147 passthru.cellservdb = callPackage ../cellservdb.nix { };
148
149 meta = {
150 outputsToInstall = [
151 "out"
152 "doc"
153 "man"
154 ];
155 description = "Open AFS client";
156 homepage = "https://www.openafs.org";
157 license = lib.licenses.ipl10;
158 platforms = lib.platforms.linux;
159 maintainers = [
160 lib.maintainers.spacefrogg
161 ];
162 };
163}