ncbi-tools-2.2.26-r2.ebuild 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit eutils flag-o-matic prefix toolchain-funcs
  5. DESCRIPTION="Development toolkit and applications for computational biology, including BLAST"
  6. HOMEPAGE="http://www.ncbi.nlm.nih.gov/"
  7. SRC_URI="ftp://ftp.ncbi.nlm.nih.gov/blast/executables/release/${PV}/ncbi.tar.gz -> ${P}.tar.gz"
  8. SLOT="0"
  9. LICENSE="public-domain"
  10. KEYWORDS="~alpha amd64 ppc64 x86 ~amd64-linux ~x86-linux ~ppc-macos"
  11. IUSE="doc static-libs X"
  12. RDEPEND="
  13. app-shells/tcsh
  14. dev-lang/perl
  15. media-libs/libpng:0=
  16. X? (
  17. media-libs/fontconfig
  18. x11-libs/motif:0=
  19. x11-libs/libICE
  20. x11-libs/libX11
  21. x11-libs/libXft
  22. x11-libs/libXmu
  23. x11-libs/libXt
  24. )"
  25. DEPEND="${RDEPEND}"
  26. S="${WORKDIR}/ncbi"
  27. EXTRA_VIB="asn2all asn2asn"
  28. pkg_setup() {
  29. echo
  30. ewarn 'Please note that the NCBI toolkit (and especially the X'
  31. ewarn 'applications) are known to have compilation and run-time'
  32. ewarn 'problems when compiled with agressive compilation flags. The'
  33. ewarn '"-O3" flag is filtered by the ebuild on the x86 architecture if'
  34. ewarn 'X support is enabled.'
  35. echo
  36. }
  37. src_prepare() {
  38. epatch \
  39. "${FILESDIR}"/${PN}-extra_vib.patch \
  40. "${FILESDIR}"/${P}-bfr-overflow.patch \
  41. "${FILESDIR}"/${P}-format-security.patch \
  42. "${FILESDIR}"/${P}-_DEFAULT_SOURCE.patch
  43. if use ppc || use ppc64; then
  44. epatch "${FILESDIR}"/${PN}-lop.patch
  45. fi
  46. if ! use X; then
  47. sed \
  48. -e "s:\#set HAVE_OGL=0:set HAVE_OGL=0:" \
  49. -e "s:\#set HAVE_MOTIF=0:set HAVE_MOTIF=0:" \
  50. -i "${S}"/make/makedis.csh || die
  51. else
  52. # X applications segfault on startup on x86 with -O3.
  53. use x86 || replace-flags '-O3' '-O2'
  54. fi
  55. # Apply user C flags...
  56. cd "${S}"/platform
  57. sed \
  58. -e "s:-O[s0-9]\?::g" \
  59. -e 's:-m\(cpu\|arch\)=[a-zA-Z0-9]*::g' \
  60. -e 's:-x[A-Z]*::g' \
  61. -e 's:-pipe::g' \
  62. -e "/NCBI_MAKE_SHELL *=/s:=.*:= \"${EPREFIX}/bin/sh\":g" \
  63. -e "/NCBI_AR *=/s:ar:$(tc-getAR):g" \
  64. -e "/NCBI_RANLIB *=/s:ranlib:$(tc-getRANLIB):g" \
  65. -e "/NCBI_CC *=/s:= [a-zA-Z0-9]* := $(tc-getCC) :g" \
  66. -e "/NCBI_OPTFLAG *=/s:$: ${CFLAGS}:g" \
  67. -e "/NCBI_LDFLAGS1 *=/s:$: ${CFLAGS} ${LDFLAGS}:g" \
  68. -e "/NCBI_OGLLIBS *=/s:=.*:= $($(tc-getPKG_CONFIG) --cflags gl glu 2>/dev/null):g" \
  69. -e "/OPENGL_LIBS *=/s:=.*:= $($(tc-getPKG_CONFIG) --libs gl glu 2>/dev/null):g" \
  70. -e "/NCBI_OGLLIBS *=/s:=.*:= $($(tc-getPKG_CONFIG) --libs gl glu 2>/dev/null):g" \
  71. -i * || die
  72. # We use dynamic libraries
  73. sed -i -e "s/-Wl,-Bstatic//" *linux*.ncbi.mk || die
  74. sed \
  75. -re "s:/usr(/bin/.*sh):\1:g" \
  76. -e "s:(/bin/.*sh):${EPREFIX}\1:g" \
  77. -i $(find "${S}" -type f) || die
  78. }
  79. src_compile() {
  80. export EXTRA_VIB
  81. cd "${WORKDIR}"
  82. csh ncbi/make/makedis.csh || die
  83. mkdir "${S}"/cgi "${S}"/real || die
  84. mv "${S}"/bin/*.cgi "${S}"/cgi || die
  85. mv "${S}"/bin/*.REAL "${S}"/real || die
  86. cd "${S}"/demo
  87. emake \
  88. -f ../make/makenet.unx \
  89. CC="$(tc-getCC) ${CFLAGS} -I../include -L../lib" \
  90. LDFLAGS="${LDFLAGS}" \
  91. spidey
  92. cp spidey ../bin/ || die
  93. }
  94. src_install() {
  95. #sci-geosciences/cdat-lite
  96. mv "${S}"/bin/cdscan "${S}"/bin/cdscan-ncbi || die
  97. dobin "${S}"/bin/*
  98. for i in ${EXTRA_VIB}; do
  99. dobin "${S}"/build/${i} || die "Failed to install binaries."
  100. done
  101. use static-libs && dolib.a "${S}"/lib/*.a
  102. mkdir -p "${ED}"/usr/include/ncbi
  103. cp -RL "${S}"/include/* "${ED}"/usr/include/ncbi || \
  104. die "Failed to install headers."
  105. # TODO: wwwblast with webapps
  106. #insinto /usr/share/ncbi/lib/cgi
  107. #doins ${S}/cgi/*
  108. #insinto /usr/share/ncbi/lib/real
  109. #doins ${S}/real/*
  110. # Basic documentation
  111. dodoc "${S}"/{README,VERSION,doc/{*.txt,README.*}}
  112. newdoc "${S}"/doc/fa2htgs/README README.fa2htgs
  113. newdoc "${S}"/config/README README.config
  114. newdoc "${S}"/network/encrypt/README README.encrypt
  115. newdoc "${S}"/network/nsclilib/readme README.nsclilib
  116. newdoc "${S}"/sequin/README README.sequin
  117. mv "${S}"/doc/man/fmerge{,-ncbi}.1 || die
  118. doman "${S}"/doc/man/*
  119. # Hypertext user documentation
  120. dohtml "${S}"/{README.htm,doc/{*.html,*.htm,*.gif}}
  121. insinto /usr/share/doc/${PF}/html
  122. doins -r "${S}"/doc/blast "${S}"/doc/images "${S}"/doc/seq_install
  123. # Developer documentation
  124. if use doc; then
  125. # Demo programs
  126. mkdir "${ED}"/usr/share/ncbi
  127. mv "${S}"/demo "${ED}"/usr/share/ncbi/demo || die
  128. fi
  129. # Shared data (similarity matrices and such) and database directory.
  130. insinto /usr/share/ncbi
  131. doins -r "${S}"/data
  132. dodir /usr/share/ncbi/formatdb
  133. # Default config file to set the path for shared data.
  134. insinto /etc/ncbi
  135. newins "${FILESDIR}"/ncbirc .ncbirc
  136. eprefixify "${ED}"/etc/ncbi/.ncbirc
  137. # Env file to set the location of the config file and BLAST databases.
  138. newenvd "${FILESDIR}"/21ncbi-r1 21ncbi
  139. }