commit:     777780e24faa006c5883307c0dadd31cab8cecd8
Author:     Martin Mokrejs <mmokrejs <AT> fold <DOT> natur <DOT> cuni <DOT> cz>
AuthorDate: Fri Mar 29 16:24:12 2019 +0000
Commit:     Martin Mokrejs <mmokrejs <AT> fold <DOT> natur <DOT> cuni <DOT> cz>
CommitDate: Fri Mar 29 16:24:12 2019 +0000
URL:        https://gitweb.gentoo.org/proj/sci.git/commit/?id=777780e2

sci-biology/repeatmasker: rewamp configuration code

The changes are partly based on https://github.com/gentoo/sci/pull/580
from Michael Schubert but it seems we could figure out the paths
to binaries automatically using `which`.

Block between the USE options and allow only a single to be enabled,
that is what configure requires, otherwise it enters a loop.

The hmmer is the default in configure and preferred.

Tested with `USE="hmmer -wublast -phrap -rmblast"` and other
combinations while only one is allowed.

If users have wublast/abblast/rmblast/crossmatch in the PATHS we just
pick it.

`which` returns a '.' (dot) if a binary was not found, we need to zap it
otherwise configure enters a loop.

In the end, one can get:

Add a Search Engine:
   1. CrossMatch: [ Configured ]
   2. RMBlast - NCBI Blast with RepeatMasker extensions: [ Configured ]
   3. WUBlast/ABBlast (required by DupMasker): [ Un-configured ]
   4. HMMER3.1 & DFAM: [ Configured, Default ]

   5. Done

properly written into

/usr/lib64/perl5/vendor_perl/5.28.0/RepeatMaskerConfig.pm

Package-Manager: Portage-2.3.62, Repoman-2.3.12
Signed-off-by: Martin Mokrejs <mmokrejs <AT> fold.natur.cuni.cz>

 .../files/repeatmasker-4.0.6__configure.patch      |   4 +-
 sci-biology/repeatmasker/metadata.xml              |   6 +
 .../repeatmasker/repeatmasker-4.0.6-r3.ebuild      | 111 ----------------
 .../repeatmasker/repeatmasker-4.0.6-r4.ebuild      | 142 +++++++++++++++++++++
 .../repeatmasker/repeatmasker-4.0.8-r1.ebuild      | 111 ----------------
 .../repeatmasker/repeatmasker-4.0.8-r2.ebuild      | 142 +++++++++++++++++++++
 6 files changed, 292 insertions(+), 224 deletions(-)

diff --git a/sci-biology/repeatmasker/files/repeatmasker-4.0.6__configure.patch 
b/sci-biology/repeatmasker/files/repeatmasker-4.0.6__configure.patch
index e4042190f..c1e0cfb55 100644
--- a/sci-biology/repeatmasker/files/repeatmasker-4.0.6__configure.patch
+++ b/sci-biology/repeatmasker/files/repeatmasker-4.0.6__configure.patch
@@ -1,5 +1,5 @@
---- configure.ori      2015-11-24 20:56:46.000000000 +0100
-+++ configure  2015-11-24 20:59:58.000000000 +0100
+--- RepeatMasker/configure.ori 2015-11-24 20:56:46.000000000 +0100
++++ RepeatMasker/configure     2015-11-24 20:59:58.000000000 +0100
 @@ -253,17 +253,16 @@
    close INVERS;
  }

diff --git a/sci-biology/repeatmasker/metadata.xml 
b/sci-biology/repeatmasker/metadata.xml
index 8417d1580..de382fa16 100644
--- a/sci-biology/repeatmasker/metadata.xml
+++ b/sci-biology/repeatmasker/metadata.xml
@@ -5,4 +5,10 @@
                <email>[email protected]</email>
                <name>Gentoo Biology Project</name>
        </maintainer>
+       <use>
+               <flag name="phrap">Use cross_match search engine as 
default</flag>
+               <flag name="rmblast">Use RM-BLAST search engine as 
default</flag>
+               <flag name="hmmer">Use HMMER search engine as default</flag>
+               <flag name="wublast">Use wublast or abblast search engine as 
default</flag>
+       </use>
 </pkgmetadata>

diff --git a/sci-biology/repeatmasker/repeatmasker-4.0.6-r3.ebuild 
b/sci-biology/repeatmasker/repeatmasker-4.0.6-r3.ebuild
deleted file mode 100644
index d41784eb7..000000000
--- a/sci-biology/repeatmasker/repeatmasker-4.0.6-r3.ebuild
+++ /dev/null
@@ -1,111 +0,0 @@
-# Copyright 1999-2018 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit eutils perl-module
-
-MY_PV=${PV//\./-}
-
-DESCRIPTION="Screen DNA sequences for interspersed repeats and low complexity 
DNA"
-HOMEPAGE="http://repeatmasker.org/";
-SRC_URI="http://www.repeatmasker.org/RepeatMasker-open-${MY_PV}.tar.gz";
-
-LICENSE="OSL-2.1"
-SLOT="0"
-KEYWORDS="~amd64 ~x86"
-IUSE=""
-
-DEPEND=">=dev-lang/perl-5.8"
-RDEPEND="
-       dev-perl/Text-Soundex
-       sci-biology/phrap
-       <=sci-biology/repeatmasker-libraries-20160829
-       sci-biology/rmblast
-       !sci-biology/trf
-       >=sci-biology/trf-bin-4.0.4
-"
-
-S="${WORKDIR}/RepeatMasker"
-
-PATCHES=( "${FILESDIR}"/"${P}"__configure.patch )
-
-src_configure() {
-       sed \
-               -e "s#/usr/bin/which#which#g" \
-               -e "s#/usr/bin/perl#perl#g" \
-               -i "${S}"/configure || die
-       perl_set_version
-       insinto ${VENDOR_LIB}
-       sed -e "s#/usr/perl5/lib/#${VENDOR_LIB}/#g" -i "${S}"/configure || die
-       # The below is wrong as it causes:
-       # Enter path [ 
/var/tmp/portage/sci-biology/repeatmasker-4.0.1-r1/work/RepeatMasker ]:
-       #  -- Building monolithic RM database...sh: 
/var/tmp/portage/sci-biology/repeatmasker-4.0.1-r1/image///usr/share/repeatmasker/Libraries/RepeatMasker.lib:
 No such file or directory
-       # -e 's|> \($rmLocation/Libraries/RepeatMasker.lib\)|> '${D}'/\1|'
-       sed -i -e 's/system( "clear" );//' "${S}/configure" || die
-       mkdir -p "${ED}"/usr/share/repeatmasker/Libraries/ || die
-       #
-       # the below files is actually overwritten by buildRMLibFromEMBL.pl so 
the 'blah'
-       # item does not get installed
-       echo ">blah\natgc" > 
"${ED}"/usr/share/repeatmasker/Libraries/RepeatMasker.lib || die
-       # below try to define paths to trf, cross_match, rmblast and nhmmer as 
search tools
-       echo "
-env
-${S}
-${EPREFIX}/opt/trf/bin
-1
-${EPREFIX}/usr/bin
-Y
-2
-${EPREFIX}/usr/bin
-Y
-4
-${EPREFIX}/usr/bin
-Y
-5" | "${S}"/configure || die "configure failed"
-       sed -i -e "s|use lib $FindBin::RealBin;|use lib 
${EPREFIX}/usr/share/${PN}/lib;|" \
-               -e 
"s|.*\(taxonomy.dat\)|${EPREFIX}/usr/share/${PN}/Libraries/\1|" \
-               -e "/$REPEATMASKER_DIR/ 
s|$FindBin::RealBin|${EPREFIX}/usr/share/${PN}|" \
-               
"${S}"/{DateRepeats,ProcessRepeats,RepeatMasker,DupMasker,RepeatProteinMask,RepeatMaskerConfig.pm,Taxonomy.pm}
 || die
-}
-# configure failed to 'cp RepeatMaskerConfig.tmpl RepeatMaskerConfig.pm'
-# replace also /u1/local/bin/perl with proper Gentoo PATH
-
-src_install() {
-       exeinto /usr/share/${PN}
-       for i in DateRepeats ProcessRepeats RepeatMasker DupMasker 
RepeatProteinMask; do
-               doexe $i
-               dosym ../share/${PN}/$i /usr/bin/$i
-       done
-
-       perl_set_version
-       insinto "${VENDOR_LIB}"
-       doins "${S}"/*.pm "${S}"/Libraries/*.pm
-       # zap the supposedly misplaced RepeatAnnotationData.pm file
-       rm -r "${S}"/Libraries/*.pm || die
-
-       # if sci-biology/repeatmasker-libraries is installed prevent file 
collision
-       # and do NOT install Libraries/RepeatMaskerLib.embl file which contains
-       # a limited version of the file: 20110419-min
-       rm -r Libraries/RepeatMaskerLib.embl || die
-       insinto /usr/share/${PN}
-       doins -r util Matrices Libraries *.help
-       keepdir /usr/share/${PN}/Libraries
-
-       dodoc README INSTALL *.help
-}
-
-pkg_postinst(){
-       einfo "RepeatMasker provides bundled human repeats database"
-       einfo "from Dfam-1.0 database www.dfam.org"
-       einfo "You can configure which search search engine is to be used and"
-       einfo "PATHs to the search binaries are defined in"
-       einfo "${EPREFIX}/usr/share/${PN}/lib/RepeatMaskerConfig.pm"
-       einfo "Supported search engines are:"
-       optfeature "cross_match" sci-biology/phrap
-       optfeature "rmblast" sci-biology/rmblast
-       optfeature "nhmmer" \>=sci-biology/hmmer-3.1
-       einfo "abblast/wublast from http://blast.advbiocomp.com/licensing";
-       einfo "repeatmasker-libraries-20160829 (RepBase 21.12) is the last"
-       einfo "version compatible with <repeatmasker-4.0.7"
-}

diff --git a/sci-biology/repeatmasker/repeatmasker-4.0.6-r4.ebuild 
b/sci-biology/repeatmasker/repeatmasker-4.0.6-r4.ebuild
new file mode 100644
index 000000000..8216bfe7f
--- /dev/null
+++ b/sci-biology/repeatmasker/repeatmasker-4.0.6-r4.ebuild
@@ -0,0 +1,142 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit eutils perl-module
+
+MY_PV=${PV//\./-}
+
+DESCRIPTION="Screen DNA sequences for interspersed repeats and low complexity 
DNA"
+HOMEPAGE="http://repeatmasker.org/";
+SRC_URI="http://www.repeatmasker.org/RepeatMasker-open-${MY_PV}.tar.gz";
+
+LICENSE="OSL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="phrap rmblast hmmer wublast"
+# RepeatMaskerConfig.pm says:
+#   Default search tool can be one of "hmmer", "crossmatch", "wublast", 
"decypher" or "ncbi".
+#   Upstream uses "hmmer" as the default.
+
+DEPEND=">=dev-lang/perl-5.8"
+RDEPEND="
+       <=sci-biology/repeatmasker-libraries-20160829
+       dev-perl/Text-Soundex
+       phrap? ( !hmmer? ( !rmblast? ( !wublast? ( sci-biology/phrap ) ) ) )
+       rmblast? ( !hmmer? ( !phrap? ( !wublast? ( sci-biology/rmblast ) ) ) )
+       hmmer? ( !phrap? ( !wublast? ( !rmblast? ( sci-biology/hmmer ) ) ) )
+       !sci-biology/trf
+       >=sci-biology/trf-bin-4.0.4
+"
+# wublast? ( sci-biology/wublast || sci-biology/abblast )
+# ncbi? ( would that be ncbi-tools++ or ncbi-blast+ ) ???
+
+S="${WORKDIR}/RepeatMasker"
+
+PATCHES=( "${FILESDIR}"/"${P}"__configure.patch )
+
+src_configure() {
+       sed \
+               -e "s#/usr/bin/which#which#g" \
+               -e "s#/usr/bin/perl#perl#g" \
+               -i "${S}"/configure || die
+       perl_set_version
+       insinto ${VENDOR_LIB}
+       sed -e "s#/usr/perl5/lib/#${VENDOR_LIB}/#g" -i "${S}"/configure || die
+       # The below is wrong as it causes:
+       # Enter path [ 
/var/tmp/portage/sci-biology/repeatmasker-4.0.1-r1/work/RepeatMasker ]:
+       #  -- Building monolithic RM database...sh: 
/var/tmp/portage/sci-biology/repeatmasker-4.0.1-r1/image///usr/share/repeatmasker/Libraries/RepeatMasker.lib:
 No such file or directory
+       # -e 's|> \($rmLocation/Libraries/RepeatMasker.lib\)|> '${D}'/\1|'
+       sed -i -e 's/system( "clear" );//' "${S}/configure" || die
+       mkdir -p "${ED}"/usr/share/repeatmasker/Libraries/ || die
+       #
+       # the below files is actually overwritten by buildRMLibFromEMBL.pl so 
the 'blah'
+       # item does not get installed
+       echo ">blah\natgc" > 
"${ED}"/usr/share/repeatmasker/Libraries/RepeatMasker.lib || die
+       # below try to define paths to trf, cross_match, rmblast and nhmmer as 
search tools
+       #
+       local my_crossmatch=`which cross_match 2>/dev/null`
+       local my_rmblastn=`which rmblastn 2>/dev/null`
+       local my_hmmer=`which nhmmscan 2>/dev/null`
+       local my_wublast=`which xdformat 2>/dev/null` # actually configure 
looks for 'setdb' executable
+       # configure is inconsistent at first, we must pass even a wrong path 
for cross_match, rmblastn, hmmer otherwise it enters a loop
+       # but, for wublast we must pass in an empty string otherwise it looks 
for 'setdb' executable in the non-existing directory and enters a loop
+       if [ "$my_crossmatch" != '.' ]; then local crossmatchdir=`dirname 
"$my_crossmatch"` else local crossmatchdir="${EPREFIX}/usr/bin"; fi
+       if [ "$my_rmblastn" != '.' ]; then local rmblastdir=`dirname 
"$my_rmblastn"` else local rmblastdir="${EPREFIX}/usr/bin"; fi
+       if [ "$my_hmmer" != '.' ]; then local hmmerdir=`dirname "$my_hmmer"` 
else local hmmerdir="${EPREFIX}/usr/bin"; fi
+       if [ "$my_wublast" != '.' ]; then local wublastdir=`dirname 
"$my_wublast"` else local wublastdir=""; fi
+       echo "crossmatchdir=${crossmatchdir} rmblastdir=${rmblastdir} 
wublastdir=${wublastdir} hmmerdir=${hmmerdir}"
+       # pick the preferred-one
+       local CONF=( x env ${S} "${EPREFIX}"/opt/bin )
+       if use phrap; then
+               CONF+=( 1 "${crossmatchdir}" Y )
+       else
+               CONF+=( 1 "${crossmatchdir}" N )
+       fi
+       if use rmblast; then
+               CONF+=( 2 "${rmblastdir}" Y )
+       else
+               CONF+=( 2 "${rmblastdir}" N )
+       fi
+       if use wublast; then
+               # no ebuild available but pick anything from PATH
+               CONF+=( 3 "${wublastdir}" Y )
+       else
+               CONF+=( 3 "${wublastdir}" N )
+       fi
+       if use hmmer; then
+               CONF+=( 4 "${hmmerdir}" Y )
+       else
+               CONF+=( 4 "${hmmerdir}" N )
+       fi
+       CONF+=( 5 )
+       echo "Will feed configure with: ${CONF[@]}"
+       printf '%s\n' "${CONF[@]}" | "${S}/configure" || die "configure failed"
+
+       sed -i -e "/use 
lib/s|\"\$FindBin::RealBin|\"${EPREFIX}/usr/share/${PN}/lib|" \
+               -e "/use 
lib/s|\$FindBin::RealBin|\"${EPREFIX}/usr/share/${PN}/lib\"|" \
+               -e "/\$REPEATMASKER_DIR/ 
s|\$FindBin::RealBin|${EPREFIX}/usr/share/${PN}|" \
+               
"${S}"/{DateRepeats,ProcessRepeats,RepeatMasker,DupMasker,RepeatProteinMask,RepeatMaskerConfig.pm,Taxonomy.pm}
 || die
+}
+
+src_install() {
+       exeinto /usr/share/${PN}
+       for i in DateRepeats ProcessRepeats RepeatMasker DupMasker 
RepeatProteinMask; do
+               doexe $i
+               dosym ../share/${PN}/$i /usr/bin/$i
+       done
+
+       perl_set_version
+       insinto "${VENDOR_LIB}"
+       doins "${S}"/*.pm "${S}"/Libraries/*.pm
+       # zap the supposedly misplaced RepeatAnnotationData.pm file
+       rm -r "${S}"/Libraries/*.pm || die
+
+       # if sci-biology/repeatmasker-libraries is installed prevent file 
collision
+       # and do NOT install Libraries/RepeatMaskerLib.embl file which contains
+       # a limited version of the file: 20110419-min
+       rm -r Libraries/RepeatMaskerLib.embl || die
+       insinto /usr/share/${PN}
+       doins -r util Matrices Libraries *.help
+       keepdir /usr/share/${PN}/Libraries
+
+       dodoc README INSTALL *.help
+}
+
+pkg_postinst(){
+       cd "${S}" || die
+       einfo "RepeatMasker provides bundled human repeats database from"
+       einfo "    Dfam-1.0 database www.dfam.org"
+       einfo "You can configure which search search engine is to be used and"
+       einfo "Current default search engine defined in"
+       einfo "    ${EPREFIX}${VENDOR_LIB}/RepeatMaskerConfig.pm is:"
+       einfo `grep 'DEFAULT_SEARCH_ENGINE =' RepeatMaskerConfig.pm`
+       einfo "\nSupported search engines are:"
+       optfeature "cross_match" sci-biology/phrap
+       optfeature "rmblast" sci-biology/rmblast
+       optfeature "nhmmer" \>=sci-biology/hmmer-3.1
+       einfo "abblast/wublast from http://blast.advbiocomp.com/licensing";
+       einfo "\nThe repeatmasker-libraries-20160829 (RepBase 21.12) was the 
last"
+       einfo "version compatible with <repeatmasker-4.0.7"
+}

diff --git a/sci-biology/repeatmasker/repeatmasker-4.0.8-r1.ebuild 
b/sci-biology/repeatmasker/repeatmasker-4.0.8-r1.ebuild
deleted file mode 100644
index 9b4af2312..000000000
--- a/sci-biology/repeatmasker/repeatmasker-4.0.8-r1.ebuild
+++ /dev/null
@@ -1,111 +0,0 @@
-# Copyright 1999-2018 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit eutils perl-module
-
-MY_PV=${PV//\./-}
-
-DESCRIPTION="Screen DNA sequences for interspersed repeats and low complexity 
DNA"
-HOMEPAGE="http://repeatmasker.org/";
-SRC_URI="http://www.repeatmasker.org/RepeatMasker-open-${MY_PV}.tar.gz";
-
-LICENSE="OSL-2.1"
-SLOT="0"
-KEYWORDS="~amd64 ~x86"
-IUSE=""
-
-DEPEND=">=dev-lang/perl-5.8"
-RDEPEND="
-       dev-perl/Text-Soundex
-       sci-biology/phrap
-       >sci-biology/repeatmasker-libraries-20160829
-       sci-biology/rmblast
-       !sci-biology/trf
-       >=sci-biology/trf-bin-4.0.4
-"
-
-S="${WORKDIR}/RepeatMasker"
-
-PATCHES=( "${FILESDIR}"/"${P}"__configure.patch )
-
-src_configure() {
-       sed \
-               -e "s#/usr/bin/which#which#g" \
-               -e "s#/usr/bin/perl#perl#g" \
-               -i "${S}"/configure || die
-       perl_set_version
-       insinto ${VENDOR_LIB}
-       sed -e "s#/usr/perl5/lib/#${VENDOR_LIB}/#g" -i "${S}"/configure || die
-       # The below is wrong as it causes:
-       # Enter path [ 
/var/tmp/portage/sci-biology/repeatmasker-4.0.1-r1/work/RepeatMasker ]:
-       #  -- Building monolithic RM database...sh: 
/var/tmp/portage/sci-biology/repeatmasker-4.0.1-r1/image///usr/share/repeatmasker/Libraries/RepeatMasker.lib:
 No such file or directory
-       # -e 's|> \($rmLocation/Libraries/RepeatMasker.lib\)|> '${D}'/\1|'
-       sed -i -e 's/system( "clear" );//' "${S}/configure" || die
-       mkdir -p "${ED}"/usr/share/repeatmasker/Libraries/ || die
-       #
-       # the below files is actually overwritten by buildRMLibFromEMBL.pl so 
the 'blah'
-       # item does not get installed
-       echo ">blah\natgc" > 
"${ED}"/usr/share/repeatmasker/Libraries/RepeatMasker.lib || die
-       # below try to define paths to trf, cross_match, rmblast and nhmmer as 
search tools
-       echo "
-env
-${S}
-${EPREFIX}/opt/trf/bin
-1
-${EPREFIX}/usr/bin
-Y
-2
-${EPREFIX}/usr/bin
-Y
-4
-${EPREFIX}/usr/bin
-Y
-5" | "${S}"/configure || die "configure failed"
-       sed -i -e "s|use lib $FindBin::RealBin;|use lib 
${EPREFIX}/usr/share/${PN}/lib;|" \
-               -e 
"s|.*\(taxonomy.dat\)|${EPREFIX}/usr/share/${PN}/Libraries/\1|" \
-               -e "/$REPEATMASKER_DIR/ 
s|$FindBin::RealBin|${EPREFIX}/usr/share/${PN}|" \
-               
"${S}"/{DateRepeats,ProcessRepeats,RepeatMasker,DupMasker,RepeatProteinMask,RepeatMaskerConfig.pm,Taxonomy.pm}
 || die
-}
-# configure failed to 'cp RepeatMaskerConfig.tmpl RepeatMaskerConfig.pm'
-# replace also /u1/local/bin/perl with proper Gentoo PATH
-
-src_install() {
-       exeinto /usr/share/${PN}
-       for i in DateRepeats ProcessRepeats RepeatMasker DupMasker 
RepeatProteinMask; do
-               doexe $i
-               dosym ../share/${PN}/$i /usr/bin/$i
-       done
-
-       perl_set_version
-       insinto "${VENDOR_LIB}"
-       doins "${S}"/*.pm "${S}"/Libraries/*.pm
-       # zap the supposedly misplaced RepeatAnnotationData.pm file
-       rm -r "${S}"/Libraries/*.pm || die
-
-       # if sci-biology/repeatmasker-libraries is installed prevent file 
collision
-       # and do NOT install Libraries/RepeatMaskerLib.embl file which contains
-       # a limited version of the file: 20110419-min
-       rm -r Libraries/RepeatMaskerLib.embl || die
-       insinto /usr/share/${PN}
-       doins -r util Matrices Libraries *.help
-       keepdir /usr/share/${PN}/Libraries
-
-       dodoc README.md INSTALL *.help
-}
-
-pkg_postinst(){
-       einfo "RepeatMasker provides bundled human repeats database"
-       einfo "from Dfam-1.0 database www.dfam.org"
-       einfo "You can configure which search search engine is to be used and"
-       einfo "PATHs to the search binaries are defined in"
-       einfo "${EPREFIX}/usr/share/${PN}/lib/RepeatMaskerConfig.pm"
-       einfo "Supported search engines are:"
-       optfeature "cross_match" sci-biology/phrap
-       optfeature "rmblast" sci-biology/rmblast
-       optfeature "nhmmer" \>=sci-biology/hmmer-3.1
-       einfo "abblast/wublast from http://blast.advbiocomp.com/licensing";
-       einfo "repeatmasker-libraries-20160829 (RepBase 21.12) was the last"
-       einfo "version compatible with <repeatmasker-4.0.7"
-}

diff --git a/sci-biology/repeatmasker/repeatmasker-4.0.8-r2.ebuild 
b/sci-biology/repeatmasker/repeatmasker-4.0.8-r2.ebuild
new file mode 100644
index 000000000..02700ba2b
--- /dev/null
+++ b/sci-biology/repeatmasker/repeatmasker-4.0.8-r2.ebuild
@@ -0,0 +1,142 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit eutils perl-module
+
+MY_PV=${PV//\./-}
+
+DESCRIPTION="Screen DNA sequences for interspersed repeats and low complexity 
DNA"
+HOMEPAGE="http://repeatmasker.org/";
+SRC_URI="http://www.repeatmasker.org/RepeatMasker-open-${MY_PV}.tar.gz";
+
+LICENSE="OSL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="phrap rmblast hmmer wublast"
+# RepeatMaskerConfig.pm says:
+#   Default search tool can be one of "hmmer", "crossmatch", "wublast", 
"decypher" or "ncbi".
+#   Upstream uses "hmmer" as the default.
+
+DEPEND=">=dev-lang/perl-5.8"
+RDEPEND="
+       >sci-biology/repeatmasker-libraries-20160829
+       dev-perl/Text-Soundex
+       phrap? ( !hmmer? ( !rmblast? ( !wublast? ( sci-biology/phrap ) ) ) )
+       rmblast? ( !hmmer? ( !phrap? ( !wublast? ( sci-biology/rmblast ) ) ) )
+       hmmer? ( !phrap? ( !wublast? ( !rmblast? ( sci-biology/hmmer ) ) ) )
+       !sci-biology/trf
+       >=sci-biology/trf-bin-4.0.4
+"
+# wublast? ( sci-biology/wublast || sci-biology/abblast )
+# ncbi? ( would that be ncbi-tools++ or ncbi-blast+ ) ???
+
+S="${WORKDIR}/RepeatMasker"
+
+PATCHES=( "${FILESDIR}"/"${P}"__configure.patch )
+
+src_configure() {
+       sed \
+               -e "s#/usr/bin/which#which#g" \
+               -e "s#/usr/bin/perl#perl#g" \
+               -i "${S}"/configure || die
+       perl_set_version
+       insinto ${VENDOR_LIB}
+       sed -e "s#/usr/perl5/lib/#${VENDOR_LIB}/#g" -i "${S}"/configure || die
+       # The below is wrong as it causes:
+       # Enter path [ 
/var/tmp/portage/sci-biology/repeatmasker-4.0.1-r1/work/RepeatMasker ]:
+       #  -- Building monolithic RM database...sh: 
/var/tmp/portage/sci-biology/repeatmasker-4.0.1-r1/image///usr/share/repeatmasker/Libraries/RepeatMasker.lib:
 No such file or directory
+       # -e 's|> \($rmLocation/Libraries/RepeatMasker.lib\)|> '${D}'/\1|'
+       sed -i -e 's/system( "clear" );//' "${S}/configure" || die
+       mkdir -p "${ED}"/usr/share/repeatmasker/Libraries/ || die
+       #
+       # the below files is actually overwritten by buildRMLibFromEMBL.pl so 
the 'blah'
+       # item does not get installed
+       echo ">blah\natgc" > 
"${ED}"/usr/share/repeatmasker/Libraries/RepeatMasker.lib || die
+       # below try to define paths to trf, cross_match, rmblast and nhmmer as 
search tools
+       #
+       local my_crossmatch=`which cross_match 2>/dev/null`
+       local my_rmblastn=`which rmblastn 2>/dev/null`
+       local my_hmmer=`which nhmmscan 2>/dev/null`
+       local my_wublast=`which xdformat 2>/dev/null` # actually configure 
looks for 'setdb' executable
+       # configure is inconsistent at first, we must pass even a wrong path 
for cross_match, rmblastn, hmmer otherwise it enters a loop
+       # but, for wublast we must pass in an empty string otherwise it looks 
for 'setdb' executable in the non-existing directory and enters a loop
+       if [ "$my_crossmatch" != '.' ]; then local crossmatchdir=`dirname 
"$my_crossmatch"` else local crossmatchdir="${EPREFIX}/usr/bin"; fi
+       if [ "$my_rmblastn" != '.' ]; then local rmblastdir=`dirname 
"$my_rmblastn"` else local rmblastdir="${EPREFIX}/usr/bin"; fi
+       if [ "$my_hmmer" != '.' ]; then local hmmerdir=`dirname "$my_hmmer"` 
else local hmmerdir="${EPREFIX}/usr/bin"; fi
+       if [ "$my_wublast" != '.' ]; then local wublastdir=`dirname 
"$my_wublast"` else local wublastdir=""; fi
+       echo "crossmatchdir=${crossmatchdir} rmblastdir=${rmblastdir} 
wublastdir=${wublastdir} hmmerdir=${hmmerdir}"
+       # pick the preferred-one
+       local CONF=( x env ${S} "${EPREFIX}"/opt/bin )
+       if use phrap; then
+               CONF+=( 1 "${crossmatchdir}" Y )
+       else
+               CONF+=( 1 "${crossmatchdir}" N )
+       fi
+       if use rmblast; then
+               CONF+=( 2 "${rmblastdir}" Y )
+       else
+               CONF+=( 2 "${rmblastdir}" N )
+       fi
+       if use wublast; then
+               # no ebuild available but pick anything from PATH
+               CONF+=( 3 "${wublastdir}" Y )
+       else
+               CONF+=( 3 "${wublastdir}" N )
+       fi
+       if use hmmer; then
+               CONF+=( 4 "${hmmerdir}" Y )
+       else
+               CONF+=( 4 "${hmmerdir}" N )
+       fi
+       CONF+=( 5 )
+       echo "Will feed configure with: ${CONF[@]}"
+       printf '%s\n' "${CONF[@]}" | "${S}/configure" || die "configure failed"
+
+       sed -i -e "/use 
lib/s|\"\$FindBin::RealBin|\"${EPREFIX}/usr/share/${PN}/lib|" \
+               -e "/use 
lib/s|\$FindBin::RealBin|\"${EPREFIX}/usr/share/${PN}/lib\"|" \
+               -e "/\$REPEATMASKER_DIR/ 
s|\$FindBin::RealBin|${EPREFIX}/usr/share/${PN}|" \
+               
"${S}"/{DateRepeats,ProcessRepeats,RepeatMasker,DupMasker,RepeatProteinMask,RepeatMaskerConfig.pm,Taxonomy.pm}
 || die
+}
+
+src_install() {
+       exeinto /usr/share/${PN}
+       for i in DateRepeats ProcessRepeats RepeatMasker DupMasker 
RepeatProteinMask; do
+               doexe $i
+               dosym ../share/${PN}/$i /usr/bin/$i
+       done
+
+       perl_set_version
+       insinto "${VENDOR_LIB}"
+       doins "${S}"/*.pm "${S}"/Libraries/*.pm
+       # zap the supposedly misplaced RepeatAnnotationData.pm file
+       rm -r "${S}"/Libraries/*.pm || die
+
+       # if sci-biology/repeatmasker-libraries is installed prevent file 
collision
+       # and do NOT install Libraries/RepeatMaskerLib.embl file which contains
+       # a limited version of the file: 20110419-min
+       rm -r Libraries/RepeatMaskerLib.embl || die
+       insinto /usr/share/${PN}
+       doins -r util Matrices Libraries *.help
+       keepdir /usr/share/${PN}/Libraries
+
+       dodoc README.md INSTALL *.help
+}
+
+pkg_postinst(){
+       cd "${S}" || die
+       einfo "RepeatMasker provides bundled human repeats database from"
+       einfo "    Dfam-1.0 database www.dfam.org"
+       einfo "You can configure which search search engine is to be used and"
+       einfo "Current default search engine defined in"
+       einfo "    ${EPREFIX}${VENDOR_LIB}/RepeatMaskerConfig.pm is:"
+       einfo `grep 'DEFAULT_SEARCH_ENGINE =' RepeatMaskerConfig.pm`
+       einfo "\nSupported search engines are:"
+       optfeature "cross_match" sci-biology/phrap
+       optfeature "rmblast" sci-biology/rmblast
+       optfeature "nhmmer" \>=sci-biology/hmmer-3.1
+       einfo "abblast/wublast from http://blast.advbiocomp.com/licensing";
+       einfo "\nThe repeatmasker-libraries-20160829 (RepBase 21.12) was the 
last"
+       einfo "version compatible with <repeatmasker-4.0.7"
+}

Reply via email to