Merge pull request #63725 from peterhoeg/u/crystal

crystal: init at 0.29.0
This commit is contained in:
Peter Hoeg 2019-06-25 12:59:56 +08:00 committed by GitHub
commit e3afc85cba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 74 additions and 15 deletions

View File

@ -1,11 +1,11 @@
{ stdenv, lib, fetchFromGitHub, fetchurl, makeWrapper { 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 }: , boehmgc, libatomic_ops, pcre, libevent, libiconv, llvm, clang, which, zlib }:
# We need multiple binaries as a given binary isn't always able to build # 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.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 # We need to keep around at least the latest version released with a stable
# NixOS # NixOS
@ -19,7 +19,7 @@ let
arch = archs."${stdenv.system}" or (throw "system ${stdenv.system} not supported"); 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 }: genericBinary = { version, sha256s, rel ? 1 }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
@ -38,8 +38,8 @@ let
generic = { version, sha256, binary, doCheck ? true }: generic = { version, sha256, binary, doCheck ? true }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
inherit doCheck; pname = "crystal";
name = "crystal-${version}"; inherit doCheck version;
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "crystal-lang"; owner = "crystal-lang";
@ -48,14 +48,30 @@ let
inherit sha256; inherit sha256;
}; };
# we are almost able to run the full test suite now
postPatch = '' postPatch = ''
substituteInPlace src/crystal/system/unix/time.cr \
--replace /usr/share/zoneinfo ${tzdata}/share/zoneinfo
ln -s spec/compiler spec/std 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 \ 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 = [ buildInputs = [
boehmgc libatomic_ops pcre libevent boehmgc libatomic_ops pcre libevent libyaml
llvm zlib openssl llvm zlib openssl
] ++ stdenv.lib.optionals stdenv.isDarwin [ ] ++ stdenv.lib.optionals stdenv.isDarwin [
libiconv libiconv
@ -111,7 +127,11 @@ let
checkTarget = "spec"; checkTarget = "spec";
preCheck = '' preCheck = ''
export HOME=/tmp
mkdir -p $HOME/test
export LIBRARY_PATH=${lib.makeLibraryPath checkInputs}:$LIBRARY_PATH export LIBRARY_PATH=${lib.makeLibraryPath checkInputs}:$LIBRARY_PATH
export PATH=${lib.makeBinPath checkInputs}:$PATH
''; '';
meta = with lib; { 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 { crystal_0_25 = generic {
version = "0.25.1"; version = "0.25.1";
sha256 = "15xmbkalsdk9qpc6wfpkly3sifgw6a4ai5jzlv78dh3jp7glmgyl"; sha256 = "15xmbkalsdk9qpc6wfpkly3sifgw6a4ai5jzlv78dh3jp7glmgyl";
@ -163,5 +192,12 @@ in rec {
binary = binaryCrystal_0_27; 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;
} }

View File

@ -2,13 +2,13 @@
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "shards-${version}"; name = "shards-${version}";
version = "0.8.1"; version = "0.9.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "crystal-lang"; owner = "crystal-lang";
repo = "shards"; repo = "shards";
rev = "v${version}"; rev = "v${version}";
sha256 = "1cjn2lafr08yiqzlhyqx14jjjxf1y24i2kk046px07gljpnlgqwk"; sha256 = "19q0xww4v0h5ln9gz8d8zv0c9ig761ik7gw8y31yxynzgzihwpf4";
}; };
buildInputs = [ crystal libyaml pcre which ]; buildInputs = [ crystal libyaml pcre which ];

View File

@ -1,9 +1,8 @@
{ stdenv, fetchFromGitHub, crystal, shards, which }: { stdenv, lib, fetchFromGitHub, crystal, shards, llvm, which }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "scry"; pname = "scry";
# 0.7.1 doesn't work with crystal > 0.25 version = "0.8.0";
version = "0.7.1.20180919";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "crystal-lang-tools"; owner = "crystal-lang-tools";
@ -12,7 +11,9 @@ stdenv.mkDerivation rec {
sha256 = "1yq7jap3y5pr2yqc6fn6bxshzwv7dz3w97incq7wpcvi7ibb4lcn"; 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 = '' buildPhase = ''
runHook preBuild runHook preBuild

View File

@ -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"

View File

@ -7192,6 +7192,8 @@ in
}) })
crystal_0_25 crystal_0_25
crystal_0_26 crystal_0_26
crystal_0_27
crystal_0_29
crystal; crystal;
icr = callPackage ../development/tools/icr {}; icr = callPackage ../development/tools/icr {};