Bug 268300 - [New port] science/geant4: Simulation of the passage of particles through matter
Summary: [New port] science/geant4: Simulation of the passage of particles through matter
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Thierry Thomas
URL: https://gitlab.cern.ch/geant4/geant4
Keywords:
Depends on:
Blocks:
 
Reported: 2022-12-10 15:42 UTC by Erik Jensen
Modified: 2022-12-28 23:22 UTC (History)
1 user (show)

See Also:


Attachments
archive containing the port files (232.33 KB, application/x-compressed-tar)
2022-12-10 15:42 UTC, Erik Jensen
no flags Details
archive containing the port files (211.33 KB, patch)
2022-12-26 02:14 UTC, Erik Jensen
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Jensen 2022-12-10 15:42:31 UTC
Created attachment 238692 [details]
archive containing the port files

Port of Geant4 (https://geant4.web.cern.ch/) which is a toolkit for the simulation of the passage of particles through matter.

I attach the port files as a tgz archive here, since it would exceed the file size limit in shar archive format.

The port has passed a `poudriere testport` on the 2022Q4 branch of 13.1R-p5 amd64 on my end.
Comment 1 Erik Jensen 2022-12-11 12:49:44 UTC
Forgot to mention: The CMake project contained in this port fetches data files for the library during build.
As such, I had to enable ALLOW_NETWORKING_PACKAGES="geant4" in my poudriere config.
If this is a big no-no in production, I can look into fetching the data files prior to building - perhaps with some guidance.
The way it is already implemented during build of Geant4 seems quite sober to me.
Comment 2 Erik Jensen 2022-12-11 12:59:27 UTC
"Data files", as in "not libraries upon which the port depends", but data files which the library itself indexes for experimentally documented values to be used in its simulations after installation of the port.
Comment 3 Thierry Thomas freebsd_committer freebsd_triage 2022-12-25 14:55:25 UTC
Yes, ALLOW_NETWORKING_PACKAGES will never be activated on the compilation farm, and the package will fail.

You have to set these datafiles in DISTFILES, maybe add an extra target post-patch: to move them from $WRKDIR to the expected directory, and patch the makefile to not fetch them.
Comment 4 Erik Jensen 2022-12-26 02:14:30 UTC
Created attachment 239025 [details]
archive containing the port files

Updated patch such that data files are fetched during do-fetch rather than during the project's own CMake build step
Comment 5 Thierry Thomas freebsd_committer freebsd_triage 2022-12-26 12:00:50 UTC
During configure, the hereunder message is displayed:
------------------------------------------------------------------------
  *WARNING*
    Geant4 has been pre-configured to look for datasets
    in the directory:
 
    /usr/local/share/Geant4-11.0.3/data
 
    but the following datasets are NOT present on disk at
    that location:
 
    G4NDL (4.6)
    G4EMLOW (8.0)
    PhotonEvaporation (5.7)
    RadioactiveDecay (5.6)
    G4PARTICLEXS (4.0)
    G4PII (1.3)
    RealSurface (2.2)
    G4SAIDDATA (2.0)
    G4ABLA (3.1)
    G4INCL (1.0)
    G4ENSDFSTATE (2.3)
 
    If you want to have these datasets installed automatically
    simply re-run cmake and set the GEANT4_INSTALL_DATA
    variable to ON. This will configure the build to download
    and install these datasets for you. For example, on the
    command line, do:
 
    cmake -DGEANT4_INSTALL_DATA=ON <otherargs>
 
    The variable can also be toggled in ccmake or cmake-gui.
    If you're running on a Windows system, this is the best
    solution as CMake will unpack the datasets for you
    without any further software being required
 
    Alternatively, you can install these datasets manually
    now or after you have installed Geant4. To do this,
    download the following files:
 
    https://cern.ch/geant4-data/datasets/G4NDL.4.6.tar.gz
    https://cern.ch/geant4-data/datasets/G4EMLOW.8.0.tar.gz
    https://cern.ch/geant4-data/datasets/G4PhotonEvaporation.5.7.tar.gz
    https://cern.ch/geant4-data/datasets/G4RadioactiveDecay.5.6.tar.gz
    https://cern.ch/geant4-data/datasets/G4PARTICLEXS.4.0.tar.gz
    https://cern.ch/geant4-data/datasets/G4PII.1.3.tar.gz
    https://cern.ch/geant4-data/datasets/G4RealSurface.2.2.tar.gz
    https://cern.ch/geant4-data/datasets/G4SAIDDATA.2.0.tar.gz
    https://cern.ch/geant4-data/datasets/G4ABLA.3.1.tar.gz
    https://cern.ch/geant4-data/datasets/G4INCL.1.0.tar.gz
    https://cern.ch/geant4-data/datasets/G4ENSDFSTATE.2.3.tar.gz
 
    and unpack them under the directory:
 
    /usr/local/share/Geant4-11.0.3/data
 
    As we supply the datasets packed in gzipped tar files,
    you will need the 'tar' utility to unpack them.
 
    Nota bene: Missing datasets will not affect or break
               compilation and installation of the Geant4
               libraries.
 
------------------------------------------------------------------------

Maybe you could add an option for these datasets?
Comment 6 Thierry Thomas freebsd_committer freebsd_triage 2022-12-26 15:08:43 UTC
Committed (with some modifications to pet portlint: tabs after variable assignation, trailing spaces, etc.). Thanks!

Note: the port CLHEP, science/clhep, is lagging, but once updated it would be better to depend on it.
Comment 7 commit-hook freebsd_committer freebsd_triage 2022-12-26 15:09:04 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3f600a75eaafb4430d0c19a19d27e542f77b13ef

commit 3f600a75eaafb4430d0c19a19d27e542f77b13ef
Author:     Erik Jensen <erik@tenku.dk>
AuthorDate: 2022-12-26 15:01:50 +0000
Commit:     Thierry Thomas <thierry@FreeBSD.org>
CommitDate: 2022-12-26 15:04:31 +0000

    science/geant4: adding Geant4, a TK for the simulation of the passage of particles through matter

    PR:             268300
    Reported by:    erik (at) tenku.dk

 science/Makefile                                   |     1 +
 science/geant4/Makefile (new)                      |    79 +
 science/geant4/distinfo (new)                      |    25 +
 science/geant4/files/patch-CMakeLists.txt (new)    |     8 +
 ..._global_management_include_G4Backtrace.hh (new) |    11 +
 ...h-source_global_management_include_tls.hh (new) |    12 +
 science/geant4/pkg-descr (new)                     |     9 +
 science/geant4/pkg-plist (new)                     | 54962 +++++++++++++++++++
 8 files changed, 55107 insertions(+)
Comment 8 Erik Jensen 2022-12-26 15:40:43 UTC
(In reply to Thierry Thomas from comment #5)
These are the datasets I referred to in comment #1.

For the changes attached in comment #4, I turned off the CMake flag GEANT4_INSTALL_DATA, which the warning message mentions, because this implies fetching the data over https during building of the library.
Instead, the datasets are fetched as DISTFILES during do-fetch and installed to the relevant place in the post-install step.

For my next patch, I can look into adding an option to toggle the fetching and installation of these datasets on/off in the port Makefile, if that is what you mean?

The most sensible default is to install Geant4 with the datasets.

Cheers,
Erik
Comment 9 Erik Jensen 2022-12-26 15:42:17 UTC
(In reply to Thierry Thomas from comment #6)
Thanks Thierry!

As for the dependency on science/clhep, what do you have in mind here?
Comment 10 Erik Jensen 2022-12-26 15:44:35 UTC
(In reply to Erik Jensen from comment #8)
I can also patch the CMake config so it does not produce this warning, if/when the fetching of datasets is enabled.
Comment 11 Thierry Thomas freebsd_committer freebsd_triage 2022-12-26 16:23:49 UTC
(In reply to Erik Jensen from comment #10)
No problem for the datasets, I thought that these warnings applied some other files! No worry, this is fine, and an option is not necessary.
Comment 12 Thierry Thomas freebsd_committer freebsd_triage 2022-12-26 16:27:06 UTC
(In reply to Erik Jensen from comment #9)
According to their notes, Geant4 would use a recent CLHEP if it finds one, but since science/clhep is too old, ATM it builds a minimum clhep.

It the port science/clhep get updated, I suggest to switch to it.
Comment 13 Erik Jensen 2022-12-26 16:35:16 UTC
(In reply to Thierry Thomas from comment #12)
Gotcha - I will keep an eye on this.

Thanks again!
Comment 14 Erik Jensen 2022-12-28 23:22:31 UTC
I see that science/clhep has been upgraded.
I have the update of Geant4 to version 11.1.0 on my todo list, and I will modify the port to depend on science/clhep while I am at it.