| 1 |
# Copyright 1999-2012 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/sci-libs/mathgl/mathgl-1.11.1.1.ebuild,v 1.2 2012/02/28 00:56:32 patrick Exp $
|
| 4 |
|
| 5 |
EAPI=3
|
| 6 |
|
| 7 |
WX_GTK_VER=2.8
|
| 8 |
PYTHON_DEPEND="2"
|
| 9 |
SUPPORT_PYTHON_ABIS="1"
|
| 10 |
RESTRICT_PYTHON_ABIS="3.* 2.7-pypy-* *-jython"
|
| 11 |
|
| 12 |
inherit autotools wxwidgets python versionator toolchain-funcs
|
| 13 |
|
| 14 |
DESCRIPTION="Math Graphics Library"
|
| 15 |
HOMEPAGE="http://mathgl.sourceforge.net/"
|
| 16 |
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz mirror://sourceforge/${PN}/STIX_font.tgz"
|
| 17 |
|
| 18 |
LICENSE="LGPL-3"
|
| 19 |
SLOT="0"
|
| 20 |
KEYWORDS="~amd64 ~x86"
|
| 21 |
IUSE="doc fltk gif glut gsl hdf5 jpeg octave python qt4 wxwidgets"
|
| 22 |
|
| 23 |
RDEPEND="media-libs/libpng
|
| 24 |
virtual/opengl
|
| 25 |
python? ( dev-python/numpy )
|
| 26 |
glut? ( media-libs/freeglut )
|
| 27 |
fltk? ( x11-libs/fltk:1 )
|
| 28 |
gif? ( media-libs/giflib )
|
| 29 |
jpeg? ( virtual/jpeg )
|
| 30 |
hdf5? ( >=sci-libs/hdf5-1.8 )
|
| 31 |
gsl? ( sci-libs/gsl )
|
| 32 |
octave? ( >=sci-mathematics/octave-3.4.0 )
|
| 33 |
qt4? ( x11-libs/qt-gui:4 )
|
| 34 |
wxwidgets? ( x11-libs/wxGTK:2.8 )"
|
| 35 |
DEPEND="${RDEPEND}
|
| 36 |
>=sys-devel/libtool-2.2.4
|
| 37 |
doc? ( app-text/texi2html virtual/texi2dvi )
|
| 38 |
python? ( dev-lang/swig )
|
| 39 |
octave? ( dev-lang/swig )"
|
| 40 |
|
| 41 |
pkg_setup() {
|
| 42 |
if ! version_is_at_least "4.3.0" "$(gcc-version)"; then
|
| 43 |
eerror "You need >=gcc-4.3.0 to compile this package"
|
| 44 |
die "Wrong gcc version"
|
| 45 |
fi
|
| 46 |
if use hdf5 && has_version sci-libs/hdf5[mpi]; then
|
| 47 |
export CC=mpicc
|
| 48 |
export CXX=mpicxx
|
| 49 |
fi
|
| 50 |
use python && python_pkg_setup
|
| 51 |
use wxwidgets && wxwidgets_pkg_setup
|
| 52 |
}
|
| 53 |
|
| 54 |
src_unpack() {
|
| 55 |
unpack ${A}
|
| 56 |
mkdir "${S}"/fonts
|
| 57 |
cd "${S}"/fonts
|
| 58 |
unpack STIX_font.tgz
|
| 59 |
}
|
| 60 |
|
| 61 |
src_prepare() {
|
| 62 |
# bug #267061
|
| 63 |
epatch "${FILESDIR}"/${PN}-1.10.2-gcc43.patch
|
| 64 |
|
| 65 |
# bug #358245
|
| 66 |
epatch "${FILESDIR}"/${PN}-octave-3.4.patch
|
| 67 |
|
| 68 |
# correct location of numpy/arrayobject.h
|
| 69 |
if use python; then
|
| 70 |
sed \
|
| 71 |
-e '/SUBDIRS/s:lang::g' \
|
| 72 |
-i Makefile.am || die
|
| 73 |
fi
|
| 74 |
|
| 75 |
echo "#!${EPREFIX}/bin/sh" > config/py-compile
|
| 76 |
|
| 77 |
eautoreconf
|
| 78 |
}
|
| 79 |
|
| 80 |
src_configure() {
|
| 81 |
econf --docdir="${ROOT}"usr/share/doc/${PF} \
|
| 82 |
$(use_enable glut) \
|
| 83 |
$(use_enable qt4 qt) \
|
| 84 |
$(use_enable wxwidgets wx) \
|
| 85 |
$(use_enable fltk) \
|
| 86 |
$(use_enable gif) \
|
| 87 |
$(use_enable jpeg) \
|
| 88 |
$(use_enable hdf5 hdf5_18) \
|
| 89 |
$(use_enable python) \
|
| 90 |
$(use_enable octave) \
|
| 91 |
$(use_enable gsl) \
|
| 92 |
$(use_enable doc docs)
|
| 93 |
}
|
| 94 |
|
| 95 |
src_compile() {
|
| 96 |
# see bug #249627
|
| 97 |
local JOBS
|
| 98 |
use doc && JOBS=-j1
|
| 99 |
emake ${JOBS} || die "emake failed"
|
| 100 |
|
| 101 |
if use python; then
|
| 102 |
python_copy_sources lang
|
| 103 |
compilation() {
|
| 104 |
local numpy_h
|
| 105 |
numpy_h=$(python_get_sitedir)/numpy/core/include/numpy/arrayobject.h
|
| 106 |
einfo "fixing numpy.i for Python-${PYTHON_ABI}"
|
| 107 |
sed -e "s|<numpy/arrayobject.h>|\"${numpy_h}\"|" \
|
| 108 |
-i numpy.i \
|
| 109 |
|| die "sed failed"
|
| 110 |
emake PYTHON_HEADERS="-I$(python_get_includedir)" pyexecdir="$(python_get_sitedir)"
|
| 111 |
}
|
| 112 |
python_execute_function -s --source-dir lang compilation
|
| 113 |
fi
|
| 114 |
}
|
| 115 |
|
| 116 |
src_install() {
|
| 117 |
emake DESTDIR="${D}" install || die "emake install failed"
|
| 118 |
|
| 119 |
if use python; then
|
| 120 |
installation() {
|
| 121 |
emake DESTDIR="${D}" PYTHON="$(PYTHON)" pyexecdir="$(python_get_sitedir)" pythondir="$(python_get_sitedir)" install
|
| 122 |
}
|
| 123 |
python_execute_function -s --source-dir lang installation
|
| 124 |
python_clean_installation_image
|
| 125 |
fi
|
| 126 |
dodoc README AUTHORS || die "dodoc failed"
|
| 127 |
}
|
| 128 |
|
| 129 |
pkg_postinst() {
|
| 130 |
if use octave; then
|
| 131 |
octave <<-EOF
|
| 132 |
pkg install /usr/share/${PN}/octave/${PN}.tar.gz
|
| 133 |
EOF
|
| 134 |
fi
|
| 135 |
use python && python_mod_optimize ${PN}.py
|
| 136 |
}
|
| 137 |
|
| 138 |
pkg_prerm() {
|
| 139 |
if use octave; then
|
| 140 |
octave <<-EOF
|
| 141 |
pkg uninstall ${PN}
|
| 142 |
EOF
|
| 143 |
fi
|
| 144 |
}
|
| 145 |
|
| 146 |
pkg_postrm() {
|
| 147 |
use python && python_mod_cleanup ${PN}.py
|
| 148 |
}
|