diff --git a/lib/maintainers.nix b/lib/maintainers.nix index 437fb0744025..c7dbd3fb0dea 100644 --- a/lib/maintainers.nix +++ b/lib/maintainers.nix @@ -136,6 +136,7 @@ dancek = "Hannu Hartikainen "; danielfullmer = "Daniel Fullmer "; dasuxullebt = "Christoph-Simon Senjak "; + david50407 = "David Kuo "; davidak = "David Kleuker "; davidrusu = "David Rusu "; davorb = "Davor Babic "; diff --git a/pkgs/development/compilers/crystal/default.nix b/pkgs/development/compilers/crystal/default.nix index ae94a76ab237..6b817d06553e 100644 --- a/pkgs/development/compilers/crystal/default.nix +++ b/pkgs/development/compilers/crystal/default.nix @@ -1,81 +1,71 @@ -{ stdenv, fetchurl, boehmgc, libatomic_ops, pcre, libevent, libiconv, llvm_4, makeWrapper }: +{ stdenv, fetchurl, boehmgc, libatomic_ops, pcre, libevent, libiconv, llvm, makeWrapper }: stdenv.mkDerivation rec { - version = "0.23.0"; - name = "crystal-${version}-1"; - arch = - { - "x86_64-linux" = "linux-x86_64"; - "i686-linux" = "linux-i686"; - "x86_64-darwin" = "darwin-x86_64"; - }."${stdenv.system}" or (throw "system ${stdenv.system} not supported"); - - prebuiltBinary = fetchurl { - url = "https://github.com/crystal-lang/crystal/releases/download/${version}/crystal-${version}-1-${arch}.tar.gz"; - sha256 = - { - "x86_64-linux" = "0nhs7swbll8hrk15kmmywngkhij80x62axiskb1gjmiwvzhlh0qx"; - "i686-linux" = "03xp8d3lqflzzm26lpdn4yavj87qzgd6xyrqxp2pn9ybwrq8fx8a"; - "x86_64-darwin" = "1prz6c1gs8z7dgpdy2id2mjn1c8f5p2bf9b39985bav448njbyjz"; - }."${stdenv.system}" or (throw "system ${stdenv.system} not supported"); - }; + name = "crystal-${version}"; + version = "0.23.1"; src = fetchurl { url = "https://github.com/crystal-lang/crystal/archive/${version}.tar.gz"; - sha256 = "05ymwmjkl1b4m888p725kybpiap5ag2vj8l07d59j02inm5r0rcv"; + sha256 = "8cf1b9a4eab29fca2f779ea186ae18f7ce444ce189c621925fa1a0c61dd5ff55"; }; + prebuiltName = "crystal-0.23.0-1"; + prebuiltSrc = let arch = { + "x86_64-linux" = "linux-x86_64"; + "i686-linux" = "linux-i686"; + "x86_64-darwin" = "darwin-x86_64"; + }."${stdenv.system}" or (throw "system ${stdenv.system} not supported"); + in fetchurl { + url = "https://github.com/crystal-lang/crystal/releases/download/0.23.0/${prebuiltName}-${arch}.tar.gz"; + sha256 = { + "x86_64-linux" = "0nhs7swbll8hrk15kmmywngkhij80x62axiskb1gjmiwvzhlh0qx"; + "i686-linux" = "03xp8d3lqflzzm26lpdn4yavj87qzgd6xyrqxp2pn9ybwrq8fx8a"; + "x86_64-darwin" = "1prz6c1gs8z7dgpdy2id2mjn1c8f5p2bf9b39985bav448njbyjz"; + }."${stdenv.system}"; + }; + + srcs = [ src prebuiltSrc ]; + # crystal on Darwin needs libiconv to build - buildInputs = [ - boehmgc libatomic_ops pcre libevent llvm_4 makeWrapper + libs = [ + boehmgc libatomic_ops pcre libevent ] ++ stdenv.lib.optionals stdenv.isDarwin [ libiconv ]; - libPath = stdenv.lib.makeLibraryPath ([ - boehmgc libatomic_ops pcre libevent - ] ++ stdenv.lib.optionals stdenv.isDarwin [ - libiconv - ]); + nativeBuildInputs = [ makeWrapper ]; - unpackPhase = '' - tar zxf ${src} - tar zxf ${prebuiltBinary} - ''; + buildInputs = libs ++ [ llvm ]; - sourceRoot = "."; + libPath = stdenv.lib.makeLibraryPath libs; + + sourceRoot = "${name}"; fixPrebuiltBinary = if stdenv.isDarwin then '' - wrapProgram $(pwd)/crystal-${version}-1/embedded/bin/crystal \ + wrapProgram ../${prebuiltName}/embedded/bin/crystal \ --suffix DYLD_LIBRARY_PATH : $libPath '' else '' patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ - crystal-${version}-1/embedded/bin/crystal + ../${prebuiltName}/embedded/bin/crystal patchelf --set-rpath ${ stdenv.lib.makeLibraryPath [ stdenv.cc.cc ] } \ - crystal-${version}-1/embedded/bin/crystal + ../${prebuiltName}/embedded/bin/crystal ''; - buildPhase = '' - # patch the script which launches the prebuilt compiler - substituteInPlace $(pwd)/crystal-${version}-1/bin/crystal --replace \ - "/usr/bin/env bash" "${stdenv.shell}" - substituteInPlace $(pwd)/crystal-${version}/bin/crystal --replace \ - "/usr/bin/env bash" "${stdenv.shell}" - + preBuild = '' + patchShebangs bin/crystal + patchShebangs ../${prebuiltName}/bin/crystal ${fixPrebuiltBinary} - - cd crystal-${version} - make release=1 PATH="../crystal-${version}-1/bin:$PATH" - make doc + export PATH="$(pwd)/../${prebuiltName}/bin:$PATH" ''; + makeFlags = [ "CRYSTAL_CONFIG_VERSION=${version}" "release=1" "all" "doc" ]; + installPhase = '' install -Dm755 .build/crystal $out/bin/crystal wrapProgram $out/bin/crystal \ --suffix CRYSTAL_PATH : $out/lib/crystal \ --suffix LIBRARY_PATH : $libPath - install -dm755 $out/lib/crystal cp -r src/* $out/lib/crystal/ @@ -93,12 +83,13 @@ stdenv.mkDerivation rec { dontStrip = true; + enableParallelBuilding = true; + meta = { description = "A compiled language with Ruby like syntax and type inference"; homepage = https://crystal-lang.org/; license = stdenv.lib.licenses.asl20; - maintainers = with stdenv.lib.maintainers; [ sifmelcara ]; + maintainers = with stdenv.lib.maintainers; [ sifmelcara david50407 ]; platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" ]; }; } - diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 8affbe3996aa..b68458fb8477 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5410,7 +5410,9 @@ with pkgs; ''; }); - crystal = callPackage ../development/compilers/crystal { }; + crystal = callPackage ../development/compilers/crystal { + llvm = llvm_4; + }; devpi-client = callPackage ../development/tools/devpi-client {};