From 802a8416b6f0b34afd2eec9d6249aa9763b9924d Mon Sep 17 00:00:00 2001 From: Theodore Ni <3806110+tjni@users.noreply.github.com> Date: Wed, 11 May 2022 02:33:57 -0500 Subject: [PATCH 1/2] bowtie: add arm64 patch to build on M1 Macs This does not fix the build on Macs, but it brings the build on M1 Macs to parity with non-M1 Macs. --- pkgs/applications/science/biology/bowtie/default.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/science/biology/bowtie/default.nix b/pkgs/applications/science/biology/bowtie/default.nix index 81cdaecf2c1..85c7756dbce 100644 --- a/pkgs/applications/science/biology/bowtie/default.nix +++ b/pkgs/applications/science/biology/bowtie/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchFromGitHub, zlib }: +{ lib, stdenv, fetchFromGitHub, fetchpatch, zlib }: stdenv.mkDerivation rec { pname = "bowtie"; @@ -11,6 +11,16 @@ stdenv.mkDerivation rec { sha256 = "sha256-mWItmrTMPst/NnzSpxxTHcBztDqHPCza9yOsZPwp7G4="; }; + patches = [ + # Without this patch, compiling with clang on an M1 Mac fails because + # 'cpuid.h' is included. It only works on x86 and throws an error. + (fetchpatch { + name = "fix_compilation_on_arm64"; + url = "https://github.com/BenLangmead/bowtie/commit/091d72f4cb69ca0713704d38bd7f9b37e6c4ff2d.patch"; + sha256 = "sha256-XBvgICUBnE5HKpJ36IHTDiKjJgLFKETsIaJC46uN+2I="; + }) + ]; + buildInputs = [ zlib ]; installFlags = [ "prefix=$(out)" ]; From 81046b393b404714d56d7bef275cdd28f7cfb044 Mon Sep 17 00:00:00 2001 From: Theodore Ni <3806110+tjni@users.noreply.github.com> Date: Wed, 11 May 2022 03:17:52 -0500 Subject: [PATCH 2/2] bowtie: fix build on case insensitive file systems Add a patch that removes the current source directory from the include search path during compilation so that #include does not end up picking the VERSION source code file. --- pkgs/applications/science/biology/bowtie/default.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkgs/applications/science/biology/bowtie/default.nix b/pkgs/applications/science/biology/bowtie/default.nix index 85c7756dbce..ccb797d8a22 100644 --- a/pkgs/applications/science/biology/bowtie/default.nix +++ b/pkgs/applications/science/biology/bowtie/default.nix @@ -19,6 +19,16 @@ stdenv.mkDerivation rec { url = "https://github.com/BenLangmead/bowtie/commit/091d72f4cb69ca0713704d38bd7f9b37e6c4ff2d.patch"; sha256 = "sha256-XBvgICUBnE5HKpJ36IHTDiKjJgLFKETsIaJC46uN+2I="; }) + + # Without this patch, compilation adds the current source directory to the + # include search path, and #include in standard library code can + # end up picking the unrelated VERSION source code file on case-insensitive + # file systems. + (fetchpatch { + name = "fix_include_search_path"; + url = "https://github.com/BenLangmead/bowtie/commit/c208b9db936eab0bc3ffdf0182b4f59a9017a1c4.patch"; + sha256 = "sha256-772EE+oWFWXssSMabPryb0AfIS1tC10mPTRCBm7RrUs="; + }) ]; buildInputs = [ zlib ];