aboutsummaryrefslogtreecommitdiff
blob: aeb36f76f1aa4eefd09c0bf751708e0b0ea60a48 (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
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit autotools flag-o-matic xdg

MY_PV="$(ver_rs 3-4 -)"

DESCRIPTION="A free C++ CAS (Computer Algebra System) library and its interfaces"
HOMEPAGE="https://www-fourier.ujf-grenoble.fr/~parisse/giac.html"
SRC_URI="https://www-fourier.ujf-grenoble.fr/~parisse/debian/dists/stable/main/source/${PN}_${MY_PV}.tar.gz -> ${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"

# French documentation is not GPL, and is subject to a non commercial use license, so skipping it.
LANGS="el en es pt"
IUSE="ao doc +ecm examples gc +glpk gui static-libs test"
for X in ${LANGS} ; do
	IUSE="${IUSE} l10n_${X}"
done

RDEPEND="
	dev-libs/gmp:=[cxx]
	sys-libs/readline:=
	gui? (
		>=x11-libs/fltk-1.1.9
		media-libs/libpng:=
	)
	ao? ( media-libs/libao )
	dev-libs/mpfr:=
	sci-libs/mpfi
	sci-libs/gsl:=
	>=sci-mathematics/pari-2.7:=[threads]
	dev-libs/ntl:=
	virtual/lapack
	virtual/blas
	net-misc/curl
	>=sci-mathematics/nauty-2.6.7
	ecm? ( >=sci-mathematics/gmp-ecm-7.0.0 )
	glpk? ( sci-mathematics/glpk )
	gc? ( dev-libs/boehm-gc )"

DEPEND="${RDEPEND}"

BDEPEND="
	dev-tex/hevea
	virtual/pkgconfig
	virtual/yacc
"

PATCHES=(
	"${FILESDIR}"/${PN}-1.6.0.17-gsl_lapack.patch
	"${FILESDIR}"/pari_2_11.patch
	)

REQUIRED_USE="test? ( gui )"
RESTRICT="!test? ( test )"

S="${WORKDIR}/${PN}-$(ver_cut 1-3)"

src_prepare(){
	default

	eautoreconf
}

src_configure(){
	if use gui; then
		append-cppflags -I$(fltk-config --includedir)
		append-lfs-flags
		append-libs $(fltk-config --ldflags | sed -e 's/\(-L\S*\)\s.*/\1/') || die
	fi

	# Using libsamplerate is currently broken
	econf \
		--enable-gmpxx \
		--disable-samplerate \
		$(use_enable static-libs static) \
		$(use_enable gui)  \
		$(use_enable gui png)  \
		$(use_enable ao) \
		$(use_enable ecm) \
		$(use_enable glpk) \
		$(use_enable gc)
}

src_install() {
	emake install DESTDIR="${D}"
	dodoc AUTHORS ChangeLog INSTALL NEWS README TROUBLES
	if !(use gui); then
		rm -rf \
			"${ED}"/usr/bin/x* \
			"${ED}"/usr/share/application-registry \
			"${ED}"/usr/share/applications \
			"${ED}"/usr/share/icons
	fi

	if use !doc; then
		rm -R "${ED}"/usr/share/doc/giac* "${ED}"/usr/share/giac/doc/ || die
	else
		for lang in ${LANGS}; do
			if use l10n_$lang; then
				ln "${ED}"/usr/share/giac/doc/aide_cas "${ED}"/usr/share/giac/doc/"${lang}"/aide_cas || die
			else
				rm -rf "${ED}"/usr/share/giac/doc/"${lang}"
			fi
		done
		# Deleting French documentation for copyright reasons
		rm -rf "${ED}"/usr/share/giac/doc/fr
	fi

	if use !examples; then
		rm -R "${ED}"/usr/share/giac/examples || die
	fi

	# remove .la file
	find "${ED}" -name '*.la' -delete || die
}