Portfile clarifications

Jim Busser jbusser at interchange.ubc.ca
Mon Sep 7 00:55:00 PDT 2009


Hi all

I am new to MacPorts but have it installed (on Leopard), and have  
further installed some ports both from the command line and using the  
GUI Porticus.

I am working on a first portfile for client software GNUmed-client  
which connects to a database. What the Portfile needs to mediate is

- user downloads the archive
- checksums applied and directory and contents extracted
- check and take care of dependencies
- there is no build (compilation) needed, because what is being  
downloaded is just a directory containing subdirectories and python  
source, which does not need compilation
- copy the extracted directory to a suitable machine directory (owned  
by root) but also to the logged-in user's home directory
- also create some hard links but this bit I am not (at this time)  
worried about :-)

I have read the following

	http://guide.macports.org/
	http://trac.macports.org/wiki/PortfileRecipes
	http://trac.macports.org/wiki/BuildPhases

but still have a few questions:

1. Am I right to surmise that the phases
	fetch
	checksum
	extract
     execute by default (without having to be declared), so long as  
distfiles and checksums had been specified?

Does extraction rely on the value of "extract.suffix" or is the latter  
used only for the fetch phase?

2. As our distfile is actually a directory which needs no compilation,  
do I need to explicitly eliminate the following phases, using:
	configure {}
	build {}
	destroot {}

     or (in the case of configure) do I instead declare a keyword
	use_configure       no

     or if configure {} is the same as use_configure       no
	then it doesn't matter? either gives identical results ??

3. If I would eliminate destroot, then there will exist no destrooted  
files on which the install phase can act. So do I need to do

	install{} ?

4. On Debian, in order to keep a copy of our client (owned by root)  
available to supply machine-wide defaults, our project installs a copy  
of the client in
	/etc/

In MacPorts, I take it this should instead reside in:

	/opt/local/var/macports/software/

as (for example)

	/opt/local/var/macports/software/GNUmed-client-0.5.0
	
but we will also want creation of

	~/GNUmed-client-0.5.0

So for this, would I declare a post-destroot phase, and how do I  
achieve the two copying tasks above, since I am not sure whether the  
source would be

	${worksrcpath}

	=

	${prefix}/var/macports/build/${name}/work/${worksrcdir}

or would it instead be

	${prefix}/var/macports/build/${name}/work/${name}

and if xinstall even copies recursively? I was guessing maybe

post-destroot { /
     xinstall -m 755 -W ${worksrcpath} ${prefix}/var/macports/software/
     xinstall -m 700 -d ~/{name}
     xinstall -m 700 -W ${worksrcpath} ~/{name}
}

but would appreciate the guidance. As I figure this out, I am  
identifying some possible improvements to the guide that I will like  
to suggest for consideration.


More information about the macports-users mailing list