commit:     6659d55f12a3e8b75dbf9545cac23f37ca00bd58
Author:     David Seifert <soap <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 25 09:37:47 2024 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Thu Apr 25 09:37:47 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6659d55f

sci-biology/bedtools: add 2.31.1

Bug: https://bugs.gentoo.org/881783
Bug: https://bugs.gentoo.org/907971
Bug: https://bugs.gentoo.org/929751
Signed-off-by: David Seifert <soap <AT> gentoo.org>

 sci-biology/bedtools/Manifest                      |   1 +
 sci-biology/bedtools/bedtools-2.31.1.ebuild        |  49 ++++++
 .../files/bedtools-2.31.1-buildsystem.patch        |  84 ++++++++++
 .../bedtools/files/bedtools-2.31.1-includes.patch  | 178 +++++++++++++++++++++
 .../bedtools/files/bedtools-2.31.1-python.patch    |  40 +++++
 5 files changed, 352 insertions(+)

diff --git a/sci-biology/bedtools/Manifest b/sci-biology/bedtools/Manifest
index 571c4c92d6b5..0b52182a52f6 100644
--- a/sci-biology/bedtools/Manifest
+++ b/sci-biology/bedtools/Manifest
@@ -1 +1,2 @@
 DIST bedtools-2.30.0.tar.gz 20648577 BLAKE2B 
042bc31e846455cb1c20199f7a27a3850851f7c256a45b1e674c7aa48ecedc211b0fdfc5e25f915b588f21447e757ebff2bba16a65905bb10d3c88e4b17b1db1
 SHA512 
3993243cc3db12d194d6220aeae200e6af843d6d32d4e5a9a82d04c9d119f8ed47e618e87241edfa82cfac081bc9a40ada18f097d21b0cafc5f912ae012701c9
+DIST bedtools-2.31.1.tar.gz 19629373 BLAKE2B 
f09742ee74494c783cef4909c56abd7b8542344539fe006140716b0a6a1d972db4e3df4a03fb3996a71cb57709b0494be8686879cba15c0985236f3a1282c92d
 SHA512 
fbdc23011566697b2fc44bf3e7b466949487d3f648e81957fa80e8ad4b192d0ef7e2e3944b9b18612774a7984ec99e3fc339c3fddb8889caa632b8ce8defa20d

diff --git a/sci-biology/bedtools/bedtools-2.31.1.ebuild 
b/sci-biology/bedtools/bedtools-2.31.1.ebuild
new file mode 100644
index 000000000000..57ee6c3fde3f
--- /dev/null
+++ b/sci-biology/bedtools/bedtools-2.31.1.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+
+inherit python-any-r1 toolchain-funcs
+
+DESCRIPTION="Tools for manipulation and analysis of BED, GFF/GTF, VCF, SAM/BAM 
file formats"
+HOMEPAGE="https://bedtools.readthedocs.io/";
+SRC_URI="https://github.com/arq5x/${PN}2/releases/download/v${PV}/${P}.tar.gz";
+S="${WORKDIR}/${PN}2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+       app-arch/bzip2
+       app-arch/xz-utils
+       sys-libs/zlib"
+DEPEND="${RDEPEND}"
+BDEPEND="
+       ${PYTHON_DEPS}
+       test? ( >=sci-biology/samtools-1.10:0 )"
+
+# bedtools2 has a *terrible* build system and development practices.
+# Upstream has forked htslib 1.9 and extended it by adding clever callbacks
+# that make unbundling it nigh impossible. There are no signs of upstream 
porting
+# their fork to 1.10, which means we're stuck with the bundled version.
+PATCHES=(
+       "${FILESDIR}"/${PN}-2.31.1-buildsystem.patch
+       "${FILESDIR}"/${PN}-2.31.1-python.patch
+       "${FILESDIR}"/${PN}-2.31.1-includes.patch
+)
+
+src_configure() {
+       tc-export AR CC CXX RANLIB
+}
+
+src_install() {
+       default
+
+       insinto /usr/share/bedtools
+       doins -r genomes
+}

diff --git a/sci-biology/bedtools/files/bedtools-2.31.1-buildsystem.patch 
b/sci-biology/bedtools/files/bedtools-2.31.1-buildsystem.patch
new file mode 100644
index 000000000000..8bb2a096e917
--- /dev/null
+++ b/sci-biology/bedtools/files/bedtools-2.31.1-buildsystem.patch
@@ -0,0 +1,84 @@
+--- a/Makefile
++++ b/Makefile
+@@ -4,46 +4,29 @@
+ # (c) 2009 Aaron Quinlan
+ # ==========================
+ 
+-SHELL := /bin/bash -e
++SHELL := bash -e
+ 
+ VERSION_FILE=./src/utils/version/version_git.h
+ RELEASED_VERSION_FILE=./src/utils/version/version_release.txt
+ 
+ 
+ # define our object and binary directories
+-ifeq ($(VERBOSE),1)
+ CCPREFIX =
+-else
+-CCPREFIX = @
+-endif
+ 
+ OBJ_DIR       = obj
+ BIN_DIR       = bin
+ SRC_DIR       = src
+ 
+-CXX     = g++
+-
+-PYTHON ?= $(shell python --version >/dev/null 2>&1 && echo "python" || echo 
python3)
+-
+-ifeq ($(DEBUG),1)
+-BT_CPPFLAGS = -DDEBUG -D_DEBUG -D_FILE_OFFSET_BITS=64 -DWITH_HTS_CB_API 
$(INCLUDES)
+-BT_CXXFLAGS = -Wconversion -Wall -Wextra -g -O0
+-else
+ BT_CPPFLAGS = -D_FILE_OFFSET_BITS=64 -DWITH_HTS_CB_API $(INCLUDES)
+-BT_CXXFLAGS = -g -Wall -O2
+-endif
++BT_CXXFLAGS = -Wall
+ 
+ # If the user has specified to do so, tell the compile to use rand() (instead 
of mt19937).
+-ifeq ($(USE_RAND),1)
+-BT_CXXFLAGS += -DUSE_RAND
+-else
+ BT_CXXFLAGS += -std=c++11
+-endif
+ 
+ BT_LDFLAGS =
+ BT_LIBS    = -lz -lm -lbz2 -llzma -lpthread
+ 
+-prefix ?= /usr/local
++prefix = $(EPREFIX)/usr
+ 
+ SUBDIRS = $(SRC_DIR)/annotateBed \
+                 $(SRC_DIR)/bamToBed \
+@@ -213,7 +196,7 @@
+ 
+ # make the "obj/" and "bin/" directories, if they don't exist
+ $(OBJ_DIR) $(BIN_DIR):
+-      @mkdir -p $@
++      mkdir -p $@
+ 
+ 
+ # Usually HTSlib's configure script has not been used (detected via config.mk
+--- a/src/utils/htslib/Makefile
++++ b/src/utils/htslib/Makefile
+@@ -22,20 +22,13 @@
+ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ # DEALINGS IN THE SOFTWARE.
+ 
+-CC     = gcc
+-AR     = ar
+-RANLIB = ranlib
+-
+ # Default libraries to link if configure is not used
+ htslib_default_libs = -lz -lm -lbz2 -llzma
+ 
+-CPPFLAGS =
+ # TODO: probably update cram code to make it compile cleanly with -Wc++-compat
+ # For testing strict C99 support add -std=c99 -D_XOPEN_SOURCE=600
+ #CFLAGS   = -g -Wall -O2 -pedantic -std=c99 -D_XOPEN_SOURCE=600 
-D__FUNCTION__=__func__
+-CFLAGS   = -g -Wall -O2
+ EXTRA_CFLAGS_PIC = -fpic
+-LDFLAGS  =
+ LIBS     = $(htslib_default_libs)
+ 
+ prefix      = /usr/local

diff --git a/sci-biology/bedtools/files/bedtools-2.31.1-includes.patch 
b/sci-biology/bedtools/files/bedtools-2.31.1-includes.patch
new file mode 100644
index 000000000000..1b0a9f0849ed
--- /dev/null
+++ b/sci-biology/bedtools/files/bedtools-2.31.1-includes.patch
@@ -0,0 +1,178 @@
+From 3fbf2ddc8ebf0fc1bd492d14a6046aadd59ecadb Mon Sep 17 00:00:00 2001
+From: David Seifert <[email protected]>
+Date: Thu, 25 Apr 2024 11:18:48 +0200
+Subject: [PATCH] Add missing `stdint.h` includes
+
+* Musl is a lot stricter with transitive includes:
+  Bug: https://bugs.gentoo.org/907971
+--- a/src/bamToBed/bamToBed.cpp
++++ b/src/bamToBed/bamToBed.cpp
+@@ -22,6 +22,7 @@ using namespace BamTools;
+ #include <sstream>
+ #include <fstream>
+ #include <stdlib.h>
++#include <stdint.h>
+ 
+ using namespace std;
+ 
+--- a/src/clusterBed/clusterBed.cpp
++++ b/src/clusterBed/clusterBed.cpp
+@@ -12,6 +12,8 @@
+ #include "lineFileUtilities.h"
+ #include "clusterBed.h"
+ 
++#include <stdint.h>
++
+ // = Constructor =
+ BedCluster::BedCluster(string &bedFile, 
+                    int  maxDistance, 
+--- a/src/pairToBed/pairToBed.h
++++ b/src/pairToBed/pairToBed.h
+@@ -22,6 +22,7 @@ using namespace BamTools;
+ #include <vector>
+ #include <iostream>
+ #include <fstream>
++#include <stdint.h>
+ 
+ using namespace std;
+ 
+--- a/src/randomBed/randomBed.h
++++ b/src/randomBed/randomBed.h
+@@ -22,6 +22,7 @@
+ #include <unistd.h>
+ #include <sys/types.h>
+ #include <algorithm>  // for binary search
++#include <stdint.h>
+ using namespace std;
+ 
+ const int MAX_TRIES = 1000000;
+--- a/src/summaryFile/summaryFile.h
++++ b/src/summaryFile/summaryFile.h
+@@ -12,6 +12,8 @@
+ #include "ToolBase.h"
+ #include "ContextSummary.h"
+ 
++#include <stdint.h>
++
+ struct Interval {
+   CHRPOS start;
+   CHRPOS end;
+--- a/src/utils/BamTools/include/BamAlignment.mapping.hpp
++++ b/src/utils/BamTools/include/BamAlignment.mapping.hpp
+@@ -1,3 +1,4 @@
++#include <stdint.h>
+ 
+ struct _RefID_t {
+     operator int32_t() const {return (int32_t)(_ptr()->core.tid);}
+--- a/src/utils/BamTools/include/api/BamAux.h
++++ b/src/utils/BamTools/include/api/BamAux.h
+@@ -1,4 +1,5 @@
+ #include <string>
++#include <stdint.h>
+ 
+ #ifndef BAMAUX_H
+ #define BAMAUX_H
+--- a/src/utils/FileRecordTools/FileReaders/SingleLineDelimTextFileReader.h
++++ b/src/utils/FileRecordTools/FileReaders/SingleLineDelimTextFileReader.h
+@@ -9,6 +9,7 @@
+ #define SINGLELINETEXTFILEREADER_H_
+ 
+ #include <algorithm>
++#include <stdint.h>
+ #include "FileReader.h"
+ #include "string.h"
+ #include "lineFileUtilities.h"
+--- a/src/utils/FileRecordTools/Records/BamRecord.cpp
++++ b/src/utils/FileRecordTools/Records/BamRecord.cpp
+@@ -10,6 +10,8 @@
+ #include "BamFileReader.h"
+ #include "RecordKeyVector.h"
+ 
++#include <stdint.h>
++
+ BamRecord::BamRecord()
+ : _bamChromId(-1)
+ {
+--- a/src/utils/GenomeFile/GenomeFile.h
++++ b/src/utils/GenomeFile/GenomeFile.h
+@@ -19,6 +19,7 @@
+ #include <fstream>
+ #include <cstring>
+ #include <cstdio>
++#include <stdint.h>
+ #include <algorithm> // for bsearch lower_bound()
+ #include "api/BamReader.h"
+ #include "api/BamAux.h"
+--- a/src/utils/GenomeFile/NewGenomeFile.h
++++ b/src/utils/GenomeFile/NewGenomeFile.h
+@@ -14,6 +14,7 @@
+ #define NEW_GENOMEFILE_H
+ 
+ #include <algorithm> // for bsearch lower_bound()
++#include <stdint.h>
+ 
+ #include "BedtoolsTypes.h"
+ 
+--- a/src/utils/bedFilePE/bedFilePE.h
++++ b/src/utils/bedFilePE/bedFilePE.h
+@@ -8,6 +8,7 @@
+ #include <fstream>
+ #include <sstream>
+ #include <cstring>
++#include <stdint.h>
+ #include <algorithm>
+ #include "bedFile.h"
+ #include "lineFileUtilities.h"
+--- a/src/utils/general/ParseTools.cpp
++++ b/src/utils/general/ParseTools.cpp
+@@ -2,7 +2,7 @@
+ #include <climits>
+ #include <cctype>
+ #include <cstring>
+-#include <cstdint>
++#include <stdint.h>
+ #include <cstdio>
+ #include <cstdlib>
+ #include <sstream>
+--- a/src/utils/lineFileUtilities/lineFileUtilities.h
++++ b/src/utils/lineFileUtilities/lineFileUtilities.h
+@@ -4,6 +4,7 @@
+ #include <vector>
+ #include <string>
+ #include <cstring>
++#include <stdint.h>
+ #include <cstdlib>
+ #include <sstream>
+ #include <iostream>
+--- a/src/utils/sequenceUtilities/sequenceUtils.h
++++ b/src/utils/sequenceUtilities/sequenceUtils.h
+@@ -4,6 +4,7 @@
+ #include <string>
+ #include <algorithm>
+ #include <cctype>
++#include <stdint.h>
+ 
+ using namespace std;
+ 
+--- a/src/windowMaker/windowMaker.h
++++ b/src/windowMaker/windowMaker.h
+@@ -12,6 +12,8 @@ Licenced under the GNU General Public License 2.0 license.
+ #include "NewGenomeFile.h"
+ #include "bedFile.h"
+ 
++#include <stdint.h>
++
+ using namespace std;
+ 
+ 
+--- a/src/windowMaker/windowMakerMain.cpp
++++ b/src/windowMaker/windowMakerMain.cpp
+@@ -12,6 +12,8 @@ Licenced under the GNU General Public License 2.0 license.
+ #include "windowMaker.h"
+ #include "version.h"
+ 
++#include <stdint.h>
++
+ using namespace std;
+ 
+ // define our program name

diff --git a/sci-biology/bedtools/files/bedtools-2.31.1-python.patch 
b/sci-biology/bedtools/files/bedtools-2.31.1-python.patch
new file mode 100644
index 000000000000..28819ac82d49
--- /dev/null
+++ b/sci-biology/bedtools/files/bedtools-2.31.1-python.patch
@@ -0,0 +1,40 @@
+From eabcd3dcb9caa1fcc17acd43df2ded4170ed1449 Mon Sep 17 00:00:00 2001
+From: David Seifert <[email protected]>
+Date: Thu, 25 Apr 2024 11:18:47 +0200
+Subject: [PATCH] Allow PYTHON from environment
+
+* Distros need to be able to specify exactly which python
+  interpreter to run tests under.
+--- a/test/bigchroms/test-bigchroms.sh
++++ b/test/bigchroms/test-bigchroms.sh
+@@ -28,7 +28,7 @@ check obs abig.bed
+ rm obs
+ 
+ if [[ "$BT_NO_BIG_FILES" != "" ]]; then
+-python make-big-chrom.py
++${PYTHON:-python} make-big-chrom.py
+ 
+ echo -e "    bigchroms.t03...big get fasta \c"
+ $BT getfasta -fi bigx.fasta -bed bigx.bed | tail -1 > obs
+--- a/test/fisher/cmp.sh
++++ b/test/fisher/cmp.sh
+@@ -3,7 +3,7 @@ set -eo pipefail
+ echo "fisher,shuffled"
+ 
+ for i in $(seq 1000); do
+-    fisher=$(python ./sim.py | tail -1 | cut -f 2)
++    fisher=$(${PYTHON:-python} ./sim.py | tail -1 | cut -f 2)
+     shuffle=$(bash shuf.sh)
+     echo "$fisher,$shuffle"
+ done
+--- a/test/genomecov/test-genomecov.sh
++++ b/test/genomecov/test-genomecov.sh
+@@ -288,7 +288,7 @@ CRAM_REFERENCE=test_ref.fa $BT genomecov -ibam empty.cram 
> obs
+ check obs exp
+ rm obs exp
+ 
+-python mk-deep.py > deep.sam
++${PYTHON:-python} mk-deep.py > deep.sam
+ echo -e "    genomecov.t18...\c"
+ echo "c1      1       1000000" > exp
+ $BT genomecov -d -ibam deep.sam | head -1 > obs

Reply via email to