Merge pull request #3266 from cstrahan/mesos

[WIP] mesos: Add package
This commit is contained in:
John Wiegley 2014-08-09 01:03:58 -05:00
commit 16ffd0638b
6 changed files with 1455 additions and 1 deletions

View File

@ -0,0 +1,80 @@
diff --git a/configure.ac b/configure.ac
index 1ebd196..a49d7d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -463,11 +463,6 @@ __EOF__
fi
# Determine linker flags for Java if not set.
- if test "$OS_NAME" = "darwin"; then
- dir="$JAVA_HOME/jre/lib/server"
- JAVA_TEST_LDFLAGS="-framework JavaVM"
- JAVA_JVM_LIBRARY=$dir/libjvm.dylib
- elif test "$OS_NAME" = "linux"; then
for arch in amd64 i386; do
dir="$JAVA_HOME/jre/lib/$arch/server"
if test -e "$dir"; then
@@ -477,7 +472,6 @@ __EOF__
break;
fi
done
- fi
if test -z "$JAVA_TEST_LDFLAGS"; then
AC_MSG_ERROR([failed to determine linker flags for using Java \
@@ -488,26 +482,6 @@ __EOF__
# flags as necessary (provided JAVA_CPPFLAGS was not set).
AC_MSG_CHECKING([whether or not we can build with JNI])
if test -z "$JAVA_CPPFLAGS"; then
- if test "$OS_NAME" = "darwin"; then
- while true; do # Loop until sucessful (via break) or exhausted options.
- m4_foreach([java_cppflags],
- [["-I$JAVA_HOME/include -I$JAVA_HOME/include/$OS_NAME"],
- ["-I/System/Library/Frameworks/JavaVM.framework/Headers"]],
- [JAVA_CPPFLAGS=java_cppflags
- TRY_LINK_JNI([break])])
- # Exhausted options.
- AC_MSG_ERROR([failed to build with JNI
- -------------------------------------------------------------------
- It appears we were unable to compile against the JNI. This is most
- likely due to one of the following issues:
- 1. You do not have a JDK installed on your system.
- 2. All JDKs installed on your system have deprecated JNI headers.
- It is advised to install OpenJDK on your system, as the JDK that
- ships with OS X has deprecated JNI headers.
- -------------------------------------------------------------------
- ])
- done
- else
while true; do # Loop until sucessful (via break) or exhausted options.
m4_foreach([java_cppflags],
[["-I$JAVA_HOME/include -I$JAVA_HOME/include/$OS_NAME"]],
@@ -516,7 +490,6 @@ __EOF__
# Exhausted options.
AC_MSG_ERROR([failed to build with JNI])
done
- fi
else
TRY_LINK_JNI([], [AC_MSG_ERROR([failed to build with JNI])])
fi
@@ -760,20 +733,6 @@ libcurl is required for mesos to build.
if test "x$with_cxx11" = "xyes"; then
AX_CXX_COMPILE_STDCXX_11([noext], [mandatory])
- case "$host_os" in
- darwin* )
- # If we're using clang, we need to pass -stdlib=libc++ too.
- if test "x$CLANG" = "xyes"; then
- CXXFLAGS="$CXXFLAGS -stdlib=libc++"
- fi
-
- # GTEST on OSX needs its own tr1 tuple.
- # TODO(dhamon): Update to gmock 1.7 and pass GTEST_LANG_CXX11 when in
- # c++11 mode.
- CXXFLAGS="$CXXFLAGS -DGTEST_USE_OWN_TR1_TUPLE=1"
- ;;
- esac
-
# Also pass the flags to 3rdparty libraries.
CONFIGURE_ARGS="$CONFIGURE_ARGS CXXFLAGS='$CXXFLAGS'"
fi

View File

@ -0,0 +1,107 @@
{ stdenv, lib, makeWrapper, fetchurl, fetchzip, curl, sasl, openssh, autoconf
, automake, libtool, unzip, gnutar, jdk, maven, python, wrapPython
, setuptools, distutils-cfg, boto, pythonProtobuf
}:
let version = "0.19.1";
in stdenv.mkDerivation {
dontDisableStatic = true;
name = "mesos-${version}";
src = fetchurl {
url = "http://www.apache.org/dist/mesos/${version}/mesos-${version}.tar.gz";
sha256 = "12li5xqfcw3124qg3h2cji3yhrc7gbx91lj45zfliicwgjkbmyf1";
};
patches = [ ./darwin.patch ];
buildInputs = [
makeWrapper autoconf automake libtool curl sasl jdk maven
python wrapPython boto distutils-cfg
];
propagatedBuildInputs = [
pythonProtobuf
];
mavenRepo = import ./mesos-deps.nix { inherit stdenv curl; };
preConfigure = ''
export MAVEN_OPTS="-Dmaven.repo.local=$(pwd)/.m2"
ln -s $mavenRepo .m2
substituteInPlace src/launcher/fetcher.cpp \
--replace '"tar' '"${gnutar}/bin/tar' \
--replace '"unzip' '"${unzip}/bin/unzip'
substituteInPlace src/cli/mesos-scp \
--replace "'scp " "'${openssh}/bin/scp "
'';
configureFlags = [
"--sbindir=\${out}/bin"
"--with-python-headers=${python}/include"
"--with-webui"
"--with-java-home=${jdk}"
"--with-java-headers=${jdk}/include"
"--with-included-zookeeper"
];
postInstall = ''
rm -rf $out/var
rm $out/bin/*.sh
ensureDir $out/share/java
cp src/java/target/mesos-*.jar $out/share/java
shopt -s extglob
MESOS_NATIVE_JAVA_LIBRARY=$(echo $out/lib/libmesos.*(so|dylib))
shopt -u extglob
ensureDir $out/nix-support
touch $out/nix-support/setup-hook
echo "export MESOS_NATIVE_JAVA_LIBRARY=$MESOS_NATIVE_JAVA_LIBRARY" >> $out/nix-support/setup-hook
echo "export MESOS_NATIVE_LIBRARY=$MESOS_NATIVE_JAVA_LIBRARY" >> $out/nix-support/setup-hook
# Inspired by: pkgs/development/python-modules/generic/default.nix
ensureDir "$out/lib/${python.libPrefix}"/site-packages
export PYTHONPATH="$out/lib/${python.libPrefix}/site-packages:$PYTHONPATH"
${python}/bin/${python.executable} src/python/setup.py install \
--install-lib=$out/lib/${python.libPrefix}/site-packages \
--old-and-unmanageable \
--prefix="$out"
rm -f "$out/lib/${python.libPrefix}"/site-packages/site.py*
'';
postFixup = ''
if test -e $out/nix-support/propagated-build-inputs; then
ln -s $out/nix-support/propagated-build-inputs $out/nix-support/propagated-user-env-packages
fi
for inputsfile in propagated-build-inputs propagated-native-build-inputs; do
if test -e $out/nix-support/$inputsfile; then
createBuildInputsPth $inputsfile "$(cat $out/nix-support/$inputsfile)"
fi
done
# wrap the python programs
declare -A pythonPathsSeen=()
program_PYTHONPATH="$out/libexec/mesos/python"
program_PATH=""
_addToPythonPath "$out"
for prog in mesos-cat mesos-ps mesos-scp mesos-tail; do
wrapProgram "$out/bin/$prog" \
--prefix PYTHONPATH ":" $program_PYTHONPATH
true
done
'';
meta = with lib; {
homepage = "http://mesos.apache.org";
license = licenses.asl20;
description = "A cluster manager that provides efficient resource isolation and sharing across distributed applications, or frameworks";
maintainers = with maintainers; [ cstrahan ];
platforms = with platforms; linux;
};
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,18 @@
{stdenv, curl}:
stdenv.mkDerivation {
name = "mesos-maven-deps";
builder = ./fetch-mesos-deps.sh;
outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash = "03qjq481ly5ajynlr9iqvrjra5fvv2jz4wp2f3in5vnxa61inrrk";
buildInputs = [ curl ];
# We borrow these environment variables from the caller to allow
# easy proxy configuration. This is impure, but a fixed-output
# derivation like fetchurl is allowed to do so since its result is
# by definition pure.
impureEnvVars = ["http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy"];
}

View File

@ -3486,6 +3486,13 @@ let
flex = flex_2_5_35;
};
mesos = callPackage ../applications/networking/cluster/mesos {
sasl = cyrus_sasl;
automake = automake114x;
inherit (pythonPackages) python boto setuptools distutils-cfg wrapPython;
pythonProtobuf = pythonPackages.protobuf;
};
octave = callPackage ../development/interpreters/octave {
fltk = fltk13;
qt = null;

View File

@ -5482,7 +5482,7 @@ rec {
protobuf = buildPythonPackage rec {
inherit (pkgs.protobuf) name src;
propagatedBuildInputs = [pkgs.protobuf];
propagatedBuildInputs = [ pkgs.protobuf setuptools ];
sourceRoot = "${name}/python";
meta = {