at master 2.1 kB view raw
1{ 2 lib, 3 stdenv, 4 callPackage, 5 fetchurl, 6 gitUpdater, 7 mkRubyVersion, 8 makeBinaryWrapper, 9 jre, 10}: 11 12let 13 # The version number here is whatever is reported by the RUBY_VERSION string 14 rubyVersion = mkRubyVersion "3" "1" "4" ""; 15in 16stdenv.mkDerivation (finalAttrs: { 17 pname = "jruby"; 18 version = "10.0.0.0"; 19 20 src = fetchurl { 21 url = "https://s3.amazonaws.com/jruby.org/downloads/${finalAttrs.version}/jruby-bin-${finalAttrs.version}.tar.gz"; 22 hash = "sha256-Qn2YJ+0j/mtNEf5hZlx13XR2ujagQ4N26zEM4qjSRzM="; 23 }; 24 25 nativeBuildInputs = [ makeBinaryWrapper ]; 26 27 installPhase = '' 28 mkdir -pv $out/share/jruby/docs 29 mv * $out 30 rm $out/bin/*.{bat,dll,exe,sh} 31 mv $out/samples $out/share/jruby/ 32 mv $out/BSDL $out/COPYING $out/LEGAL $out/LICENSE* $out/share/jruby/docs/ 33 34 for i in $out/bin/jruby; do 35 wrapProgram $i \ 36 --set JAVA_HOME ${jre.home} 37 done 38 39 ln -s $out/bin/jruby $out/bin/ruby 40 41 # Bundler tries to create this directory 42 mkdir -pv $out/${finalAttrs.passthru.gemPath} 43 mkdir -p $out/nix-support 44 cat > $out/nix-support/setup-hook <<EOF 45 addGemPath() { 46 addToSearchPath GEM_PATH \$1/${finalAttrs.passthru.gemPath} 47 } 48 49 addEnvHooks "$hostOffset" addGemPath 50 EOF 51 ''; 52 53 postFixup = '' 54 PATH=$out/bin:$PATH patchShebangs $out/bin 55 ''; 56 57 passthru = rec { 58 rubyEngine = "jruby"; 59 gemPath = "lib/${rubyEngine}/gems/${rubyVersion.libDir}"; 60 libPath = "lib/${rubyEngine}/${rubyVersion.libDir}"; 61 devEnv = callPackage ../ruby/dev.nix { 62 ruby = finalAttrs.finalPackage; 63 }; 64 updateScript = gitUpdater { 65 url = "https://github.com/jruby/jruby.git"; 66 }; 67 }; 68 69 meta = with lib; { 70 description = "Ruby interpreter written in Java"; 71 homepage = "https://www.jruby.org/"; 72 changelog = "https://github.com/jruby/jruby/releases/tag/${finalAttrs.version}"; 73 license = with licenses; [ 74 cpl10 75 gpl2 76 lgpl21 77 ]; 78 platforms = jre.meta.platforms; 79 maintainers = [ maintainers.fzakaria ]; 80 sourceProvenance = with sourceTypes; [ binaryBytecode ]; 81 }; 82})