From b4149c74ef0165b8555bb5a76324176b21db0876 Mon Sep 17 00:00:00 2001 From: Joshua Zhuang <71105179+mencian@users.noreply.github.com> Date: Tue, 12 Nov 2024 16:35:15 -0600 Subject: [PATCH] bayestyper: add arm64/aarch64 builds (#52076) * bayestyper: add arm64/aarch64 builds * remove from blacklist * Update build.sh * Update bayestyper.patch --- build-fail-blacklist | 1 - recipes/bayestyper/0001-CMakeLists.patch | 45 ++++++++++++++++++++++++ recipes/bayestyper/bayestyper.patch | 28 +++++++++++++++ recipes/bayestyper/build.sh | 30 ++++++++++++---- recipes/bayestyper/kmer_defs.patch | 18 ++++++++++ recipes/bayestyper/meta.yaml | 35 ++++++++++++------ recipes/bayestyper/stdafx.patch | 10 ++++++ 7 files changed, 150 insertions(+), 17 deletions(-) create mode 100644 recipes/bayestyper/0001-CMakeLists.patch create mode 100644 recipes/bayestyper/bayestyper.patch create mode 100644 recipes/bayestyper/kmer_defs.patch create mode 100644 recipes/bayestyper/stdafx.patch diff --git a/build-fail-blacklist b/build-fail-blacklist index eb572aa005ebc..c679e4d7a8eee 100644 --- a/build-fail-blacklist +++ b/build-fail-blacklist @@ -220,7 +220,6 @@ recipes/unitig-counter recipes/probcons recipes/spydrpick recipes/bctools -recipes/bayestyper recipes/group_humann2_uniref_abundances_to_go recipes/isonclust2 recipes/sibelia diff --git a/recipes/bayestyper/0001-CMakeLists.patch b/recipes/bayestyper/0001-CMakeLists.patch new file mode 100644 index 0000000000000..6e80f38569139 --- /dev/null +++ b/recipes/bayestyper/0001-CMakeLists.patch @@ -0,0 +1,45 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6bc8406..3a9a766 100755 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -42,9 +42,39 @@ else(${BUILD_STATIC} EQUAL 0) + endif(${BUILD_STATIC} EQUAL 0) + + +-FIND_PACKAGE(Boost COMPONENTS iostreams program_options system filesystem serialization REQUIRED) ++# When user specifies boost paths to use, we need to disable searching from the ++# environment and from using cmake's internal boost variables. ++if (BOOST_ROOT OR BOOST_INCLUDEDIR OR BOOST_LIBRARYDIR OR DEFINED ENV{BOOST_ROOT} OR DEFINED ENV{BOOST_INCLUDEDIR} OR DEFINED ENV{BOOST_LIBRARYDIR}) ++ # Don't search for system include dirs for boost ++ set(Boost_NO_SYSTEM_PATHS ON) ++ # Disable excessive warning messages when using multiple boost versions ++ set(Boost_NO_WARN_NEW_VERSION ON) ++endif() ++ ++# Use the OLD way of looking for Boost ++# The NEW way only respects BOOST_ROOT, not these more-specific variables. ++if (BOOST_INCLUDEDIR OR BOOST_LIBRARYDIR OR DEFINED ENV{BOOST_INCLUDEDIR} OR DEFINED ENV{BOOST_LIBRARYDIR}) ++ # Ignore cmake boost variables ++ set(Boost_NO_BOOST_CMAKE ON) ++endif() ++ ++set( Boost_USE_STATIC_LIBS OFF ) ++set( Boost_USE_MULTITHREADED TRUE ) ++set( Boost_DEBUG ON ) ++ ++find_package(Boost 1.71.0 COMPONENTS iostreams program_options system filesystem serialization REQUIRED) + message(STATUS ${Boost_LIBRARIES}) + ++if(Boost_FOUND) ++ include_directories(${Boost_INCLUDE_DIRS}) ++ LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) ++endif() ++ ++MESSAGE("Boost configuration results:") ++MESSAGE(" Boost_INCLUDE_DIRS: ${Boost_INCLUDE_DIR}") ++MESSAGE(" Boost_LIBRARY_DIRS: ${Boost_LIBRARY_DIRS}") ++MESSAGE(" Boost_LIBRARIES: ${Boost_LIBRARIES}") ++ + add_subdirectory(${CMAKE_SOURCE_DIR}/external/kmc_api) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/vcf++) + add_subdirectory(${CMAKE_SOURCE_DIR}/src/kmerBloom) diff --git a/recipes/bayestyper/bayestyper.patch b/recipes/bayestyper/bayestyper.patch new file mode 100644 index 0000000000000..58c2be00de657 --- /dev/null +++ b/recipes/bayestyper/bayestyper.patch @@ -0,0 +1,28 @@ +diff --git i/include/vcf++/VcfFile.hpp w/include/vcf++/VcfFile.hpp +index 4a2f69e..aaf49be 100644 +--- i/include/vcf++/VcfFile.hpp ++++ w/include/vcf++/VcfFile.hpp +@@ -35,8 +35,8 @@ THE SOFTWARE. + #include + #include + +-#include "boost/iostreams/filtering_stream.hpp" +-#include "boost/iostreams/filter/gzip.hpp" ++#include ++#include + + #include "Variant.hpp" + #include "VcfMetaData.hpp" +diff --git i/src/vcf++/CMakeLists.txt w/src/vcf++/CMakeLists.txt +index c8a6142..beddd90 100755 +--- i/src/vcf++/CMakeLists.txt ++++ w/src/vcf++/CMakeLists.txt +@@ -3,6 +3,8 @@ project(vcf++) + SET(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/lib) + + include_directories(${CMAKE_SOURCE_DIR}/include/vcf++ ${Boost_INCLUDE_DIRS}) ++message(STATUS "====== DEBUG Boost_INCLUDE_DIRS: " ${Boost_INCLUDE_DIRS}) ++message(STATUS "====== DEBUG Boost_LIB_DIRS: " ${Boost_LIB_DIRS}) + link_directories(${Boost_LIB_DIRS}) + + add_library(${PROJECT_NAME} VcfFile.cpp Variant.cpp Allele.cpp VcfMetaData.cpp AttributeSet.cpp Sample.cpp Utils.cpp Attribute.cpp JoiningString.cpp Stats.cpp AttributeFilter.cpp SampleAlleleAttributeFilter.cpp FastaReader.cpp FastaRecord.cpp Auxiliaries.cpp Trio.cpp Contig.cpp Regions.cpp) diff --git a/recipes/bayestyper/build.sh b/recipes/bayestyper/build.sh index ceeea5f2b87b9..f3f8e30d6657b 100644 --- a/recipes/bayestyper/build.sh +++ b/recipes/bayestyper/build.sh @@ -1,10 +1,28 @@ #!/bin/bash -mkdir build && cd build -cmake .. -make - mkdir -p ${PREFIX}/bin -cp ../bin/bayesTyper ${PREFIX}/bin -cp ../bin/bayesTyperTools ${PREFIX}/bin +export INCLUDES="-I${PREFIX}/include" +export CPLUS_INCLUDE_PATH="${PREFIX}/include" +export LIBPATH="-L${PREFIX}/lib" +export LDFLAGS="${LDFLAGS} -L${PREFIX}/lib" +export CXXFLAGS="${CXXFLAGS} -O3 -std=c++14 -I${PREFIX}/include" + +if [[ `uname` == "Darwin" ]]; then + export CONFIG_ARGS="-DCMAKE_FIND_FRAMEWORK=NEVER -DCMAKE_FIND_APPBUNDLE=NEVER" + export CXXFLAGS="${CXXFLAGS} -Wno-dev -Wno-deprecated-declarations -Wno-unused-command-line-argument" +else + export CONFIG_ARGS="" +fi + +cmake -S . -B build -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="${PREFIX}" \ + -DCMAKE_CXX_COMPILER="${CXX}" \ + -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ + -DBOOST_ROOT="${PREFIX}" \ + "${CONFIG_ARGS}" +cmake --build build -j "${CPU_COUNT}" + +chmod 0755 bin/* +mv bin/bayesTyper ${PREFIX}/bin +mv bin/bayesTyperTools ${PREFIX}/bin diff --git a/recipes/bayestyper/kmer_defs.patch b/recipes/bayestyper/kmer_defs.patch new file mode 100644 index 0000000000000..eeeb9de5cfb13 --- /dev/null +++ b/recipes/bayestyper/kmer_defs.patch @@ -0,0 +1,18 @@ +diff --git a/external/kmc_api/kmer_defs.h b/external/kmc_api/kmer_defs.h +index 8328822..89ae5e0 100644 +--- a/external/kmc_api/kmer_defs.h ++++ b/external/kmc_api/kmer_defs.h +@@ -33,7 +33,12 @@ + + + #include +- #include ++ #if defined(__clang__) ++ #include ++ #elif defined(__GNUC__) ++ #include ++ using __gnu_cxx::copy_n; ++ #endif + #include + using namespace std; + diff --git a/recipes/bayestyper/meta.yaml b/recipes/bayestyper/meta.yaml index 1542f4b25824f..198b607f0e82e 100644 --- a/recipes/bayestyper/meta.yaml +++ b/recipes/bayestyper/meta.yaml @@ -1,16 +1,23 @@ +{% set name = "bayestyper" %} {% set version = "1.5" %} package: - name: bayestyper + name: {{ name }} version: {{ version }} -build: - number: 1 - skip: True # [osx] - source: url: https://github.com/bioinformatics-centre/BayesTyper/archive/v{{ version }}.tar.gz sha256: 917cd1b1ca7b5cfb6b8327138515ca1ad70878f0c4e8df393fddcbe42f281e14 + patches: + - 0001-CMakeLists.patch + - bayestyper.patch + - kmer_defs.patch # [osx] + - stdafx.patch # [osx] + +build: + number: 2 + run_exports: + - {{ pin_subpackage('bayestyper', max_pin="x") }} requirements: build: @@ -21,15 +28,23 @@ requirements: - zlib - boost-cpp run: - - zlib - boost-cpp about: - home: https://github.com/bioinformatics-centre/BayesTyper + home: "https://github.com/bioinformatics-centre/BayesTyper" license: MIT - summary: A method for variant graph genotyping based on exact alignment of k-mers + license_family: MIT + summary: "A method for variant graph genotyping based on exact alignment of k-mers." + dev_url: "https://github.com/bioinformatics-centre/BayesTyper" + doc_url: "https://github.com/bioinformatics-centre/BayesTyper/blob/v{{ version }}/README.md" test: commands: - - bayesTyper | grep BayesTyper - - bayesTyperTools | grep BayesTyperTools + - bayesTyper | grep "BayesTyper" + - bayesTyperTools | grep "BayesTyperTools" + identifiers: + - biotools:bayestyper + - doi:10.1038/s41588-018-0145-5 + additional-platforms: + - linux-aarch64 + - osx-arm64 diff --git a/recipes/bayestyper/stdafx.patch b/recipes/bayestyper/stdafx.patch new file mode 100644 index 0000000000000..629aa59278f21 --- /dev/null +++ b/recipes/bayestyper/stdafx.patch @@ -0,0 +1,10 @@ +diff --git a/external/kmc_api/stdafx.h b/external/kmc_api/stdafx.h +index 5b8d29d..3610d6c 100644 +--- a/external/kmc_api/stdafx.h ++++ b/external/kmc_api/stdafx.h +@@ -1,4 +1,4 @@ + #include +-#include ++#include + #include + using namespace std;