pgplot-5.2.2-r6.ebuild 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=4
  4. inherit eutils fortran-2 toolchain-funcs multilib
  5. MY_P="${PN}${PV//.}"
  6. DESCRIPTION="FORTRAN/C device-independent scientific graphic library"
  7. HOMEPAGE="http://www.astro.caltech.edu/~tjp/pgplot/"
  8. SRC_URI="ftp://ftp.astro.caltech.edu/pub/pgplot/${MY_P}.tar.gz"
  9. SLOT="0"
  10. LICENSE="free-noncomm"
  11. KEYWORDS="amd64 ~arm ~ia64 ~ppc x86 ~amd64-linux ~x86-linux"
  12. IUSE="doc motif static-libs tk"
  13. RDEPEND="
  14. media-libs/libpng
  15. x11-libs/libX11
  16. x11-libs/libXt
  17. motif? ( >=x11-libs/motif-2.3:0 )
  18. tk? ( dev-lang/tk )"
  19. DEPEND="${RDEPEND}
  20. doc? ( virtual/latex-base )"
  21. S="${WORKDIR}/${PN}"
  22. src_prepare() {
  23. epatch \
  24. "${FILESDIR}"/${PN}-drivers.patch \
  25. "${FILESDIR}"/${PN}-makemake.patch \
  26. "${FILESDIR}"/${PN}-compile-setup.patch \
  27. "${FILESDIR}"/${PN}-headers.patch \
  28. "${FILESDIR}"/${PN}-libpng15.patch \
  29. "${FILESDIR}"/${PN}-tk86.patch
  30. # gfortran < 4.3 does not compile gif, pp and wd drivers
  31. if [[ $(tc-getFC) == *gfortran* ]] &&
  32. [[ $(gcc-major-version)$(gcc-minor-version) -lt 43 ]] ; then
  33. echo
  34. ewarn "Warning!"
  35. ewarn "gfortran < 4.3 selected: does not compile all drivers"
  36. ewarn "disabling gif, wd, and ppd drivers"
  37. ewarn "if you want more drivers, use gfortran >= 4.3"
  38. echo
  39. sed -i \
  40. -e 's/GIDRIV/! GIDRIV/g' \
  41. -e 's/PPDRIV/! GIDRIV/g' \
  42. -e 's/WDDRIV/! GIDRIV/g' \
  43. drivers.list || die "sed drivers failed"
  44. fi
  45. # fix pointers for 64 bits
  46. if use amd64 || use ia64; then
  47. sed -i \
  48. -e 's/INTEGER PIXMAP/INTEGER*8 PIXMAP/g' \
  49. drivers/{gi,pp,wd}driv.f || die "sed 64bits failed"
  50. fi
  51. cp sys_linux/g77_gcc.conf local.conf
  52. sed -i \
  53. -e "s:FCOMPL=.*:FCOMPL=\"$(tc-getFC)\":g" \
  54. -e "s:CCOMPL=.*:CCOMPL=\"$(tc-getCC)\":g" \
  55. local.conf || die "sed flags failed"
  56. if [[ "$(tc-getFC)" = if* ]]; then
  57. sed -i \
  58. -e 's/-Wall//g' \
  59. -e 's/TK_LIBS="/TK_LIBS="-nofor-main /' \
  60. local.conf || die "sed drivers failed"
  61. fi
  62. sed -i \
  63. -e "s:/usr/local/pgplot:/usr/$(get_libdir)/pgplot:g" \
  64. -e "s:/usr/local/bin:/usr/bin:g" \
  65. src/grgfil.f makehtml maketex || die "sed path failed"
  66. use motif && sed -i -e '/XMDRIV/s/!//' drivers.list
  67. use tk && sed -i -e '/TKDRIV/s/!//' drivers.list
  68. }
  69. src_configure() {
  70. ./makemake . linux
  71. # post makefile creation prefix hack
  72. sed -i -e "s|/usr|${EROOT}/usr|g" makefile || die
  73. }
  74. src_compile() {
  75. emake \
  76. CFLAGS="${CFLAGS} -fPIC" \
  77. FFLAGS="${FFLAGS} -fPIC" \
  78. shared cpg-shared pgxwin_server pgdisp pgplot.doc
  79. use tk && emake CFLAGS="${CFLAGS} -fPIC" libtkpgplot.so
  80. use motif && emake CFLAGS="${CFLAGS} -fPIC" libXmPgplot.so
  81. emake -j1 clean
  82. use static-libs && emake all cpg
  83. if use doc; then
  84. export VARTEXFONTS="${T}/fonts"
  85. emake pgplot.html pgplot-routines.tex
  86. pdflatex pgplot-routines.tex
  87. pdflatex pgplot-routines.tex
  88. fi
  89. # this just cleans out not needed files
  90. emake -j1 clean
  91. }
  92. src_test() {
  93. # i can go to 16
  94. local i j
  95. for i in 1 2 3; do
  96. emake pgdemo${i}
  97. # j can also be LATEX CPS...
  98. for j in NULL PNG PS CPS LATEX; do
  99. local testexe=./test_${j}_${i}
  100. echo "LD_LIBRARY_PATH=. ./pgdemo${i} <<EOF" > ${testexe}
  101. echo "/${j}" >> ${testexe}
  102. echo "EOF" >> ${testexe}
  103. sh ${testexe} || die "test ${i} failed"
  104. done
  105. done
  106. }
  107. src_install() {
  108. insinto /usr/$(get_libdir)/pgplot
  109. doins grfont.dat grexec.f *.inc rgb.txt
  110. echo "PGPLOT_FONT=${EROOT%/}/usr/$(get_libdir)/pgplot/grfont.dat" >> 99pgplot
  111. doenvd 99pgplot
  112. dolib.so libpgplot.so*
  113. dobin pgxwin_server pgdisp
  114. # C binding
  115. insinto /usr/include
  116. doins cpgplot.h
  117. dolib.so libcpgplot.so*
  118. if use motif; then
  119. insinto /usr/include
  120. doins XmPgplot.h
  121. dolib.so libXmPgplot.so*
  122. fi
  123. if use tk; then
  124. insinto /usr/include
  125. doins tkpgplot.h
  126. dolib.so libtkpgplot.so*
  127. fi
  128. use static-libs && dolib.a lib*pgplot.a
  129. # minimal doc
  130. dodoc aaaread.me pgplot.doc
  131. newdoc pgdispd/aaaread.me pgdispd.txt
  132. if use doc; then
  133. dodoc cpg/cpgplot.doc applications/curvefit/curvefit.doc
  134. dohtml pgplot.html
  135. insinto /usr/share/doc/${PF}
  136. doins pgplot-routines.pdf pgplot-routines.tex
  137. insinto /usr/share/doc/${PF}/examples
  138. doins examples/* cpg/cpgdemo.c
  139. insinto /usr/share/doc/${PF}/applications
  140. doins -r applications/*
  141. if use motif; then
  142. insinto /usr/share/doc/${PF}/pgm
  143. doins pgmf/* drivers/xmotif/pgmdemo.c
  144. fi
  145. if use tk; then
  146. insinto /usr/share/doc/${PF}/pgtk
  147. doins drivers/xtk/pgtkdemo.*
  148. fi
  149. fi
  150. }