From 609f8e0590dfe0114ad2139cc331c3e870fefaa9 Mon Sep 17 00:00:00 2001 From: Alex Hamilton <1622250+Aehmlo@users.noreply.github.com> Date: Fri, 21 Jun 2024 11:10:14 -0400 Subject: [PATCH] muscle: compile with GCC for Darwin This revision updates pkgs.muscle to compile with GCC (gccStdenv instead of stdenv). This works around issues with OpenMP in the Darwin version of LLVM. The upstream Makefile assumes that we're compiling with Homebrew or similar and uses g++-11 instead of g++, so this revision also introduces a patch to remove this behavior, allowing the package to compile on Darwin without issue. --- .../science/biology/muscle/default.nix | 28 +++++++++++++------ .../biology/muscle/muscle-darwin-g++.patch | 15 ++++++++++ 2 files changed, 34 insertions(+), 9 deletions(-) create mode 100644 pkgs/applications/science/biology/muscle/muscle-darwin-g++.patch diff --git a/pkgs/applications/science/biology/muscle/default.nix b/pkgs/applications/science/biology/muscle/default.nix index cdcf6c7b50aa..86067538b13c 100644 --- a/pkgs/applications/science/biology/muscle/default.nix +++ b/pkgs/applications/science/biology/muscle/default.nix @@ -1,10 +1,9 @@ -{ lib, stdenv, fetchFromGitHub }: +{ lib, gccStdenv, fetchFromGitHub }: -stdenv.mkDerivation rec { - pname = "muscle"; +gccStdenv.mkDerivation rec { + pname = "muscle"; version = "5.1.0"; - src = fetchFromGitHub { owner = "rcedgar"; repo = pname; @@ -14,15 +13,26 @@ stdenv.mkDerivation rec { sourceRoot = "${src.name}/src"; - installPhase = '' - install -m755 -D Linux/muscle $out/bin/muscle - ''; + patches = [ + ./muscle-darwin-g++.patch + ]; + + installPhase = + let + target = + if gccStdenv.isDarwin + then "Darwin" + else "Linux"; + in + '' + install -m755 -D ${target}/muscle $out/bin/muscle + ''; meta = with lib; { description = "Multiple sequence alignment with top benchmark scores scalable to thousands of sequences"; mainProgram = "muscle"; - license = licenses.gpl3Plus; - homepage = "https://www.drive5.com/muscle/"; + license = licenses.gpl3Plus; + homepage = "https://www.drive5.com/muscle/"; maintainers = with maintainers; [ unode thyol ]; }; } diff --git a/pkgs/applications/science/biology/muscle/muscle-darwin-g++.patch b/pkgs/applications/science/biology/muscle/muscle-darwin-g++.patch new file mode 100644 index 000000000000..41e5fc7ae476 --- /dev/null +++ b/pkgs/applications/science/biology/muscle/muscle-darwin-g++.patch @@ -0,0 +1,15 @@ + +diff --git a/Makefile b/Makefile +index df16673..be3bd0d 100644 +--- a/Makefile ++++ b/Makefile +@@ -20,9 +20,6 @@ OS := $(shell uname) + CPPFLAGS := $(CPPFLAGS) -DNDEBUG -pthread + + CXX := g++ +-ifeq ($(OS),Darwin) +- CXX := g++-11 +-endif + + CXXFLAGS := $(CXXFLAGS) -O3 -fopenmp -ffast-math +