@@ -1,80 +1,65 @@
1−x@{builderDefsPackage
2− , boost, fuse, openssl, cmake, attr, jdk, ant, which, python, file
3− , ...}:
4−builderDefsPackage
5−(a :
6−let
7− helperArgNames = ["stdenv" "fetchurl" "builderDefsPackage"] ++
8− [];
9−
10− buildInputs = map (n: builtins.getAttr n x)
11− (builtins.attrNames (builtins.removeAttrs x helperArgNames));
12− sourceInfo = rec {
13− baseName="XtreemFS";
14− version="1.4";
15− name="${baseName}-${version}";
16− url="http://xtreemfs.googlecode.com/files/${name}.tar.gz";
17− hash="1hzd6anplxdcl4cg6xwriqk9b34541r7ah1ab2xavv149a2ll25s";
18− };
19−in
20−rec {
21− src = a.fetchurl {
22− url = sourceInfo.url;
23− sha256 = sourceInfo.hash;
1+{ stdenv, boost, fuse, openssl, cmake, attr, jdk, ant, which, file, python
2+, fetchurl, lib, valgrind, makeWrapper, fetchFromGitHub }:
3+
4+stdenv.mkDerivation rec {
5+ src = fetchFromGitHub {
6+ # using unstable release because stable (v1.5.1) has broken repl java plugin
7+ rev = "7ddcb081aa125b0cfb008dc98addd260b8353ab3";
8+ owner = "xtreemfs";
9+ repo = "xtreemfs";
10+ sha256 = "1hjmd32pla27zf98ghzz6r5ml8ry86m9dsryv1z01kxv5l95b3m0";
2411 };
2512
26− inherit (sourceInfo) name version;
27− inherit buildInputs;
13+ name = "XtreemFS-${version}";
14+ version = "1.5.1.81";
15+
16+ buildInputs = [ which attr makeWrapper python ];
17+
18+ preConfigure = ''
19+ export JAVA_HOME=${jdk}
20+ export ANT_HOME=${ant}
21+
22+ export BOOST_INCLUDEDIR=${boost.dev}/include
23+ export BOOST_LIBRARYDIR=${boost.lib}/lib
24+ export OPENSSL_ROOT_DIR=${openssl}
25+
26+ substituteInPlace cpp/cmake/FindValgrind.cmake \
27+ --replace "/usr/local" "${valgrind}"
28+
29+ substituteInPlace cpp/CMakeLists.txt \
30+ --replace '"/lib64" "/usr/lib64"' '"${attr}/lib" "${fuse}/lib"'
31+
32+ export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${fuse}/include"
33+ export NIX_CFLAGS_LINK="$NIX_CFLAGS_LINK -L${fuse}/lib"
34+
35+ export DESTDIR=$out
2836
29− /* doConfigure should be removed if not needed */
30− phaseNames = ["setVars" "fixMakefile" "doMakeInstall" "fixInterpreterBin"
31− "fixInterpreterEtc"
32− "usrIsOut"];
37+ substituteInPlace Makefile \
38+ --replace "/usr/share/" "/share/" \
39+ --replace 'BIN_DIR=$(DESTDIR)/usr/bin' "BIN_DIR=$out/bin"
3340
34− setVars = a.noDepEntry ''
35− export JAVA_HOME="${jdk}"
36− export ANT_HOME="${ant}"
37− export CMAKE_HOME=${cmake}
41+ substituteInPlace etc/init.d/generate_initd_scripts.sh \
42+ --replace "/bin/bash" "${stdenv.shell}"
43+
44+ # do not put cmake into buildInputs
45+ export PATH="$PATH:${cmake}/bin"
46+ '';
47+
48+ preBuild = ''
49+ substituteInPlace configure \
50+ --replace "/usr/bin/file" "${file}/bin/file"
51+ '';
52+
53+ doCheck = false;
54+
55+ postInstall = ''
56+ rm -r $out/sbin
3857 '';
3958
40− fixMakefile = a.fullDepEntry ''
41− sed -e 's@DESTDIR)/usr@DESTDIR)@g' -i Makefile
42−
43− sed -e 's@/usr/bin/@@g' -i cpp/thirdparty/protobuf-*/configure
44− sed -e 's@/usr/bin/@@g' -i cpp/thirdparty/protobuf-*/gtest/configure
45− sed -e 's@/usr/bin/@@g' -i cpp/thirdparty/gtest-*/configure
46− '' ["doUnpack" "minInit"];
47−
48− fixInterpreterBin = a.doPatchShebangs "$out/bin";
49− fixInterpreterEtc = a.doPatchShebangs "$out/etc/xos/xtreemfs";
50−
51− usrIsOut = a.fullDepEntry ''
52− sed -e "s@/usr/@$out/@g" -i \
53− "$out"/{bin/xtfs_*,etc/xos/xtreemfs/*.*,etc/xos/xtreemfs/*/*,etc/init.d/*}
54− sed -e "s@JAVA_HOME=/usr@JAVA_HOME=${jdk}@g" -i \
55− "$out"/{bin/xtfs_*,etc/init.d/*}
56− '' ["minInit"];
57−
58− makeFlags = [
59− ''DESTDIR="$out"''
60− ''SHELL="${a.stdenv.shell}"''
61− ];
62−
6359 meta = {
6460 description = "A distributed filesystem";
65− maintainers = with a.lib.maintainers;
66− [
67− raskin
68− ];
69− platforms = with a.lib.platforms;
70− linux;
71− license = a.lib.licenses.bsd3;
72− broken = true;
61+ maintainers = with lib.maintainers; [ raskin matejc ];
62+ platforms = lib.platforms.linux;
63+ license = lib.licenses.bsd3;
7364 };
74− passthru = {
75− updateInfo = {
76− downloadPage = "http://xtreemfs.org/download_sources.php";
77− };
78− };
79−}) x
80−
65+}