[107878] users/mojca/ports/science

mojca at macports.org mojca at macports.org
Mon Jul 8 00:59:41 PDT 2013


Revision: 107878
          https://trac.macports.org/changeset/107878
Author:   mojca at macports.org
Date:     2013-07-08 00:59:41 -0700 (Mon, 08 Jul 2013)
Log Message:
-----------
geant: a new attempt to put all geant versions + data in a single port (not well tested yet)

Added Paths:
-----------
    users/mojca/ports/science/geant/
    users/mojca/ports/science/geant/Portfile
    users/mojca/ports/science/geant/files/

Added: users/mojca/ports/science/geant/Portfile
===================================================================
--- users/mojca/ports/science/geant/Portfile	                        (rev 0)
+++ users/mojca/ports/science/geant/Portfile	2013-07-08 07:59:41 UTC (rev 107878)
@@ -0,0 +1,209 @@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+# $Id:  $
+
+PortSystem          1.0
+PortGroup           cmake 1.0
+
+# TODO: this will probably be called geant4
+name                geant
+# TODO: not sure what the version should be (version should be specific to each subport)
+#version            4.0
+categories          science
+maintainers         mojca openmaintainer
+# TODO: what licence is needed to make sure that Geant can be installed as a binary package
+license             Geant4
+description         Geant4 is a toolkit for the simulation of the passage of particles through matter.
+long_description    Geant4 is a toolkit for the simulation of the passage of particles through matter. \
+                    Its areas of application include high energy, nuclear and accelerator physics, as well as studies in medical and space science. \
+                    The two main reference papers for Geant4 are published in Nuclear Instruments and Methods in Physics Research A 506 (2003) 250-303, \
+                    and IEEE Transactions on Nuclear Science 53 No. 1 (2006) 270-278.
+homepage            http://geant4.web.cern.ch/
+platforms           darwin
+
+master_sites        http://geant4.cern.ch/support/source/
+
+# - version
+# - revision (used internally in MacPorts to force updates)
+# - patchlevel (also used in directory names)
+# - version string (used for fetching the source)
+set geant.versions_info {
+     9.5  0  2  4.9.5.p02    33413f6233b75c003254af5888f4af32d17f515d  adb04fce9472228bb10d78cbc7f40493bfb37454beee22e7c80d630646cd3777
+     9.6  0  2  4.9.6.p02    9ae32c3f8769e303b41df164693f77a74ca6db97  cf5df83b7e2c99e6729449b32d3ecb0727b4692317426b66fc7fd41951c7351f
+    10.0  0  0  4.10.00.b01  14820eca2893ffa7a27cd44f51c6c9b4b125b491  0fa7c9b0e1b09fd11b682523b839b4c6c67f4c3cd5bc9a9357512c37ea4a9e1e
+}
+set geant.data_versions_10.0 {
+    G4NDL              4.3   G4NDL                G4NEUTRONHPDATA    55493e74cba90e6cb167a5008e138cd7  d7559295e71e373246f90db9ab8ce652a1bb71c2  169dbc6d6c1c5b7bb57ee676687ae5b830847cf4e75fecb1e35187172f472e6a
+    G4EMLOW            6.33  G4EMLOW              G4LEDATA           0002a1c16c9b1fb5e8d49dfbce12a576  e6b3b60c04d6e5faa6ea9d9f04c805fd479dbc47  441542ed5359b536f7908369d4abc045468a14e89975855dd145ffd352d3701f
+    PhotonEvaporation  2.3   G4PhotonEvaporation  G4LEVELGAMMADATA   08848ebdd536280a0629d802040b70be  8cd383005f5f8c38f69e4818cf5b1ad397925abc  60449df933794aa0ad3938886c8c023e3093ff59ad6c752923390d5c550f34cb
+    RadioactiveDecay   3.7   G4RadioactiveDecay   G4RADIOACTIVEDATA  039e5f64b0e451eb5c095bf81552cb42  a30e4c0123242405219da4194f37653719a53cbc  f0b96a5f39fb58c1fff80140b4b471fee9718e96d01660bc1d6bff85e0ceab53
+    G4NEUTRONXS        1.3   G4NEUTRONXS          G4NEUTRONXSDATA    ede7c4b3e99cbe1773b672a7404fe0f6  33ed98449ad754cfd756247392d5484aca8a276b  0aad03ecaf3762e38d9cede48366615d694544c3a1fd843141c548a9a128028f
+    G4PII              1.3   G4PII                G4PIIDATA          05f2471dbcdf1a2b17cbff84e8e83b37  313a2615903b0682b8aabc344bedde82c345704b  6225ad902675f4381c98c6ba25fc5a06ce87549aa979634d3d03491d6616e926
+    RealSurface        1.0   RealSurface          G4REALSURFACEDATA  0dde95e00fcd3bcd745804f870bb6884  030513fe340e0cccbfe0b9ae9acb3ba6b5291ebb  3e2d2506600d2780ed903f1f2681962e208039329347c58ba1916740679020b1
+    G4SAIDDATA         1.1   G4SAIDDATA           G4SAIDXSDATA       d88a31218fdf28455e5c5a3609f7216f  7f0c75c86eea3d227379d3dfe77e4600752f99a2  a38cd9a83db62311922850fe609ecd250d36adf264a88e88c82ba82b7da0ed7f
+}                    
+set geant.data_versions_9.6 {
+    G4NDL              4.2   G4NDL                G4NEUTRONHPDATA    2302d7ffeef1a450955302f027ee1cf4  5289896235ccb84f551f642447372f286084a695  173f60a506b9176d7ff531d6a5f6195dcec74df30ffafc09644f47f979bd641b
+    G4EMLOW            6.32  G4EMLOW              G4LEDATA           9d3302072ba694b1d4505c330ed89d89  d5b1c435fb4925339175188472f1453637c98b0d  bdb3c00af89b18c21553d79fd823110429fdcf1e83c029aa450185d9caf4a7cf
+    PhotonEvaporation  2.3   G4PhotonEvaporation  G4LEVELGAMMADATA   08848ebdd536280a0629d802040b70be  8cd383005f5f8c38f69e4818cf5b1ad397925abc  60449df933794aa0ad3938886c8c023e3093ff59ad6c752923390d5c550f34cb
+    RadioactiveDecay   3.6   G4RadioactiveDecay   G4RADIOACTIVEDATA  9566ff1614bea7455343328cb66abd6f  1ed4a9707a18720d9a649fd4a7ca97faf24434b9  3502ed4be04d694115a3acf59d7a3593725a2d79f3adad0ffa135ff653f89d1d
+    G4NEUTRONXS        1.2   G4NEUTRONXS          G4NEUTRONXSDATA    092634b9258c7bc387cb83557ff1df81  5ebf3b9006a9c6249cad8e40e9661fbe3ec50f0e  9ce488505b4c3623e2d98209f708a30e3f213a1371a9110d289257a02b2d7d5c
+    G4PII              1.3   G4PII                G4PIIDATA          05f2471dbcdf1a2b17cbff84e8e83b37  313a2615903b0682b8aabc344bedde82c345704b  6225ad902675f4381c98c6ba25fc5a06ce87549aa979634d3d03491d6616e926
+    RealSurface        1.0   RealSurface          G4REALSURFACEDATA  0dde95e00fcd3bcd745804f870bb6884  030513fe340e0cccbfe0b9ae9acb3ba6b5291ebb  3e2d2506600d2780ed903f1f2681962e208039329347c58ba1916740679020b1
+    G4SAIDDATA         1.1   G4SAIDDATA           G4SAIDXSDATA       d88a31218fdf28455e5c5a3609f7216f  7f0c75c86eea3d227379d3dfe77e4600752f99a2  a38cd9a83db62311922850fe609ecd250d36adf264a88e88c82ba82b7da0ed7f
+}
+set geant.data_versions_9.5 {
+    G4NDL              4.2   G4NDL                G4NEUTRONHPDATA    6d23aff98e5706af1dd7fff397969f37  602d209009ee93d792cb67fe592aa37de6bab7c2  cef4fab143d8dcb8eae4c6e5c095af01d735bb36334b9958e00e30bcec9827ed
+    G4EMLOW            6.32  G4EMLOW              G4LEDATA           98cdca1024bf168c8f8ca1deb40f43b9  84529979894ed5e35ade27201fee67884d7b381d  6452215d9a0acbd35c71eed47f3581fd0276d7088b1a1a8588c003d9072aed3e
+    PhotonEvaporation  2.3   G4PhotonEvaporation  G4LEVELGAMMADATA   8010e7ce8a92564e38dd3418e6040563  8efc16c40b4755d209f83f31f2d251bbef52ccb8  9db02ef8e5b065c1b7f7d1becd1b72dde2b8fc617bcedde97788040418f239c0
+    RadioactiveDecay   3.6   G4RadioactiveDecay   G4RADIOACTIVEDATA  a5b681048584631608ab0965b33c7959  378c237cd5857b4205980815a3c47cdb654506d4  1ecfb477ca3c3966dd128193d8e11e24d6c3dc29cc188c8c9b0b21b941f9c30c
+    G4ABLA             3.0   G4ABLA               G4ABLADATA         d7049166ef74a592cb97df0ed4b757bd  656b10fc9d8022e89e99a728576d0b502161aa69  99fd4dcc9b4949778f14ed8364088e45fa4ff3148b3ea36f9f3103241d277014
+    G4NEUTRONXS        1.1   G4NEUTRONXS          G4NEUTRONXSDATA    61ef3a05b56525db04e11820e3f603f1  a4cd8791219f0df856da39295e7f913a537bde1a  d477a377aee229bf9d75d3c9cc4b7cd48b414285a246449e4e44a72bf037472b
+    G4PII              1.3   G4PII                G4PIIDATA          05f2471dbcdf1a2b17cbff84e8e83b37  313a2615903b0682b8aabc344bedde82c345704b  6225ad902675f4381c98c6ba25fc5a06ce87549aa979634d3d03491d6616e926
+    RealSurface        1.0   RealSurface          G4REALSURFACEDATA  0dde95e00fcd3bcd745804f870bb6884  030513fe340e0cccbfe0b9ae9acb3ba6b5291ebb  3e2d2506600d2780ed903f1f2681962e208039329347c58ba1916740679020b1
+}
+
+foreach {geant.version geant.revision geant.patchlevel geant.version_full geant.rmd160 geant.sha256} ${geant.versions_info} {
+    set geant.version_simple 4.${geant.version}
+    # or perhaps share/Geant4/Geant${geant.version_simple}/Data
+    # note that gmk files go to share/Geant4/Geant4-${geant.version}.${geant.patchlevel}
+    set geant.datadir ${prefix}/share/Geant4/Data/Geant${geant.version_simple}
+
+    subport geant4-${geant.version}-data {
+        # TODO: also set revision from some variable to allow rebuilding data file only when they are really needed
+        revision 0
+        supported_archs     noarch
+        description         "Data files for Geant4"
+        long_description    ${description}
+ 
+        set list_distfiles {}
+        # TODO: use an array (hash) to implement this without if-else
+        if {${geant.version} == "10.0" } {
+            set geant.data_versions ${geant.data_versions_10.0}
+        }
+        if {${geant.version} == "9.6" } {
+            set geant.data_versions ${geant.data_versions_9.6}
+            }
+        if {${geant.version} == "9.5" } {
+            set geant.data_versions ${geant.data_versions_9.5}
+        }
+        foreach {data.name data.version data.filename data.envvariable data.md5 data.rmd160 data.sha256} ${geant.data_versions} {
+            set filename ${data.filename}.${data.version}${extract.suffix}
+            lappend list_distfiles ${filename}
+            checksums-append ${filename} md5 ${data.md5} rmd160 ${data.rmd160} sha256 ${data.sha256}
+        }
+        distfiles ${list_distfiles}
+        post-extract {
+            # only necessary for G4EMLOW 6.23 & 6.32
+            # but G4NEUTRONXS 1.1, 1.2, 1.3 and PhotonEvaporation 2.2 also have some weird permissions
+            system "find ${workpath} -type f -exec chmod 644 {} \\;"
+        }
+        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}"
+            }
+        }
+    }
+
+    # TODO: should eventually become ${name}.${geant.version} (geant4.9.6)
+    # (or maybe something else, I'm open to suggestions)
+    subport geant4-${geant.version} {
+        set                 geant.distfilename geant${geant.version_full}${extract.suffix}
+        # TODO: check whether x.b01 -> x -> x.p01 -> x.p02 works properly
+        version             ${geant.version_full}
+        revision            ${geant.revision}
+        distfiles           ${geant.distfilename}
+        checksums           ${geant.distfilename} rmd160 ${geant.rmd160} sha256 ${geant.sha256}
+        
+        worksrcdir          geant${version}
+        configure.dir       ${workpath}/build
+        build.dir           ${configure.dir}
+
+        post-extract {
+            file mkdir ${configure.dir}
+        }
+        configure.post_args ${worksrcpath}
+
+        # TODO: a few more dependencies
+        depends_lib         port:${name}-data \
+                            port:zlib \
+                            port:expat \
+                            port:root \
+                            port:iAIDA
+
+        if {${geant.version} == "9.6" || ${geant.version} == "10.0"} {
+            patchfiles      patch-cmake_Modules_FindAIDA.cmake.diff
+        }
+
+        configure.args-append -DGEANT4_INSTALL_DATA=OFF \
+                              -DCMAKE_INSTALL_BINDIR=libexec/Geant4/Geant${geant.version_simple} \
+                              -DCMAKE_INSTALL_DATAROOTDIR=share/Geant4 \
+                              -DCMAKE_INSTALL_INCLUDEDIR=include/Geant4/Geant${geant.version_simple} \
+                              -DCMAKE_INSTALL_LIBDIR=lib/Geant4/Geant${geant.version_simple} \
+                              -DGEANT4_USE_OPENGL_X11=OFF
+
+        if {${geant.version} != "9.5"} {
+            configure.args-append -DGEANT4_INSTALL_DATADIR=${geant.datadir} \
+        }
+
+        variant qt description {Build with Qt support} {
+            depends_lib-append    port:qt4-mac
+            configure.args-append -DGEANT4_USE_QT=ON
+            # maybe we need more variables?
+        }
+        variant x11 description {Build with X11 visualisation drivers} {
+            depends_lib-append    port:xorg-libice \
+                                  port:xorg-libsm \
+                                  port:xorg-libX11 \
+                                  port:xorg-libXext \
+                                  port:xorg-libXmu
+            configure.args-delete -DGEANT4_USE_OPENGL_X11=OFF
+            configure.args-append -DGEANT4_USE_OPENGL_X11=ON
+        }
+        # TODO: probably no need for a separate option (just make it default)
+        variant clhep description {Use external CLHEP} {
+            depends_lib-append    port:clhep
+            configure.args-append -DGEANT4_USE_SYSTEM_CLHEP=ON \
+                                  -DCLHEP_CONFIG_EXECUTABLE=${prefix}/bin/clhep-config \
+                                  -DCLHEP_INCLUDE_DIR=${prefix}/include \
+                                  -DCLHEP_LIBRARY=${prefix}/lib/libCLHEP.dylib
+        }
+
+        # TODO: figure out how to install binaries somewhere else
+        variant examples requires clhep description {Build and install examples} {
+            configure.args-append -DGEANT4_BUILD_EXAMPLES=ON \
+                                  -DGEANT4_INSTALL_EXAMPLES=ON
+        }
+
+        # DATAROOTDIR: Geant automatically adds /Geant4-9.6.2 (any way to prevent this?)
+        # INCLUDEDIR: /opt/local/include/Geant4/Geant4.9.6/Geant4 (any way to prevent double Geant4?)
+        # CMake files are under /opt/local/lib/Geant4/Geant4.9.6/Geant4-9.6.2/*.cmake
+        # CMAKE_INSTALL_BINDIR: this installs binaries to a non-default location;
+        #     port select could be used to get the default installation, but all three scripts in bindir need patching to properly detect their location
+        default_variants +qt +clhep
+    }
+}
+
+# stub port
+if {$subport == $name || $subport == ""} {
+    fetch         {}
+    checksum      {}
+    extract       {}
+    patch         {}
+    use_configure no
+    build         {}
+    destroot {
+        set geant.docdir ${prefix}/share/doc/${name}
+        xinstall -m 755 -d ${destroot}${geant.docdir}
+        system "echo $name is a stub port > ${destroot}${geant.docdir}/README"
+    }
+    livecheck.type  none
+}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130708/c831de89/attachment-0001.html>


More information about the macports-changes mailing list