[119488] trunk/dports/kde

Ryan Schmidt ryandesign at macports.org
Sun Apr 27 21:40:50 PDT 2014


On Apr 27, 2014, at 05:20, mk at macports.org wrote:

> Revision
> 119488
> Author
> mk at macports.org
> Date
> 2014-04-27 03:20:14 -0700 (Sun, 27 Apr 2014)
> Log Message
> 
> rkward: new ports for RKWard (ticket #32837)
> Added Paths
> 
> 	• trunk/dports/kde/rkward/
> 	• trunk/dports/kde/rkward/Portfile
> Diff
> 
> Added: trunk/dports/kde/rkward/Portfile (0 => 119488)
> 
> --- trunk/dports/kde/rkward/Portfile	                        (rev 0)
> +++ trunk/dports/kde/rkward/Portfile	2014-04-27 10:20:14 UTC (rev 119488)
> 
> @@ -0,0 +1,95 @@
> 
> +# -*- 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
> +fetch.type          svn
> +svn.url             http://svn.code.sf.net/p/rkward/code/branches/release_branches/rkward_0.6.1

You should not need to repeat the version number multiple times in the portfile (http://en.wikipedia.org/wiki/Don't_repeat_yourself). Declare it once, in the version variable, then use that variable’s value anywhere else that you need the value.

> +svn.revision        4635
> +worksrcdir          ${workpath}/rkward_0.6.1

This value is incorrect. worksrcdir is supposed to be a path relative to workpath, not an absolute path. Either set worksrcdir to ${name}_${version} (preferred), or set worksrcpath to ${workpath}/${name}_${version} (equivalent but more verbose).


> +name                rkward
> +conflicts           rkward-devel
> +version             0.6.1
> +categories          kde kde4 math science
> +maintainers         hhu.de:meik.michalke
> +license             GPL-2
> +platforms           darwin
> +
> +description         KDE frontend to the R statistics language
> +
> +long_description    RKWard aims to become an easy to use, transparent frontend to R, a powerful system \
> +                    for statistical computation and graphics. Besides a convenient GUI for the most important \
> +                    statistical functions, future versions will also provide seamless integration with an office-suite.
> +
> +homepage            http://rkward.sourceforge.net
> 
> +
> +master_sites        https://sourceforge.net/projects/rkward/files/Current_Stable_Releases

Shouldn’t this be using the sourceforge fetch group? Actually, if you’re fetching from svn instead, then the master_sites line isn’t used at all and can be removed. But if you can fetch from a tarball instead of from svn that would be preferable.


> +PortGroup           cmake 1.0

Portgroup are conventionally declared directly following the PortSystem line.


> +depends_lib         port:kdelibs4 \
> +                    port:kate \
> +                    port:R
> +
> +# add port:okular once the graphics device is fully functional
> +# this needs port:poppler with +qt4 +quartz varaints which cannot be
> +# specified with depends_lib-append
> +variant okular description {Add okular for nice PDF handling} {
> +        depends_lib-append port:okular
> +}

A variant that does nothing more than add a dependency is usually wrong. You need to also tell the build system to use the dependency. Or, if the build system uses the dependency automatically if present, then you need to inform the build system *not* to use the dependency if the variant is *not* selected.

> +if {${configure.compiler} == "clang"} {
> +        # force the use of gcc 4.7 to be able to link with R-framework
> +        depends_lib-append   port:gcc47
> +        configure.compiler   macports-gcc-4.7
> +        configure.objc       /usr/bin/gcc
> +        configure.env-append "OBJCXX=${configure.objc}"
> +}

This looks very wrong and makes me very uncomfortable. Why is the MacPorts chosen default compiler (usually clang, these days) not satisfactory? If you’re trying to match the compiler selection of the R port, then add all the code the R port contains for adding compiler variants, and use the active_variants 1.1 port to ensure they match. However, note that the R port is only using the compiler variants to select the fortran compiler; it’s using the standard MacPorts-selected C/C++ and ObjectiveC/C++ compilers, so this port should too, and if this port does not need a fortran compiler, then the compiler variants are wholly unnecessary.

> +post-extract {
> +        # creates the build dir if it doesn't exist
> +        # this won't return errors if directory is already there
> +        file mkdir ${worksrcdir}/build
> +}

These comments seem unnecessary and just slow down whoever’s reading the code, who will already know what “file mkdir” does since it’s in the documentation for “file mkdir”.

> +configure.dir       ${worksrcdir}/build

This should be ${worksrcpath}/build

> +configure.args-append \
> +        -DNO_R_XML=1 \
> +        -DRKVERSION_NUMBER=${version} \
> +        -DBUNDLE_INSTALL_DIR=${applications_dir} \
> +        -DR_EXECUTABLE=${prefix}/Library/Frameworks/R.framework/Resources/R

Use ${frameworks_dir} instead of assuming its value is ${prefix}/Library/Frameworks (the user might have changed it).

> +# work around moved Qt include dir
> +if { ![file exists ${prefix}/include/Qt/qglobal.h] && [file exists ${prefix}/include/QtCore/qglobal.h] } {
> +        configure.args-append -DQT_QT_INCLUDE_DIR=${prefix}/include/QtCore
> +}

I’m not sure what this code is trying to do, but note that tests for file existence cannot be relied upon at this point. At the point that these lines are executed, MacPorts has not yet attempted to install or upgrade the port’s dependencies.

> +configure.cmd       cmake ..

The cmake portgroup already sets configure.cmd to run cmake, so it’s best to leave that alone, and instead add the “..” at the end of configure.args, or use configure.post_args.

> +
> +# configure R to use Mac binaries by default
> +# you must first install the OS X packages of CRAN R, as we'll link against them
> +subport rkward-binary {
> +        conflicts-append rkward rkward-devel-binary rkward-devel-debug rkward-debug
> +        depends_lib-delete   port:gcc47 port:R
> +        configure.compiler   llvm-gcc-4.2

Again, the compiler overriding here makes me very uncomfortable. For one thing, Xcode 5 does not provide llvm-gcc-4.2, so this would fail for users with Xcode 5 who have not already installed the llvm-gcc42 port.

Moreover, the whole concept of this subport makes me uncomfortable. MacPorts policy is not to link with third-party software installed outside of MacPorts; this subport’s purpose seems in violation of that policy.

> +        configure.args-delete \
> +               -DR_EXECUTABLE=${prefix}/Library/Frameworks/R.framework/Resources/R
> +        configure.args-append \
> +               -DUSE_BINARY_PACKAGES=1 \
> +               -DR_EXECUTABLE=/Library/Frameworks/R.framework/Resources/R \
> +               -DR_LIBDIR=${prefix}/Library/Frameworks/R.framework/Resources/library
> +        # create libdir if it doesn't exist
> +        file mkdir ${prefix}/Library/Frameworks/R.framework/Resources/library

You cannot create a directory directly in ${prefix} (or anywhere else outside of ${workpath}), and especially should not be attempting to do so for every single port operation including those that are supposed to be read-only, such as “port info” or “port livecheck”.

> +}
> +
> +# compile with full debugging support
> +subport rkward-debug {
> +        conflicts-append rkward rkward-devel-binary rkward-devel-debug rkward-binary
> +        depends_lib-append port:valgrind
> +        configure.args-append -DCMAKE_BUILD_TYPE=debugfull
> +}

debug should be a variant, not a subport. Actually the cmake portgroup already gives you one that sets this configure.arg, so you would just need to add the dependency, if that’s really required.

> +
> +build.dir           ${worksrcdir}/build

This should be ${worksrcpath}/build

> +pre-pkg {
> +        file copy -force -- ${worksrcdir}/macports/postinstall ${package.scripts}/postinstall
> +        file attributes ${package.scripts}/postinstall -permissions 0755
> +}



More information about the macports-dev mailing list