2023-07-15 17:15:38 +00:00
|
|
|
{ lib, stdenv, callPackage, fetchurl, mkRubyVersion, makeBinaryWrapper, jre }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
2023-07-15 17:15:38 +00:00
|
|
|
# The version number here is whatever is reported by the RUBY_VERSION string
|
|
|
|
rubyVersion = mkRubyVersion "3" "1" "4" "";
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "jruby";
|
2023-07-15 17:15:38 +00:00
|
|
|
version = "9.4.3.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2023-07-15 17:15:38 +00:00
|
|
|
url = "https://s3.amazonaws.com/jruby.org/downloads/${finalAttrs.version}/jruby-bin-${finalAttrs.version}.tar.gz";
|
|
|
|
hash = "sha256-sJfgjFZp6KGIKI4RORHRK0rSvWeiwgnW36hEXWOk2Mk=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
nativeBuildInputs = [ makeBinaryWrapper ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
2023-07-15 17:15:38 +00:00
|
|
|
mkdir -pv $out/share/jruby/docs
|
|
|
|
mv * $out
|
|
|
|
rm $out/bin/*.{bat,dll,exe,sh}
|
|
|
|
mv $out/samples $out/share/jruby/
|
|
|
|
mv $out/BSDL $out/COPYING $out/LEGAL $out/LICENSE* $out/share/jruby/docs/
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
for i in $out/bin/jruby; do
|
|
|
|
wrapProgram $i \
|
|
|
|
--set JAVA_HOME ${jre.home}
|
|
|
|
done
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
ln -s $out/bin/jruby $out/bin/ruby
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
# Bundler tries to create this directory
|
|
|
|
mkdir -pv $out/${finalAttrs.passthru.gemPath}
|
|
|
|
mkdir -p $out/nix-support
|
|
|
|
cat > $out/nix-support/setup-hook <<EOF
|
|
|
|
addGemPath() {
|
|
|
|
addToSearchPath GEM_PATH \$1/${finalAttrs.passthru.gemPath}
|
|
|
|
}
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
addEnvHooks "$hostOffset" addGemPath
|
|
|
|
EOF
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2020-10-07 09:15:18 +00:00
|
|
|
postFixup = ''
|
|
|
|
PATH=$out/bin:$PATH patchShebangs $out/bin
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
passthru = rec {
|
|
|
|
rubyEngine = "jruby";
|
|
|
|
gemPath = "lib/${rubyEngine}/gems/${rubyVersion.libDir}";
|
|
|
|
libPath = "lib/${rubyEngine}/${rubyVersion.libDir}";
|
2023-07-15 17:15:38 +00:00
|
|
|
devEnv = callPackage ../ruby/dev.nix {
|
|
|
|
ruby = finalAttrs.finalPackage;
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Ruby interpreter written in Java";
|
2023-07-15 17:15:38 +00:00
|
|
|
homepage = "https://www.jruby.org/";
|
|
|
|
changelog = "https://github.com/jruby/jruby/releases/tag/${version}";
|
2020-08-20 17:08:02 +00:00
|
|
|
license = with licenses; [ cpl10 gpl2 lgpl21 ];
|
2023-07-15 17:15:38 +00:00
|
|
|
platforms = jre.meta.platforms;
|
2020-08-20 17:08:02 +00:00
|
|
|
maintainers = [ maintainers.fzakaria ];
|
2022-08-21 13:32:41 +00:00
|
|
|
sourceProvenance = with sourceTypes; [ binaryBytecode ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
})
|