Commit 609f8e05 authored by Alex Hamilton's avatar Alex Hamilton
Browse files

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.
parent 930b24ae
Loading
Loading
Loading
Loading
+19 −9
Original line number Diff line number Diff line
{ lib, stdenv, fetchFromGitHub }:
{ lib, gccStdenv, fetchFromGitHub }:

stdenv.mkDerivation rec {
gccStdenv.mkDerivation rec {
  pname = "muscle";
  version = "5.1.0";


  src = fetchFromGitHub {
    owner = "rcedgar";
    repo = pname;
@@ -14,8 +13,19 @@ 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; {
+15 −0
Original line number Diff line number Diff line

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