[65255] trunk/dports/lang

Ryan Schmidt ryandesign at macports.org
Wed Mar 24 13:41:39 PDT 2010


On Mar 24, 2010, at 15:09, singingwolfboy at macports.org wrote:

> Revision: 65255
>          http://trac.macports.org/changeset/65255
> Author:   singingwolfboy at macports.org
> Date:     2010-03-24 13:09:45 -0700 (Wed, 24 Mar 2010)
> Log Message:
> -----------
> Added portfile for development version of Google Go programming language
> 
> Added Paths:
> -----------
>    trunk/dports/lang/go-devel/
>    trunk/dports/lang/go-devel/Portfile
> 


> +name                go-devel
> +set real_name       go
> +version             0.0.1

> +homepage            http://golang.org/
> +fetch.type          hg
> +hg.url              https://go.googlecode.com/hg/
> +hg.tag              release

By what means are you ensuring that version 0.0.1 is being downloaded?


> +build.cmd           cd src && ./make.bash
> +build.target    
> +build.env           GOROOT=${GOROOT} GOBIN=${GOBIN}
> +use_parallel_build  no
> +test.run            yes
> +test.cmd            cd src && ./run.bash
> +test.target 
> +test.env            GOROOT=${GOROOT} GOBIN=${GOBIN}

You probably don't want "cd src &&" in your build.cmd and test.cmd. Instead, you probably want to set build.dir and test.dir to ${worksrcpath}/src.


> +destroot {
> +    # bin files
> +    file delete ${destroot}${prefix}/bin
> +    file copy ${workpath}/bin ${destroot}${prefix}

This surprises me. I would have expected copying from ${worksrcpath}/bin, not ${workpath}/bin. But I guess it works the way it is. Maybe it would be clearer to replace this hardcoded ${workpath}/bin with the variable you already set up with this value, ${GOBIN}. (Is there a special reason why GOBIN is set to be a directory outside of ${worksrcpath}?)

> +    # lib files
> +    xinstall -m 644 -W ${worksrcpath}/lib lib9.a libbio.a libmach.a \
> +        ${destroot}${prefix}/lib
> +    
> +    # include files
> +    file copy ${worksrcpath}/include ${destroot}${prefix}/include/${real_name}
> +}
> +
> +### PLATFORM VARIANTS ###
> +variant darwin {
> +    build.env-append GOOS=darwin
> +    test.env-append GOOS=darwin
> +}
> +variant freebsd {
> +    build.env-append GOOS=freebsd
> +    test.env-append GOOS=freebsd
> +}
> +variant linux {
> +    build.env-append GOOS=linux
> +    test.env-append GOOS=linux
> +}

My instinct is to say these should be "platform darwin", "platform freebsd" and "platform linux", though MacPorts 1.8 doesn't work so well on non-BSD OSes anymore. But I understand that this is the environment you want to develop with. So presumably you're saying you might want to develop FOR Linux ON Mac OS X, by using the +linux variant? If so, does that actually work, and is that something someone would actually want to do? It would seem to be simpler to say if you're installing with MacPorts on Mac OS X, you can only do development for Mac OS X.

> +variant nacl description {Platform variant} {
> +    build.env-append GOOS=nacl
> +    test.env-append GOOS=nacl
> +}

Not sure what OS this is.

> +variant i386 {
> +    build.env-append GOARCH=386
> +    test.env-append GOARCH=386
> +}

Again my instinct would be that this should be "platform i386".


> +variant amd64 description {Platform variant} {
> +    build.env-append GOARCH=amd64
> +    test.env-append GOARCH=amd64
> +}
> +variant arm description {Platform variant} {
> +    build.env-append GOARCH=arm
> +    test.env-append GOARCH=arm
> +}

I don't know what should be done with this. These look like architectures, but we don't have platforms by those names in MacPorts.

Should I take it that the variants i386, amd64 and arm should conflict with one another?

Actually, if we're going to build for the local system, then it seems you should throw out these variants, and instead set GOARCH based on the value of ${build_arch}.

Since I don't see any PowerPC stuff in Go, you may also want to prevent installation on PowerPC Macs. Unless again we're thinking of cross-compiling where someone could install Go on a PowerPC Mac and develop for a Intel machine. That doesn't sound like an efficient development environment however.


> +### OTHER VARIANTS ###
> +variant docs description {Install Go documentation} {
> +    post-destroot {
> +        xinstall -m 755 -d ${destroot}${prefix}/share/doc/
> +        file copy ${worksrcpath}/doc ${destroot}${prefix}/share/doc/${real_name}
> +        xinstall -m 644 -W ${worksrcpath} favicon.ico \
> +            ${destroot}${prefix}/share/doc/${real_name}
> +    }
> +}
> +variant bash_completion description {Install bash completion files for Go} {
> +    depends_run-append      path:etc/bash_completion.d:bash-completion
> +    post-destroot {
> +        xinstall -m 755 -d ${destroot}${prefix}/etc/bash_completion.d
> +        xinstall -m 644 -W ${worksrcpath}/misc/bash ${real_name} \
> +            ${destroot}${prefix}/etc/bash_completion.d/${real_name}
> +    }
> +}
> +variant emacs description {Install Go syntax highlighting for emacs} {
> +    depends_run-append      bin:emacs:emacs
> +    post-destroot {
> +        xinstall -m 755 -d ${destroot}${prefix}/share/emacs/site-lisp/
> +        eval xinstall -m 644 [glob ${worksrcpath}/misc/emacs/*.el] \
> +            ${destroot}${prefix}/share/emacs/site-lisp/
> +    }
> +}
> +variant vim description {Install Go syntax highlighting for vim} {
> +    depends_run-append      bin:vim:vim
> +    post-destroot {
> +        xinstall -m 755 -d ${destroot}${prefix}/share/vim/vim72/syntax/
> +        xinstall -m 644 ${worksrcpath}/misc/vim/${real_name}.vim \
> +            ${destroot}${prefix}/share/vim/vim72/syntax/
> +    }
> +}
> +
> +default_variants +docs

I suggest you remove the docs variant and just integrate it into the port proper. Fewer variants is better.





More information about the macports-dev mailing list