Skip to content

Commit

Permalink
ruby: add jemalloc support
Browse files Browse the repository at this point in the history
  • Loading branch information
peterhoeg committed Feb 5, 2020
1 parent a21c2fa commit 6ed1585
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
20 changes: 14 additions & 6 deletions pkgs/development/interpreters/ruby/default.nix
@@ -1,9 +1,10 @@
{ stdenv, buildPackages, lib
, fetchurl, fetchpatch, fetchFromSavannah, fetchFromGitHub
, zlib, openssl, gdbm, ncurses, readline, groff, libyaml, libffi, autoreconfHook, bison
, zlib, openssl, gdbm, ncurses, readline, groff, libyaml, libffi, autoreconfHook, bison, pkgconfig
, autoconf, libiconv, libobjc, libunwind, Foundation
, buildEnv, bundler, bundix
, makeWrapper, buildRubyGem, defaultGemConfig, removeReferencesTo
, jemalloc
} @ args:

let
Expand Down Expand Up @@ -45,12 +46,13 @@ let
, groff, docSupport ? true
, libyaml, yamlSupport ? true
, libffi, fiddleSupport ? true
, jemalloc, jemallocSupport ? true
# ruby -e "puts RbConfig::CONFIG['configure_args']"
# puts a reference to the C compiler in the binary.
# This might be required by some gems at runtime,
# but we allow to strip it out for smaller closure size.
, removeReferencesTo, removeReferenceToCC ? true
, autoreconfHook, bison, autoconf
, autoreconfHook, bison, autoconf, pkgconfig
, buildEnv, bundler, bundix
, libiconv, libobjc, libunwind, Foundation
, makeWrapper, buildRubyGem, defaultGemConfig
Expand All @@ -74,11 +76,12 @@ let

outputs = [ "out" ] ++ lib.optional docSupport "devdoc";

nativeBuildInputs = [ autoreconfHook bison ]
nativeBuildInputs = [ autoreconfHook bison pkgconfig ]
++ (op docSupport groff)
++ op (stdenv.buildPlatform != stdenv.hostPlatform) buildPackages.ruby;
buildInputs =
(op fiddleSupport libffi)
buildInputs = [ ]
++ (op jemallocSupport jemalloc )
++ (op fiddleSupport libffi)
++ (ops cursesSupport [ ncurses readline ])
++ (op zlibSupport zlib)
++ (op opensslSupport openssl)
Expand Down Expand Up @@ -123,7 +126,12 @@ let
# https://github.com/ruby/ruby/commit/97a5af62a318fcd93a4e5e4428d576c0280ddbae
buildFlags = lib.optionals atLeast27 [ "REVISION_LATEST=0" ];

configureFlags = ["--enable-shared" "--enable-pthread" "--with-soname=ruby_${tag}"]
configureFlags = [
"--enable-shared"
"--enable-pthread"
"--with-jemalloc"
"--with-soname=ruby_${tag}"
]
++ op useRailsExpress "--with-baseruby=${baseruby}/bin/ruby"
++ op (!docSupport) "--disable-install-doc"
++ ops stdenv.isDarwin [
Expand Down
1 change: 1 addition & 0 deletions pkgs/top-level/all-packages.nix
Expand Up @@ -9442,6 +9442,7 @@ in
docSupport = false;
yamlSupport = false;
fiddleSupport = false;
jemallocSupport = false;
};

ruby = ruby_2_6;
Expand Down

0 comments on commit 6ed1585

Please sign in to comment.