about summary refs log tree commit diff
path: root/pkgs/development/compilers/crystal
diff options
context:
space:
mode:
authorWeijia Wang <9713184+wegank@users.noreply.github.com>2023-04-19 09:09:51 +0300
committerGitHub <noreply@github.com>2023-04-19 09:09:51 +0300
commitefa78c18f08a5e5b077d08b56efa1dcf4c52ead6 (patch)
tree54cec8c5823207386196b458cc676d9dc3578cc4 /pkgs/development/compilers/crystal
parent2fe0919eaf0b81e2db85441bdd220b117344314f (diff)
parent995ace105bdd80f650693bd34d1f74614cf15764 (diff)
Merge pull request #226932 from wegank/crystal-pcre
crystal: migrate to pcre2 on 1.8
Diffstat (limited to 'pkgs/development/compilers/crystal')
-rw-r--r--pkgs/development/compilers/crystal/build-package.nix4
-rw-r--r--pkgs/development/compilers/crystal/default.nix29
2 files changed, 16 insertions, 17 deletions
diff --git a/pkgs/development/compilers/crystal/build-package.nix b/pkgs/development/compilers/crystal/build-package.nix
index dea386b875b4c..e1ff7d08fb54b 100644
--- a/pkgs/development/compilers/crystal/build-package.nix
+++ b/pkgs/development/compilers/crystal/build-package.nix
@@ -1,6 +1,7 @@
 { stdenv
 , lib
 , crystal
+, pcre2
 , shards
 , git
 , pkg-config
@@ -90,7 +91,8 @@ stdenv.mkDerivation (mkDerivationArgs // {
 
   inherit enableParallelBuilding;
   strictDeps = true;
-  buildInputs = args.buildInputs or [ ] ++ [ crystal ];
+  buildInputs = args.buildInputs or [ ] ++ [ crystal ]
+    ++ lib.optional (lib.versionAtLeast crystal.version "1.8") pcre2;
 
   nativeBuildInputs = args.nativeBuildInputs or [ ] ++ [
     crystal
diff --git a/pkgs/development/compilers/crystal/default.nix b/pkgs/development/compilers/crystal/default.nix
index e51e1e27dd377..d35869b4a78a6 100644
--- a/pkgs/development/compilers/crystal/default.nix
+++ b/pkgs/development/compilers/crystal/default.nix
@@ -72,18 +72,6 @@ let
       meta.platforms = lib.attrNames sha256s;
     };
 
-  commonBuildInputs = extraBuildInputs: [
-    boehmgc
-    pcre
-    pcre2
-    libevent
-    libyaml
-    zlib
-    libxml2
-    openssl
-  ] ++ extraBuildInputs
-  ++ lib.optionals stdenv.isDarwin [ libiconv ];
-
   generic = (
     { version
     , sha256
@@ -92,7 +80,7 @@ let
     , extraBuildInputs ? [ ]
     , buildFlags ? [ "all" "docs" "release=1"]
     }:
-    lib.fix (compiler: stdenv.mkDerivation {
+    lib.fix (compiler: stdenv.mkDerivation (finalAttrs: {
       pname = "crystal";
       inherit buildFlags doCheck version;
 
@@ -172,7 +160,16 @@ let
 
       strictDeps = true;
       nativeBuildInputs = [ binary makeWrapper which pkg-config llvmPackages.llvm ];
-      buildInputs = commonBuildInputs extraBuildInputs;
+      buildInputs = [
+        boehmgc
+        (if lib.versionAtLeast version "1.8" then pcre2 else pcre)
+        libevent
+        libyaml
+        zlib
+        libxml2
+        openssl
+      ] ++ extraBuildInputs
+      ++ lib.optionals stdenv.isDarwin [ libiconv ];
 
       makeFlags = [
         "CRYSTAL_CONFIG_VERSION=${version}"
@@ -202,7 +199,7 @@ let
           --suffix PATH : ${lib.makeBinPath [ pkg-config llvmPackages.clang which ]} \
           --suffix CRYSTAL_PATH : lib:$lib/crystal \
           --suffix CRYSTAL_LIBRARY_PATH : ${
-            lib.makeLibraryPath (commonBuildInputs extraBuildInputs)
+            lib.makeLibraryPath finalAttrs.buildInputs
           }
         install -dm755 $lib/crystal
         cp -r src/* $lib/crystal/
@@ -248,7 +245,7 @@ let
         license = licenses.asl20;
         maintainers = with maintainers; [ david50407 manveru peterhoeg ];
       };
-    })
+    }))
   );
 
 in