/[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.6 - (hide annotations) (download)
Mon Mar 23 03:51:42 2009 UTC (11 years, 2 months ago) by nerdboy
Branch: MAIN
Changes since 1.5: +8 -4 lines
Updated with fix for fortify_source error and buffer size.
(Portage version: 2.2_rc25/cvs/Linux x86_64)

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

  ViewVC Help
Powered by ViewVC 1.1.20