From 3111f21eec2fdc26cd3d1489d22aea8be3b84e49 Mon Sep 17 00:00:00 2001 From: "R. Ryantm" Date: Fri, 27 Feb 2026 12:35:11 +0000 Subject: [PATCH] kalign: 3.4.0 -> 3.5.1 --- .../ka/kalign/macos-openmp-config.patch | 46 +++++++++++++++++++ pkgs/by-name/ka/kalign/package.nix | 12 ++++- 2 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 pkgs/by-name/ka/kalign/macos-openmp-config.patch diff --git a/pkgs/by-name/ka/kalign/macos-openmp-config.patch b/pkgs/by-name/ka/kalign/macos-openmp-config.patch new file mode 100644 index 000000000000..c24f2cb4f0df --- /dev/null +++ b/pkgs/by-name/ka/kalign/macos-openmp-config.patch @@ -0,0 +1,46 @@ +From fb223fceeb81f481316694560ceacc473ad04b4a Mon Sep 17 00:00:00 2001 +From: natsukium +Date: Thu, 23 Apr 2026 16:46:54 +0900 +Subject: [PATCH] cmake: allow overriding hardcoded libomp path on macOS + +The OpenMP workaround hardcoded /opt/homebrew/opt/libomp, which locked +out a custom build. +Introduce LIBOMP_ROOT (defaulting to Homebrew) so the prefix can be +overridden on the cmake command line. + +While here, restrict the block to AppleClang. The flags inside are +AppleClang-specific (-Xpreprocessor -fopenmp, linking against the LLVM +libomp runtime) and were previously forced on any compiler targeting +Apple Silicon, silently breaking GCC and mis-configuring Homebrew LLVM +Clang builds. +--- + CMakeLists.txt | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5a7d3f0..d76453d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -75,15 +75,15 @@ set(KALIGN_KMEANS_UPGMA_THRESHOLD "50" CACHE STRING "Number of sequences thresho + + + if(USE_OPENMP) +- # Configure OpenMP for macOS with Homebrew (only for arm64 native builds) +- if(APPLE AND CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "arm64" AND NOT CMAKE_OSX_ARCHITECTURES MATCHES "x86_64") +- list(APPEND CMAKE_PREFIX_PATH /opt/homebrew) +- # Set OpenMP flags for Apple Clang + Homebrew libomp +- set(OpenMP_C_FLAGS "-Xpreprocessor -fopenmp -I/opt/homebrew/opt/libomp/include") ++ # Configure OpenMP for macOS with external libomp (only for Apple Clang on arm64 native builds) ++ if(APPLE AND CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "arm64" AND NOT CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" AND CMAKE_C_COMPILER_ID STREQUAL "AppleClang") ++ # Defaults to Homebrew ++ set(LIBOMP_ROOT "/opt/homebrew/opt/libomp" CACHE PATH "libomp install prefix") ++ set(OpenMP_C_FLAGS "-Xpreprocessor -fopenmp -I${LIBOMP_ROOT}/include") + set(OpenMP_C_LIB_NAMES "omp") +- set(OpenMP_CXX_FLAGS "-Xpreprocessor -fopenmp -I/opt/homebrew/opt/libomp/include") ++ set(OpenMP_CXX_FLAGS "-Xpreprocessor -fopenmp -I${LIBOMP_ROOT}/include") + set(OpenMP_CXX_LIB_NAMES "omp") +- set(OpenMP_omp_LIBRARY /opt/homebrew/opt/libomp/lib/libomp.dylib) ++ set(OpenMP_omp_LIBRARY "${LIBOMP_ROOT}/lib/libomp.dylib") + endif() + + find_package(OpenMP) diff --git a/pkgs/by-name/ka/kalign/package.nix b/pkgs/by-name/ka/kalign/package.nix index 86a75dd384ed..fc1d0818490d 100644 --- a/pkgs/by-name/ka/kalign/package.nix +++ b/pkgs/by-name/ka/kalign/package.nix @@ -11,15 +11,23 @@ stdenv.mkDerivation (finalAttrs: { pname = "kalign"; - version = "3.4.0"; + version = "3.5.1"; src = fetchFromGitHub { owner = "TimoLassmann"; repo = "kalign"; tag = "v${finalAttrs.version}"; - hash = "sha256-QcFNaCTqj6CFiOzQ6ezfBL0mu8PDU11hyNdkcsLOPzA="; + hash = "sha256-wcVzKedd8IFKql+TU4wJ4jEGDPdDfpyC5iGXrPYa0oY="; }; + patches = [ + # Allow overriding the hardcoded Homebrew libomp path on macOS and + # restrict the workaround to AppleClang so other compilers fall back + # to the standard OpenMP detection path. + # https://github.com/TimoLassmann/kalign/pull/65 + ./macos-openmp-config.patch + ]; + nativeBuildInputs = [ cmake ];