about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/hyperscan
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-10-20 22:09:03 +0000
committerAlyssa Ross <hi@alyssa.is>2023-10-20 22:09:03 +0000
commit50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e (patch)
treef2556b911180125ccbb7ed0e78a54e92da89adce /nixpkgs/pkgs/development/libraries/hyperscan
parent4c16d4548a98563c9d9ad76f4e5b2202864ccd54 (diff)
parentcfc75eec4603c06503ae750f88cf397e00796ea8 (diff)
downloadnixlib-50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e.tar
nixlib-50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e.tar.gz
nixlib-50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e.tar.bz2
nixlib-50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e.tar.lz
nixlib-50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e.tar.xz
nixlib-50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e.tar.zst
nixlib-50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e.zip
Merge commit 'cfc75eec4603c06503ae750f88cf397e00796ea8'
Conflicts:
	nixpkgs/pkgs/build-support/rust/build-rust-package/default.nix
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/hyperscan')
-rw-r--r--nixpkgs/pkgs/development/libraries/hyperscan/default.nix31
1 files changed, 21 insertions, 10 deletions
diff --git a/nixpkgs/pkgs/development/libraries/hyperscan/default.nix b/nixpkgs/pkgs/development/libraries/hyperscan/default.nix
index 2bfde78f7dbc..0b9765dac4cf 100644
--- a/nixpkgs/pkgs/development/libraries/hyperscan/default.nix
+++ b/nixpkgs/pkgs/development/libraries/hyperscan/default.nix
@@ -1,14 +1,16 @@
-{ lib, stdenv, fetchFromGitHub, cmake, ragel, python3
-, util-linux, fetchpatch
+{ lib
+, stdenv
+, fetchFromGitHub
+, cmake
+, ragel
+, python3
+, util-linux
+, pkg-config
 , boost
+, pcre
 , withStatic ? false # build only shared libs by default, build static+shared if true
 }:
 
-# NOTICE: pkg-config, pcap and pcre intentionally omitted from build inputs
-#         pcap used only in examples, pkg-config used only to check for pcre
-#         which is fixed 8.41 version requirement (nixpkgs have 8.42+, and
-#         I not see any reason (for now) to backport 8.41.
-
 stdenv.mkDerivation (finalAttrs: {
   pname = "hyperscan";
   version = "5.4.2";
@@ -24,16 +26,24 @@ stdenv.mkDerivation (finalAttrs: {
 
   buildInputs = [ boost ];
   nativeBuildInputs = [
-    cmake ragel python3 util-linux
+    cmake ragel python3 util-linux pkg-config
   ];
 
   cmakeFlags = [
-    "-DFAT_RUNTIME=ON"
     "-DBUILD_AVX512=ON"
   ]
+  ++ lib.optional (!stdenv.isDarwin) "-DFAT_RUNTIME=ON"
   ++ lib.optional (withStatic) "-DBUILD_STATIC_AND_SHARED=ON"
   ++ lib.optional (!withStatic) "-DBUILD_SHARED_LIBS=ON";
 
+  # hyperscan CMake is completely broken for chimera builds when pcre is compiled
+  # the only option to make it build - building from source
+  # In case pcre is built from source, chimera build is turned on by default
+  preConfigure = lib.optional withStatic ''
+    mkdir -p pcre
+    tar xvf ${pcre.src} --strip-components 1 -C pcre
+  '';
+
   postPatch = ''
     sed -i '/examples/d' CMakeLists.txt
     substituteInPlace libhs.pc.in \
@@ -46,6 +56,7 @@ stdenv.mkDerivation (finalAttrs: {
     runHook preCheck
 
     bin/unit-hyperscan
+    ${lib.optionalString withStatic ''bin/unit-chimera''}
 
     runHook postCheck
   '';
@@ -67,7 +78,7 @@ stdenv.mkDerivation (finalAttrs: {
 
     homepage = "https://www.hyperscan.io/";
     maintainers = with maintainers; [ avnik ];
-    platforms = [ "x86_64-linux" ];
+    platforms = [ "x86_64-linux" "x86_64-darwin" ];
     license = licenses.bsd3;
   };
 })