1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
9 PYTHON_COMPAT=( python2_7 )
11 inherit cmake-utils flag-o-matic fortran-2 java-pkg-opt-2 python-single-r1 toolchain-funcs virtualx wxwidgets
13 DESCRIPTION="Multi-language scientific plotting library"
14 HOMEPAGE="http://plplot.sourceforge.net/"
15 SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
18 SLOT="0/14" # SONAME of libplplot.so
19 KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
20 IUSE="cairo cxx doc +dynamic examples fortran gd java jpeg latex lua ocaml octave pdf
21 pdl png python qhull qt5 shapefile svg tcl test threads tk truetype wxwidgets X"
22 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} ) qt5? ( dynamic ) test? ( latex ) tk? ( tcl )"
23 RESTRICT="octave? ( test )"
26 cairo? ( x11-libs/cairo:0=[svg?,X] )
27 gd? ( media-libs/gd:2=[jpeg?,png?] )
28 java? ( >=virtual/jre-1.5:* )
30 app-text/ghostscript-gpl
33 lua? ( dev-lang/lua:0= )
37 cairo? ( dev-ml/cairo-ocaml[gtk] )
39 octave? ( sci-mathematics/octave:0= )
40 pdf? ( media-libs/libharu:0= )
47 dev-python/numpy[${PYTHON_USEDEP}]
48 qt5? ( dev-python/PyQt5[${PYTHON_USEDEP}] )
50 qhull? ( media-libs/qhull:0= )
54 dev-qt/qtprintsupport:5
56 shapefile? ( sci-libs/shapelib:0= )
68 gd? ( media-libs/gd:2=[truetype] )
71 x11-libs/wxGTK:${WX_GTK_VER}=[X]
72 x11-libs/agg:0=[truetype?]
86 ocaml? ( dev-ml/findlib )
87 octave? ( >=dev-lang/swig-3.0.12 )
88 python? ( dev-lang/swig )
90 media-fonts/font-misc-misc
91 media-fonts/font-cursor-misc
95 "${FILESDIR}"/${PN}-5.9.6-python.patch
96 "${FILESDIR}"/${PN}-5.11.0-octave.patch
97 "${FILESDIR}"/${PN}-5.12.0-multiarch.patch
98 "${FILESDIR}"/${PN}-5.12.0-java-install-path.patch
99 "${FILESDIR}"/${PN}-5.12.0-ocaml-remove-rpath.patch
103 use python && python-single-r1_pkg_setup
104 use java && java-pkg-opt-2_pkg_setup
105 use fortran && fortran-2_pkg_setup
109 use wxwidgets && need-wxwidgets unicode
110 cmake-utils_src_prepare
112 # avoid installing license
113 sed -i -e '/COPYING.LIB/d' CMakeLists.txt || die
115 # prexify hard-coded /usr/include in cmake modules
117 -e "s:/usr/include:${EPREFIX}/usr/include:g" \
118 -e "s:/usr/lib:${EPREFIX}/usr/$(get_libdir):g" \
119 -e "s:/usr/share:${EPREFIX}/usr/share:g" \
120 cmake/modules/*.cmake || die
122 # change default install directories for doc and examples
124 while IFS="" read -d $'\0' -r f; do
125 sed -i -e 's:${DATA_DIR}/examples:${DOC_DIR}/examples:g' "${f}" || die
126 done < <(find "${S}" -name CMakeLists.txt -print0)
129 -e 's:${VERSION}::g' \
130 -e "s:doc/\${PACKAGE}:doc/${PF}:" \
131 cmake/modules/instdirs.cmake || die
133 java-utils-2_src_prepare
137 # - don't build doc, it pulls in a whole stack of horrible dependencies
139 # * Ada is a mess in Gentoo, don't use
140 # * D has been removed from Gentoo, don't use
141 # * Qt4 has been disabled, as it is deprecated and unsupported upstream
142 # - DPLD_* drivers need to use ON/OFF instead of the usex defaults yes/no, as
143 # the testsuite performs a string comparison to determine which tests to run
145 # Octave bindings now require C++11 support, #609980
146 append-cxxflags -std=c++11
149 # The build system does not honour CMAKE_INSTALL_LIBDIR as a
150 # relative dir, which is against the spirit of GNUInstallDirs, #610066
151 -DCMAKE_INSTALL_LIBDIR="${EPREFIX}"/usr/$(get_libdir)
156 -DCMAKE_SKIP_RPATH=ON
157 -DPREBUILT_DOC=$(usex doc)
158 -DHAVE_SHAPELIB=$(usex shapefile)
159 -DWITH_FREETYPE=$(usex truetype)
160 -DPL_HAVE_PTHREAD=$(usex threads)
161 -DPL_HAVE_QHULL=$(usex qhull)
162 -DPLPLOT_USE_QT5=$(usex qt5)
165 -DTEST_DYNDRIVERS=OFF
166 -DBUILD_TEST=$(usex test)
171 -DENABLE_ocaml=$(usex ocaml)
173 -DENABLE_cxx=$(usex cxx)
174 -DENABLE_DYNDRIVERS=$(usex dynamic)
175 -DENABLE_f95=$(usex fortran)
176 -DENABLE_java=$(usex java)
177 -DENABLE_lua=$(usex lua)
178 -DTRY_OCTAVE4=$(usex octave)
179 -DENABLE_octave=$(usex octave)
180 -DENABLE_pdl=$(usex pdl)
181 -DENABLE_python=$(usex python)
182 -DENABLE_qt=$(usex qt5)
183 -DENABLE_tcl=$(usex tcl)
184 -DENABLE_itcl=$(usex tcl)
185 -DENABLE_tk=$(usex tk)
186 -DENABLE_itk=$(usex tk)
187 -DENABLE_wxwidgets=$(usex wxwidgets)
201 $(usex cairo "" "-DDEFAULT_NO_CAIRO_DEVICES=ON")
202 -DPLD_epscairo=$(usex cairo ON OFF)
203 -DPLD_extcairo=$(usex cairo ON OFF)
204 -DPLD_memcairo=$(usex cairo ON OFF)
205 -DPLD_pdfcairo=$(usex cairo ON OFF)
206 -DPLD_pngcairo=$(usex cairo ON OFF)
207 -DPLD_pscairo=$(usex cairo ON OFF)
208 -DPLD_svgcairo=$(usex cairo ON OFF)
209 -DPLD_xcairo=$(usex cairo ON OFF)
211 -DPLD_ps=$(usex latex ON OFF)
213 -DPLD_pdf=$(usex pdf ON OFF)
215 -DPLD_aqt=$(usex qt5 ON OFF)
216 -DPLD_bmpqt=$(usex qt5 ON OFF)
217 -DPLD_epsqt=$(usex qt5 ON OFF)
218 -DPLD_extqt=$(usex qt5 ON OFF)
219 -DPLD_jpgqt=$(usex qt5 ON OFF)
220 -DPLD_memqt=$(usex qt5 ON OFF)
221 -DPLD_pdfqt=$(usex qt5 ON OFF)
222 -DPLD_pngqt=$(usex qt5 ON OFF)
223 -DPLD_ppmqt=$(usex qt5 ON OFF)
224 -DPLD_qtwidget=$(usex qt5 ON OFF)
225 -DPLD_svgqt=$(usex qt5 ON OFF)
226 -DPLD_tiffqt=$(usex qt5 ON OFF)
228 -DPLD_svg=$(usex svg ON OFF)
230 -DPLD_ntk=$(usex tk ON OFF)
231 -DPLD_tk=$(usex tk ON OFF)
232 -DPLD_tkwin=$(usex tk ON OFF)
234 -DPLD_psttf=$(usex truetype ON OFF)
236 -DPLD_wxwidgets=$(usex wxwidgets ON OFF)
238 -DPLD_xfig=$(usex X ON OFF)
239 -DPLD_xwin=$(usex X ON OFF)
242 use truetype && mycmakeargs+=(
243 -DPL_FREETYPE_FONT_PATH="${EPREFIX}"/usr/share/fonts/freefont
245 use shapefile && mycmakeargs+=(
246 -DSHAPELIB_INCLUDE_DIR="${EPREFIX}"/usr/include/libshp
248 use ocaml && mycmakeargs+=(
249 -DOCAML_INSTALL_DIR="$(ocamlc -where)"
251 use python && mycmakeargs+=(
252 -DENABLE_pyqt5=$(usex qt5)
255 cmake-utils_src_configure
257 # clean up bloated pkg-config files (help linking properly on prefix)
259 -e "/Cflags/s:-I\(${EPREFIX}\|\)/usr/include[[:space:]]::g" \
260 -e "/Libs/s:-L\(${EPREFIX}\|\)/usr/lib\(64\|\)[[:space:]]::g" \
261 -e "s:${LDFLAGS}::g" \
262 "${BUILD_DIR}"/pkgcfg/*pc || die
266 virtx cmake-utils_src_test
270 cmake-utils_src_install
272 if use examples; then
273 docompress -x /usr/share/doc/${PF}/examples
275 rm -r "${ED%/}"/usr/share/doc/${PF}/examples || die
279 java-pkg_dojar "${BUILD_DIR}"/examples/java/${PN}.jar
280 java-pkg_regso "${EPREFIX}"/usr/$(get_libdir)/jni/plplotjavac_wrap.so