aboutsummaryrefslogtreecommitdiff
blob: c1fe41d90b19da3646e44443d1dc20b7126c1ab0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=3
inherit autotools check-reqs eutils fdo-mime flag-o-matic java-pkg-2

DESCRIPTION="Scientific software package for numerical computations"
LICENSE="CeCILL-2"
HOMEPAGE="http://www.scilab.org/"
SRC_URI="http://www.scilab.org/download/${PV}/${P}-src.tar.gz"

SLOT="0"
IUSE="doc fftw +gui hdf5 +matio nls tk +umfpack xcos"
KEYWORDS="~amd64 ~x86"

# hdf5 is required to compile (and use) xcos
# doc generation and xcos is disabled if gui is disabled
# see http://wiki.scilab.org/Description_of_configure_options

# http://wiki.scilab.org/Dependencies_of_Scilab_5.X
RDEPEND="virtual/lapack
	tk? ( dev-lang/tk )
	xcos? ( dev-lang/ocaml
			dev-java/hdf-java )
	umfpack? ( sci-libs/umfpack )
	gui? ( >=virtual/jre-1.5
		dev-java/commons-logging
		>=dev-java/flexdock-0.5.2
		>=dev-java/jeuclid-core-3.1
		>=dev-java/jlatexmath-0.9.4
		=dev-java/jgraphx-1.4.1.0
		dev-java/jogl
		dev-java/jgoodies-looks
		dev-java/jrosetta
		dev-java/javahelp
		dev-java/fop
		>=dev-java/batik-1.7
		hdf5? ( dev-java/hdf-java ) )
	fftw? ( sci-libs/fftw:3.0 )
	matio? ( sci-libs/matio )
	hdf5? ( >=sci-libs/hdf5-1.8.4[-mpi] )"

DEPEND="${RDEPEND}
	dev-util/pkgconfig
	doc? (
		>=dev-java/jlatexmath-fop-0.9.4
		~dev-java/saxon-6.5.5
		app-text/docbook-xsl-stylesheets )"

pkg_setup() {
	if use doc; then
		CHECKREQS_MEMORY="512M"
		check-reqs_pkg_setup
	fi
	java-pkg-2_pkg_setup

	# temp Bug 6593 upstream, fixed
	append-ldflags $(no-as-needed)
}

src_prepare() {
	# Increases java heap to 512M when available, when building docs
	use doc && epatch "${FILESDIR}/java-heap-${PV}.patch"
	# fix scilib path
	epatch "${FILESDIR}/${P}-scilib-fix.patch"
	# bug 9268 reported upstream http://bugzilla.scilab.org/show_bug.cgi?id=9268
	epatch "${FILESDIR}"/bug_9268.diff
	#bug 9883 upstream
	epatch "${FILESDIR}/disablebuildhelp.patch"
	#bug 10244 upstream
	mv  modules/call_scilab/examples/call_scilab/NET/VB.NET/My\ Project/ \
	modules/call_scilab/examples/call_scilab/NET/VB.NET/My_Project||die
	#bug 9824 upstream
	sed -i "/BLAS_LIBS=$/d" m4/libsmath.m4
	epatch "${FILESDIR}/${P}-allow-hdf-1.8.7.patch"
	#bug 392363 
	sed -i -e "s|Clément DAVID|Clement DAVID|g" $(find . -iname '*.java')
	sed -i -e "s/ -lhpi//g" m4/java.m4

	sed -i "s|-L\$SCI_SRCDIR/bin/|-L\$SCI_SRCDIR/bin/ \
		-L$(java-config -i gluegen) \
		-L$(java-config -i jogl)|" \
		configure.ac || die

	sed -i \
		-e "/<\/librarypaths>/i\<path value=\"$(java-config -i gluegen)\"\/>" \
		-e "/<\/librarypaths>/i\<path value=\"$(java-config -i jogl)\"\/>" \
		-e "/<\/librarypaths>/i\<path value=\"$(java-config -i hdf-java)\"\/>" \
		etc/librarypath.xml || die

	eautoreconf
	java-pkg-2_src_prepare
}

src_configure() {
	local myopts
	use doc && myopts="--with-docbook=/usr/share/sgml/docbook/xsl-stylesheets"
	# javac complained about (j)hdf
	use hdf5 && myopts="$myopts --with-hdf5-library=$(java-config -i hdf-java)"
	export JAVA_HOME="$(java-config -O)"
	export BLAS_LIBS="$(pkg-config --libs blas)"
	export LAPACK_LIBS="$(pkg-config --libs lapack)"

	econf \
		--disable-rpath \
		--without-pvm \
		$(use_enable doc build-help) \
		$(use_enable nls) \
		$(use_enable nls build-localization) \
		$(use_with fftw) \
		$(use_with gui)\
		$(use_with gui javasci)\
		$(use_with hdf5) \
		$(use_with matio) \
		$(use_with umfpack) \
		$(use_with tk) \
		$(use_with xcos) \
		${myopts}
}

src_compile() {
	emake || die "emake failed"
	if use doc; then
		emake doc || die "emake failed"
	fi
}

src_install() {
	emake DESTDIR="${ED}" install || die "emake install failed"
	find "${ED}" -name '*.la' -delete || die
	# install docs
	dodoc ACKNOWLEDGEMENTS README_Unix Readme_Visual.txt \
	|| die "failed to install docs"
	insinto /usr/share/mime/packages
	doins "${FILESDIR}/${PN}.xml"
}

pkg_postinst() {
	fdo-mime_mime_database_update
}