summaryrefslogtreecommitdiff
blob: fa51deae0ff943c595bbcac3188833f59f04804a (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
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sci-mathematics/dataplot/dataplot-20080225.ebuild,v 1.7 2009/12/26 17:45:37 pva Exp $

EAPI="2"
inherit eutils toolchain-funcs autotools fortran

#     DAY         MONTH    YEAR
MY_PV=${PV:4:2}_${PV:6:2}_${PV:0:4}
MY_P=dpsrc.${MY_PV}
MY_P_AUX=dplib.${MY_PV}

DESCRIPTION="A program for scientific visualization and statistical analyis"
HOMEPAGE="http://www.itl.nist.gov/div898/software/dataplot/"
SRC_URI="ftp://ftp.nist.gov/pub/dataplot/unix/dpsrc.${MY_PV}.tar.gz
	ftp://ftp.nist.gov/pub/dataplot/unix/dplib.${MY_PV}.tar.gz"

LICENSE="public-domain"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="examples gd gs opengl X"

COMMON_DEPEND="opengl? ( virtual/opengl )
	gd? ( media-libs/gd[png,jpeg] )
	gs? ( app-text/ghostscript-gpl media-libs/gd[png,jpeg] )"
DEPEND="${COMMON_DEPEND}
	dev-util/pkgconfig"
RDEPEND="${COMMON_DEPEND}
	X? ( x11-misc/xdg-utils )"

S="${WORKDIR}/${MY_P}"
S_AUX="${WORKDIR}/${MY_P_AUX}"

FORTRAN="gfortran"

src_unpack() {
	# unpacking and renaming because
	# upstream does not use directories
	mkdir "${S_AUX}"
	pushd "${S_AUX}"
	unpack ${MY_P_AUX}.tar.gz
	popd
	mkdir ${MY_P}
	cd "${S}"
	unpack ${MY_P}.tar.gz

	# autotoolization: need to fix a few files with
	# hardcoded directories (will be fixed with autoconf)
	mv DPCOPA.INC DPCOPA.INC.in
	mv dp1_linux.f dp1_linux.f.in
	mv dp1_linux_64.f dp1_linux_64.f.in
	# various fixes (mainly syntax)
	epatch "${FILESDIR}"/dpsrc-patchset-${PV}.patch
	# some fortran patches
	epatch "${FILESDIR}"/dpsrc-dp1patches-${PV}.patch
	cp "${FILESDIR}"/Makefile.am.${PV} Makefile.am
	cp "${FILESDIR}"/configure.ac.${PV} configure.ac
	eautoreconf
}

src_configure() {
	econf \
		$(use_enable gd) \
		$(use_enable gs) \
		$(use_enable opengl) \
		$(use_enable X)
}

src_install() {
	emake DESTDIR="${D}" install || die "Install failed"

	if use examples; then
		insinto /usr/share/doc/${PF}/examples
		doins -r "${S_AUX}"/data/* || die "Installing examples failed"
	fi
	insinto /usr/share/dataplot
	doins "${S_AUX}"/dp{mes,sys,log}f.tex || die "Doins failed."
	doenvd "${FILESDIR}"/90${PN} || die "doenvd failed"
}

pkg_postinst() {
	elog "Before using dataplot, please run (as root):"
	elog "env-update && source /etc/profile"
}