git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #171469 from luispedro/static_bioinformatics
commit1bb17332abf7a782ed7fa3101fd7ba54dd239694 authorBen Siraphob <bensiraphob@gmail.com> dateWed 4 May 2022, 20:36 (5 years ago) parent0ab6bce596c5e7
4 files changed+31−3
pkgs/applications/science/biology/bwa/default.nix+2 pkgs/applications/science/biology/megahit/default.nix+3 pkgs/applications/science/biology/samtools/default.nix+8−1 pkgs/development/libraries/science/biology/htslib/default.nix+18−2
pkgs/applications/science/biology/bwa/default.nix+2
@@ -17,6 +17,8 @@ stdenv.mkDerivation rec {
1717 sed -i '/^CC/d' Makefile
1818 '';
1919
20+ makeFlags = lib.optional stdenv.hostPlatform.isStatic "AR=${stdenv.cc.targetPrefix}ar";
21+
2022 # it's unclear which headers are intended to be part of the public interface
2123 # so we may find ourselves having to add more here over time
2224 installPhase = ''
pkgs/applications/science/biology/megahit/default.nix+3
@@ -14,6 +14,9 @@ stdenv.mkDerivation rec {
1414 nativeBuildInputs = [ cmake ];
1515 buildInputs = [ zlib ];
1616
17+ cmakeFlags = lib.optional stdenv.hostPlatform.isStatic [
18+ "-DSTATIC_BUILD=ON"
19+ ];
1720 meta = with lib; {
1821 description = "An ultra-fast single-node solution for large and complex metagenomics assembly via succinct de Bruijn graph";
1922 license = licenses.gpl3;
pkgs/applications/science/biology/samtools/default.nix+8−1
@@ -22,8 +22,15 @@ stdenv.mkDerivation rec {
2222
2323 buildInputs = [ zlib ncurses htslib ];
2424
25+ preConfigure = lib.optional stdenv.hostPlatform.isStatic ''
26+ export LIBS="-lz -lbz2 -llzma"
27+ '';
28+ makeFlags = lib.optional stdenv.hostPlatform.isStatic "AR=${stdenv.cc.targetPrefix}ar";
29+
2530 configureFlags = [ "--with-htslib=${htslib}" ]
26− ++ lib.optional (ncurses == null) "--without-curses";
31+ ++ lib.optional (ncurses == null) "--without-curses"
32+ ++ lib.optional stdenv.hostPlatform.isStatic ["--without-curses" ]
33+ ;
2734
2835 preCheck = ''
2936 patchShebangs test/
pkgs/development/libraries/science/biology/htslib/default.nix+18−2
@@ -14,9 +14,25 @@ stdenv.mkDerivation rec {
1414
1515 buildInputs = [ zlib bzip2 xz curl ];
1616
17− configureFlags = [ "--enable-libcurl" ]; # optional but strongly recommended
17+ configureFlags = if ! stdenv.hostPlatform.isStatic
18+ then [ "--enable-libcurl" ] # optional but strongly recommended
19+ else [ "--disable-libcurl" "--disable-plugins" ];
1820
19− installFlags = [ "prefix=$(out)" ];
21+
22+ # In the case of static builds, we need to replace the build and install phases
23+ buildPhase = lib.optional stdenv.hostPlatform.isStatic ''
24+ make AR=$AR lib-static
25+ make LDFLAGS=-static bgzip htsfile tabix
26+ '';
27+
28+ installPhase = lib.optional stdenv.hostPlatform.isStatic ''
29+ install -d $out/bin
30+ install -d $out/lib
31+ install -d $out/include/htslib
32+ install -D libhts.a $out/lib
33+ install -m644 htslib/*h $out/include/htslib
34+ install -D bgzip htsfile tabix $out/bin
35+ '';
2036
2137 preCheck = ''
2238 patchShebangs test/