11class Freebayes < Formula
22 desc "Bayesian haplotype-based genetic polymorphism discovery and genotyping"
33 homepage "https://github.com/freebayes/freebayes"
4+ # pull from git tag to get submodules
5+ url "https://github.com/freebayes/freebayes.git" ,
6+ tag : "v1.3.9" ,
7+ revision : "ab36d1f789c039ba872f5d911ce6ff09952dc329"
48 license "MIT"
59 head "https://github.com/freebayes/freebayes.git" , branch : "master"
610
7- stable do
8- # Use tarball and resources as workaround for https://github.com/freebayes/freebayes/pull/799
9- url "https://github.com/freebayes/freebayes/archive/refs/tags/v1.3.8.tar.gz"
10- sha256 "d1c24b1d1b35277e7403cd67063557998218a105c916b01a745e7704715fce67"
11-
12- depends_on "cmake" => :build
13- depends_on "pybind11" => :build
14- depends_on "simde" => :build
15-
16- on_macos do
17- depends_on "libomp" => :build
18- end
19-
20- resource "contrib/smithwaterman" do
21- url "https://github.com/ekg/smithwaterman/archive/2610e259611ae4cde8f03c72499d28f03f6d38a7.tar.gz"
22- sha256 "8e1b37ab0e8cd9d3d5cbfdba80258c0ebd0862749b531e213f44cdfe2fc541d8"
23- end
24-
25- resource "contrib/fastahack" do
26- url "https://github.com/ekg/fastahack/archive/bb332654766c2177d6ec07941fe43facf8483b1d.tar.gz"
27- sha256 "552a1b261ea90023de7048a27c53a425a1bc21c3fb172b3c8dc9f585f02f6c43"
28- end
29-
30- resource "contrib/multichoose" do
31- url "https://github.com/vcflib/multichoose/archive/255192edd49cfe36557f7f4f0d2d6ee1c702ffbb.tar.gz"
32- sha256 "0045051ee85d36435582151830efe0eefb466be0ec9aedbbc4465dca30d22102"
33- end
34-
35- resource "contrib/vcflib" do
36- url "https://github.com/vcflib/vcflib.git" ,
37- tag : "v1.0.10" ,
38- revision : "2ad261860807e66dbd9bcb07fee1af47b9930d70"
39- end
40- end
41-
4211 # The Git repository contains a few older tags that erroneously omit a
4312 # leading zero in the version (e.g., `v9.9.2` should have been `v0.9.9.2`)
4413 # and these would appear as the newest versions until the current version
@@ -50,48 +19,84 @@ class Freebayes < Formula
5019 end
5120
5221 bottle do
53- sha256 cellar : :any , arm64_sequoia : "42919ea368e7fb300680e17b7eb783e61eaa251c8b1492d2eba3e9db068bf3e8 "
54- sha256 cellar : :any , arm64_sonoma : "c367f0574466d1c538750aeed89d68b2066280be424fbfdd8f33f92ae6f3e538 "
55- sha256 cellar : :any , arm64_ventura : "58b47ea65fc8b8fd2bcedad4b67e9edb1f41781679ddbd2f2d7d214a1e3eaabc "
56- sha256 cellar : :any , sonoma : "d6c0009f7ed19acbfe3d93a83fe4a1ec6d1c21867f67ad037bfda62c56394122 "
57- sha256 cellar : :any , ventura : "b2631095db533474d1e6ce81dc00412cbf2c378bcd9cec40959b029aa8e9a8f4 "
58- sha256 x86_64_linux : "056ef004633b4ad83902199054e990313f0e2654455ebe17f822b28d5a7add9a "
22+ sha256 cellar : :any , arm64_sequoia : "33af05be5ee1447351c87cc4619116ce170e8859ff0533c070f346fb2f6eca8b "
23+ sha256 cellar : :any , arm64_sonoma : "315f293a526bef59d1c63f8f4f4fb27783852f19dfaa20218131d4604523a22f "
24+ sha256 cellar : :any , arm64_ventura : "c29719f1990607011ef77722f0059255652d721641ba57ffa1fc1d7effed0bdc "
25+ sha256 cellar : :any , sonoma : "7d68eca383a04fae9434a48205c7548bb02a6ec9e1f511645e69c33959e35a4e "
26+ sha256 cellar : :any , ventura : "2b5efeb60159a49524d33c803581815a4005afe972a4c3cb102d04ce91b7120e "
27+ sha256 x86_64_linux : "8b76cc3e3db9575510c456b74286a1f5732e5495b3c1232311a2c0c220fc7e0f "
5928 end
6029
30+ depends_on "cmake" => :build # for vcflib
6131 depends_on "meson" => :build
6232 depends_on "ninja" => :build
6333 depends_on "pkgconf" => :build
34+ depends_on "pybind11" => :build # for vcflib
35+ depends_on "simde" => :build
36+ depends_on "wfa2-lib" => :build # for vcflib
37+ depends_on "xz" => :build # for vcflib
6438 depends_on "htslib"
65- depends_on "xz"
6639
67- uses_from_macos "zlib"
40+ uses_from_macos "bzip2" => :build # for vcflib
41+ uses_from_macos "zlib" => :build # for vcflib
42+
43+ on_macos do
44+ depends_on "libomp" => :build # for vcflib
45+ end
46+
47+ resource "vcflib" do
48+ url "https://github.com/vcflib/vcflib/releases/download/v1.0.12/vcflib-1.0.12-src.tar.gz"
49+ sha256 "cb1e78d675f06ae3b22ffed7e1dea317e4c7f826e51e5b5dabd80240efbe1019"
50+
51+ # Backport fix for using external `wfa2-lib`
52+ patch do
53+ url "https://github.com/vcflib/vcflib/commit/5e4edec2fba5d5a51dae7a9fe48d0252ade53857.patch?full_index=1"
54+ sha256 "e7d6d433d837dd823916ef91fe0165bf4ba4f05c52fd4c9517aef7f80653a2a8"
55+ end
56+
57+ # Apply open PR to help find `wfa2-lib` include directory
58+ # PR ref: https://github.com/vcflib/vcflib/pull/413
59+ patch do
60+ url "https://github.com/vcflib/vcflib/commit/9f9237ff0e6b4887f0edfc88587957aa736ced7b.patch?full_index=1"
61+ sha256 "bede43d22b4b47141cd90edc4df90f65b9ac41e9598c2b05b2fe7fa84ea51aa8"
62+ end
63+ end
64+
65+ # Apply open PR to help Meson locate vcflib and wfa2 libraries
66+ # PR ref: https://github.com/freebayes/freebayes/pull/822
67+ patch do
68+ url "https://github.com/freebayes/freebayes/commit/b458396e1acbad3983c70c202a6db2b3711a8eac.patch?full_index=1"
69+ sha256 "b5c7d855d4d66c6c96dada307e82ccbf0b6904a25928c4f3e163f52e178b7907"
70+ end
71+
72+ # Apply open PR to fix build when using git submodules
73+ # PR ref: https://github.com/freebayes/freebayes/pull/823
74+ patch do
75+ url "https://github.com/freebayes/freebayes/commit/35eeacb6468fdce25233a33f7216f4e776d381f9.patch?full_index=1"
76+ sha256 "1b6f0bb1e369a4b11e9a7754f3b789035b39cc5d9e3dbbac84fde21893f0d9be"
77+ end
6878
6979 def install
70- if build . stable?
71- resources . each { | r | ( buildpath / r . name ) . install r }
80+ resource ( "vcflib" ) . stage do
81+ rm_r ( [ "contrib/WFA2-lib" , "contrib/tabixpp/htslib" ] ) # avoid bundled libraries
7282
73- system "cmake" , "-S" , "contrib/vcflib " , "-B" , "build_vcflib " ,
83+ system "cmake" , "-S" , ". " , "-B" , "build " ,
7484 "-DBUILD_DOC=OFF" ,
7585 "-DBUILD_ONLY_LIB=ON" ,
7686 "-DZIG=OFF" ,
7787 *std_cmake_args ( install_prefix : buildpath /"vendor" )
78- system "cmake" , "--build" , "build_vcflib"
79- system "cmake" , "--install" , "build_vcflib"
88+ system "cmake" , "--build" , "build"
89+ system "cmake" , "--install" , "build"
90+ system "make" , "-C" , "contrib/intervaltree" , "install" , "DESTDIR=" , "PREFIX=#{ buildpath } /vendor"
91+ ( buildpath /"vendor/include" ) . install "contrib/tabixpp/tabix.hpp"
8092
81- # libvcflib.a is installed into CMAKE_INSTALL_BINDIR
82- ( buildpath /"vendor/bin" ) . install "build_vcflib/contrib/WFA2-lib/libwfa2.a"
83- inreplace "meson.build" do |s |
84- s . sub! "find_library('libvcflib'" , "\\ 0, dirs: ['#{ buildpath } /vendor/bin']"
85- s . sub! "find_library('libwfa2'" , "\\ 0, dirs: ['#{ buildpath } /vendor/bin']"
86- end
93+ ENV . append_path "LIBRARY_PATH" , buildpath /"vendor/bin"
8794 ENV . append_to_cflags "-I#{ buildpath } /vendor/include"
95+ ENV . append_to_cflags "-I#{ buildpath } /vendor/include/vcflib"
8896 end
8997
90- # Workaround for ../src/BedReader.h:12:10: fatal error: 'IntervalTree.h' file not found
91- # Issue ref: https://github.com/freebayes/freebayes/issues/803
92- ENV . append_to_cflags "-I#{ buildpath } /contrib/SeqLib/SeqLib"
93-
94- system "meson" , "setup" , "build" , "-Dcpp_std=c++14" , *std_meson_args
98+ # Set prefer_system_deps=false as we don't have formulae for these and some are not versioned/tagged
99+ system "meson" , "setup" , "build" , "-Dcpp_std=c++14" , "-Dprefer_system_deps=false" , *std_meson_args
95100 system "meson" , "compile" , "-C" , "build" , "--verbose"
96101 system "meson" , "install" , "-C" , "build"
97102 pkgshare . install "test"
0 commit comments