2021-01-23 13:15:07 +00:00
|
|
|
{ lib, stdenv, callPackage, fetchurl, makeWrapper, jre }:
|
2010-07-28 11:55:54 +00:00
|
|
|
|
2017-07-10 06:41:36 +00:00
|
|
|
let
|
|
|
|
# The version number here is whatever is reported by the RUBY_VERSION string
|
2020-08-04 18:33:27 +00:00
|
|
|
rubyVersion = callPackage ../ruby/ruby-version.nix {} "2" "5" "7" "";
|
2017-07-10 06:41:36 +00:00
|
|
|
jruby = stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "jruby";
|
2014-04-22 17:00:09 +00:00
|
|
|
|
2021-04-28 14:27:39 +00:00
|
|
|
version = "9.2.17.0";
|
2009-06-26 16:52:58 +00: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";
|
2021-04-28 14:27:39 +00:00
|
|
|
sha256 = "sha256-dwHTU3s6YG0nZaxtXEDmdd2qAdPOutJqIaZuOq3VwgI=";
|
2009-06-26 16:52:58 +00:00
|
|
|
};
|
|
|
|
|
2021-02-07 09:17:39 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2012-01-18 20:32:20 +00:00
|
|
|
|
|
|
|
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 17:00:09 +00:00
|
|
|
mv $out/COPYING $out/LICENSE* $out/docs
|
2012-01-18 20:32:20 +00:00
|
|
|
|
2017-07-10 05:11:53 +00:00
|
|
|
for i in $out/bin/jruby{,.bash}; do
|
2012-01-18 20:32:20 +00:00
|
|
|
wrapProgram $i \
|
2021-03-11 23:59:12 +00:00
|
|
|
--set JAVA_HOME ${jre.home}
|
2012-01-18 20:32:20 +00:00
|
|
|
done
|
2017-07-10 06:41:36 +00: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 22:22:07 +00:00
|
|
|
addEnvHooks "$hostOffset" addGemPath
|
2017-07-10 06:41:36 +00:00
|
|
|
EOF
|
2012-01-18 20:32:20 +00:00
|
|
|
'';
|
2009-06-26 16:52:58 +00:00
|
|
|
|
2020-09-24 23:33:43 +00:00
|
|
|
postFixup = ''
|
|
|
|
PATH=$out/bin:$PATH patchShebangs $out/bin
|
|
|
|
'';
|
|
|
|
|
2017-07-10 06:41:36 +00:00
|
|
|
passthru = rec {
|
|
|
|
rubyEngine = "jruby";
|
|
|
|
gemPath = "lib/${rubyEngine}/gems/${rubyVersion.libDir}";
|
|
|
|
libPath = "lib/${rubyEngine}/${rubyVersion.libDir}";
|
|
|
|
};
|
|
|
|
|
2021-01-23 13:15:07 +00:00
|
|
|
meta = with lib; {
|
2010-07-28 11:55:54 +00:00
|
|
|
description = "Ruby interpreter written in Java";
|
2020-03-05 02:42:20 +00:00
|
|
|
homepage = "http://jruby.org/";
|
2020-07-17 22:01:27 +00:00
|
|
|
license = with licenses; [ cpl10 gpl2 lgpl21 ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = [ maintainers.fzakaria ];
|
2009-06-26 16:52:58 +00:00
|
|
|
};
|
2017-07-10 06:41:36 +00:00
|
|
|
};
|
|
|
|
in jruby.overrideAttrs (oldAttrs: {
|
|
|
|
passthru = oldAttrs.passthru // {
|
|
|
|
devEnv = callPackage ../ruby/dev.nix {
|
|
|
|
ruby = jruby;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
})
|