Merge pull request #131808 from Artturin/crystal-darwin-fix

Various crystal improvements
This commit is contained in:
Artturi 2021-09-28 01:26:40 +03:00 committed by GitHub
commit d0e4e9b474
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 37 additions and 85 deletions

View file

@ -1,10 +1,10 @@
{ lib
, fetchFromGitHub
, crystal_0_33
, crystal_1_0
}:
let
crystal = crystal_0_33;
crystal = crystal_1_0;
in crystal.buildCrystalPackage rec {
pname = "thicket";

View file

@ -2,7 +2,7 @@
ameba = {
owner = "veelenga";
repo = "ameba";
rev = "v0.10.0";
sha256 = "1yjxzwdhigsyjn0qp362jkj85qvg4dsyzal00pgr1srnh2xry912";
rev = "v0.14.3";
sha256 = "1cfr95xi6hsyxw1wlrh571hc775xhwmssk3k14i8b7dgbwfmm5x1";
};
}

View file

@ -10,7 +10,7 @@
, format ? "make"
, installManPages ? true
# Specify binaries to build in the form { foo.src = "src/foo.cr"; }
# The default `crystal build` options can be overridden with { foo.options = [ "--no-debug" ]; }
# The default `crystal build` options can be overridden with { foo.options = [ "--optionname" ]; }
, crystalBinaries ? { }
, ...
}@args:
@ -32,8 +32,7 @@ let
})
(import shardsFile));
# we previously had --no-debug here but that is not recommended by upstream
defaultOptions = [ "--release" "--progress" "--verbose" ];
defaultOptions = [ "--release" "--progress" "--verbose" "--no-debug" ];
buildDirectly = shardsFile == null || crystalBinaries != { };
@ -120,7 +119,7 @@ stdenv.mkDerivation (mkDerivationArgs // {
installCheckPhase = args.installCheckPhase or ''
for f in $out/bin/*; do
$f --help
$f --help > /dev/null
done
'';

View file

@ -56,6 +56,7 @@ let
buildCommand = ''
mkdir -p $out
tar --strip-components=1 -C $out -xf ${src}
patchShebangs $out/bin/crystal
'';
};
@ -93,6 +94,10 @@ let
outputs = [ "out" "lib" "bin" ];
postPatch = ''
export TMP=$(mktemp -d)
export HOME=$TMP
mkdir -p $HOME/test
# Add dependency of crystal to docs to avoid issue on flag changes between releases
# https://github.com/crystal-lang/crystal/pull/8792#issuecomment-614004782
substituteInPlace Makefile \
@ -103,39 +108,35 @@ let
ln -sf spec/compiler spec/std
# Dirty fix for when no sandboxing is enabled
rm -rf /tmp/crystal
mkdir -p /tmp/crystal
mkdir -p $TMP/crystal
substituteInPlace spec/std/file_spec.cr \
--replace '/bin/ls' '${coreutils}/bin/ls' \
--replace '/usr/share' '/tmp/crystal' \
--replace '/usr' '/tmp'
--replace '/usr/share' "$TMP/crystal" \
--replace '/usr' "$TMP" \
--replace '/tmp' "$TMP"
substituteInPlace spec/std/process_spec.cr \
--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/socket/tcp_server_spec.cr \
--replace '{% if flag?(:gnu) %}"listen: "{% else %}"bind: "{% end %}' '"bind: "'
--replace '/usr' "$TMP" \
--replace '/tmp' "$TMP"
substituteInPlace spec/std/system_spec.cr \
--replace '`hostname`' '`${hostname}/bin/hostname`'
# See https://github.com/crystal-lang/crystal/pull/8640
substituteInPlace spec/std/http/cookie_spec.cr \
--replace '01 Jan 2020' '01 Jan #{Time.utc.year + 2}'
# See https://github.com/crystal-lang/crystal/issues/8629
substituteInPlace spec/std/socket/udp_socket_spec.cr \
--replace 'it "joins and transmits to multicast groups"' 'pending "joins and transmits to multicast groups"'
'';
# See https://github.com/crystal-lang/crystal/pull/8699
substituteInPlace spec/std/xml/xml_spec.cr \
--replace 'it "handles errors"' 'pending "handles errors"'
# Defaults are 4
preBuild = ''
export CRYSTAL_WORKERS=$NIX_BUILD_CORES
export threads=$NIX_BUILD_CORES
export CRYSTAL_CACHE_DIR=$TMP
'';
buildInputs = commonBuildInputs extraBuildInputs;
@ -197,9 +198,6 @@ let
checkTarget = "compiler_spec";
preCheck = ''
export HOME=/tmp
mkdir -p $HOME/test
export LIBRARY_PATH=${lib.makeLibraryPath checkInputs}:$LIBRARY_PATH
export PATH=${lib.makeBinPath checkInputs}:$PATH
'';
@ -214,60 +212,26 @@ let
license = licenses.asl20;
maintainers = with maintainers; [ david50407 fabianhjr manveru peterhoeg ];
platforms = builtins.attrNames archs;
# Error running at_exit handler: Nil assertion failed
broken = lib.versions.minor version == "32" && stdenv.isDarwin;
broken = lib.versionOlder version "0.36.1" && stdenv.isDarwin;
};
})
);
in
rec {
binaryCrystal_0_31 = genericBinary {
version = "0.31.1";
binaryCrystal_0_36 = genericBinary {
version = "0.36.1";
sha256s = {
x86_64-linux = "0r8salf572xrnr4m6ll9q5hz6jj8q7ff1rljlhmqb1r26a8mi2ih";
i686-linux = "0hridnis5vvrswflx0q67xfg5hryhz6ivlwrb9n4pryj5d1gwjrr";
x86_64-darwin = "1dgxgv0s3swkc5cwawzgpbc6bcd2nx4hjxc7iw2h907y1vgmbipz";
x86_64-linux = "065vzq34g7hgzl2mrzy9gwwsfikc78nj7xxsbrk67r6rz0a7bk1q";
i686-linux = "18m4b1lnd682i5ygbg6cljqjny60nn2mlrzrk765h2ip6fljqbm1";
x86_64-darwin = "0xggayk92zh64pb5sz77n12hkcd1hg8kw90z7gb18594q551sf1v";
};
};
crystal_0_31 = generic {
version = "0.31.1";
sha256 = "1dswxa32w16gnc6yjym12xj7ibg0g6zk3ngvl76lwdjqb1h6lwz8";
doCheck = false; # 5 checks are failing now
binary = binaryCrystal_0_31;
};
crystal_0_32 = generic {
version = "0.32.1";
sha256 = "120ndi3nhh2r52hjvhwfb49cdggr1bzdq6b8xg7irzavhjinfza6";
binary = crystal_0_31;
};
crystal_0_33 = generic {
version = "0.33.0";
sha256 = "1zg0qixcws81s083wrh54hp83ng2pa8iyyafaha55mzrh8293jbi";
binary = crystal_0_32;
};
crystal_0_34 = generic {
version = "0.34.0";
sha256 = "110lfpxk9jnqyznbfnilys65ixj5sdmy8pvvnlhqhc3ccvrlnmq4";
binary = crystal_0_33;
};
crystal_0_35 = generic {
version = "0.35.1";
sha256 = "0p51bjl1nsvwsm64lqq421dcsxa201w7wwq8plw4r8wqarpq0g69";
binary = crystal_0_34;
# Needs git to build as per https://github.com/crystal-lang/crystal/issues/9789
extraBuildInputs = [ git ];
};
crystal_0_36 = generic {
version = "0.36.1";
sha256 = "sha256-5rjrvwZKM4lHpmxLyUVbi0Zw98xT+iJKonxwfUwS/Wk=";
binary = crystal_0_35;
binary = binaryCrystal_0_36;
};
crystal_1_0 = generic {

View file

@ -1,7 +1,6 @@
{ lib
, fetchFromGitHub
, crystal_0_34
, crystal_0_36
, crystal_1_0
}:
let
generic =
@ -36,18 +35,12 @@ let
in
rec {
# needed for anything that requires the old v1 shards format
shards_0_11 = generic {
version = "0.11.1";
sha256 = "05qnhc23xbmicdl4fwyxfpcvd8jq4inzh6v7jsjjw4n76vzb1f71";
crystal = crystal_0_34;
};
shards_0_14 = generic {
version = "0.14.1";
shards_0_15 = generic {
version = "0.15.0";
sha256 = "sha256-/C6whh5RbTBkFWqpn0GqyVe0opbrklm8xPv5MIG99VU=";
crystal = crystal_0_36;
crystal = crystal_1_0;
};
shards = shards_0_14;
shards = shards_0_15;
}

View file

@ -11120,9 +11120,6 @@ with pkgs;
inherit (callPackages ../development/compilers/crystal {
llvmPackages = llvmPackages_10;
})
crystal_0_33
crystal_0_34
crystal_0_35
crystal_0_36
crystal_1_0
crystal;
@ -14723,8 +14720,7 @@ with pkgs;
shallot = callPackage ../tools/misc/shallot { };
inherit (callPackage ../development/tools/build-managers/shards { })
shards_0_11
shards_0_14
shards_0_15
shards;
shellcheck = callPackage ../development/tools/shellcheck {};