Ticket #35274: Portfile

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

Portfile for lang/go

Line 
1# $Id: Portfile 86679 2011-10-31 18:47:38Z singingwolfboy@macports.org $
2
3PortSystem          1.0
4
5name                go
6conflicts           go-devel
7epoch               2
8#version             release
9#revision            go1.0.2
10version             1.0.2
11categories          lang
12platforms           darwin freebsd linux
13license             BSD
14maintainers         singingwolfboy
15description         compiled, garbage-collected, concurrent programming \
16                    language developed by Google Inc.
17long_description    \
18    The Go programming language is an open source project to make programmers \
19    more productive. Go is expressive, concise, clean, and efficient. Its \
20    concurrency mechanisms make it easy to write programs that get the most \
21    out of multicore and networked machines, while its novel type system \
22    enables flexible and modular program construction. Go compiles quickly \
23    to machine code yet has the convenience of garbage collection and the \
24    power of run-time reflection. It's a fast, statically typed, compiled \
25    language that feels like a dynamically typed, interpreted language. Go \
26    is developed by Google Inc.
27
28homepage            http://golang.org/
29fetch.type          hg
30hg.url              https://code.google.com/p/go
31# hg.tag              ${revision}
32hg.tag              ${name}${version}
33
34depends_build       bin:bison:bison \
35                    bin:make:gmake \
36                    bin:awk:gawk \
37                    bin:ed:ed
38
39set GOROOT          ${worksrcpath}
40set GOBIN           ${GOROOT}/bin
41
42switch ${build_arch} {
43    i386 {
44        set GOARCH 386
45        set cmd_prefix 8
46    }
47    x86_64 {
48        set GOARCH amd64
49        set cmd_prefix 6
50    }
51    default {
52        # unsupported arch, but GOARCH needs to be set to something to prevent errors
53        set GOARCH x
54        set cmd_prefix 6
55    }
56}
57
58pre-fetch {
59    if {"big" == ${os.endian}} {
60        ui_error "${name} can only be used on an Intel Mac or other computer with a little-endian processor."
61        return -code error "incompatible processor"
62    }
63}
64
65use_configure       no
66
67pre-build {
68    xinstall -m 755 -d ${GOROOT} ${GOBIN}
69}
70build.dir           ${worksrcpath}/src
71build.cmd           ./make.bash
72build.target   
73build.env           GOROOT=${GOROOT} GOBIN=${GOBIN} GOARCH=${GOARCH} \
74                    GOROOT_FINAL=${prefix}/lib/${name}${version}
75use_parallel_build  no
76post-build {
77    # remove mercurial extras
78    system "find ${worksrcpath} -type d -name '.hg*' -delete"
79}
80
81# test.run            yes
82# test.dir            ${worksrcpath}/src
83# test.cmd            ./run.bash
84# test.target
85# test.env            ${build.env}
86
87destroot {
88    # src
89    set srcdir ${destroot}${prefix}/lib/${name}${version}
90    file copy ${worksrcpath}/ ${srcdir}
91
92    # commands
93    xinstall -m 755 -d ${destroot}${prefix}/bin
94    foreach f [glob -tails -directory ${srcdir}/bin *] {
95        ln -s ../lib/${name}${version}/bin/${f} ${destroot}${prefix}/bin
96    }
97   
98    # do not install include files: see #30203
99   
100    # documentation
101    xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}${version}
102    file copy ${worksrcpath}/doc \
103        ${destroot}${prefix}/share/doc/${name}${version}
104    xinstall -m 644 -W ${worksrcpath} favicon.ico \
105        ${destroot}${prefix}/share/doc/${name}${version}/${name}.ico
106
107    # misc.
108    xinstall -m 755 -d ${destroot}${prefix}/share/${name}${version}
109    file copy ${worksrcpath}/misc ${destroot}${prefix}/share/${name}${version}
110
111    # bash completion
112    xinstall -m 755 -d ${destroot}${prefix}/etc/bash_completion.d
113    xinstall -m 644 -W ${worksrcpath}/misc/bash ${name} \
114        ${destroot}${prefix}/etc/bash_completion.d/${name}
115
116    # emacs syntax highlighting
117    xinstall -m 755 -d ${destroot}${prefix}/share/emacs/site-lisp/
118    eval xinstall -m 644 [glob ${worksrcpath}/misc/emacs/*.el] \
119        ${destroot}${prefix}/share/emacs/site-lisp/
120
121    # vim syntax highlighting
122    set vimdir ${destroot}${prefix}/share/vim/vim73
123    xinstall -m 755 -d ${vimdir}/syntax ${vimdir}/ftdetect ${vimdir}/ftplugin
124    xinstall -m 644 ${worksrcpath}/misc/vim/syntax/go.vim \
125        ${vimdir}/syntax/go.vim
126    xinstall -m 644 ${worksrcpath}/misc/vim/ftdetect/gofiletype.vim \
127        ${vimdir}/ftdetect/go.vim
128    xinstall -m 644 ${worksrcpath}/misc/vim/ftplugin/go/import.vim \
129        ${vimdir}/ftplugin/go.vim
130}
131
132platform darwin {
133    build.env-append GOOS=darwin
134    test.env-append GOOS=darwin
135}
136platform freebsd {
137    build.env-append GOOS=freebsd
138    test.env-append GOOS=freebsd
139}
140platform linux {
141    build.env-append GOOS=linux
142    test.env-append GOOS=linux
143}
144
145livecheck.type      regex
146livecheck.url       http://code.google.com/p/go/source/browse
147livecheck.regex     {>go(1\.[0-9.]+)<}