about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorPeter Hoeg <peter@hoeg.com>2019-06-25 12:59:56 +0800
committerGitHub <noreply@github.com>2019-06-25 12:59:56 +0800
commite3afc85cbaf57637f829712f338aa12eff2f253a (patch)
treef669ce4107f3aa9675606ac2492b7e884b629095 /pkgs
parent4ec4dc0aa61b755025c1c851bce90debab6156c4 (diff)
parentfda3f06656840dc22addd06fce9be850b75486cd (diff)
Merge pull request #63725 from peterhoeg/u/crystal
crystal: init at 0.29.0
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/compilers/crystal/default.nix54
-rw-r--r--pkgs/development/tools/build-managers/shards/default.nix4
-rw-r--r--pkgs/development/tools/scry/default.nix9
-rw-r--r--pkgs/development/tools/scry/fix_for_crystal_0_28_and_above.patch20
-rw-r--r--pkgs/top-level/all-packages.nix2
5 files changed, 74 insertions, 15 deletions
diff --git a/pkgs/development/compilers/crystal/default.nix b/pkgs/development/compilers/crystal/default.nix
index 1e0f8656ef082..2e823fe1f0f8f 100644
--- a/pkgs/development/compilers/crystal/default.nix
+++ b/pkgs/development/compilers/crystal/default.nix
@@ -1,11 +1,11 @@
 { stdenv, lib, fetchFromGitHub, fetchurl, makeWrapper
-, gmp, openssl, readline, tzdata, libxml2, libyaml
+, coreutils, git, gmp, nettools, openssl, readline, tzdata, libxml2, libyaml
 , boehmgc, libatomic_ops, pcre, libevent, libiconv, llvm, clang, which, zlib }:
 
 # We need multiple binaries as a given binary isn't always able to build
-# (even slightly) older or newer version.
+# (even slightly) older or newer versions.
 # - 0.26.1 can build 0.25.x and 0.26.x but not 0.27.x
-# - 0.27.2 can build 0.27.x but not 0.25.x and 0.26.x
+# - 0.27.2 can build 0.27.x but not 0.25.x, 0.26.x and 0.29.x
 #
 # We need to keep around at least the latest version released with a stable
 # NixOS
@@ -19,7 +19,7 @@ let
 
   arch = archs."${stdenv.system}" or (throw "system ${stdenv.system} not supported");
 
-  checkInputs = [ gmp openssl readline libxml2 libyaml tzdata ];
+  checkInputs = [ git gmp openssl readline libxml2 libyaml ];
 
   genericBinary = { version, sha256s, rel ? 1 }:
   stdenv.mkDerivation rec {
@@ -38,8 +38,8 @@ let
 
   generic = { version, sha256, binary, doCheck ? true }:
   stdenv.mkDerivation rec {
-    inherit doCheck;
-    name = "crystal-${version}";
+    pname = "crystal";
+    inherit doCheck version;
 
     src = fetchFromGitHub {
       owner  = "crystal-lang";
@@ -48,14 +48,30 @@ let
       inherit sha256;
     };
 
+    # we are almost able to run the full test suite now
     postPatch = ''
+      substituteInPlace src/crystal/system/unix/time.cr \
+        --replace /usr/share/zoneinfo ${tzdata}/share/zoneinfo
+
       ln -s spec/compiler spec/std
+
+      substituteInPlace spec/std/file_spec.cr \
+        --replace '/bin/ls' '${coreutils}/bin/ls' \
+        --replace '/usr/share' '/tmp/test'
+
       substituteInPlace spec/std/process_spec.cr \
-        --replace /bin/ /run/current-system/sw/bin/
+        --replace '/bin/cat' '${coreutils}/bin/cat' \
+        --replace '/bin/ls' '${coreutils}/bin/ls' \
+        --replace '/usr/bin/env' '${coreutils}/bin/env' \
+        --replace '"env"' '"${coreutils}/bin/env"' \
+        --replace '"/usr"' '"/tmp"'
+
+      substituteInPlace spec/std/system_spec.cr \
+        --replace '`hostname`' '`${nettools}/bin/hostname`'
     '';
 
     buildInputs = [
-      boehmgc libatomic_ops pcre libevent
+      boehmgc libatomic_ops pcre libevent libyaml
       llvm zlib openssl
     ] ++ stdenv.lib.optionals stdenv.isDarwin [
       libiconv
@@ -111,7 +127,11 @@ let
     checkTarget = "spec";
 
     preCheck = ''
+      export HOME=/tmp
+      mkdir -p $HOME/test
+
       export LIBRARY_PATH=${lib.makeLibraryPath checkInputs}:$LIBRARY_PATH
+      export PATH=${lib.makeBinPath checkInputs}:$PATH
     '';
 
     meta = with lib; {
@@ -142,6 +162,15 @@ in rec {
     };
   };
 
+  binaryCrystal_0_29 = genericBinary {
+    version = "0.29.0";
+    sha256s = {
+      "x86_64-linux"  = "1wrk29sfx35akg7hxwpdiikvl18wd40gq1kwirw7x522hnq7vlna";
+      "i686-linux"    = "1nx0piis2k3nn7kqiijqazzbvlaavhgvsln0l3dxmpfa4i4dz5h2";
+      "x86_64-darwin" = "1fd0fbyf05abivnp3igjlrm2axf65n2wdmg4aq6nqj60ipc01rvd";
+    };
+  };
+
   crystal_0_25 = generic {
     version = "0.25.1";
     sha256  = "15xmbkalsdk9qpc6wfpkly3sifgw6a4ai5jzlv78dh3jp7glmgyl";
@@ -163,5 +192,12 @@ in rec {
     binary = binaryCrystal_0_27;
   };
 
-  crystal = crystal_0_27;
+  crystal_0_29 = generic {
+    version = "0.29.0";
+    sha256  = "0v9l253b2x8yw6a43vvalywpwciwr094l3g5wakmndfrzak2s3zr";
+    doCheck = false; # 6 checks are failing now
+    binary = binaryCrystal_0_29;
+  };
+
+  crystal = crystal_0_29;
 }
diff --git a/pkgs/development/tools/build-managers/shards/default.nix b/pkgs/development/tools/build-managers/shards/default.nix
index 02d5adb0c34da..00345179131a2 100644
--- a/pkgs/development/tools/build-managers/shards/default.nix
+++ b/pkgs/development/tools/build-managers/shards/default.nix
@@ -2,13 +2,13 @@
 
 stdenv.mkDerivation rec {
   name = "shards-${version}";
-  version = "0.8.1";
+  version = "0.9.0";
 
   src = fetchFromGitHub {
     owner  = "crystal-lang";
     repo   = "shards";
     rev    = "v${version}";
-    sha256 = "1cjn2lafr08yiqzlhyqx14jjjxf1y24i2kk046px07gljpnlgqwk";
+    sha256 = "19q0xww4v0h5ln9gz8d8zv0c9ig761ik7gw8y31yxynzgzihwpf4";
   };
 
   buildInputs = [ crystal libyaml pcre which ];
diff --git a/pkgs/development/tools/scry/default.nix b/pkgs/development/tools/scry/default.nix
index 03e7c64f54967..05f7805a55aca 100644
--- a/pkgs/development/tools/scry/default.nix
+++ b/pkgs/development/tools/scry/default.nix
@@ -1,9 +1,8 @@
-{ stdenv, fetchFromGitHub, crystal, shards, which }:
+{ stdenv, lib, fetchFromGitHub, crystal, shards, llvm, which }:
 
 stdenv.mkDerivation rec {
   pname = "scry";
-  # 0.7.1 doesn't work with crystal > 0.25
-  version = "0.7.1.20180919";
+  version = "0.8.0";
 
   src = fetchFromGitHub {
     owner  = "crystal-lang-tools";
@@ -12,7 +11,9 @@ stdenv.mkDerivation rec {
     sha256 = "1yq7jap3y5pr2yqc6fn6bxshzwv7dz3w97incq7wpcvi7ibb4lcn";
   };
 
-  nativeBuildInputs = [ crystal shards which ];
+  patches = lib.optional (lib.versionAtLeast crystal.version "0.28") ./fix_for_crystal_0_28_and_above.patch;
+
+  nativeBuildInputs = [ crystal shards llvm which ];
 
   buildPhase = ''
     runHook preBuild
diff --git a/pkgs/development/tools/scry/fix_for_crystal_0_28_and_above.patch b/pkgs/development/tools/scry/fix_for_crystal_0_28_and_above.patch
new file mode 100644
index 0000000000000..909b790b81a8e
--- /dev/null
+++ b/pkgs/development/tools/scry/fix_for_crystal_0_28_and_above.patch
@@ -0,0 +1,20 @@
+diff --git a/src/scry/completion_provider.cr b/src/scry/completion_provider.cr
+index 29e0d36..f67438c 100644
+--- a/src/scry/completion_provider.cr
++++ b/src/scry/completion_provider.cr
+@@ -1,4 +1,5 @@
+ require "./log"
++require "compiler/crystal/codegen/target"
+ require "compiler/crystal/crystal_path"
+ require "./completion/*"
+
+diff --git a/src/scry/parse_analyzer.cr b/src/scry/parse_analyzer.cr
+index d87eca4..bbe9ed5 100644
+--- a/src/scry/parse_analyzer.cr
++++ b/src/scry/parse_analyzer.cr
+@@ -1,4 +1,5 @@
+ require "compiler/crystal/syntax"
++require "compiler/crystal/codegen/target"
+ require "compiler/crystal/crystal_path"
+ require "./workspace"
+ require "./text_document"
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 764a94081479c..0494305130332 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -7192,6 +7192,8 @@ in
   })
     crystal_0_25
     crystal_0_26
+    crystal_0_27
+    crystal_0_29
     crystal;
 
   icr = callPackage ../development/tools/icr {};