Question about creating a port for saga gis

Rainer Hurling rhurlin at gwdg.de
Sat Nov 14 13:58:16 UTC 2009


Hello Eygene,

On 14.11.2009 12:36 (UTC+1), Eygene Ryabinkin wrote:
> Sat, Nov 14, 2009 at 10:41:58AM +0100, Rainer Hurling wrote:
>> The original configure script of SAGA GIS expects 'wx-config', but in
>> newer FreeBSD systems there only is e.g. wxgtk2-2.8-config.
>>
>> The porters handbook shows how to configure the ports Makefile to let
>> the port know what wxWidget version to use. I patched the original
>> configure script but obviously that's not enough. The attached files
>> are saved under math/saga and show what I have tried.
> 
> Seems like spawning REINPLACE_CMD over the whole horde of Makefile.in
> files will do the trick:
> -----
> post-patch:
> 	@for f in `${FIND} '${WRKSRC}' -name Makefile.in` \
> 	  ${WRKSRC}/configure; do \
> 		${REINPLACE_CMD} -e's|wx-config |${WX_CONFIG} |g' "$$f"; \
> 	done
> -----

oh yes, I only patched configure, but not the Makefile.in's. That's it!

>> It would be nice if someone with more experience could give me a hint
>> how to do it right.
> 
> I am not sure for 100% that the above is the Only Right Way (tm), but
> the Porter's Handbook suggests that in such cases (when "wx-config" is
> hardcoded), the best thing is to patch the sources and that's what I did.

I read it but not understood it right until now ;-)

> BTW, there is absolutely no need to specify WX_CONFIG in your Makefile,
> bsd.wx.mk will take care of it.  WX_CONF_ARGS seems redundant too:
> SAGA's configure understands no --with-wx-config option, so it is just
> a no-op.

Both are deleted now from my Makefile and everything build and install 
just fine.

So far, I only tested my new port "math/saga" under very recent 
9.0-CURRENT, both i386 and amd64. Is there any need for me to let it 
test on other platforms and/or system versions before requesting a commit?

'portlint -A' gives me the following errors:
FATAL: Makefile: MASTER_SITES appears out-of-order.
FATAL: Makefile: order must be 
PORTNAME/PORTVERSION/DISTVERSIONPREFIX/DISTVERSION/DISTVERSIONSUFFIX/PORTREVISION/PORTEPOCH/CATEGORIES/MASTER_SITES/MASTER_SITE_SUBDIR/PKGNAMEPREFIX/PKGNAMESUFFIX/DISTNAME/EXTRACT_SUFX/DISTFILES/DIST_SUBDIR/EXTRACT_ONLY.
WARN: Makefile: "BUILD_DEPENDS" has to appear earlier.
2 fatal errors and 1 warning found.

I think there is no chance to avoid the fatal errors with the used URL?

Irritating is the warning about the position of "BUILD_DEPENDS". I am 
not sure if this is the right way to optionally install a library. What 
do you think?

Many thanks again,
Rainer
-------------- next part --------------
# Ports collection makefile for:   saga
# Date created:        13 November 2009
# Whom:                rhurlin
#
# $FreeBSD$
#

PORTNAME=	saga
PORTVERSION=	2.0.4
CATEGORIES=	math
DISTNAME=	${PORTNAME}_${PORTVERSION}_src_linux
MASTER_SITES=	SF
MASTER_SITE_SUBDIR=	saga-gis/SAGA%20-%20${PORTVERSION:C/\.[[:digit:]]*$//}/SAGA%20${PORTVERSION}

MAINTAINER=	rhurlin at gwdg.de
COMMENT=	System for Automated Geoscientific Analyses

LIB_DEPENDS=	proj.5:${PORTSDIR}/graphics/proj \
		gdal.14:${PORTSDIR}/graphics/gdal \
		jasper.4:${PORTSDIR}/graphics/jasper \
		tiff.4:${PORTSDIR}/graphics/tiff

OPTIONS=	HARU "Enable Haru Free PDF Library (optional)" On

.include <bsd.port.options.mk>

.if !defined(WITHOUT_HARU)
BUILD_DEPENDS=	${LOCALBASE}/include/hpdf.h:${PORTSDIR}/print/libharu
.endif

#INSTALL_TARGET=	install install-man
#ALL_TARGET=	all

WRKSRC=		${WRKDIR}/saga-2.0

USE_LDCONFIG=	yes
GNU_CONFIGURE=	yes
CFLAGS+=	-I${LOCALBASE}/include

USE_WX=		2.8

post-patch:
	@for f in `${FIND} '${WRKSRC}' -name Makefile.in` \
		${WRKSRC}/configure; do \
		${REINPLACE_CMD} -e's|wx-config |${WX_CONFIG} |g' "$$f"; \
	done
	@${REINPLACE_CMD} -e 's,malloc.h,stdlib.h,' \
		${WRKSRC}/src/saga_core/saga_api/api_memory.cpp \
		${WRKSRC}/src/modules_projection/pj_georeference/pj_georeference/lmdif0.c

#MAN1=		saga.1
#MANCOMPRESSED=	yes

post-install:
	@${CAT} ${PKGMESSAGE}

.include <bsd.port.mk>
-------------- next part --------------
MD5 (saga_2.0.4_src_linux.tar.gz) = 2f91cd0eb0c807de6e6e1f706d4b10ce
SHA256 (saga_2.0.4_src_linux.tar.gz) = e0ac3c7f2ec52f41874c7dc1f0c873cf8d19f3f387151820abea9c7d68125ebe
SIZE (saga_2.0.4_src_linux.tar.gz) = 2518635
-------------- next part --------------
SAGA - short hand for "System for Automated Geoscientific Analyses" - is a free,
hybrid, cross-platform GIS software.
The heart of SAGA is it's C++ and thus object oriented Application Programming 
Interface (API), providing data object definitions and computational methods for
raster, vector and tabular data. As a normal user, you will not get into touch
with the API. But as an interested scientist or coder you will soon discover
it's great flexibility.

WWW: http://www.saga-gis.org/en/index.html
-------------- next part --------------
bin/saga_cmd
bin/saga_gui
lib/libsaga_api.la
lib/libsaga_api.so
lib/libsaga_api.so.0
lib/saga/libcontrib_a_perego.la
lib/saga/libcontrib_a_perego.so
lib/saga/libcontrib_a_perego.so.0
lib/saga/libgeostatistics_grid.la
lib/saga/libgeostatistics_grid.so
lib/saga/libgeostatistics_grid.so.0
lib/saga/libgeostatistics_kriging.la
lib/saga/libgeostatistics_kriging.so
lib/saga/libgeostatistics_kriging.so.0
lib/saga/libgeostatistics_points.la
lib/saga/libgeostatistics_points.so
lib/saga/libgeostatistics_points.so.0
lib/saga/libgrid_analysis.la
lib/saga/libgrid_analysis.so
lib/saga/libgrid_analysis.so.0
lib/saga/libgrid_calculus.la
lib/saga/libgrid_calculus.so
lib/saga/libgrid_calculus.so.0
lib/saga/libgrid_discretisation.la
lib/saga/libgrid_discretisation.so
lib/saga/libgrid_discretisation.so.0
lib/saga/libgrid_filter.la
lib/saga/libgrid_filter.so
lib/saga/libgrid_filter.so.0
lib/saga/libgrid_gridding.la
lib/saga/libgrid_gridding.so
lib/saga/libgrid_gridding.so.0
lib/saga/libgrid_spline.la
lib/saga/libgrid_spline.so
lib/saga/libgrid_spline.so.0
lib/saga/libgrid_tools.la
lib/saga/libgrid_tools.so
lib/saga/libgrid_tools.so.0
lib/saga/libgrid_visualisation.la
lib/saga/libgrid_visualisation.so
lib/saga/libgrid_visualisation.so.0
lib/saga/libio_esri_e00.la
lib/saga/libio_esri_e00.so
lib/saga/libio_esri_e00.so.0
lib/saga/libio_gdal.la
lib/saga/libio_gdal.so
lib/saga/libio_gdal.so.0
lib/saga/libio_gps.la
lib/saga/libio_gps.so
lib/saga/libio_gps.so.0
lib/saga/libio_grid.la
lib/saga/libio_grid.so
lib/saga/libio_grid.so.0
lib/saga/libio_grid_grib2.la
lib/saga/libio_grid_grib2.so
lib/saga/libio_grid_grib2.so.0
lib/saga/libio_grid_image.la
lib/saga/libio_grid_image.so
lib/saga/libio_grid_image.so.0
lib/saga/libio_shapes.la
lib/saga/libio_shapes.so
lib/saga/libio_shapes.so.0
lib/saga/libio_shapes_dxf.la
lib/saga/libio_shapes_dxf.so
lib/saga/libio_shapes_dxf.so.0
lib/saga/libio_table.la
lib/saga/libio_table.so
lib/saga/libio_table.so.0
lib/saga/liblectures_introduction.la
lib/saga/liblectures_introduction.so
lib/saga/liblectures_introduction.so.0
lib/saga/libpj_georeference.la
lib/saga/libpj_georeference.so
lib/saga/libpj_georeference.so.0
lib/saga/libpj_proj4.la
lib/saga/libpj_proj4.so
lib/saga/libpj_proj4.so.0
lib/saga/libpointcloud_tools.la
lib/saga/libpointcloud_tools.so
lib/saga/libpointcloud_tools.so.0
lib/saga/libpointcloud_viewer.la
lib/saga/libpointcloud_viewer.so
lib/saga/libpointcloud_viewer.so.0
lib/saga/librecreations_fractals.la
lib/saga/librecreations_fractals.so
lib/saga/librecreations_fractals.so.0
lib/saga/librecreations_games.la
lib/saga/librecreations_games.so
lib/saga/librecreations_games.so.0
lib/saga/libsaga_gdi.la
lib/saga/libsaga_gdi.so
lib/saga/libsaga_gdi.so.0
lib/saga/libshapes_grid.la
lib/saga/libshapes_grid.so
lib/saga/libshapes_grid.so.0
lib/saga/libshapes_lines.la
lib/saga/libshapes_lines.so
lib/saga/libshapes_lines.so.0
lib/saga/libshapes_points.la
lib/saga/libshapes_points.so
lib/saga/libshapes_points.so.0
lib/saga/libshapes_polygons.la
lib/saga/libshapes_polygons.so
lib/saga/libshapes_polygons.so.0
lib/saga/libshapes_tools.la
lib/saga/libshapes_tools.so
lib/saga/libshapes_tools.so.0
lib/saga/libsim_cellular_automata.la
lib/saga/libsim_cellular_automata.so
lib/saga/libsim_cellular_automata.so.0
lib/saga/libsim_ecosystems_hugget.la
lib/saga/libsim_ecosystems_hugget.so
lib/saga/libsim_ecosystems_hugget.so.0
lib/saga/libsim_fire_spreading.la
lib/saga/libsim_fire_spreading.so
lib/saga/libsim_fire_spreading.so.0
lib/saga/libsim_hydrology.la
lib/saga/libsim_hydrology.so
lib/saga/libsim_hydrology.so.0
lib/saga/libta_channels.la
lib/saga/libta_channels.so
lib/saga/libta_channels.so.0
lib/saga/libta_hydrology.la
lib/saga/libta_hydrology.so
lib/saga/libta_hydrology.so.0
lib/saga/libta_lighting.la
lib/saga/libta_lighting.so
lib/saga/libta_lighting.so.0
lib/saga/libta_morphometry.la
lib/saga/libta_morphometry.so
lib/saga/libta_morphometry.so.0
lib/saga/libta_preprocessor.la
lib/saga/libta_preprocessor.so
lib/saga/libta_preprocessor.so.0
lib/saga/libta_profiles.la
lib/saga/libta_profiles.so
lib/saga/libta_profiles.so.0
lib/saga/libtable_calculus.la
lib/saga/libtable_calculus.so
lib/saga/libtable_calculus.so.0
lib/saga/libtable_tools.la
lib/saga/libtable_tools.so
lib/saga/libtable_tools.so.0
lib/saga/libtin_tools.la
lib/saga/libtin_tools.so
lib/saga/libtin_tools.so.0
@dirrm lib/saga
-------------- next part --------------

######################################################################

Unlike to windows systems, saga_cmd should be instantly available in
the shell as it is usually installed in %%PREFIX%%/bin.  

Next you have to set the environmental variable SAGA_MLB to make SAGA
know where the SAGA module libraries exist on your system. You can do
this permanently by adding the following command to your .bashrc file
or by defining it temporarily on the command line before executing
SAGA CMD:

  export SAGA_MLB=/yourPathToSAGA_modules

e.g.:
  export SAGA_MLB=%%PREFIX%%/lib/saga

Now your system is prepared for using SAGA CMD to execute SAGA
modules. 

######################################################################

And don't forget, on Unix-like systems you will have to alter the
module library name accordingly by adding "lib" to the module library
name.

e.g.:
  saga_cmd libta_morphometry    instead of    saga_cmd ta_morphometry

For more information see

http://sourceforge.net/apps/trac/saga-gis/wiki/\
Executing%20Modules%20with%20SAGA%20CMD

######################################################################


More information about the freebsd-ports mailing list