[108008] users/mojca
Lawrence Velázquez
larryv at macports.org
Wed Jul 10 12:03:25 PDT 2013
On Jul 10, 2013, at 3:00 PM, mojca at macports.org wrote:
> Revision: 108008
> https://trac.macports.org/changeset/108008
> Author: mojca at macports.org
> Date: 2013-07-10 12:00:20 -0700 (Wed, 10 Jul 2013)
> Log Message:
> -----------
> geant: better geant4data.sh for initializing the data, move examples to libexec, evaluate destroot, add gccxml-devel, iAIDA now works
> Modified: users/mojca/ports/science/geant/Portfile
> ===================================================================
> --- users/mojca/ports/science/geant/Portfile 2013-07-10 18:51:46 UTC (rev 108007)
> +++ users/mojca/ports/science/geant/Portfile 2013-07-10 19:00:20 UTC (rev 108008)
> @@ -105,18 +105,28 @@
> }
> use_configure no
> build {}
> - destroot {
> - xinstall -m 755 -d ${destroot}${geant.datadir}
> - # TODO: maybe a better name or a better location
> - # in any case the filename of this file needs to be known in the portgroup
> - set filename ${destroot}${geant.datadir}/setup-geant4data.sh
> - system "echo export G4DATADIR=${geant.datadir} > ${filename}"
> - foreach {data.name data.version data.filename data.envvariable data.md5 data.rmd160 data.sha256} ${geant.data_versions} {
> - move ${workpath}/${data.name}${data.version} ${destroot}${geant.datadir}
> - # one option is also to install this as part of geant4 core installation
> - system "echo export ${data.envvariable}=\\\$G4DATADIR/${data.name}${data.version} >> ${filename}"
> +
> + set dr {
> + destroot {
> + xinstall -m 755 -d ${destroot}${geant.datadir}
> + # TODO: maybe a better name or a better location, possibly including version, possibly symlinked in bin
> + # the filename of this file should probably come frome the portgroup
> + xinstall -m 755 -d ${destroot}${prefix}/libexec/Geant4/Geant${geant.version_simple}
> + set filename ${destroot}${prefix}/libexec/Geant4/Geant${geant.version_simple}/geant4data
> + system "echo #!/bin/sh > ${filename}.sh"
> + system "echo #!/bin/csh > ${filename}.csh"
> + system "echo export G4DATADIR=\\\"${geant.datadir}\\\" >> ${filename}.sh"
> + system "echo setenv G4DATADIR=\\\"${geant.datadir}\\\" >> ${filename}.csh"
> + foreach {data.name data.version data.filename data.envvariable data.md5 data.rmd160 data.sha256} ${geant.data_versions} {
> + move ${workpath}/${data.name}${data.version} ${destroot}${geant.datadir}
> + # one option is also to install this as part of geant4 core installation
> + system "echo export ${data.envvariable}=\\\"\\\$G4DATADIR/${data.name}${data.version}\\\" >> ${filename}.sh"
> + system "echo setenv ${data.envvariable} \\\"\\\$G4DATADIR/${data.name}${data.version}\\\" >> ${filename}.csh"
> + }
> }
> }
> + eval [string map [list \${geant.datadir} [list ${geant.datadir}]] $dr]
> + eval [string map [list \${geant.version_simple} [list ${geant.version_simple}]] $dr]
> }
This probably won't work, as you're defining destroot twice. If you want to substitute multiple variables, you can extend the first argument of "string map" to have arbitrarily many pairs[1]:
eval [string map [list \${geant.datadir} [list ${geant.datadir}] \${geant.version_simple} [list ${geant.version_simple}]] $dr]
…or you can build up the substituted script gradually. This is probably easier to read and extend.
set dr [string map [list \${geant.datadir} [list ${geant.datadir}]] $dr]
set dr [string map [list \${geant.version_simple} [list ${geant.version_simple}]] $dr]
eval $dr
vq
[1] http://www.tcl.tk/man/tcl8.4/TclCmd/string.htm#M33
More information about the macports-dev
mailing list