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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.9 - (show annotations) (download)
Sat Sep 5 02:09:59 2009 UTC (10 years, 5 months ago) by nerdboy
Branch: MAIN
Changes since 1.8: +7 -3 lines
Updated to use postgresql virtual in preparation for push to stable.
(Portage version: 2.2_rc33/cvs/Linux x86_64)

1 # Copyright 1999-2009 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.3.0.ebuild,v 1.8 2009/08/02 18:50:17 nerdboy Exp $
4
5 inherit eutils distutils fdo-mime versionator wxwidgets
6
7 MY_PV=$(get_version_component_range 1-2 ${PV})
8 MY_PVM=$(delete_all_version_separators ${MY_PV})
9 MY_PM=${PN}${MY_PVM}
10
11 DESCRIPTION="A free GIS with raster and vector functionality, as well as 3D vizualization."
12 HOMEPAGE="http://grass.osgeo.org//"
13 SRC_URI="http://download.osgeo.org/grass/${MY_PM}/source/${P}.tar.gz"
14
15 LICENSE="GPL-2"
16 SLOT="6"
17 KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
18
19 IUSE="ffmpeg fftw gmath jpeg largefile motif mysql nls odbc opengl png \
20 postgres python readline sqlite tiff truetype wxwindows X"
21
22 RESTRICT="strip"
23
24 RDEPEND=">=sys-libs/zlib-1.1.4
25 >=sys-libs/ncurses-5.3
26 >=sys-libs/gdbm-1.8.0
27 || (
28 sys-apps/man
29 sys-apps/man-db )
30 sci-libs/gdal
31 >=sci-libs/proj-4.4.7
32 ffmpeg? ( media-video/ffmpeg )
33 fftw? ( sci-libs/fftw )
34 gmath? ( virtual/blas
35 virtual/lapack )
36 jpeg? ( media-libs/jpeg )
37 mysql? ( dev-db/mysql )
38 odbc? ( >=dev-db/unixODBC-2.0.6 )
39 opengl? ( virtual/opengl )
40 motif? ( x11-libs/openmotif )
41 png? ( >=media-libs/libpng-1.2.2 )
42 postgres? ( || (
43 >=virtual/postgresql-base-8.0
44 >=virtual/postgresql-server-8.0 )
45 )
46 python? ( dev-lang/python )
47 readline? ( sys-libs/readline )
48 sqlite? ( dev-db/sqlite )
49 tiff? ( >=media-libs/tiff-3.5.7 )
50 truetype? ( >=media-libs/freetype-2.0 )
51 wxwindows? (
52 >=dev-python/wxpython-2.8.1.1
53 >=dev-lang/python-2.4
54 )
55 X? (
56 x11-libs/libXmu
57 x11-libs/libXext
58 x11-libs/libXp
59 x11-libs/libX11
60 x11-libs/libXt
61 x11-libs/libSM
62 x11-libs/libICE
63 x11-libs/libXpm
64 x11-libs/libXaw
65 >=dev-lang/tcl-8.4
66 >=dev-lang/tk-8.4
67 )"
68
69 DEPEND="${RDEPEND}
70 >=sys-devel/flex-2.5.4a
71 >=sys-devel/bison-1.35
72 wxwindows? ( >=dev-lang/swig-1.3.31 )
73 X? (
74 x11-proto/xproto
75 x11-proto/xextproto
76 )"
77
78 pkg_setup() {
79 local myblas
80 elog ""
81 elog "This version enables the experimental wxpython interface, which"
82 elog "you may want to try. If the legacy GUI seems a little wonky in"
83 elog "this version, just enable the wxwindows USE flag and rebuild"
84 elog "grass to use it."
85 elog ""
86 if use gmath; then
87 for d in $(eselect lapack show); do myblas=${d}; done
88 if [[ -z "${myblas/reference/}" ]] && [[ -z "${myblas/atlas/}" ]]; then
89 ewarn "You need to set lapack to atlas or reference. Do:"
90 ewarn " eselect lapack set <impl>"
91 ewarn "where <impl> is atlas, threaded-atlas or reference"
92 die "setup failed"
93 fi
94 for d in $(eselect blas show); do myblas=${d}; done
95 if [[ -z "${myblas/reference/}" ]] && [[ -z "${myblas/atlas/}" ]]; then
96 ewarn "You need to set blas to atlas or reference. Do:"
97 ewarn " eselect blas set <impl>"
98 ewarn "where <impl> is atlas, threaded-atlas or reference"
99 die "setup failed"
100 fi
101 fi
102
103 if use opengl && ! use X; then
104 ewarn "GRASS OpenGL support needs X (will also pull in Tcl/Tk)."
105 die "Please set the X useflag."
106 fi
107 }
108
109 src_unpack() {
110 unpack ${A}
111 cd "${S}"
112
113 epatch rpm/fedora/grass-readline.patch
114 # fix the fortify_source and buffer issues (see bug #261283)
115 epatch "${FILESDIR}"/${P}-o_creat.patch
116 # and update for gcc 4.4 C++ changes (see bug #270916)
117 epatch "${FILESDIR}"/${P}-gcc44.patch
118
119 sed -i -e "s:buff\[12:buff\[16:g" general/g.parser/main.c \
120 || die "sed failed"
121
122 if ! use opengl; then
123 epatch "${FILESDIR}"/${P}-html-nonviz.patch
124 fi
125
126 # patch missing math functions (yes, this is still needed)
127 sed -i -e "s:\$(EXTRA_LIBS):\$(EXTRA_LIBS) \$(MATHLIB):g" include/Make/Shlib.make
128 echo "MATHLIB=-lm" >> include/Make/Rules.make
129 }
130
131 src_compile() {
132 local myconf
133 addpredict /var/cache/fontconfig
134 # wxwindows needs python (see bug #237495)
135 use wxwindows && distutils_python_version
136
137 myconf="--prefix=/usr --with-cxx --enable-shared \
138 --with-gdal=$(type -P gdal-config) --with-curses --with-proj \
139 --with-includes=/usr/include --with-libs=/usr/$(get_libdir) \
140 --with-proj-includes=/usr/include \
141 --with-proj-libs=/usr/$(get_libdir) \
142 --with-proj-share=/usr/share/proj \
143 --without-glw"
144
145 if use X; then
146 if has_version ">=dev-lang/tcl-8.5"; then
147 TCL_LIBDIR="/usr/$(get_libdir)/tcl8.5"
148 else
149 TCL_LIBDIR="/usr/$(get_libdir)/tcl8.4"
150 fi
151 myconf="${myconf} --with-tcltk --with-x \
152 --with-tcltk-includes=/usr/include \
153 --with-tcltk-libs=${TCL_LIBDIR}"
154 if use wxwindows; then
155 WX_GTK_VER=2.8
156 need-wxwidgets unicode
157 # The following lib should be there, based on the above and the
158 # wxpython dependency (in theory). I still need a good way to
159 # query for the location...
160 LIBGDI="/usr/$(get_libdir)/python${PYVER}/site-packages/wx-${WX_GTK_VER}-gtk2-unicode/wx/_gdi_.so"
161 myconf="${myconf} --with-python --with-wxwidgets=${WX_CONFIG}"
162 else
163 # USE=python must be enabled above if wxwindows is enabled
164 myconf="${myconf} $(use_with python) --without-wxwidgets"
165 fi
166 else
167 myconf="${myconf} --without-tcltk --without-x"
168 fi
169
170 if use opengl; then
171 myconf="${myconf} --with-opengl --with-opengl-libs=/usr/$(get_libdir)/opengl/xorg-x11/lib"
172 else
173 myconf="${myconf} --without-opengl"
174 fi
175
176 # Should handle either older or latest without intervention;
177 # this won't work forever, but it should be okay for a while...
178 if use ffmpeg; then
179 myconf="${myconf} --with-ffmpeg \
180 --with-ffmpeg-libs=/usr/$(get_libdir)"
181 if has_version ">=media-video/ffmpeg-0.4.9_p20080326" ; then
182 # must pass multiple include dirs now; if you have a better
183 # way to do this, please speak up and file a bug :)
184 myconf="${myconf} --with-ffmpeg-includes=/usr/include/libav*"
185 else
186 myconf="${myconf} --with-ffmpeg-includes=/usr/include/ffmpeg"
187 fi
188 else
189 myconf="${myconf} --without-ffmpeg"
190 fi
191
192 if use truetype; then
193 myconf="${myconf} --with-freetype \
194 --with-freetype-includes=/usr/include/freetype2"
195 fi
196
197 if use mysql; then
198 myconf="${myconf} --with-mysql --with-mysql-includes=/usr/include/mysql \
199 --with-mysql-libs=/usr/$(get_libdir)/mysql"
200 else
201 myconf="${myconf} --without-mysql"
202 fi
203
204 if use sqlite; then
205 myconf="${myconf} --with-sqlite --with-sqlite-includes=/usr/include \
206 --with-sqlite-libs=/usr/$(get_libdir)"
207 else
208 myconf="${myconf} --without-sqlite"
209 fi
210
211 econf ${myconf} --with-libs=/usr/$(get_libdir) \
212 $(use_enable amd64 64bit) \
213 $(use_with fftw) \
214 $(use_with gmath blas) \
215 $(use_with gmath lapack) \
216 $(use_with jpeg) \
217 $(use_enable largefile) \
218 $(use_with motif) \
219 $(use_with nls) \
220 $(use_with odbc) \
221 $(use_with png) \
222 $(use_with postgres) \
223 $(use_with readline) \
224 $(use_with tiff) || die "configure failed!"
225
226 if use wxwindows; then
227 # can't use die here since we need to hack the vdigit build
228 emake -j1
229 ln -sf "${LIBGDI}" dist.${CHOST}/lib/libgdi.so \
230 || die "making libgdi link failed"
231 cd gui/wxpython/vdigit
232 # now we're OK
233 make default -j1 || die "make vdigit failed!"
234 else
235 emake -j1 || die "make failed!"
236 fi
237 }
238
239 src_install() {
240 elog "Grass Home is ${MY_PM}"
241 make install UNIX_BIN="${D}"usr/bin BINDIR="${D}"usr/bin \
242 PREFIX="${D}"usr INST_DIR="${D}"usr/${MY_PM} \
243 || die "make install failed!"
244
245 if use wxwindows; then
246 ln -sf "${LIBGDI}" "${D}"usr/${MY_PM}/lib/libgdi.so \
247 || die "failed to find wx library"
248 fi
249
250 # get rid of DESTDIR in script path
251 sed -i -e "s@${D}@/@" "${D}"usr/bin/${MY_PM}
252
253 # Grass Extension Manager conflicts with ruby gems
254 mv "${D}"usr/bin/gem "${D}"usr/${MY_PM}/bin/
255
256 ebegin "Adding env.d and desktop entry for Grass6..."
257 generate_files
258 doenvd 99grass-6
259 if use X; then
260 doicon "${FILESDIR}"/grass_icon.png
261 domenu ${MY_PM}-grass.desktop
262 fi
263 eend ${?}
264 }
265
266 pkg_postinst() {
267 use X && fdo-mime_desktop_database_update
268
269 elog "Note this version re-enables support for threads in Tcl and Tk."
270 elog "Enable the threads USE flag and rebuild to try it."
271 }
272
273 pkg_postrm() {
274 use X && fdo-mime_desktop_database_update
275 }
276
277 generate_files() {
278 local GUI="-gui"
279 use wxwindows && GUI="-wxpython"
280
281 cat <<-EOF > 99grass-6
282 GRASS_LD_LIBRARY_PATH="/usr/${MY_PM}/lib"
283 LDPATH="/usr/${MY_PM}/lib"
284 MANPATH="/usr/${MY_PM}/man"
285 GRASS_HOME="/usr/${MY_PM}"
286 EOF
287
288 cat <<-EOF > ${MY_PM}-grass.desktop
289 [Desktop Entry]
290 Encoding=UTF-8
291 Version=1.0
292 Name=Grass ${PV}
293 Type=Application
294 Comment=GRASS (Geographic Resources Analysis Support System), the original GIS.
295 Exec=${TERM} -T Grass -e /usr/bin/${MY_PM} ${GUI}
296 Path=
297 Icon=grass_icon.png
298 Categories=Science;Education;
299 Terminal=false
300 EOF
301 }

  ViewVC Help
Powered by ViewVC 1.1.20