Portfile for GEANT4

Ryan Schmidt ryandesign at macports.org
Sat Jan 16 15:58:28 PST 2010


On Jan 16, 2010, at 17:45, Cristiano Fontana wrote:

> Thank you again!
> 
> I am working on the destroot phase now but I could not get xinstall to install full directory trees.
> Since xinstall complains if asked to install a directory I can not use it.
> Is there a simple way to do it?

> I tried with the suggestion of the guide:
> 
> eval xinstall [glob ${workpath}/G4NDL${G4NDL_v}/*] ${destroot}${prefix}/share/geant4/data/G4NDL${G4NDL_v}
> 
> But it did not work:
> 
> Error: Target org.macports.destroot returned: xinstall: Inappropriate file type: /opt/local/var/macports/build/_Users_fontana_ports_science_geant4/work/G4NDL3.13/Capture
> 
> because that capture is a directory.

Right, xinstall copies files only, not directories. Try file copy:

file copy ${workpath}/G4NDL${G4NDL_v} ${destroot}${prefix}/share/geant4/data


> So I tried with some loops:
> 
>    foreach data {G4NDL${G4NDL_v} \
>                  G4EMLOW${G4EMLOW_v} \
>                  PhotonEvaporation${PhotonEvaporation_v} \
>                  RadioactiveDecay${RadioactiveDecay_v} \
>                  G4ABLA${G4ABLA_v} \
>                  RealSurface${RealSurface_v}} {
> 
>        puts "-> Installing ${data}"
>        foreach directory [exec find ${workpath}/${data}/ -type d ] {
>            puts "--> Creating ${prefix}/share/geant4/data/${directory}"
>            xinstall -d ${destroot}${prefix}/share/geant4/data/${directory}
>            foreach file [glob -nocomplain -type f ${directory}/*] {
>                puts "---> Installing ${file} to ${prefix}/share/geant4/data/${directory}"
>                xinstall ${file} ${destroot}${prefix}/share/geant4/data/${directory}"
>            }
>        }
>    }
> 
> but this works only if the current directory is the one that contains the directories: G4NDL${G4NDL_v} G4EMLOW${G4EMLOW_v} ...
> 
> Besides, the interpreter does not substitute the variables ${G4NDL_v} with their values:
> 
> Error: Target org.macports.destroot returned: find: /opt/local/var/macports/build/_Users_fontana_ports_science_geant4/work/G4NDL${G4NDL_v}/: No such file or directory
> 
> But if I put a line like:
> 
> puts "G4NDL${G4NDL_v} G4EMLOW${G4EMLOW_v} PhotonEvaporation${PhotonEvaporation_v} RadioactiveDecay${RadioactiveDecay_v} G4ABLA${G4ABLA_v} RealSurface${RealSurface_v}"
> 
> it gives the expected result:
> 
> G4NDL3.13 G4EMLOW6.9 PhotonEvaporation2.0 RadioactiveDecay3.2 G4ABLA3.0 RealSurface1.0

Variables expand inside double-quoted strings:

"variables expand here: ${name}"

but not inside curly-bracket-quoted strings:

{variables don't expand here: ${name}}


> I am sorry for all these questions but it is kinda hard to get my grip on MacPorts scripts...

No problem! Ask away.



More information about the macports-dev mailing list