/[gentoo-x86]/sci-geosciences/grass/grass-6.4.2.ebuild
Gentoo

Contents of /sci-geosciences/grass/grass-6.4.2.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Mon May 28 07:40:15 2012 UTC (7 years, 8 months ago) by scarabeus
Branch: MAIN
Changes since 1.2: +20 -18 lines
Fix wxwidgets handling, thanks to papillon81

(Portage version: 2.2.0_alpha108/cvs/Linux x86_64)

1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/sci-geosciences/grass/grass-6.4.2.ebuild,v 1.2 2012/05/24 19:33:27 scarabeus Exp $
4
5 EAPI=4
6
7 PYTHON_DEPEND="python? 2"
8
9 inherit eutils gnome2 multilib python versionator wxwidgets base
10
11 MY_PM=${PN}$(get_version_component_range 1-2 ${PV})
12 MY_PM=${MY_PM/.}
13 MY_P=${P/_rc/RC}
14
15 DESCRIPTION="A free GIS with raster and vector functionality, as well as 3D vizualization"
16 HOMEPAGE="http://grass.osgeo.org/"
17 SRC_URI="http://grass.osgeo.org/${MY_PM}/source/${MY_P}.tar.gz"
18
19 LICENSE="GPL-2"
20 SLOT="6"
21 KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
22 IUSE="X cairo cxx ffmpeg fftw gmath jpeg motif mysql nls odbc opengl png postgres python readline sqlite tiff truetype wxwidgets"
23
24 TCL_DEPS="
25 >=dev-lang/tcl-8.5
26 >=dev-lang/tk-8.5"
27
28 RDEPEND="
29 >=app-admin/eselect-1.2
30 sci-libs/gdal
31 sci-libs/proj
32 sys-libs/gdbm
33 sys-libs/ncurses
34 sys-libs/zlib
35 cairo? ( x11-libs/cairo[X?,opengl?] )
36 ffmpeg? ( virtual/ffmpeg )
37 fftw? ( sci-libs/fftw:3.0 )
38 gmath? (
39 virtual/blas
40 virtual/lapack
41 )
42 jpeg? ( virtual/jpeg )
43 mysql? ( virtual/mysql )
44 odbc? ( dev-db/unixODBC )
45 opengl? (
46 virtual/opengl
47 ${TCL_DEPS}
48 )
49 png? ( media-libs/libpng )
50 postgres? ( >=dev-db/postgresql-base-8.4 )
51 readline? ( sys-libs/readline )
52 sqlite? ( dev-db/sqlite:3 )
53 tiff? ( media-libs/tiff )
54 truetype? ( media-libs/freetype:2 )
55 wxwidgets? ( >=dev-python/wxpython-2.8.10.1[cairo,opengl?] )
56 X? (
57 x11-libs/libICE
58 x11-libs/libSM
59 x11-libs/libX11
60 x11-libs/libXaw
61 x11-libs/libXext
62 x11-libs/libXmu
63 x11-libs/libXp
64 x11-libs/libXpm
65 x11-libs/libXt
66 motif? (
67 >=x11-libs/openmotif-2.3:0
68 opengl? (
69 || (
70 media-libs/mesa[motif]
71 ( media-libs/mesa x11-libs/libGLw )
72 )
73 )
74 )
75 !python? ( ${TCL_DEPS} )
76 !wxwidgets? ( ${TCL_DEPS} )
77 )"
78
79 DEPEND="${RDEPEND}
80 virtual/pkgconfig
81 sys-devel/flex
82 sys-devel/gettext
83 sys-devel/bison
84 wxwidgets? ( dev-lang/swig )
85 X? (
86 x11-proto/xextproto
87 x11-proto/xproto
88 )"
89
90 S="${WORKDIR}/${MY_P}"
91
92 PATCHES=(
93 "${FILESDIR}"/${PN}-pkgconf.patch
94 "${FILESDIR}"/${PN}-6.4.1-libav-0.8.patch
95 )
96
97 REQUIRED_USE="
98 motif? ( X )
99 opengl? ( X )
100 wxwidgets? ( X python )
101 "
102
103 pkg_setup() {
104 local myblas
105
106 # check correct gmath profiles (this must sadly die)
107 if use gmath; then
108 for d in $(eselect lapack show); do myblas=${d}; done
109 if [[ -z "${myblas/reference/}" ]] && [[ -z "${myblas/atlas/}" ]]; then
110 ewarn "You need to set lapack to atlas or reference. Do:"
111 ewarn " eselect lapack set <impl>"
112 ewarn "where <impl> is atlas, threaded-atlas or reference"
113 die "setup failed"
114 fi
115 for d in $(eselect blas show); do myblas=${d}; done
116 if [[ -z "${myblas/reference/}" ]] && [[ -z "${myblas/atlas/}" ]]; then
117 ewarn "You need to set blas to atlas or reference. Do:"
118 ewarn " eselect blas set <impl>"
119 ewarn "where <impl> is atlas, threaded-atlas or reference"
120 die "setup failed"
121 fi
122 fi
123
124 if use python; then
125 # only py2 is supported
126 python_set_active_version 2
127 fi
128 }
129
130 src_prepare() {
131 use opengl || epatch "${FILESDIR}"/${PN}-6.4.0-html-nonviz.patch
132 base_src_prepare
133 }
134
135 src_configure() {
136 local myconf TCL_LIBDIR
137
138 if use X; then
139 TCL_LIBDIR="/usr/$(get_libdir)/tcl8.5"
140 myconf+="
141 --with-tcltk-libs=${TCL_LIBDIR}
142 $(use_with motif)
143 $(use_with opengl)
144 --with-x
145 "
146
147 use opengl && myconf+=" --with-tcltk"
148 use motif && use opengl && myconf+=" --with-glw"
149 use motif || myconf+=" --without-glw"
150
151 if use wxwidgets; then
152 WX_BUILD=yes
153 WX_GTK_VER=2.8
154 need-wxwidgets unicode
155 myconf+="
156 --without-tcltk
157 --with-wxwidgets=${WX_CONFIG}
158 "
159 else
160 WX_BUILD=no
161 # use tcl gui if wxwidgets are disabled
162 myconf+="
163 --with-tcltk
164 --without-wxwidgets
165 "
166 fi
167 else
168 myconf+="
169 --without-glw
170 --without-opengl
171 --without-tcltk
172 --without-wxwidgets
173 --without-x
174 "
175 fi
176
177 econf \
178 --with-gdal=$(type -P gdal-config) \
179 --with-curses \
180 --with-proj \
181 --with-proj-share="/usr/share/proj/" \
182 --without-glw \
183 --enable-shared \
184 $(use_enable amd64 64bit) \
185 $(use_enable ppc64 64bit) \
186 $(use_with cairo) \
187 $(use_with cxx) \
188 $(use_with fftw) \
189 $(use_with ffmpeg) \
190 --with-ffmpeg-includes="/usr/include/libavcodec /usr/include/libavdevice /usr/include/libavfilter /usr/include/libavformat /usr/include/libavutil /usr/include/libpostproc /usr/include/libswscale" \
191 $(use_with gmath blas) \
192 $(use_with gmath lapack) \
193 $(use_with jpeg) \
194 $(use_with mysql) \
195 --with-mysql-includes=/usr/include/mysql \
196 --with-mysql-libs=/usr/$(get_libdir)/mysql \
197 $(use_with nls) \
198 $(use_with odbc) \
199 $(use_with png) \
200 $(use_with postgres) \
201 $(use_with python) \
202 $(use_with readline) \
203 $(use_with sqlite) \
204 $(use_with tiff) \
205 $(use_with truetype freetype) \
206 --with-freetype-includes="/usr/include/freetype2/" \
207 --enable-largefile \
208 ${myconf}
209 }
210
211 src_compile() {
212 # we don't want to link against embeded mysql lib
213 base_src_compile MYSQLDLIB=""
214 }
215
216 src_install() {
217 emake DESTDIR="${D}" \
218 INST_DIR="${D}"/usr/${MY_PM} \
219 prefix="${D}"/usr BINDIR="${D}"/usr/bin \
220 PREFIX="${D}"/usr/ \
221 install
222
223 pushd "${ED}"/usr/${MY_PM} &> /dev/null
224
225 # fix docs
226 dodoc AUTHORS CHANGES
227 dohtml -r docs/html/*
228 rm -rf docs/ || die
229 rm -rf {AUTHORS,CHANGES,COPYING,GPL.TXT,REQUIREMENTS.html} || die
230
231 # manuals
232 dodir /usr/share/man/man1
233 mv man/man1/* "${ED}"/usr/share/man/man1/ || die
234 rm -rf man/ || die
235 mv -vf "${ED}"/usr/share/man/man1/sql.1{,grass} || die #381599
236
237 # translations
238 if use nls; then
239 dodir /usr/share/locale/
240 mv locale/* "${ED}"/usr/share/locale/ || die
241 rm -rf locale/ || die
242 # pt_BR is broken
243 mv "${ED}"/usr/share/locale/pt_br "${ED}"/usr/share/locale/pt_BR || die
244 fi
245
246 popd &> /dev/null
247
248 # place libraries where they belong
249 mv "${ED}"/usr/${MY_PM}/lib/ "${ED}"/usr/$(get_libdir)/ || die
250
251 # place header files where they belong
252 mv "${ED}"/usr/${MY_PM}/include/ "${ED}"/usr/include/ || die
253 # make rules are not required on installed system
254 rm -rf "${ED}"/usr/include/Make || die
255
256 # mv remaining gisbase stuff to libdir
257 mv "${ED}"/usr/${MY_PM} "${ED}"/usr/$(get_libdir) || die
258
259 # set proper default window renderer
260 if [[ ${WX_BUILD} == yes ]]; then
261 sed -i \
262 -e "1,\$s:^DEFAULT_GUI.*:DEFAULT_GUI=\"wxpython\":" \
263 "${ED}"/usr/$(get_libdir)/${MY_PM}/etc/Init.sh || die
264 fi
265
266 # get proper folder for grass path in script
267 sed -i \
268 -e "1,\$s:^GISBASE.*:GISBASE=/usr/$(get_libdir)/${MY_PM}:" \
269 "${ED}"usr/bin/${MY_PM} || die
270
271 # get proper fonts path for fontcap
272 sed -i \
273 -e "s|${ED}/usr/${MY_PM}|${EPREFIX}usr/$(get_libdir)/${MY_PM}|" \
274 "${ED}"/usr/$(get_libdir)/${MY_PM}/etc/fontcap || die
275
276 if use X; then
277 generate_files
278 doicon gui/icons/${PN}-48x48.png
279 domenu ${MY_PM}-grass.desktop
280 fi
281
282 # install .pc file so other apps know where to look for grass
283 insinto /usr/$(get_libdir)/pkgconfig/
284 doins grass.pc
285
286 # fix weird +x on tcl scripts
287 find "${D}" -name "*.tcl" -exec chmod +r-x '{}' \;
288 }
289
290 pkg_postinst() {
291 if use X; then
292 fdo-mime_desktop_database_update
293 gnome2_icon_cache_update
294 fi
295 }
296
297 pkg_postrm() {
298 if use X; then
299 fdo-mime_desktop_database_update
300 gnome2_icon_cache_update
301 fi
302 }
303
304 generate_files() {
305 local GUI="-gui"
306 [[ ${WX_BUILD} == yes ]] && GUI="-wxpython"
307
308 cat <<-EOF > ${MY_PM}-grass.desktop
309 [Desktop Entry]
310 Encoding=UTF-8
311 Version=1.0
312 Name=Grass ${PV}
313 Type=Application
314 Comment=GRASS (Geographic Resources Analysis Support System), the original GIS.
315 Exec=${TERM} -T Grass -e /usr/bin/${MY_PM} ${GUI}
316 Path=
317 Icon=${PN}-48x48.png
318 Categories=Science;Education;
319 Terminal=false
320 EOF
321 }

  ViewVC Help
Powered by ViewVC 1.1.20