Ticket #33887: Portfile.2.diff

File Portfile.2.diff, 4.8 KB (added by slewsys (Andrew L. Moore), 12 years ago)

Configure version-less install by modifying only GOSRCDIR

  • Portfile

     
    33PortSystem          1.0
    44
    55name                go
    6 epoch               1
    7 version             60.3
    8 revision            1
     6conflicts           go-devel
     7epoch               2
     8version             1.0.2
    99categories          lang
    1010platforms           darwin freebsd linux
    1111license             BSD
     
    2525
    2626homepage            http://golang.org/
    2727fetch.type          hg
    28 hg.url              https://go.googlecode.com/hg/
    29 hg.tag              release.r${version}
     28hg.url              https://code.google.com/p/go
     29hg.tag              ${name}${version}
    3030
    3131depends_build       bin:bison:bison \
    3232                    bin:make:gmake \
     
    3434                    bin:ed:ed
    3535
    3636set GOROOT          ${worksrcpath}
    37 set GOBIN           ${workpath}/bin
     37set GOBIN           ${GOROOT}/bin
     38set GOSRCDIR        lib/${name}/${version}
    3839
    3940switch ${build_arch} {
    4041    i386 {
     
    6869build.cmd           ./make.bash
    6970build.target   
    7071build.env           GOROOT=${GOROOT} GOBIN=${GOBIN} GOARCH=${GOARCH} \
    71                     GOROOT_FINAL=${prefix}
     72                    GOROOT_FINAL=${prefix}/${GOSRCDIR}
    7273use_parallel_build  no
    7374post-build {
    7475    # remove mercurial extras
    75     system "find ${worksrcpath} -type d -name .hg -print0 | xargs -0 rm -rf"
     76    system "find ${worksrcpath} -type d -name '.hg*' -delete"
    7677}
    7778
    7879test.run            yes
    7980test.dir            ${worksrcpath}/src
    8081test.cmd            ./run.bash
    8182test.target
    82 test.env            ${build.env}
     83test.env            ${build.env} \
     84                    PATH=${GOBIN}:${prefix}/bin:/bin:/usr/bin
    8385
    8486destroot {
    85     # bin files
    86     file delete ${destroot}${prefix}/bin
    87     file copy ${GOBIN} ${destroot}${prefix}
    88     # on Darwin, have to install and setgid; see ${GOROOT}/src/sudo.bash
    89     foreach i {prof cov} {
    90         xinstall -g procmod -m 2755 ${worksrcpath}/src/cmd/$i/${cmd_prefix}$i \
    91             ${destroot}${prefix}/bin
    92     }
    93        
    94     # lib files
    95     file delete -force ${destroot}${prefix}/lib
    96     file copy ${worksrcpath}/lib ${destroot}${prefix}
     87    # build tree => GOROOT
     88    set gorootdir ${destroot}${prefix}/${GOSRCDIR}
     89    xinstall -m 755 -d ${gorootdir}
     90    eval file copy [glob ${worksrcpath}/*] ${gorootdir}
     91    xinstall -m 644 ${worksrcpath}/favicon.ico ${gorootdir}/doc/${name}.ico
     92
     93    # ../GOROOT/bin symlink => bin
     94    xinstall -m 755 -d ${destroot}${prefix}/bin
     95    foreach f [glob -tails -directory ${worksrcpath}/bin *] {
     96        ln -s ../${GOSRCDIR}/bin/${f} ${destroot}${prefix}/bin
     97    }
    9798   
    98     # compiled packages: violates mtree
    99     file copy ${worksrcpath}/pkg ${destroot}${prefix}
    100 
    10199    # do not install include files: see #30203
    102100   
    103     # documentation
    104     xinstall -m 755 -d ${destroot}${prefix}/share/doc/
    105     file copy ${worksrcpath}/doc ${destroot}${prefix}/share/doc/${name}
    106     xinstall -m 644 -W ${worksrcpath} favicon.ico \
    107         ${destroot}${prefix}/share/doc/${name}/${name}.ico
    108     # godoc command required documentation
    109     xinstall -m 755 -d ${destroot}${prefix}/src/go
    110     file copy ${worksrcpath} ${destroot}${prefix}/src/go
    111     system "cd ${destroot}${prefix}/src/${name}/${name}-${version}/src && ./clean.bash"
    112     file delete ${destroot}${prefix}/src/${name}/${name}-${version}/bin
    113     file delete ${destroot}${prefix}/src/${name}/${name}-${version}/pkg
    114     ln -s ${prefix}/src/${name}/${name}-${version}/src/pkg ${destroot}${prefix}/src/pkg
    115     # gomake command required makefiles
    116     foreach f [glob -tails -directory ${destroot}${prefix}/src/${name}/${name}-${version}/src/ Make.*] {
    117         ln -s ${name}/${name}-${version}/src/${f} ${destroot}${prefix}/src
     101    # ../../../GOROOT/doc symlink => share/doc/go
     102    xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
     103    foreach f [glob -tails -directory ${worksrcpath}/doc *] {
     104        ln -s ../../../${GOSRCDIR}/doc/${f} \
     105            ${destroot}${prefix}/share/doc/${name}
    118106    }
    119107
     108    # ../../GOROOT/{misc, LICENSE, et al.} symlink => share/go
     109    xinstall -m 755 -d ${destroot}${prefix}/share/${name}
     110    foreach f [glob -tails -directory ${worksrcpath} \[A-Z\]* misc] {
     111        ln -s ../../${GOSRCDIR}/${f} ${destroot}${prefix}/share/${name}
     112    }
     113
    120114    # bash completion
    121115    xinstall -m 755 -d ${destroot}${prefix}/etc/bash_completion.d
    122116    xinstall -m 644 -W ${worksrcpath}/misc/bash ${name} \
     
    137131    xinstall -m 644 ${worksrcpath}/misc/vim/ftplugin/go/import.vim \
    138132        ${vimdir}/ftplugin/go.vim
    139133}
    140 destroot.violate_mtree     yes
    141134
    142135platform darwin {
    143136    build.env-append GOOS=darwin
     
    154147
    155148livecheck.type      regex
    156149livecheck.url       http://code.google.com/p/go/source/browse
    157 livecheck.regex     {>release\.r([0-9.]+)<}
     150livecheck.regex     {>go(1\.[0-9.]+)<}