[90985] trunk/dports/science

Ryan Schmidt ryandesign at macports.org
Tue Mar 20 23:25:42 PDT 2012


On Mar 20, 2012, at 14:08, aronnax at macports.org wrote:

> Revision: 90985
>          https://trac.macports.org/changeset/90985
> Author:   aronnax at macports.org
> Date:     2012-03-20 12:08:01 -0700 (Tue, 20 Mar 2012)
> Log Message:
> -----------
> New port: healpix
> 
> Added Paths:
> -----------
>    trunk/dports/science/healpix/
>    trunk/dports/science/healpix/Portfile
>    trunk/dports/science/healpix/files/
>    trunk/dports/science/healpix/files/patch-src-cxx-cxxsupport-arr.h.diff


> +master_sites        sourceforge
> +master_sites.mirror_subdir ${name}/Healpix_${version}

You could simplify this to:

master_sites        sourceforge:project/healpix/Healpix_${version}

That's how we usually write it.


> +use_configure       no

Because you turn off the standard configure mechanism, you're responsible for ensuring you use the right -arch flags. See [get_canonical_archflags]. Adding a universal variant may also be possible.


> +# Find a compiler that supports OpenMP.  Courtesy of Adam Mercer.
> +if {${configure.compiler} == "clang"} {
> +   configure.compiler llvm-gcc-4.2
> +}
> +
> +if {${configure.compiler} == "gcc-4.0"} {

Systems on which gcc-4.0 is the default are Tiger and Leopard.

> +   configure.compiler gcc-4.2

Of those, only Leopard's Xcode also has gcc-4.2.

> +   if {![file executable ${configure.cc}]} {

So this block takes effect only on Tiger.

> +       depends_build-append port:apple-gcc42
> +       configure.compiler apple-gcc-4.2

The apple-gcc42 port does not build on Tiger:

https://trac.macports.org/ticket/32127

So I think py-healpy cannot be used on Tiger.

> +       # base (as of 2.0.3) doesn't set cxx for apple-gcc-4.2
> +       configure.cxx ${prefix}/bin/g++-apple-4.2

This 2.0.3 bug was fixed in 2.0.4 so this workaround is no longer needed.


The above also applies to py-healpy.



> +build.post_args-append \
> +                    HEALPIX_TARGET=osx \
> +                    BINDIR=${worksrcpath}/bin \
> +                    LIBDIR=${worksrcpath}/lib \
> +                    INCDIR=${worksrcpath}/include \
> +                    EXTERNAL_CFITSIO=yes \
> +                    CFITSIO_INCDIR=${prefix}/include \
> +                    CFITSIO_LIBDIR=${prefix}/lib \
> +                    CFITSIO_EXT_LIB=${prefix}/lib/libcfitsio.a \
> +                    CFITSIO_EXT_INC=${prefix}/include \
> +                    CC=${configure.cc} CL=${configure.cc} \
> +                    CXX=${configure.cxx} CXXL=${configure.cxx}

Here's where you probably would deal with -arch flags, perhaps e.g.

CC="${configure.cc} [get_canonical_archflags cc]"

(untested)

(and the same for CL, CXX, CXXL)


> +build {
> +    system "${build.cmd} -C ${worksrcpath}/src/cxx ${build.post_args}"
> +    system "${build.cmd} -C ${worksrcpath}/src/C/subs static install AR=\"ar -rsv\" ${build.post_args}"
> +}

This is fine, but note system also has a -W argument you can use to change the current working directory. That would look like:

    system -W ${worksrcpath}/src/cxx "${build.cmd} ${build.post_args}"
    system -W ${worksrcpath}/src/C/subs "${build.cmd} static install AR=\"ar -rsv\" ${build.post_args}"


> +pre-destroot {
> +    # This file is just a copy of ${worksrcpath}/lib/libhpxgif.a
> +    # and conflicts with port:giflib.
> +    file delete ${worksrcpath}/lib/libgif.a
> +}

This should be in post-build, or more simply, since you're already overriding it, in build.


> +destroot {
> +    xinstall -d ${destroot}${prefix}/include
> +    xinstall -d ${destroot}${prefix}/lib
> +    xinstall -d ${destroot}${prefix}/bin

MacPorts automatically creates these directories for you.




More information about the macports-dev mailing list