sparky-3.115-r2.ebuild 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. PYTHON_COMPAT=( python2_7 )
  5. PYTHON_REQ_USE="tk"
  6. inherit flag-o-matic prefix python-single-r1 toolchain-funcs
  7. DESCRIPTION="Graphical NMR assignment and integration program for large polymers"
  8. HOMEPAGE="http://www.cgl.ucsf.edu/home/sparky/"
  9. SRC_URI="http://www.cgl.ucsf.edu/home/sparky/distrib-${PV}/${PN}-source-${PV}.tar.gz"
  10. LICENSE="sparky"
  11. SLOT="0"
  12. KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
  13. IUSE="examples"
  14. REQUIRED_USE="${PYTHON_REQUIRED_USE}"
  15. RDEPEND="${PYTHON_DEPS}
  16. app-shells/tcsh
  17. dev-lang/tcl:0=
  18. dev-lang/tk:0="
  19. DEPEND="${RDEPEND}"
  20. RESTRICT="mirror"
  21. S="${WORKDIR}/${PN}"
  22. PATCHES=(
  23. "${FILESDIR}"/${PV}-ldflags.patch
  24. "${FILESDIR}"/${PV}-wrapper-r1.patch
  25. "${FILESDIR}"/${PV}-paths.patch
  26. "${FILESDIR}"/${PV}-makefile.patch
  27. "${FILESDIR}"/${PV}-fix-c++14.patch
  28. )
  29. pkg_setup() {
  30. python-single-r1_pkg_setup
  31. TKVER=$(best_version dev-lang/tk | cut -d- -f3 | cut -d. -f1,2)
  32. PYVER=${EPYTHON#python}
  33. }
  34. src_prepare() {
  35. default
  36. sed -i \
  37. -e "s:^\(set PYTHON =\).*:\1 ${PYTHON}:g" \
  38. -e "s:^\(setenv SPARKY_INSTALL[[:space:]]*\).*:\1 ${EPREFIX}/usr/$(get_libdir)/${PN}:g" \
  39. -e "s:tcl8.4:tcl${TKVER}:g" \
  40. -e "s:tk8.4:tk${TKVER}:g" \
  41. -e "s:^\(setenv TCLTK_LIB[[:space:]]*\).*:\1 ${EPREFIX}/usr/$(get_libdir):g" \
  42. "${S}"/bin/sparky || die
  43. eprefixify "${S}"/bin/sparky
  44. }
  45. src_compile() {
  46. emake \
  47. SPARKY="${S}" \
  48. PYTHON_VERSION="${PYVER}" \
  49. PYTHON_PREFIX="${EPREFIX}/usr" \
  50. PYTHON_LIB="${EPREFIX}/usr/$(get_libdir)" \
  51. PYTHON_INC="$(python_get_includedir)" \
  52. TK_PREFIX="${EPREFIX}/usr" \
  53. TCLTK_VERSION="${TKVER}" \
  54. TKLIBS="-L${EPREFIX}/usr/$(get_libdir)/ -ltk -ltcl -lX11" \
  55. CXX="$(tc-getCXX)" \
  56. CC="$(tc-getCC)" \
  57. LDSHARED="-shared" \
  58. binaries
  59. rm c++/*.o || die
  60. emake \
  61. SPARKY="${S}" \
  62. PYTHON_VERSION="${PYVER}" \
  63. PYTHON_PREFIX="${EPREFIX}/usr" \
  64. PYTHON_LIB="${EPREFIX}/usr/$(get_libdir)" \
  65. PYTHON_INC="$(python_get_includedir)" \
  66. TK_PREFIX="${EPREFIX}/usr" \
  67. TCLTK_VERSION="${TKVER}" \
  68. TKLIBS="-L${EPREFIX}/usr/$(get_libdir)/ -ltk -ltcl -lX11" \
  69. CXX="$(tc-getCXX)" \
  70. CC="$(tc-getCC)" \
  71. CXXFLAGS="${CXXFLAGS} -fPIC" \
  72. CFLAGS="${CFLAGS} -fPIC" \
  73. LDSHARED="-shared -fPIC" \
  74. libraries
  75. }
  76. src_install() {
  77. # The symlinks are needed to avoid hacking the complete code to fix the locations
  78. dobin c++/{{bruk,matrix,peaks,pipe,vnmr}2ucsf,ucsfdata,sparky-no-python} bin/${PN}
  79. insinto /usr/share/${PN}/
  80. doins lib/{print-prolog.ps,Sparky}
  81. dosym ../../share/${PN}/print-prolog.ps /usr/$(get_libdir)/${PN}/print-prolog.ps
  82. dosym ../../share/${PN}/Sparky /usr/$(get_libdir)/${PN}/Sparky
  83. python_moduleinto ${PN}
  84. python_domodule python/*.py c++/{spy.so,_tkinter.so}
  85. dosym ../${EPYTHON}/site-packages /usr/$(get_libdir)/${PN}/python
  86. rm manual/{pkzip.cfg,Makefile} || die
  87. mv {manual/,}manual.ps || die
  88. local DOCS=( README manual.ps )
  89. local HTML_DOCS=( manual/. )
  90. einstalldocs
  91. newdoc python/README README.python
  92. dosym ../../share/doc/${PF}/html /usr/$(get_libdir)/${PN}/manual
  93. if use examples; then
  94. dodoc -r example
  95. dosym ../../share/doc/${PF}/example /usr/$(get_libdir)/${PN}/example
  96. fi
  97. }