Question about creating a port for saga gis

Eygene Ryabinkin rea-fbsd at codelabs.ru
Fri Nov 13 10:42:11 UTC 2009


Rainer, good day.

Fri, Nov 13, 2009 at 10:48:15AM +0100, Rainer Hurling wrote:
> Unfortunately I have problems to let the port fetch the distfile. I 
> tried many ways described in the porters handbook without success.
> 
> The distfile is located at
> 
> http://sourceforge.net/projects/saga-gis/files/SAGA%20-%202.0/SAGA%202.0.4/saga_2.0.4_src_linux.tar.gz/download

No, this is the location of the fancy page with ads that will allow one
to select mirrors and other stuff.  It will select the mirror
automatically, so you're seeing it as the download URL, but it's not so,
it is just a redirector.

> I tried for example with combinations of
> 
> PORTNAME=      saga
> PORTVERSION=   2.0.4
> DISTNAME=      saga_2.0.4_src_linux
> MASTER_SITES= 
> http://sourceforge.net/projects/saga-gis/files/SAGA%20-%202.0/SAGA%202.0.4/
> 
> but the main problem seems to be the '/download' after the filename.
> 
> Fetching the file by hand works but I have no clue how to describe this 
> path in the ports Makefile.

The following mini-Makefile does the trick for me:
-----
PORTNAME=       saga
PORTVERSION=    2.0.4
DISTNAME=       saga_2.0.4_src_linux
MASTER_SITES=   SF/saga-gis/SAGA%20-%20${PORTVERSION:C/\.[[:digit:]]*$//}/SAGA%20${PORTVERSION}/

CATEGORIES=     devel

.include <bsd.port.mk>
-----

Please, note that the "SF" word is expanded to the full list of the
SourceForge mirrors known to the FreeBSD ports subsystem, so you need
not to explicitely list any URLs -- just use "SF" for SourceForce
mirrors.

And the snippet I showed above is yet better rewritten as
-----
PORTNAME=       saga
PORTVERSION=    2.0.4
DISTNAME=       saga_2.0.4_src_linux
MASTER_SITES=   SF
MASTER_SITE_SUBDIR=     saga-gis/SAGA%20-%20${PORTVERSION:C/\.[[:digit:]]*$//}/SAGA%20${PORTVERSION}

CATEGORIES=     devel

.include <bsd.port.mk>
-----
It does the same, but has better semantics.
-- 
Eygene
 _                ___       _.--.   #
 \`.|\..----...-'`   `-._.-'_.-'`   #  Remember that it is hard
 /  ' `         ,       __.--'      #  to read the on-line manual
 )/' _/     \   `-_,   /            #  while single-stepping the kernel.
 `-'" `"\_  ,_.-;_.-\_ ',  fsc/as   #
     _.-'_./   {_.'   ; /           #    -- FreeBSD Developers handbook
    {_.-``-'         {_/            #


More information about the freebsd-ports mailing list