sys-libs/ncurses: move to SLOT=0 #557472
[gentoo.git] / dev-lang / gdl / gdl-0.9.5.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6
7 WX_GTK_VER="2.8"
8 PYTHON_COMPAT=( python2_7 )
9
10 inherit cmake-utils eutils python-r1 wxwidgets toolchain-funcs virtualx
11
12 DESCRIPTION="GNU Data Language"
13 HOMEPAGE="http://gnudatalanguage.sourceforge.net/"
14 SRC_URI="mirror://sourceforge/gnudatalanguage/${P}.tar.gz"
15
16 LICENSE="GPL-2"
17 SLOT="0"
18 KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
19 IUSE="+eigen fftw grib gshhs hdf hdf5 imagemagick netcdf openmp
20         png proj postscript     python static-libs udunits wxwidgets"
21
22 RDEPEND="
23         sci-libs/gsl:0=
24         sci-libs/plplot:0=[-dynamic]
25         sys-libs/ncurses:0=
26         sys-libs/readline:0=
27         sys-libs/zlib:0=
28         x11-libs/libX11:0=
29         fftw? ( sci-libs/fftw:3.0= )
30         grib? ( sci-libs/grib_api:0= )
31         gshhs? ( sci-geosciences/gshhs-data sci-geosciences/gshhs:0= )
32         hdf? ( sci-libs/hdf:0= )
33         hdf5? ( sci-libs/hdf5:0= )
34         imagemagick? (
35                 || (
36                         media-gfx/graphicsmagick[cxx]
37                         media-gfx/imagemagick[cxx]
38                         )
39         )
40         netcdf? ( sci-libs/netcdf )
41         proj? ( sci-libs/proj )
42         postscript? ( dev-libs/pslib )
43         python? (
44                 ${PYTHON_DEPS}
45                 dev-python/numpy[${PYTHON_USEDEP}]
46         )
47         udunits? ( sci-libs/udunits )
48         wxwidgets? ( x11-libs/wxGTK:2.8[X,-odbc] )"
49
50 DEPEND="${RDEPEND}
51         >=dev-java/antlr-2.7.7-r5:0[cxx,java,script]
52         virtual/pkgconfig
53         eigen? ( dev-cpp/eigen:3 )"
54
55 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
56
57 PATCHES=(
58         "${FILESDIR}"/0.9.5-antlr.patch
59         "${FILESDIR}"/0.9.2-include.patch
60         "${FILESDIR}"/0.9.5-plplot.patch
61         "${FILESDIR}"/0.9.5-png.patch
62 )
63
64 pkg_setup() {
65         use openmp && [[ $(tc-getCXX)$ == *g++* ]] && ! tc-has-openmp && \
66                 die "You have openmp enabled but your current g++ does not support it"
67 }
68
69 src_prepare() {
70         cmake-utils_src_prepare
71
72         use hdf5 && has_version sci-libs/hdf5[mpi] && export CXX=mpicxx
73
74         # make sure antlr includes are from system and rebuild the sources with it
75         # https://sourceforge.net/tracker/?func=detail&atid=618685&aid=3465878&group_id=97659
76         rm -r src/antlr || die
77         einfo "Regenerating grammar"
78         pushd src > /dev/null
79         local i
80         for i in *.g; do antlr ${i} || die ; done
81         popd > /dev/null
82
83         # gentoo: use proj instead of libproj4 (libproj4 last update: 2004)
84         sed -i \
85                 -e 's:proj4:proj:' \
86                 -e 's:lib_proj\.h:proj_api\.h:g' \
87                 CMakeModules/FindLibproj4.cmake src/math_utl.hpp || die
88
89         # gentoo: avoid install files in datadir directory
90         sed -i \
91                 -e '/AUTHORS/d' \
92                 CMakeLists.txt || die
93 }
94
95 src_configure() {
96         # MPI is still very buggy
97         # x11=off does not compile
98         local mycmakeargs=(
99                 -DMPICH=OFF
100                 -DBUNDLED_ANTLR=OFF
101                 -DX11=ON
102                 $(cmake-utils_use fftw)
103                 $(cmake-utils_use eigen EIGEN3)
104                 $(cmake-utils_use grib)
105                 $(cmake-utils_use gshhs)
106                 $(cmake-utils_use hdf)
107                 $(cmake-utils_use hdf5)
108                 $(cmake-utils_use netcdf)
109                 $(cmake-utils_use openmp)
110                 $(cmake-utils_use png PNGLIB)
111                 $(cmake-utils_use proj LIBPROJ4)
112                 $(cmake-utils_use postscript PSLIB)
113                 $(cmake-utils_use udunits)
114                 $(cmake-utils_use wxwidgets)
115         )
116         if use imagemagick; then
117                 if has_version media-gfx/graphicsmagick[cxx]; then
118                         mycmakeargs+=( -DGRAPHICSMAGICK=ON -DMAGICK=OFF )
119                 else
120                         mycmakeargs+=( -DGRAPHICSMAGICK=OFF -DMAGICK=ON )
121                 fi
122         else
123                 mycmakeargs+=( -DGRAPHICSMAGICK=OFF -DMAGICK=OFF )
124         fi
125         configuration() {
126                 mycmakeargs+=( $@ )
127                 cmake-utils_src_configure
128         }
129         configuration -DPYTHON_MODULE=OFF -DPYTHON=OFF
130         use python && python_foreach_impl configuration -DPYTHON_MODULE=ON -DPYTHON=ON
131 }
132
133 src_compile() {
134         cmake-utils_src_compile
135         use python && python_foreach_impl cmake-utils_src_make
136 }
137
138 src_test() {
139         # there is check target instead of the ctest to define some LDPATH
140         Xemake -C "${BUILD_DIR}" check
141 }
142
143 src_install() {
144         cmake-utils_src_install
145         if use python; then
146                 installation() {
147                         mv src/libgdl.so GDL.so || die
148                         python_domodule GDL.so
149                 }
150                 python_foreach_impl run_in_build_dir installation
151                 dodoc PYTHON.txt
152         fi
153
154         echo "GDL_PATH=\"+${EROOT%/}/usr/share/gnudatalanguage\"" > 50gdl
155         doenvd 50gdl
156 }