raster3d-3.0.2.ebuild 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. # Copyright 1999-2012 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=4
  4. inherit eutils fortran-2 flag-o-matic multilib toolchain-funcs versionator prefix
  5. MY_PN="Raster3D"
  6. MY_PV=$(replace_version_separator 2 -)
  7. MY_P="${MY_PN}_${MY_PV}"
  8. DESCRIPTION="Generation high quality raster images of proteins or other molecules"
  9. HOMEPAGE="http://www.bmsc.washington.edu/raster3d/raster3d.html"
  10. SRC_URI="http://www.bmsc.washington.edu/${PN}/${MY_P}.tar.gz -> ${MY_P}.tar"
  11. LICENSE="Artistic-2"
  12. SLOT="0"
  13. KEYWORDS="amd64 ppc x86 ~amd64-linux ~x86-linux"
  14. IUSE="gd tiff"
  15. RDEPEND="
  16. tiff? ( media-libs/tiff:0 )
  17. gd? ( media-libs/gd[jpeg,png] )"
  18. DEPEND="${RDEPEND}"
  19. S="${WORKDIR}/${MY_P}"
  20. src_prepare() {
  21. epatch \
  22. "${FILESDIR}"/${PV}-as-needed.patch \
  23. "${FILESDIR}"/${PV}-gentoo-prefix.patch
  24. sed \
  25. -e "s:MYPF:${PF}:" \
  26. -e "s:MYLIB:$(get_libdir):g" \
  27. -i Makefile.template || \
  28. die "Failed to patch makefile.template"
  29. if ! use gd; then
  30. sed \
  31. -e "/GDLIBS/s:^:#:g" \
  32. -e "/GDDEFS/s:^:#:g" \
  33. -i Makefile.template || die
  34. fi
  35. if ! use tiff; then
  36. sed \
  37. -e "/TLIBS/s:^:#:g" \
  38. -e "/TDEFS/s:^:#:g" \
  39. -i Makefile.template || die
  40. fi
  41. if [[ $(tc-getFC) =~ gfortran ]]; then
  42. append-cflags -Dgfortran
  43. fi
  44. append-fflags -ffixed-line-length-132
  45. eprefixify Makefile.template
  46. cp Makefile.template Makefile.incl || die
  47. }
  48. src_compile() {
  49. local target
  50. local i
  51. if [[ $(tc-getFC) =~ gfortran ]]; then
  52. target="linux"
  53. else
  54. target="linux-$(tc-getFC)"
  55. fi
  56. for i in render.o ${target} all; do
  57. emake \
  58. CFLAGS="${CFLAGS}" \
  59. LDFLAGS="${LDFLAGS}" \
  60. FFLAGS="${FFLAGS}" \
  61. CC="$(tc-getCC)"\
  62. FC="$(tc-getFC)" \
  63. INCDIRS="-I${EPREFIX}/usr/include" \
  64. LIBDIRS="-L${EPREFIX}/usr/$(get_libdir)" \
  65. ${i}
  66. done
  67. }
  68. src_install() {
  69. emake prefix="${ED}"/usr \
  70. bindir="${ED}"/usr/bin \
  71. datadir="${ED}"/usr/share/Raster3D/materials \
  72. mandir="${ED}"/usr/share/man/man1 \
  73. htmldir="${ED}"/usr/share/doc/${PF}/html \
  74. examdir="${ED}"/usr/share/Raster3D/examples \
  75. install
  76. dodir /etc/env.d
  77. echo -e "R3D_LIB=${EPREFIX}/usr/share/${NAME}/materials" > \
  78. "${ED}"/etc/env.d/10raster3d || \
  79. die "Failed to install env file."
  80. }
  81. pkg_postinst() {
  82. elog "Add following line:"
  83. elog "<delegate decode=\"r3d\" command='\"render\" < \"%i\" > \"%o\"' />"
  84. elog "to ${EPREFIX}/usr/$(get_libdir)/ImageMagick-6.5.8/config/delegates.xml"
  85. elog "to make imagemagick use raster3d for .r3d files"
  86. }