summary refs log tree commit diff
diff options
context:
space:
mode:
authorzimbatm <zimbatm@zimbatm.com>2020-01-10 14:35:29 +0000
committerGitHub <noreply@github.com>2020-01-10 14:35:29 +0000
commitddc83e68ccf088a99d1ac4f07feee6fdcd593418 (patch)
treea58a3417d524c30d7511f090b9e4b588a071a4ce
parente639d3e844d7385e977d31387e82e437616f8c3f (diff)
parent1ac11cc1c1858af1cef725d68cacf7102366e588 (diff)
downloadnixpkgs-ddc83e68ccf088a99d1ac4f07feee6fdcd593418.tar
nixpkgs-ddc83e68ccf088a99d1ac4f07feee6fdcd593418.tar.gz
nixpkgs-ddc83e68ccf088a99d1ac4f07feee6fdcd593418.tar.bz2
nixpkgs-ddc83e68ccf088a99d1ac4f07feee6fdcd593418.tar.lz
nixpkgs-ddc83e68ccf088a99d1ac4f07feee6fdcd593418.tar.xz
nixpkgs-ddc83e68ccf088a99d1ac4f07feee6fdcd593418.tar.zst
nixpkgs-ddc83e68ccf088a99d1ac4f07feee6fdcd593418.zip
Merge pull request #77149 from alyssais/asciidoctor
Reduce AsciiDoctor closure size
-rw-r--r--pkgs/development/interpreters/ruby/default.nix2
-rw-r--r--pkgs/development/ruby-modules/gem-config/default.nix17
-rw-r--r--pkgs/development/ruby-modules/gem/default.nix9
-rw-r--r--pkgs/top-level/all-packages.nix2
4 files changed, 24 insertions, 6 deletions
diff --git a/pkgs/development/interpreters/ruby/default.nix b/pkgs/development/interpreters/ruby/default.nix
index 58ccf5ae9b4..8b8e7ccc8bb 100644
--- a/pkgs/development/interpreters/ruby/default.nix
+++ b/pkgs/development/interpreters/ruby/default.nix
@@ -49,7 +49,7 @@ let
       # 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 ? false
+      , removeReferencesTo, removeReferenceToCC ? true
       , autoreconfHook, bison, autoconf
       , buildEnv, bundler, bundix
       , libiconv, libobjc, libunwind, Foundation
diff --git a/pkgs/development/ruby-modules/gem-config/default.nix b/pkgs/development/ruby-modules/gem-config/default.nix
index c1eb82c5fa8..088bcedf6de 100644
--- a/pkgs/development/ruby-modules/gem-config/default.nix
+++ b/pkgs/development/ruby-modules/gem-config/default.nix
@@ -39,6 +39,15 @@ let
 in
 
 {
+  asciidoctor-diagram = { version, ruby, ... }: {
+    postInstall = ''
+      # Delete vendored JAR files unless using JRuby.
+      if ruby -e 'exit(RUBY_PLATFORM != "java")'; then
+          rm -v $out/${ruby.gemPath}/gems/$gemName-${version}/lib/*.jar
+      fi
+    '';
+  };
+
   atk = attrs: {
     dependencies = attrs.dependencies ++ [ "gobject-introspection" ];
     nativeBuildInputs = [ rake bundler pkgconfig ];
@@ -315,6 +324,14 @@ in
     # The ruby build script takes care of this
     dontUseCmakeConfigure = true;
 
+    postInstall = ''
+      # Reduce output size by a lot, and remove some unnecessary references.
+      # The ext directory should only be required at build time, so
+      # can be deleted now.
+      rm -r $out/${ruby.gemPath}/gems/mathematical-${attrs.version}/ext \
+            $out/${ruby.gemPath}/extensions/*/*/mathematical-${attrs.version}/gem_make.out
+    '';
+
     # For some reason 'mathematical.so' is missing cairo and glib in its RPATH, add them explicitly here
     postFixup = lib.optionalString stdenv.isLinux ''
       soPath="$out/${ruby.gemPath}/gems/mathematical-${attrs.version}/lib/mathematical/mathematical.so"
diff --git a/pkgs/development/ruby-modules/gem/default.nix b/pkgs/development/ruby-modules/gem/default.nix
index af38160a5fa..158d5891ec3 100644
--- a/pkgs/development/ruby-modules/gem/default.nix
+++ b/pkgs/development/ruby-modules/gem/default.nix
@@ -39,7 +39,7 @@ lib.makeOverridable (
 , meta ? {}
 , patches ? []
 , gemPath ? []
-, dontStrip ? true
+, dontStrip ? false
 # Assume we don't have to build unless strictly necessary (e.g. the source is a
 # git checkout).
 # If you need to apply patches, make sure to set `dontBuild = false`;
@@ -205,8 +205,11 @@ stdenv.mkDerivation ((builtins.removeAttrs attrs ["source"]) // {
       $gempkg $gemFlags -- $buildFlags
 
     # looks like useless files which break build repeatability and consume space
-    rm -fv $out/${ruby.gemPath}/doc/*/*/created.rid || true
-    rm -fv $out/${ruby.gemPath}/gems/*/ext/*/mkmf.log || true
+    pushd $out/${ruby.gemPath}
+    rm -fv doc/*/*/created.rid || true
+    rm -fv {gems/*/ext/*,extensions/*/*/*}/{mkmf.log,gem_make.out} || true
+    rm -fvr cache
+    popd
 
     # write out metadata and binstubs
     spec=$(echo $out/${ruby.gemPath}/specifications/*.gemspec)
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 614369dbb7d..ec93b78b181 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -9409,8 +9409,6 @@ in
     docSupport = false;
     yamlSupport = false;
     fiddleSupport = false;
-    # remove gcc from runtime closure
-    removeReferenceToCC = true;
   };
 
   ruby = ruby_2_6;