Gate & Geant4: how to pass the variables from one port to the other

Ryan Schmidt ryandesign at macports.org
Sun Jul 7 00:00:19 PDT 2013


On Jul 6, 2013, at 19:25, Mojca Miklavec wrote:

> A few more questions are popping up in my head during the development
> of a Portfile for Geant4 & Gate.
> 
> The first one is the following: Let's say that Gate can depend either
> on Geant4 9.5 or on 9.6 and that I decide to provide two port
> variants, geant495 and geant496.
> 
> In case of dependence on 9.6 I need to provide the following:
> 
> variant geant496 conflicts geant495 description {Use Geant4 9.6} {
>    depends_lib port:geant4.9.6
>    configure.args-append
> -DGeant4_DIR=${prefix}/lib/Geant4/Geant4.9.6/Geant4-9.6.2
>    # 9.6.2 stands for "version 9.6, patch 2"
> }
> 
> If/when patch 3 for Geant4 9.6 comes out, the second argument would
> need to change into
>    configure.args-append
> -DGeant4_DIR=${prefix}/lib/Geant4/Geant4.9.6/Geant4-9.6.3
> and Gate would need to be rebuilt anyway.
> 
> In case of dependence on 9.5, I would need:
> 
> variant geant495 conflicts geant496 description {Use Geant4 9.5} {
>   depends_lib port:geant4.9.5
>    configure.args-append
> -DGeant4_DIR=${prefix}/lib/Geant4/Geant4.9.5/Geant4-9.5.2
> }
> 
> Even though I can hardcode the value of Geant4_DIR in Gate, it is
> probably cleaner/safer if the value would come from the Geant4
> PortGroup, but then again I'm not sure how to handle the version
> numbers. (The value comes from
> -DCMAKE_INSTALL_LIBDIR=lib/Geant4/Geant${simpleversion} in the Geant4
> port - simpleversion is set to "4.9.6" in the Geant's Portfile and
> "Geant4-9.6.2" is added automatically by the installation scripts.)
> 
> 
> What solution would you suggest for this? Supporting two versions of
> Geant4 for Gate is not really required, but I still need to get the
> variable for Geant4_DIR from somewhere (unless it's ok to hardcode
> that value.)

The Gate port should ask the installed geant4.9.6 software what its directory is. Depending on how geant provides this information, that might happen via pkg-config, a config script, a config file, or manual inspection of the directories that got installed. If it's complicated to find this out, then a proc in the portgroup would be a good idea so that the complicated bits are hidden out of the way.

Or, geant4.x should always install its software in the same directory, i.e. don't include the patchlevel in the directory name. Deciding whether to use this strategy might depend on how geant is usually packaged, and why they want the patchlevel in the directory name in the first place.



More information about the macports-dev mailing list