creating new env variables in Portfiles

markd at macports.org markd at macports.org
Sun Apr 29 09:29:14 PDT 2007


Michael Thon <mike012012 at yahoo.com> on Sunday, April 29, 2007 at 3:23 AM
-0800 wrote:
>I would like my Portfile to create new directories and set system  
>wide environment variables.  Can anyone showl me the right way to do  
>this or point me to an example?


post-destroot {
file  mkdir ${destroot}${prefix}/etc/myport
file copy ${worksrcpath}/examples/example.conf 
${destroot}${prefix}/etc/myport
}

If you wnt to set permissions on files or directorires explicitly, use
xinstall:

xinstall -m 755 -d  ${destroot}${prefix}/etc/myport
xinstall -m 755 ${worksrcpath}/examples/example.conf 
${destroot}${prefix}/etc/myport

${destroot} is the analogue to ${DESTDIR) in Makefiles.  You always want
to write there, never directly to ${prefix}.

I don't believe you could set system wide variables in a port.  You could
set a variable on your Mac and make McPorts respect it I think.  But this
is not done in a portfile.  But I've not done that either so perhaps
someone else should answer that.

Mark




More information about the macports-users mailing list