2017-07-10 07:41:36 +01:00
|
|
|
{ stdenv, callPackage, fetchurl, makeWrapper, jre }:
|
2010-07-28 12:55:54 +01:00
|
|
|
|
2017-07-10 07:41:36 +01:00
|
|
|
let
|
|
|
|
# The version number here is whatever is reported by the RUBY_VERSION string
|
|
|
|
rubyVersion = callPackage ../ruby/ruby-version.nix {} "2" "3" "3" "";
|
|
|
|
jruby = stdenv.mkDerivation rec {
|
2014-04-22 18:00:09 +01:00
|
|
|
name = "jruby-${version}";
|
|
|
|
|
2017-11-04 14:36:17 +00:00
|
|
|
version = "9.1.13.0";
|
2009-06-26 17:52:58 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2016-02-11 23:31:41 +00:00
|
|
|
url = "https://s3.amazonaws.com/jruby.org/downloads/${version}/jruby-bin-${version}.tar.gz";
|
2017-11-04 14:36:17 +00:00
|
|
|
sha256 = "021rmm5c18js569i4z6vj1bb193j4nska43jfiqz5hisc936c5cx";
|
2009-06-26 17:52:58 +01:00
|
|
|
};
|
|
|
|
|
2012-01-18 20:32:20 +00:00
|
|
|
buildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
installPhase = ''
|
2016-02-11 23:31:41 +00:00
|
|
|
mkdir -pv $out/docs
|
2012-01-18 20:32:20 +00:00
|
|
|
mv * $out
|
|
|
|
rm $out/bin/*.{bat,dll,exe,sh}
|
2014-04-22 18:00:09 +01:00
|
|
|
mv $out/COPYING $out/LICENSE* $out/docs
|
2012-01-18 20:32:20 +00:00
|
|
|
|
2017-07-10 06:11:53 +01:00
|
|
|
for i in $out/bin/jruby{,.bash}; do
|
2012-01-18 20:32:20 +00:00
|
|
|
wrapProgram $i \
|
|
|
|
--set JAVA_HOME ${jre}
|
|
|
|
done
|
2017-07-10 07:41:36 +01:00
|
|
|
|
|
|
|
ln -s $out/bin/jruby $out/bin/ruby
|
|
|
|
|
|
|
|
# Bundler tries to create this directory
|
|
|
|
mkdir -pv $out/${passthru.gemPath}
|
|
|
|
mkdir -p $out/nix-support
|
|
|
|
cat > $out/nix-support/setup-hook <<EOF
|
|
|
|
addGemPath() {
|
|
|
|
addToSearchPath GEM_PATH \$1/${passthru.gemPath}
|
|
|
|
}
|
|
|
|
|
2017-08-10 23:22:07 +01:00
|
|
|
addEnvHooks "$hostOffset" addGemPath
|
2017-07-10 07:41:36 +01:00
|
|
|
EOF
|
2012-01-18 20:32:20 +00:00
|
|
|
'';
|
2009-06-26 17:52:58 +01:00
|
|
|
|
2017-07-10 07:41:36 +01:00
|
|
|
passthru = rec {
|
|
|
|
rubyEngine = "jruby";
|
|
|
|
gemPath = "lib/${rubyEngine}/gems/${rubyVersion.libDir}";
|
|
|
|
libPath = "lib/${rubyEngine}/${rubyVersion.libDir}";
|
|
|
|
};
|
|
|
|
|
2014-04-22 18:00:09 +01:00
|
|
|
meta = {
|
2010-07-28 12:55:54 +01:00
|
|
|
description = "Ruby interpreter written in Java";
|
2012-01-18 20:32:20 +00:00
|
|
|
homepage = http://jruby.org/;
|
2014-11-06 00:44:33 +00:00
|
|
|
license = with stdenv.lib.licenses; [ cpl10 gpl2 lgpl21 ];
|
2016-08-02 18:50:55 +01:00
|
|
|
platforms = stdenv.lib.platforms.unix;
|
2009-06-26 17:52:58 +01:00
|
|
|
};
|
2017-07-10 07:41:36 +01:00
|
|
|
};
|
|
|
|
in jruby.overrideAttrs (oldAttrs: {
|
|
|
|
passthru = oldAttrs.passthru // {
|
|
|
|
devEnv = callPackage ../ruby/dev.nix {
|
|
|
|
ruby = jruby;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
})
|