ccpn-2.4.2_p150413.ebuild 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. # Copyright 1999-2015 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. PYTHON_COMPAT=( python2_7 )
  5. PYTHON_REQ_USE="ssl,tk"
  6. inherit eutils flag-o-matic multilib portability python-single-r1 toolchain-funcs versionator
  7. PATCHSET="${PV##*_p}"
  8. MY_PN="${PN}mr"
  9. MY_PV="$(replace_version_separator 3 _ ${PV%%_p*})"
  10. MY_MAJOR="$(get_version_component_range 1-3)"
  11. DESCRIPTION="The Collaborative Computing Project for NMR"
  12. HOMEPAGE="http://www.ccpn.ac.uk/ccpn"
  13. SRC_URI="http://www-old.ccpn.ac.uk/download/${MY_PN}/analysis${MY_PV}.tar.gz"
  14. [[ -n ${PATCHSET} ]] \
  15. && SRC_URI+=" https://dev.gentoo.org/~jlec/distfiles/ccpn-update-${MY_MAJOR}-${PATCHSET}.patch.xz"
  16. SLOT="0"
  17. LICENSE="|| ( CCPN LGPL-2.1 )"
  18. KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
  19. IUSE="+opengl"
  20. REQUIRED_USE="${PYTHON_REQUIRED_USE}"
  21. RDEPEND="
  22. ${PYTHON_DEPS}
  23. dev-lang/tk:0=[threads]
  24. dev-python/numpy[${PYTHON_USEDEP}]
  25. dev-tcltk/tix
  26. =sci-libs/ccpn-data-"${MY_MAJOR}"*[${PYTHON_USEDEP}]
  27. sci-biology/psipred
  28. x11-libs/libXext
  29. x11-libs/libX11
  30. opengl? (
  31. media-libs/freeglut
  32. dev-python/pyglet[${PYTHON_USEDEP}]
  33. )"
  34. DEPEND="${RDEPEND}"
  35. RESTRICT="mirror"
  36. S="${WORKDIR}"/${MY_PN}/${MY_PN}$(get_version_component_range 1-2)
  37. src_prepare() {
  38. [[ -n ${PATCHSET} ]] && \
  39. EPATCH_OPTS="-p2" epatch "${WORKDIR}"/ccpn-update-${MY_MAJOR}-${PATCHSET}.patch
  40. epatch "${FILESDIR}"/2.3.1-parallel.patch
  41. append-lfs-flags
  42. sed \
  43. -e "/PSIPRED_DIR/s:'data':'share/psipred/data':g" \
  44. -e "s:weights_s:weights:g" \
  45. -i python/ccpnmr/analysis/wrappers/Psipred.py || die
  46. local tk_ver
  47. local myconf
  48. tk_ver="$(best_version dev-lang/tk | cut -d- -f3 | cut -d. -f1,2)"
  49. if use opengl; then
  50. GLUT_NEED_INIT="-DNEED_GLUT_INIT"
  51. IGNORE_GL_FLAG=""
  52. GL_FLAG="-DUSE_GL_TRUE"
  53. GL_DIR="${EPREFIX}/usr"
  54. GL_LIB="-lglut -lGLU -lGL"
  55. GL_INCLUDE_FLAGS="-I\$(GL_DIR)/include"
  56. GL_LIB_FLAGS=""
  57. else
  58. IGNORE_GL_FLAG="-DIGNORE_GL"
  59. GL_FLAG="-DUSE_GL_FALSE"
  60. fi
  61. GLUT_NOT_IN_GL=""
  62. GLUT_FLAG="\$(GLUT_NEED_INIT) \$(GLUT_NOT_IN_GL)"
  63. rm -rf data model doc license || die
  64. sed \
  65. -e "s|/usr|${EPREFIX}/usr|g" \
  66. -e "s|^\(CC =\).*|\1 $(tc-getCC)|g" \
  67. -e "s|^\(OPT_FLAG =\).*|\1 ${CPPFLAGS} ${CFLAGS}|g" \
  68. -e "s|^\(LINK_FLAGS =.*\)|\1 ${LDFLAGS}|g" \
  69. -e "s|^\(IGNORE_GL_FLAG =\).*|\1 ${IGNORE_GL_FLAG}|g" \
  70. -e "s|^\(GL_FLAG =\).*|\1 ${GL_FLAG}|g" \
  71. -e "s|^\(GL_DIR =\).*|\1 ${GL_DIR}|g" \
  72. -e "s|^\(GL_LIB =\).*|\1 ${GL_LIB}|g" \
  73. -e "s|^\(GL_LIB_FLAGS =\).*|\1 ${GL_LIB_FLAGS}|g" \
  74. -e "s|^\(GL_INCLUDE_FLAGS =\).*|\1 ${GL_INCLUDE_FLAGS}|g" \
  75. -e "s|^\(GLUT_NEED_INIT =\).*|\1 ${GLUT_NEED_INIT}|g" \
  76. -e "s|^\(GLUT_NOT_IN_GL =\).*|\1|g" \
  77. -e "s|^\(X11_LIB_FLAGS =\).*|\1 -L${EPREFIX}/usr/$(get_libdir)|g" \
  78. -e "s|^\(TCL_LIB_FLAGS =\).*|\1 -L${EPREFIX}/usr/$(get_libdir)|g" \
  79. -e "s|^\(TK_LIB =\).*|\1 -ltk|g" \
  80. -e "s|^\(TK_LIB_FLAGS =\).*|\1 -L${EPREFIX}/usr/$(get_libdir)|g" \
  81. -e "s|^\(PYTHON_INCLUDE_FLAGS =\).*|\1 -I$(python_get_includedir)|g" \
  82. -e "s|^\(PYTHON_LIB =\).*|\1 -l${EPYTHON}|g" \
  83. c/environment_default.txt > c/environment.txt || die
  84. sed \
  85. -e 's:ln -s:cp -f:g' \
  86. -i $(find python -name linkSharedObjs) || die
  87. }
  88. src_compile() {
  89. emake -C c all
  90. emake -C c links
  91. }
  92. src_install() {
  93. local libdir
  94. local tkver
  95. local _wrapper
  96. find . -name "*.pyc" -type f -delete || die
  97. libdir=$(get_libdir)
  98. tkver=$(best_version dev-lang/tk | cut -d- -f3 | cut -d. -f1,2)
  99. _wrapper="analysis dangle dataShifter depositionFileImporter eci formatConverter pipe2azara xeasy2azara extendNmr"
  100. for wrapper in ${_wrapper}; do
  101. sed \
  102. -e "s|gentoo_sitedir|$(python_get_sitedir)|g" \
  103. -e "s|gentoolibdir|${EPREFIX}/usr/${libdir}|g" \
  104. -e "s|gentootk|${EPREFIX}/usr/${libdir}/tk${tkver}|g" \
  105. -e "s|gentootcl|${EPREFIX}/usr/${libdir}/tclk${tkver}|g" \
  106. -e "s|gentoopython|${EPYTHON}|g" \
  107. -e "s|gentoousr|${EPREFIX}/usr|g" \
  108. -e "s|//|/|g" \
  109. "${FILESDIR}"/${wrapper} > "${T}"/${wrapper} || die "Fail fix ${wrapper}"
  110. dobin "${T}"/${wrapper}
  111. done
  112. local in_path=$(python_get_sitedir)/${PN}
  113. local files
  114. local pydocs
  115. pydocs="$(find python -name doc -type d)"
  116. rm -rf ${pydocs} || die
  117. for i in python/memops/format/compatibility/{Converters,part2/Converters2}.py; do
  118. sed \
  119. -e 's|#from __future__|from __future__|g' \
  120. -i ${i} || die
  121. done
  122. dodir ${in_path#${EPREFIX}}/c
  123. ebegin "Installing main files"
  124. python_moduleinto ${PN}
  125. python_domodule python
  126. eend
  127. ebegin "Adjusting permissions"
  128. for _file in $(find "${ED}" -type f -name "*so"); do
  129. chmod 755 ${_file}
  130. done
  131. eend
  132. python_optimize
  133. }