Index: Portfile
===================================================================
--- Portfile	(revision 96504)
+++ Portfile	(working copy)
@@ -3,9 +3,9 @@
 PortSystem          1.0
 
 name                go
-epoch               1
-version             60.3
-revision            1
+conflicts           go-devel
+epoch               2
+version             1.0.2
 categories          lang
 platforms           darwin freebsd linux
 license             BSD
@@ -25,8 +25,8 @@
 
 homepage            http://golang.org/
 fetch.type          hg
-hg.url              https://go.googlecode.com/hg/
-hg.tag              release.r${version}
+hg.url              https://code.google.com/p/go
+hg.tag              ${name}${version}
 
 depends_build       bin:bison:bison \
                     bin:make:gmake \
@@ -34,7 +34,8 @@
                     bin:ed:ed
 
 set GOROOT          ${worksrcpath}
-set GOBIN           ${workpath}/bin
+set GOBIN           ${GOROOT}/bin
+set GOSRCDIR        lib/${name}/${version}
 
 switch ${build_arch} {
     i386 {
@@ -68,55 +69,48 @@
 build.cmd           ./make.bash
 build.target    
 build.env           GOROOT=${GOROOT} GOBIN=${GOBIN} GOARCH=${GOARCH} \
-                    GOROOT_FINAL=${prefix}
+                    GOROOT_FINAL=${prefix}/${GOSRCDIR}
 use_parallel_build  no
 post-build {
     # remove mercurial extras
-    system "find ${worksrcpath} -type d -name .hg -print0 | xargs -0 rm -rf"
+    system "find ${worksrcpath} -type d -name '.hg*' -delete"
 }
 
 test.run            yes
 test.dir            ${worksrcpath}/src
 test.cmd            ./run.bash
 test.target 
-test.env            ${build.env}
+test.env            ${build.env} \
+                    PATH=${GOBIN}:${prefix}/bin:/bin:/usr/bin
 
 destroot {
-    # bin files
-    file delete ${destroot}${prefix}/bin
-    file copy ${GOBIN} ${destroot}${prefix}
-    # on Darwin, have to install and setgid; see ${GOROOT}/src/sudo.bash 
-    foreach i {prof cov} { 
-        xinstall -g procmod -m 2755 ${worksrcpath}/src/cmd/$i/${cmd_prefix}$i \
-            ${destroot}${prefix}/bin
-    } 
-        
-    # lib files
-    file delete -force ${destroot}${prefix}/lib
-    file copy ${worksrcpath}/lib ${destroot}${prefix}
+    # build tree => GOROOT
+    set gorootdir ${destroot}${prefix}/${GOSRCDIR}
+    xinstall -m 755 -d ${gorootdir}
+    eval file copy [glob ${worksrcpath}/*] ${gorootdir}
+    xinstall -m 644 ${worksrcpath}/favicon.ico ${gorootdir}/doc/${name}.ico
+
+    # ../GOROOT/bin symlink => bin
+    xinstall -m 755 -d ${destroot}${prefix}/bin
+    foreach f [glob -tails -directory ${worksrcpath}/bin *] {
+        ln -s ../${GOSRCDIR}/bin/${f} ${destroot}${prefix}/bin
+    }
     
-    # compiled packages: violates mtree
-    file copy ${worksrcpath}/pkg ${destroot}${prefix}
-
     # do not install include files: see #30203
     
-    # documentation
-    xinstall -m 755 -d ${destroot}${prefix}/share/doc/
-    file copy ${worksrcpath}/doc ${destroot}${prefix}/share/doc/${name}
-    xinstall -m 644 -W ${worksrcpath} favicon.ico \
-        ${destroot}${prefix}/share/doc/${name}/${name}.ico
-    # godoc command required documentation 
-    xinstall -m 755 -d ${destroot}${prefix}/src/go 
-    file copy ${worksrcpath} ${destroot}${prefix}/src/go 
-    system "cd ${destroot}${prefix}/src/${name}/${name}-${version}/src && ./clean.bash" 
-    file delete ${destroot}${prefix}/src/${name}/${name}-${version}/bin 
-    file delete ${destroot}${prefix}/src/${name}/${name}-${version}/pkg 
-    ln -s ${prefix}/src/${name}/${name}-${version}/src/pkg ${destroot}${prefix}/src/pkg 
-    # gomake command required makefiles 
-    foreach f [glob -tails -directory ${destroot}${prefix}/src/${name}/${name}-${version}/src/ Make.*] {
-        ln -s ${name}/${name}-${version}/src/${f} ${destroot}${prefix}/src
+    # ../../../GOROOT/doc symlink => share/doc/go
+    xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
+    foreach f [glob -tails -directory ${worksrcpath}/doc *] {
+        ln -s ../../../${GOSRCDIR}/doc/${f} \
+            ${destroot}${prefix}/share/doc/${name}
     }
 
+    # ../../GOROOT/{misc, LICENSE, et al.} symlink => share/go
+    xinstall -m 755 -d ${destroot}${prefix}/share/${name}
+    foreach f [glob -tails -directory ${worksrcpath} \[A-Z\]* misc] {
+        ln -s ../../${GOSRCDIR}/${f} ${destroot}${prefix}/share/${name}
+    }
+
     # bash completion
     xinstall -m 755 -d ${destroot}${prefix}/etc/bash_completion.d
     xinstall -m 644 -W ${worksrcpath}/misc/bash ${name} \
@@ -137,7 +131,6 @@
     xinstall -m 644 ${worksrcpath}/misc/vim/ftplugin/go/import.vim \
         ${vimdir}/ftplugin/go.vim
 }
-destroot.violate_mtree     yes
 
 platform darwin {
     build.env-append GOOS=darwin
@@ -154,4 +147,4 @@
 
 livecheck.type      regex
 livecheck.url       http://code.google.com/p/go/source/browse
-livecheck.regex     {>release\.r([0-9.]+)<}
+livecheck.regex     {>go(1\.[0-9.]+)<}
