summaryrefslogtreecommitdiff
blob: c2de882e8d36e4d004d396ed3afe91a96b5831c4 (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
142
143
144
145
146
147
148
149
150
151
152
153
154
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-lang/gdl/gdl-0.9.4.ebuild,v 1.2 2014/06/27 17:41:30 bicatali Exp $

EAPI=5

WX_GTK_VER="2.8"
PYTHON_COMPAT=( python{2_6,2_7} )

inherit cmake-utils eutils python-r1 wxwidgets toolchain-funcs virtualx

DESCRIPTION="Interactive Data Language compatible incremental compiler"
HOMEPAGE="http://gnudatalanguage.sourceforge.net/"
SRC_URI="mirror://sourceforge/gnudatalanguage/${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE="+eigen fftw grib gshhs hdf hdf5 imagemagick netcdf openmp
	proj postscript	python static-libs udunits wxwidgets"

RDEPEND="
	sci-libs/gsl:0=
	sci-libs/plplot:0=
	sys-libs/ncurses:5=
	sys-libs/readline:0=
	sys-libs/zlib:0=
	x11-libs/libX11:0=
	fftw? ( sci-libs/fftw:3.0= )
	grib? ( sci-libs/grib_api:0= )
	gshhs? ( sci-geosciences/gshhs-data sci-geosciences/gshhs:0= )
	hdf? ( sci-libs/hdf:0= )
	hdf5? ( sci-libs/hdf5:0= )
	imagemagick? ( || (
			media-gfx/graphicsmagick[cxx]
			media-gfx/imagemagick[cxx] ) )
	netcdf? ( sci-libs/netcdf )
	proj? ( sci-libs/proj )
	postscript? ( dev-libs/pslib )
	python? ( dev-python/numpy[${PYTHON_USEDEP}] )
	udunits? ( sci-libs/udunits )
	wxwidgets? ( x11-libs/wxGTK:2.8[X,-odbc] )"

DEPEND="${RDEPEND}
	>=dev-java/antlr-2.7.7-r5:0[cxx,java,script]
	virtual/pkgconfig
	eigen? ( dev-cpp/eigen:3 )"

REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"

PATCHES=(
		"${FILESDIR}"/0.9.2-antlr.patch
		"${FILESDIR}"/0.9.2-include.patch
		"${FILESDIR}"/0.9.2-proj4.patch
		"${FILESDIR}"/0.9.2-semaphore.patch
		"${FILESDIR}"/0.9.3-plwidth.patch
		"${FILESDIR}"/0.9.4-gsl.patch
		"${FILESDIR}"/0.9.4-python.patch
		"${FILESDIR}"/0.9.4-reorder.patch
)

pkg_setup() {
	use openmp && [[ $(tc-getCXX)$ == *g++* ]] && ! tc-has-openmp && \
		die "You have openmp enabled but your current g++ does not support it"
}

src_prepare() {
	cmake-utils_src_prepare

	use hdf5 && has_version sci-libs/hdf5[mpi] && export CXX=mpicxx

	# make sure antlr includes are from system and rebuild the sources with it
	# https://sourceforge.net/tracker/?func=detail&atid=618685&aid=3465878&group_id=97659
	rm -r src/antlr || die
	einfo "Regenerating grammar"
	pushd src > /dev/null
	local i
	for i in *.g; do antlr ${i} || die ; done
	popd > /dev/null

	# gentoo: use proj instead of libproj4 (libproj4 last update: 2004)
	sed -i \
		-e 's:proj4:proj:' \
		-e 's:lib_proj\.h:proj_api\.h:g' \
		CMakeModules/FindLibproj4.cmake src/math_utl.hpp || die

	# gentoo: avoid install files in datadir directory
	sed -i \
		-e '/AUTHORS/d' \
		CMakeLists.txt || die
}

src_configure() {
	# MPI is still very buggy
	# x11=off does not compile
	local mycmakeargs=(
		-DMPICH=OFF
		-DBUNDLED_ANTLR=OFF
		-DX11=ON
		$(cmake-utils_use fftw)
		$(cmake-utils_use eigen EIGEN3)
		$(cmake-utils_use grib)
		$(cmake-utils_use gshhs)
		$(cmake-utils_use hdf)
		$(cmake-utils_use hdf5)
		$(cmake-utils_use netcdf)
		$(cmake-utils_use openmp)
		$(cmake-utils_use proj LIBPROJ4)
		$(cmake-utils_use postscript PSLIB)
		$(cmake-utils_use udunits)
		$(cmake-utils_use wxwidgets)
	)
	if use imagemagick; then
		if has_version media-gfx/graphicsmagick[cxx]; then
			mycmakeargs+=( -DGRAPHICSMAGICK=ON -DMAGICK=OFF )
		else
			mycmakeargs+=( -DGRAPHICSMAGICK=OFF -DMAGICK=ON )
		fi
	else
		mycmakeargs+=( "-DGRAPHICSMAGICK=OFF -DMAGICK=OFF" )
	fi
	configuration() {
		mycmakeargs+=( $@ )
		cmake-utils_src_configure
	}
	configuration -DPYTHON_MODULE=OFF -DPYTHON=OFF
	use python && python_foreach_impl configuration -DPYTHON_MODULE=ON -DPYTHON=ON
}

src_compile() {
	cmake-utils_src_compile
	use python && python_foreach_impl cmake-utils_src_make
}

src_test() {
	# there is check target instead of the ctest to define some LDPATH
	Xemake -C "${BUILD_DIR}" check
}

src_install() {
	cmake-utils_src_install
	if use python; then
		installation() {
			python_export PYTHON_SITEDIR
			exeinto "${PYTHON_SITEDIR#${EPREFIX}}"
			newexe src/libgdl.so GDL.so
		}
		python_foreach_impl run_in_build_dir installation
		dodoc PYTHON.txt
	fi

	echo "GDL_PATH=\"+${EROOT%/}/usr/share/gnudatalanguage\"" > 50gdl
	doenvd 50gdl
}