plplot-5.12.0-r1.ebuild 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. WX_GTK_VER=3.0-gtk3
  5. FORTRAN_NEEDED=fortran
  6. FORTRAN_STANDARD=95
  7. PYTHON_COMPAT=( python2_7 )
  8. inherit cmake-utils flag-o-matic fortran-2 java-pkg-opt-2 python-single-r1 toolchain-funcs virtualx wxwidgets
  9. DESCRIPTION="Multi-language scientific plotting library"
  10. HOMEPAGE="http://plplot.sourceforge.net/"
  11. SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
  12. LICENSE="LGPL-2"
  13. SLOT="0/14" # SONAME of libplplot.so
  14. KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
  15. IUSE="cairo cxx doc +dynamic examples fortran gd java jpeg latex lua octave pdf
  16. pdl png python qhull qt5 shapefile svg tcl test threads tk truetype wxwidgets X"
  17. REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} ) qt5? ( dynamic ) test? ( latex ) tk? ( tcl )"
  18. RESTRICT="octave? ( test )"
  19. RDEPEND="
  20. cairo? ( x11-libs/cairo:0=[svg?,X] )
  21. gd? ( media-libs/gd:2=[jpeg?,png?] )
  22. java? ( >=virtual/jre-1.5:* )
  23. latex? (
  24. app-text/ghostscript-gpl
  25. virtual/latex-base
  26. )
  27. lua? ( dev-lang/lua:0= )
  28. octave? ( sci-mathematics/octave:0= )
  29. pdf? ( media-libs/libharu:0= )
  30. pdl? (
  31. dev-perl/PDL
  32. dev-perl/XML-DOM
  33. )
  34. python? (
  35. ${PYTHON_DEPS}
  36. dev-python/numpy[${PYTHON_USEDEP}]
  37. qt5? ( dev-python/PyQt5[${PYTHON_USEDEP}] )
  38. )
  39. qhull? ( media-libs/qhull:0= )
  40. qt5? (
  41. dev-qt/qtgui:5
  42. dev-qt/qtsvg:5
  43. dev-qt/qtprintsupport:5
  44. )
  45. shapefile? ( sci-libs/shapelib:0= )
  46. tcl? (
  47. dev-lang/tcl:0=
  48. dev-tcltk/itcl:0=
  49. tk? (
  50. dev-lang/tk:0=
  51. dev-tcltk/itk
  52. )
  53. )
  54. truetype? (
  55. media-fonts/freefont
  56. media-libs/lasi:0=
  57. gd? ( media-libs/gd:2=[truetype] )
  58. )
  59. wxwidgets? (
  60. x11-libs/wxGTK:${WX_GTK_VER}=[X]
  61. x11-libs/agg:0=[truetype?]
  62. )
  63. X? (
  64. x11-libs/libX11:0=
  65. x11-libs/libXau:0=
  66. x11-libs/libXdmcp:0=
  67. )"
  68. DEPEND="${RDEPEND}
  69. virtual/pkgconfig
  70. java? (
  71. >=virtual/jdk-1.5
  72. dev-lang/swig
  73. )
  74. octave? ( >=dev-lang/swig-3.0.12 )
  75. python? ( dev-lang/swig )
  76. test? (
  77. media-fonts/font-misc-misc
  78. media-fonts/font-cursor-misc
  79. )"
  80. PATCHES=(
  81. "${FILESDIR}"/${PN}-5.9.6-python.patch
  82. "${FILESDIR}"/${PN}-5.11.0-octave.patch
  83. "${FILESDIR}"/${PN}-5.12.0-multiarch.patch
  84. "${FILESDIR}"/${PN}-5.12.0-java-install-path.patch
  85. )
  86. pkg_setup() {
  87. use python && python-single-r1_pkg_setup
  88. use java && java-pkg-opt-2_pkg_setup
  89. use fortran && fortran-2_pkg_setup
  90. }
  91. src_prepare() {
  92. use wxwidgets && need-wxwidgets unicode
  93. cmake-utils_src_prepare
  94. # avoid installing license
  95. sed -i -e '/COPYING.LIB/d' CMakeLists.txt || die
  96. # prexify hard-coded /usr/include in cmake modules
  97. sed -i \
  98. -e "s:/usr/include:${EPREFIX}/usr/include:g" \
  99. -e "s:/usr/lib:${EPREFIX}/usr/$(get_libdir):g" \
  100. -e "s:/usr/share:${EPREFIX}/usr/share:g" \
  101. cmake/modules/*.cmake || die
  102. # change default install directories for doc and examples
  103. local f
  104. while IFS="" read -d $'\0' -r f; do
  105. sed -i -e 's:${DATA_DIR}/examples:${DOC_DIR}/examples:g' "${f}" || die
  106. done < <(find "${S}" -name CMakeLists.txt -print0)
  107. sed -i \
  108. -e 's:${VERSION}::g' \
  109. -e "s:doc/\${PACKAGE}:doc/${PF}:" \
  110. cmake/modules/instdirs.cmake || die
  111. java-utils-2_src_prepare
  112. }
  113. src_configure() {
  114. # - don't build doc, it pulls in a whole stack of horrible dependencies
  115. # - Bindings:
  116. # * Ada is a mess in Gentoo, don't use
  117. # * D has been removed from Gentoo, don't use
  118. # * OCaml is a general disaster and randomly inserts RPATH
  119. # on the basis of absolute -L linker paths:
  120. # https://caml.inria.fr/mantis/view.php?id=5943
  121. # * Qt4 has been disabled, as it is deprecated and unsupported upstream
  122. # - DPLD_* drivers need to use ON/OFF instead of the usex defaults yes/no, as
  123. # the testsuite performs a string comparison to determine which tests to run
  124. # Octave bindings now require C++11 support, #609980
  125. append-cxxflags -std=c++11
  126. local mycmakeargs=(
  127. # The build system does not honour CMAKE_INSTALL_LIBDIR as a
  128. # relative dir, which is against the spirit of GNUInstallDirs, #610066
  129. -DCMAKE_INSTALL_LIBDIR="${EPREFIX}"/usr/$(get_libdir)
  130. ## Features
  131. -DBUILD_DOC=OFF
  132. -DBUILD_DOX_DOC=OFF
  133. -DUSE_RPATH=OFF
  134. -DCMAKE_SKIP_INSTALL_RPATH=ON
  135. -DPREBUILT_DOC=$(usex doc)
  136. -DHAVE_SHAPELIB=$(usex shapefile)
  137. -DWITH_FREETYPE=$(usex truetype)
  138. -DPL_HAVE_PTHREAD=$(usex threads)
  139. -DPL_HAVE_QHULL=$(usex qhull)
  140. -DPLPLOT_USE_QT5=$(usex qt5)
  141. ## Tests
  142. -DTEST_DYNDRIVERS=OFF
  143. -DBUILD_TEST=$(usex test)
  144. ## Bindings
  145. -DENABLE_ada=OFF
  146. -DENABLE_d=OFF
  147. -DENABLE_ocaml=OFF
  148. -DENABLE_pyqt4=OFF
  149. -DENABLE_cxx=$(usex cxx)
  150. -DENABLE_DYNDRIVERS=$(usex dynamic)
  151. -DENABLE_f95=$(usex fortran)
  152. -DENABLE_java=$(usex java)
  153. -DENABLE_lua=$(usex lua)
  154. -DTRY_OCTAVE4=$(usex octave)
  155. -DENABLE_octave=$(usex octave)
  156. -DENABLE_pdl=$(usex pdl)
  157. -DENABLE_python=$(usex python)
  158. -DENABLE_qt=$(usex qt5)
  159. -DENABLE_tcl=$(usex tcl)
  160. -DENABLE_itcl=$(usex tcl)
  161. -DENABLE_tk=$(usex tk)
  162. -DENABLE_itk=$(usex tk)
  163. -DENABLE_wxwidgets=$(usex wxwidgets)
  164. ## Drivers
  165. -DPLD_cgm=OFF
  166. -DPLD_gif=OFF
  167. -DPLD_jpeg=OFF
  168. -DPLD_plmeta=OFF
  169. -DPLD_png=OFF
  170. -DPLD_pstex=OFF
  171. -DPLD_wxpng=OFF
  172. -DPLD_mem=ON
  173. -DPLD_null=ON
  174. -DPLD_wingcc=ON
  175. # Cairo
  176. $(usex cairo "" "-DDEFAULT_NO_CAIRO_DEVICES=ON")
  177. -DPLD_epscairo=$(usex cairo ON OFF)
  178. -DPLD_extcairo=$(usex cairo ON OFF)
  179. -DPLD_memcairo=$(usex cairo ON OFF)
  180. -DPLD_pdfcairo=$(usex cairo ON OFF)
  181. -DPLD_pngcairo=$(usex cairo ON OFF)
  182. -DPLD_pscairo=$(usex cairo ON OFF)
  183. -DPLD_svgcairo=$(usex cairo ON OFF)
  184. -DPLD_xcairo=$(usex cairo ON OFF)
  185. # LaTeX
  186. -DPLD_ps=$(usex latex ON OFF)
  187. # PDF
  188. -DPLD_pdf=$(usex pdf ON OFF)
  189. # Qt
  190. -DPLD_aqt=$(usex qt5 ON OFF)
  191. -DPLD_bmpqt=$(usex qt5 ON OFF)
  192. -DPLD_epsqt=$(usex qt5 ON OFF)
  193. -DPLD_extqt=$(usex qt5 ON OFF)
  194. -DPLD_jpgqt=$(usex qt5 ON OFF)
  195. -DPLD_memqt=$(usex qt5 ON OFF)
  196. -DPLD_pdfqt=$(usex qt5 ON OFF)
  197. -DPLD_pngqt=$(usex qt5 ON OFF)
  198. -DPLD_ppmqt=$(usex qt5 ON OFF)
  199. -DPLD_qtwidget=$(usex qt5 ON OFF)
  200. -DPLD_svgqt=$(usex qt5 ON OFF)
  201. -DPLD_tiffqt=$(usex qt5 ON OFF)
  202. # SVG
  203. -DPLD_svg=$(usex svg ON OFF)
  204. # Tk
  205. -DPLD_ntk=$(usex tk ON OFF)
  206. -DPLD_tk=$(usex tk ON OFF)
  207. -DPLD_tkwin=$(usex tk ON OFF)
  208. # Truetype
  209. -DPLD_psttf=$(usex truetype ON OFF)
  210. # Wx
  211. -DPLD_wxwidgets=$(usex wxwidgets ON OFF)
  212. # X
  213. -DPLD_xfig=$(usex X ON OFF)
  214. -DPLD_xwin=$(usex X ON OFF)
  215. )
  216. use truetype && mycmakeargs+=(
  217. -DPL_FREETYPE_FONT_PATH="${EPREFIX}"/usr/share/fonts/freefont
  218. )
  219. use shapefile && mycmakeargs+=(
  220. -DSHAPELIB_INCLUDE_DIR="${EPREFIX}"/usr/include/libshp
  221. )
  222. use python && mycmakeargs+=(
  223. -DENABLE_pyqt5=$(usex qt5)
  224. )
  225. cmake-utils_src_configure
  226. # clean up bloated pkg-config files (help linking properly on prefix)
  227. sed -i \
  228. -e "/Cflags/s:-I\(${EPREFIX}\|\)/usr/include[[:space:]]::g" \
  229. -e "/Libs/s:-L\(${EPREFIX}\|\)/usr/lib\(64\|\)[[:space:]]::g" \
  230. -e "s:${LDFLAGS}::g" \
  231. "${BUILD_DIR}"/pkgcfg/*pc || die
  232. }
  233. src_test() {
  234. virtx cmake-utils_src_test
  235. }
  236. src_install() {
  237. cmake-utils_src_install
  238. if use examples; then
  239. docompress -x /usr/share/doc/${PF}/examples
  240. else
  241. rm -r "${ED%/}"/usr/share/doc/${PF}/examples || die
  242. fi
  243. if use java; then
  244. java-pkg_dojar "${BUILD_DIR}"/examples/java/${PN}.jar
  245. java-pkg_regso "${EPREFIX}"/usr/$(get_libdir)/jni/plplotjavac_wrap.so
  246. fi
  247. }