lol

ruby: Enable cross-compilation

authored by

Ben Gamari and committed by
Will Dietz
41026550 2d772d52

+19 -5
+19 -5
pkgs/development/interpreters/ruby/default.nix
··· 1 - { stdenv, lib, fetchurl, fetchpatch, fetchFromSavannah, fetchFromGitHub 1 + { stdenv, buildPackages, lib 2 + , fetchurl, fetchpatch, fetchFromSavannah, fetchFromGitHub 2 3 , zlib, openssl, gdbm, ncurses, readline, groff, libyaml, libffi, autoreconfHook, bison 3 4 , autoconf, darwin ? null 4 5 , buildEnv, bundler, bundix, Foundation ··· 22 23 # Contains the ruby version heuristics 23 24 rubyVersion = import ./ruby-version.nix { inherit lib; }; 24 25 26 + # Needed during postInstall 27 + buildRuby = 28 + if stdenv.hostPlatform == stdenv.buildPlatform 29 + then "$out/bin/ruby" 30 + else "${buildPackages.ruby}/bin/ruby"; 31 + 25 32 generic = { version, sha256 }: let 26 33 ver = version; 27 34 tag = ver.gitTag; ··· 30 37 isRuby25 = ver.majMin == "2.5"; 31 38 baseruby = self.override { useRailsExpress = false; }; 32 39 self = lib.makeOverridable ( 33 - { stdenv, lib, fetchurl, fetchpatch, fetchFromSavannah, fetchFromGitHub 40 + { stdenv, buildPackages, lib 41 + , fetchurl, fetchpatch, fetchFromSavannah, fetchFromGitHub 34 42 , useRailsExpress ? true 35 43 , zlib, zlibSupport ? true 36 44 , openssl, opensslSupport ? true ··· 67 75 # Have `configure' avoid `/usr/bin/nroff' in non-chroot builds. 68 76 NROFF = "${groff}/bin/nroff"; 69 77 70 - nativeBuildInputs = ops useRailsExpress [ autoreconfHook bison ]; 78 + nativeBuildInputs = 79 + ops useRailsExpress [ autoreconfHook bison ] 80 + ++ ops (stdenv.buildPlatform != stdenv.hostPlatform) [ 81 + buildPackages.ruby 82 + ]; 71 83 buildInputs = 72 84 (op fiddleSupport libffi) 73 85 ++ (ops cursesSupport [ ncurses readline ]) ··· 129 141 "--with-out-ext=tk" 130 142 # on yosemite, "generating encdb.h" will hang for a very long time without this flag 131 143 "--with-setjmp-type=setjmp" 132 - ]; 144 + ] 145 + ++ op (stdenv.hostPlatform != stdenv.buildPlatform) 146 + "--with-baseruby=${buildRuby}"; 133 147 134 148 installFlags = stdenv.lib.optionalString docSupport "install-doc"; 135 149 # Bundler tries to create this directory 136 150 postInstall = '' 137 151 # Update rubygems 138 152 pushd rubygems 139 - $out/bin/ruby setup.rb 153 + ${buildRuby} setup.rb 140 154 popd 141 155 142 156 # Remove unnecessary groff reference from runtime closure, since it's big