From e907ff51949d9c5f935bbf05c8e15873276e4092 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sun, 26 Oct 2025 19:58:55 +0000 Subject: [PATCH 1/4] hyperscan: cleanup --- pkgs/by-name/hy/hyperscan/package.nix | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/pkgs/by-name/hy/hyperscan/package.nix b/pkgs/by-name/hy/hyperscan/package.nix index faf7de95740b..b0e738faac9c 100644 --- a/pkgs/by-name/hy/hyperscan/package.nix +++ b/pkgs/by-name/hy/hyperscan/package.nix @@ -19,8 +19,8 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "intel"; repo = "hyperscan"; + tag = "v${finalAttrs.version}"; hash = "sha256-tzmVc6kJPzkFQLUM1MttQRLpgs0uckbV6rCxEZwk1yk="; - rev = "v${finalAttrs.version}"; }; outputs = [ @@ -38,16 +38,22 @@ stdenv.mkDerivation (finalAttrs: { ]; cmakeFlags = [ - "-DBUILD_AVX512=ON" + (lib.cmakeBool "BUILD_AVX512" true) ] - ++ lib.optional (!stdenv.hostPlatform.isDarwin) "-DFAT_RUNTIME=ON" - ++ lib.optional withStatic "-DBUILD_STATIC_AND_SHARED=ON" - ++ lib.optional (!withStatic) "-DBUILD_SHARED_LIBS=ON"; + ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ + (lib.cmakeBool "FAT_RUNTIME" true) + ] + ++ lib.optionals withStatic [ + (lib.cmakeBool "BUILD_STATIC_AND_SHARED" true) + ] + ++ lib.optionals (!withStatic) [ + (lib.cmakeBool "BUILD_SHARED_LIBS" true) + ]; # 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 '' + preConfigure = lib.optionalString withStatic '' mkdir -p pcre tar xvf ${pcre.src} --strip-components 1 -C pcre ''; @@ -75,7 +81,7 @@ stdenv.mkDerivation (finalAttrs: { runHook postCheck ''; - meta = with lib; { + meta = { description = "High-performance multiple regex matching library"; longDescription = '' Hyperscan is a high-performance multiple regex matching library. @@ -91,11 +97,11 @@ stdenv.mkDerivation (finalAttrs: { ''; homepage = "https://www.hyperscan.io/"; - maintainers = with maintainers; [ avnik ]; + maintainers = with lib.maintainers; [ avnik ]; platforms = [ "x86_64-linux" "x86_64-darwin" ]; - license = licenses.bsd3; + license = lib.licenses.bsd3; }; }) From f1f83023b394c31f7d624c920409a7b6452eb6c8 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sun, 26 Oct 2025 19:59:13 +0000 Subject: [PATCH 2/4] hyperscan: fix CMake 4 compatibility Tracking: https://github.com/NixOS/nixpkgs/issues/445447 --- pkgs/by-name/hy/hyperscan/package.nix | 54 ++++++++++++++++++--------- 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/pkgs/by-name/hy/hyperscan/package.nix b/pkgs/by-name/hy/hyperscan/package.nix index b0e738faac9c..9ae6121fc8f7 100644 --- a/pkgs/by-name/hy/hyperscan/package.nix +++ b/pkgs/by-name/hy/hyperscan/package.nix @@ -28,6 +28,28 @@ stdenv.mkDerivation (finalAttrs: { "dev" ]; + postPatch = '' + sed -i '/examples/d' CMakeLists.txt + substituteInPlace libhs.pc.in \ + --replace-fail "libdir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@" "libdir=@CMAKE_INSTALL_LIBDIR@" \ + --replace-fail "includedir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@" "includedir=@CMAKE_INSTALL_INCLUDEDIR@" + + substituteInPlace cmake/pcre.cmake --replace-fail 'CHECK_C_SOURCE_COMPILES("#include + #if PCRE_MAJOR != ''${PCRE_REQUIRED_MAJOR_VERSION} || PCRE_MINOR < ''${PCRE_REQUIRED_MINOR_VERSION} + #error Incorrect pcre version + #endif + main() {}" CORRECT_PCRE_VERSION)' 'set(CORRECT_PCRE_VERSION TRUE)' + '' + # CMake 4 dropped support of versions lower than 3.5, + # versions lower than 3.10 are deprecated. + # https://github.com/NixOS/nixpkgs/issues/445447 + + '' + substituteInPlace CMakeLists.txt \ + --replace-fail \ + "cmake_minimum_required (VERSION 2.8.11)" \ + "cmake_minimum_required (VERSION 3.10)" \ + ''; + buildInputs = [ boost ]; nativeBuildInputs = [ cmake @@ -53,23 +75,21 @@ stdenv.mkDerivation (finalAttrs: { # 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.optionalString withStatic '' - mkdir -p pcre - tar xvf ${pcre.src} --strip-components 1 -C pcre - ''; - - postPatch = '' - sed -i '/examples/d' CMakeLists.txt - substituteInPlace libhs.pc.in \ - --replace-fail "libdir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@" "libdir=@CMAKE_INSTALL_LIBDIR@" \ - --replace-fail "includedir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@" "includedir=@CMAKE_INSTALL_INCLUDEDIR@" - - substituteInPlace cmake/pcre.cmake --replace-fail 'CHECK_C_SOURCE_COMPILES("#include - #if PCRE_MAJOR != ''${PCRE_REQUIRED_MAJOR_VERSION} || PCRE_MINOR < ''${PCRE_REQUIRED_MINOR_VERSION} - #error Incorrect pcre version - #endif - main() {}" CORRECT_PCRE_VERSION)' 'set(CORRECT_PCRE_VERSION TRUE)' - ''; + preConfigure = lib.optionalString withStatic ( + '' + mkdir -p pcre + tar xvf ${pcre.src} --strip-components 1 -C pcre + '' + # CMake 4 dropped support of versions lower than 3.5, + # versions lower than 3.10 are deprecated. + # https://github.com/NixOS/nixpkgs/issues/445447 + + '' + substituteInPlace pcre/CMakeLists.txt \ + --replace-fail \ + "CMAKE_MINIMUM_REQUIRED(VERSION 2.8.5)" \ + "CMAKE_MINIMUM_REQUIRED(VERSION 3.10)" \ + '' + ); doCheck = true; checkPhase = '' From bc84b2e65e59d4981eb174852d440399f8f066f4 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sun, 26 Oct 2025 21:54:31 +0000 Subject: [PATCH 3/4] python3Packages.hyperscan: cleanup --- pkgs/development/python-modules/hyperscan/default.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/development/python-modules/hyperscan/default.nix b/pkgs/development/python-modules/hyperscan/default.nix index 5a38fe5c58ca..3622fa465f1b 100644 --- a/pkgs/development/python-modules/hyperscan/default.nix +++ b/pkgs/development/python-modules/hyperscan/default.nix @@ -37,7 +37,7 @@ buildPythonPackage rec { dontUseCmakeConfigure = true; - nativeBuildInputs = [ + build-system = [ cmake pathspec ninja @@ -53,7 +53,7 @@ buildPythonPackage rec { pytest-mock ]; - meta = with lib; { + meta = { description = "CPython extension for the Hyperscan regular expression matching library"; homepage = "https://github.com/darvid/python-hyperscan"; changelog = "https://github.com/darvid/python-hyperscan/blob/${src.tag}/CHANGELOG.md"; @@ -61,7 +61,7 @@ buildPythonPackage rec { "x86_64-linux" "x86_64-darwin" ]; - license = licenses.mit; - maintainers = with maintainers; [ mbalatsko ]; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ mbalatsko ]; }; } From 5e6d48156f1de18709d1903b33d9f4c74b9ddc66 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Mon, 27 Oct 2025 14:20:11 +0000 Subject: [PATCH 4/4] hyperscan: fix build with withStatic enabled --- pkgs/by-name/hy/hyperscan/package.nix | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/hy/hyperscan/package.nix b/pkgs/by-name/hy/hyperscan/package.nix index 9ae6121fc8f7..730cd4c4c459 100644 --- a/pkgs/by-name/hy/hyperscan/package.nix +++ b/pkgs/by-name/hy/hyperscan/package.nix @@ -80,14 +80,23 @@ stdenv.mkDerivation (finalAttrs: { mkdir -p pcre tar xvf ${pcre.src} --strip-components 1 -C pcre '' - # CMake 4 dropped support of versions lower than 3.5, - # versions lower than 3.10 are deprecated. - # https://github.com/NixOS/nixpkgs/issues/445447 + # - CMake 4 dropped support of versions lower than 3.5, versions lower than 3.10 are deprecated. + # https://github.com/NixOS/nixpkgs/issues/445447 + # - CMake Error at pcre/CMakeLists.txt:843 (GET_TARGET_PROPERTY): + # The LOCATION property may not be read from target "pcretest". Use the + # target name directly with add_custom_command, or use the generator + # expression $, as appropriate. + '' substituteInPlace pcre/CMakeLists.txt \ --replace-fail \ "CMAKE_MINIMUM_REQUIRED(VERSION 2.8.5)" \ "CMAKE_MINIMUM_REQUIRED(VERSION 3.10)" \ + --replace-fail \ + "CMAKE_POLICY(SET CMP0026 OLD)" \ + "CMAKE_POLICY(SET CMP0026 NEW)" \ + --replace-fail \ + "GET_TARGET_PROPERTY(PCRETEST_EXE pcretest DEBUG_LOCATION)" \ + "set(PCRETEST_EXE $)" '' );