Request for help with port organisation: how to install several versions of data files

Mojca Miklavec mojca at macports.org
Mon Jul 1 12:23:42 PDT 2013


On Mon, Jul 1, 2013 at 2:48 PM, Mojca Miklavec wrote:
>
> Hi,
>
> I'm looking for ideas about how to best organise the port(s) for
> Geant4 data files (see also https://trac.macports.org/ticket/32716).

I'm answering myself, but I would still be grateful for feedback.

I came up with a solution that works, but isn't as elegant as it could be:

PortSystem          1.0

name                geant4-data
version             1.0
maintainers         mojca openmaintainer
description         Data files for Geant4
long_description    Data files for Geant4
homepage            http://geant4.web.cern.ch/

master_sites        http://geant4.cern.ch/support/source/

platforms           darwin
supported_archs     noarch

set geant.datadir ${prefix}/share/Geant4/Data

# it would be nice to be able to use a single line
# instead of the whole block to define new data:
# geant.add_data G4EMLOW 6.33 0002a1c16c9b1fb5e8d49dfbce12a576 G4EMLOW

#-----#
subport ${name}-G4NDL-4.3 {
    set data.name     G4NDL
    set data.version  4.3
    set data.md5      55493e74cba90e6cb167a5008e138cd7
    # 10.0.b01
}
subport ${name}-G4NDL-4.2 {
    set data.name     G4NDL
    set data.version  4.2
    set data.md5      2302d7ffeef1a450955302f027ee1cf4
    # 9.6.p02
}

#-----#
subport ${name}-G4EMLOW-6.33 {
    set data.name     G4EMLOW
    set data.version  6.33
    set data.md5      0002a1c16c9b1fb5e8d49dfbce12a576
    # 10.0.b01
}
subport ${name}-G4EMLOW-6.32 {
    set data.name     G4EMLOW
    set data.version  6.32
    set data.md5      9d3302072ba694b1d4505c330ed89d89
    # 9.6.p02
}

# ...

if {$subport != $name} {
    set data.filename ${data.name}.${data.version}.tar.gz

    distfiles ${data.filename}
    checksums ${data.filename} md5 ${data.md5}
    distname  ${data.name}${data.version}

    # TODO: is it possible to extract files straight to destdir
instead of copying them around?
    configure {}
    build     {}

    destroot {
        # TODO: any better way to copy recursively?
        xinstall -m 755 -d ${destroot}${geant.datadir}
        file copy ${workpath}/${distname} ${destroot}${geant.datadir}
    }
} else {

}

I'm open to suggestions for better structure of the Portfile. In
particular it would be nice to generate the names of subports
automatically from some function.

Mojca
-------------- next part --------------
A non-text attachment was scrubbed...
Name: geant4-data.Portfile
Type: application/octet-stream
Size: 3168 bytes
Desc: not available
URL: <http://lists.macosforge.org/pipermail/macports-dev/attachments/20130701/66e915bd/attachment.obj>


More information about the macports-dev mailing list