1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python2_7 )
9 inherit cmake-utils eutils python-single-r1 wxwidgets multilib flag-o-matic
11 DESCRIPTION="Math Graphics Library"
12 HOMEPAGE="http://mathgl.sourceforge.net/"
13 SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz mirror://sourceforge/${PN}/STIX_font.tgz"
17 KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
18 IUSE="doc fltk gif glut gsl hdf hdf5 jpeg lua mpi octave opengl openmp pdf
19 png python qt5 static-libs threads wxwidgets zlib"
29 fltk? ( x11-libs/fltk:1 )
30 gif? ( media-libs/giflib )
31 glut? ( media-libs/freeglut )
32 gsl? ( >=sci-libs/gsl-2 )
34 hdf5? ( >=sci-libs/hdf5-1.8[mpi=] )
35 jpeg? ( virtual/jpeg:0 )
36 lua? ( >=dev-lang/lua-5.1:0 )
37 octave? ( >=sci-mathematics/octave-3.4.0 )
38 openmp? ( sys-cluster/openmpi )
39 pdf? ( media-libs/libharu )
40 png? ( media-libs/libpng:0 )
41 python? ( dev-python/numpy[${PYTHON_USEDEP}] ${PYTHON_DEPS} )
45 dev-qt/qtprintsupport:5
48 wxwidgets? ( x11-libs/wxGTK:${WX_GTK_VER}[X] )
49 zlib? ( sys-libs/zlib )"
52 doc? ( app-text/texi2html virtual/texi2dvi )
53 octave? ( dev-lang/swig )
54 python? ( dev-lang/swig )"
61 python? ( ${PYTHON_REQUIRED_USE} )"
64 "${FILESDIR}"/${P}-mutex.patch
68 use mpi && export CC=mpicc CXX=mpicxx
69 use python && python-single-r1_pkg_setup
74 if ! [[ -d "${S}"/fonts ]]; then
75 mkdir "${S}"/fonts || die
77 cd "${S}"/fonts || die
82 # fix for location of hdf headers
83 sed -i -e 's:hdf/::g' src/data_io.cpp || die
84 # bored of reporting bad libdir upstream
86 -e '/DESTINATION/s:lib$:lib${LIB_SUFFIX}:g' \
87 {src,widgets}/CMakeLists.txt || die
88 echo "" > lang/install.m || die
90 sed -i -e 's/.png//' udav/udav.desktop || die
91 # prevent sandbox violation
92 sed -i -e 's/update-mime-database/true/' udav/CMakeLists.txt || die
93 sed -i -e 's/update-desktop-database/true/' udav/CMakeLists.txt || die
97 -I"$(${EPYTHON} -c 'import numpy; print(numpy.get_include())')"
98 use wxwidgets && need-wxwidgets unicode
99 cmake-utils_src_prepare
106 -DHDF4_INCLUDE_DIR="${EPREFIX}/usr/include"
110 # No clue about this option:
111 # option(enable-mgl2 "Use names 'libmgl2-*' instead of 'libmgl-*'")
112 -DMathGL_INSTALL_LIB_DIR="${EPREFIX}/usr/$(get_libdir)"
113 -Denable-all-docs=$(usex doc)
114 -Denable-fltk=$(usex fltk)
115 -Denable-gif=$(usex gif)
116 -Denable-glut=$(usex glut)
117 -Denable-gsl=$(usex gsl)
118 -Denable-hdf4=$(usex hdf)
119 -Denable-hdf5=$(usex hdf5)
120 -Denable-jpeg=$(usex jpeg)
121 -Denable-lua=$(usex lua)
122 -Denable-mpi=$(usex mpi)
123 -Denable-octave=$(usex octave)
124 -Denable-opengl=$(usex opengl)
125 -Denable-openmp=$(usex openmp)
126 -Denable-pdf=$(usex pdf)
127 -Denable-png=$(usex png)
129 -Denable-qt5=$(usex qt5)
130 -Denable-qt5asqt=$(usex qt5)
131 -Denable-pthread=$(usex threads)
132 -Denable-pthr-widget=$(usex threads)
133 -Denable-python=$(usex python)
134 -Denable-wx=$(usex wxwidgets)
135 -Denable-zlib=$(usex zlib)
137 cmake-utils_src_configure
138 # to whoever cares: TODO: do for multiple python ABI
141 -e "s:--prefix=\(.*\) :--prefix=\$ENV{DESTDIR}\1 :" \
142 "${CMAKE_BUILD_DIR}"/lang/cmake_install.cmake || die
147 cmake-utils_src_install
148 dodoc README* *.txt AUTHORS
149 if ! use static-libs; then
150 rm "${ED}"/usr/$(get_libdir)/*.a || die
154 insinto /usr/share/udav
155 for lang in ${LANGS} ; do
156 use l10n_${lang} && doins udav/udav_${lang}.qm
160 insinto /usr/share/${PN}/octave
161 doins "${CMAKE_BUILD_DIR}"/lang/${PN}.tar.gz
163 use python && python_optimize
169 pkg install ${EROOT}/usr/share/${PN}/octave/${PN}.tar.gz