/[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.4 - (hide annotations) (download)
Sun Sep 21 21:23:39 2008 UTC (11 years, 5 months ago) by nerdboy
Branch: MAIN
Changes since 1.3: +7 -4 lines
updated for bug #237495 (forces python when wxwindows is enabled)
(Portage version: 2.2_rc8/cvs/Linux 2.6.26.5 x86_64)

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

  ViewVC Help
Powered by ViewVC 1.1.20