summaryrefslogtreecommitdiff
path: root/sci-mathematics/gretl/gretl-2021d.ebuild
blob: ca60b3f677254e48f8b5e4297f4dff20e760630b (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
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit elisp-common toolchain-funcs xdg-utils

DESCRIPTION="Regression, econometrics and time-series library"
HOMEPAGE="http://gretl.sourceforge.net/"
SRC_URI="https://downloads.sourceforge.net/project/${PN}/${PN}/${PV}/${P}.tar.xz"

LICENSE="GPL-3"
SLOT="0/40"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE="cpu_flags_x86_avx emacs extras gnome gtk mpi nls odbc openmp python
	readline cpu_flags_x86_sse2 R"

DEPEND="
	dev-libs/glib:2=
	>=dev-libs/gmp-4.0.1:0=
	dev-libs/json-glib:0=
	dev-libs/libxml2:2=
	>=dev-libs/mpfr-2.2.0:0=
	net-misc/curl:0=
	sci-libs/fftw:3.0=
	sci-visualization/gnuplot
	virtual/lapack
	virtual/latex-base
	emacs? ( >=app-editors/emacs-23.1:* )
	gnome? ( >=gnome-extra/libgsf-1.14.47[gtk?] )
	gtk? (
			media-libs/gd:2=[png]
			>=sci-visualization/gnuplot-5.0[cairo]
			x11-libs/gtk+:3=
			x11-libs/gtksourceview:3.0= )
	mpi? ( virtual/mpi )
	odbc? ( dev-db/unixODBC:0= )
	R? ( dev-lang/R:0= )
	readline? ( sys-libs/readline:0= )"
RDEPEND="${DEPEND}
	python? ( dev-python/numpy )"
BDEPEND="virtual/pkgconfig
	extras? ( dev-texlive/texlive-latexextra )
	gtk? ( x11-misc/xdg-utils )"

SITEFILE=50${PN}-gentoo.el

REQUIRED_USE="emacs? ( gtk )"

PATCHES=(
	"${FILESDIR}"/${PN}-2001d-appdatadir.patch
)

DOCS=( README ChangeLog CompatLog )

pkg_pretend() {
	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
}

pkg_setup() {
	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
}

src_configure() {
	xdg_environment_reset
	econf \
		--disable-rpath \
		$(use_enable cpu_flags_x86_avx avx) \
		$(use_enable extras build-addons) \
		$(use_enable gtk gui) \
		$(use_enable gtk xdg) \
		$(use_enable gtk xdg-utils) \
		$(use_enable nls) \
		$(use_enable openmp) \
		$(use_enable cpu_flags_x86_sse2 sse2) \
		$(use_with gnome gsf) \
		$(use_with mpi) \
		$(use_with odbc) \
		$(use_with readline) \
		$(use_with R libR) \
		${myconf} \
		LAPACK_LIBS="$($(tc-getPKG_CONFIG) --libs lapack)"
}

src_compile() {
	default
	if use emacs; then
		cd utils/emacs && emake
		elisp-compile gretl.el
	fi
}

src_install() {
	emake -j1 DESTDIR="${D}" install
	einstalldocs
	find "${ED}" -type f -name '*.la' -delete || die
	if use emacs; then
		elisp-install ${PN} utils/emacs/gretl.{el,elc}
		elisp-site-file-install "${FILESDIR}/${SITEFILE}"
	fi
}

pkg_postinst() {
	if use emacs; then
		elisp-site-regen
		elog "To use gretl-mode for all \".inp\" files that you edit,"
		elog "add the following line to your \"~/.emacs\" file:"
		elog "  (add-to-list 'auto-mode-alist '(\"\\\\.inp\\\\'\" . gretl-mode))"
	fi

	if use gtk; then
		xdg_desktop_database_update
		xdg_icon_cache_update
		xdg_mimeinfo_database_update
	fi
}

pkg_postrm() {
	use emacs && elisp-site-regen
	if use gtk; then
		xdg_desktop_database_update
		xdg_icon_cache_update
		xdg_mimeinfo_database_update
	fi
}