1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit eutils fortran-2 toolchain-funcs
10 DESCRIPTION="FORTRAN/C device-independent scientific graphic library"
11 HOMEPAGE="http://www.astro.caltech.edu/~tjp/pgplot/"
12 SRC_URI="ftp://ftp.astro.caltech.edu/pub/pgplot/${MY_P}.tar.gz"
15 LICENSE="free-noncomm"
16 KEYWORDS="amd64 ~arm ~ia64 ~ppc x86 ~amd64-linux ~x86-linux"
17 IUSE="doc motif static-libs tk"
23 motif? ( x11-libs/motif:= )
24 tk? ( dev-lang/tk:= )"
26 doc? ( virtual/latex-base )"
31 "${FILESDIR}"/${PN}-drivers.patch
32 "${FILESDIR}"/${PN}-makemake.patch
33 "${FILESDIR}"/${PN}-compile-setup.patch
34 "${FILESDIR}"/${PN}-headers.patch
35 "${FILESDIR}"/${PN}-libpng15.patch
36 "${FILESDIR}"/${PN}-tk86.patch
41 # gfortran < 4.3 does not compile gif, pp and wd drivers
42 if [[ $(tc-getFC) == *gfortran* ]] &&
43 [[ $(gcc-major-version)$(gcc-minor-version) -lt 43 ]] ; then
45 ewarn "gfortran < 4.3 selected: does not compile all drivers"
46 ewarn "disabling gif, wd, and ppd drivers"
47 ewarn "if you want more drivers, use gfortran >= 4.3"
48 sed -e 's/GIDRIV/! GIDRIV/g' \
49 -e 's/PPDRIV/! GIDRIV/g' \
50 -e 's/WDDRIV/! GIDRIV/g' \
51 -i drivers.list || die "sed drivers failed"
54 # fix pointers for 64 bits
55 if use amd64 || use ia64; then
56 sed -e 's/INTEGER PIXMAP/INTEGER*8 PIXMAP/g' \
57 -i drivers/{gi,pp,wd}driv.f || die "sed 64bits failed"
60 cp sys_linux/g77_gcc.conf local.conf
62 sed -e "s:FCOMPL=.*:FCOMPL=\"$(tc-getFC)\":g" \
63 -e "s:CCOMPL=.*:CCOMPL=\"$(tc-getCC)\":g" \
64 -i local.conf || die "sed flags failed"
66 if [[ "$(tc-getFC)" = if* ]]; then
68 -e 's/TK_LIBS="/TK_LIBS="-nofor-main /' \
69 -i local.conf || die "sed drivers failed"
72 sed -e "s:/usr/local/pgplot:${EPREFIX}/usr/$(get_libdir)/pgplot:g" \
73 -e "s:/usr/local/bin:${EPREFIX}/usr/bin:g" \
74 -i src/grgfil.f makehtml maketex || die "sed path failed"
76 use motif && sed -i -e '/XMDRIV/s/!//' drivers.list
77 use tk && sed -i -e '/TKDRIV/s/!//' drivers.list
82 # post makefile creation prefix hack
83 sed -i -e "s|/usr|${EPREFIX}/usr|g" makefile || die
88 CFLAGS="${CFLAGS} -fPIC" \
89 FFLAGS="${FFLAGS} -fPIC" \
90 shared cpg-shared pgxwin_server pgdisp pgplot.doc
92 use tk && emake CFLAGS="${CFLAGS} -fPIC" libtkpgplot.so
93 use motif && emake CFLAGS="${CFLAGS} -fPIC" libXmPgplot.so
96 use static-libs && emake all cpg
99 export VARTEXFONTS="${T}/fonts"
100 emake pgplot.html pgplot-routines.tex
101 pdflatex pgplot-routines.tex
102 pdflatex pgplot-routines.tex
105 # this just cleans out not needed files
114 # j can also be LATEX CPS...
115 for j in NULL PNG PS CPS LATEX; do
116 local testexe=./test_${j}_${i}
117 echo "LD_LIBRARY_PATH=. ./pgdemo${i} <<EOF" > ${testexe}
118 echo "/${j}" >> ${testexe}
119 echo "EOF" >> ${testexe}
120 sh ${testexe} || die "test ${i} failed"
126 insinto /usr/$(get_libdir)/pgplot
127 doins grfont.dat grexec.f *.inc rgb.txt
128 echo "PGPLOT_FONT=${EPREFIX}/usr/$(get_libdir)/pgplot/grfont.dat" >> 99pgplot
131 dolib.so libpgplot.so*
132 dobin pgxwin_server pgdisp
137 dolib.so libcpgplot.so*
142 dolib.so libXmPgplot.so*
148 dolib.so libtkpgplot.so*
151 use static-libs && dolib.a lib*pgplot.a
154 dodoc aaaread.me pgplot.doc
155 newdoc pgdispd/aaaread.me pgdispd.txt
158 dodoc cpg/cpgplot.doc applications/curvefit/curvefit.doc pgplot.html
159 dodoc pgplot-routines.pdf pgplot-routines.tex
160 insinto /usr/share/doc/${PF}/examples
161 doins examples/* cpg/cpgdemo.c
162 insinto /usr/share/doc/${PF}/applications
163 doins -r applications/*
165 insinto /usr/share/doc/${PF}/pgm
166 doins pgmf/* drivers/xmotif/pgmdemo.c
169 insinto /usr/share/doc/${PF}/pgtk
170 doins drivers/xtk/pgtkdemo.*