source: trunk/dports/lang/rust/Portfile

Last change on this file was 152382, checked in by g5pw@…, 11 months ago

lang/rust: (hopefully) fix build failure

Add missing dependency on cmake (apparently needed to build llvm)
Add patch to copy relevant library (will send upstream)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.5 KB
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=portfile:et:sw=4:ts=4:sts=4
2# $Id: Portfile 152382 2016-09-06 13:56:32Z ryandesign@macports.org $
3
4PortSystem          1.0
5PortGroup           active_variants 1.1
6PortGroup           compiler_blacklist_versions 1.0
7
8name                rust
9version             1.11.0
10categories          lang devel
11platforms           darwin
12supported_archs     i386 x86_64
13# https://github.com/mozilla/rust/issues/2024
14universal_variant   no
15license             {MIT Apache-2} BSD zlib NCSA Permissive
16maintainers         g5pw
17
18description         A safe, concurrent, practical language
19long_description    Rust is a curly-brace, block-structured expression \
20                    language. It visually resembles the C language \
21                    family, but differs significantly in syntactic and \
22                    semantic details. Its design is oriented toward \
23                    concerns of \"programming in the large\", that is, of \
24                    creating and maintaining boundaries -- both abstract \
25                    and operational -- that preserve large-system \
26                    integrity, availability and concurrency.
27homepage            http://www.rust-lang.org/
28
29pre-fetch {
30    if {${os.platform} eq "darwin" && ${os.major} < 11} {
31        ui_error "${name} is only supported on OS X 10.7 Lion or later."
32        return -code error "unsupported platform version"
33    }
34}
35
36# To take advantage of distfile mirroring and checksumming for the
37# snapshot compiler, we let base treat it as the distfile and deal with
38# the actual Rust source "manually".
39
40patchfiles              patch-missing-arena.diff
41
42# stage0 is found from
43# https://github.com/rust-lang/rust/blob/${version}/src/stage0.txt
44set stage0(date)        2016-07-05
45set stage0(version)     1.10.0
46set stage0(platform)    ${configure.build_arch}-apple-darwin
47
48# Sigh...
49if { ${configure.build_arch} eq "i386"} {
50    set stage0(platform)    i686-apple-darwin
51}
52
53set stage0(distname)     [join "rustc ${stage0(version)}
54                                      ${stage0(platform)}" -]
55set stage0(distfile)     ${stage0(distname)}${extract.suffix}
56
57master_sites            https://static.rust-lang.org/dist/:main \
58                        https://static.rust-lang.org/dist/${stage0(date)}/:snap
59
60distfiles               ${name}c-${version}-src${extract.suffix}:main \
61                        ${stage0(distfile)}:snap
62
63worksrcdir              ${name}c-${version}
64
65checksums               ${name}c-${version}-src${extract.suffix} \
66                            rmd160  ada0761c38febb423677c1b8bb2fd5c8fee05d53 \
67                            sha256  3685034a78e70637bdfa3117619f759f2481002fd9abbc78cc0f737c9974de6a
68
69switch ${configure.build_arch} {
70    i386    {checksums-append   ${stage0(distfile)} \
71                            rmd160  30a5463f95f2421a29e8c28ab0605358f62adadf \
72                            sha256  3ca52d9adfedc68c3509e3cdce232474fe6bbb6b4c284850bdef84fdabb955c3}
73    default {checksums-append   ${stage0(distfile)} \
74                            rmd160  c1f4c96f5aab786d64080ee4ec5aa70ba870d2d1 \
75                            sha256  2971c0e95b854507bdcf3c32f004b20024e6880257842d4b5e06dd542efce814}
76}
77
78# Only use compilers supported by upstream
79# (https://github.com/rust-lang/rust#building-from-source).
80compiler.blacklist  {clang < 211} \
81                    *dragonegg* \
82                    gcc-3.3 {*gcc-4.[0-6]}
83
84# Building the bundled LLVM requires Python 2.4-2.7. All supported
85# OS X releases have 2.6. (Using MacPorts' LLVM ports fails either
86# during build or during testing.)
87depends_build           bin:perl:perl5 \
88                        bin:python2.6:python27 \
89                        port:cmake
90depends_skip_archcheck  python27
91
92# The libs for both targets link to libgcc and libstdc++.
93if {[regexp {^macports-gcc-(\d+)\.(\d+)$} ${configure.compiler} \
94                                            -> major minor]} {
95    depends_lib-append      {path:lib/libstdc\\+\\+\\.6\\.dylib:libstdcxx}
96    require_active_variants gcc${major}${minor} universal
97    require_active_variants {path:lib/libstdc\\+\\+\\.6\\.dylib:libstdcxx} \
98                                universal
99}
100
101# TODO: Test whether i386 machines can cross-compile for x86_64.
102set tgts {i686-apple-darwin x86_64-apple-darwin}
103
104# TODO: Trying to build a cross-compiler breaks Intel 64 builds as
105# of 0.11.0. Worth fixing?
106#
107#configure.pre_args-append       --target=[join $tgts ,]
108
109if {${configure.build_arch} eq "i386"} {
110    configure.pre_args-append   --build=[lindex $tgts 0]
111} else {
112    configure.pre_args-append   --build=[lindex $tgts 1]
113}
114# We need to use "--enable-rpath" as of a0546de, otherwise the build
115# produces improperly linked binaries.
116# (https://github.com/rust-lang/rust/issues/11747)
117# TODO: Build docs also, probably in a subport.
118configure.args      --disable-docs \
119                    --enable-local-rust \
120                    --enable-rpath \
121                    --local-rust-root=${workpath}/${stage0(distname)}/rustc
122
123build.type          gnu
124build.args          VERBOSE=1 \
125                    CC=${configure.cc} \
126                    CXX=${configure.cxx} \
127                    CPP="${configure.cc} -E"
128
129# TODO: Add path-style dependency on python, whenever test dependencies
130# are implemented (#38208). Not critical, since all supported versions
131# of OS X come with Python 2.6.
132test.run            yes
133test.target         check
134test.env            VERBOSE=1
135
136destroot.args       VERBOSE=1
137post-destroot {
138    if {${subport} eq ${name}} {
139        xinstall -d ${destroot}${prefix}/share/${name}
140        xinstall -m 644 ${worksrcpath}/src/etc/ctags.rust \
141            ${destroot}${prefix}/share/${name}
142    }
143}
144
145livecheck.type      regex
146livecheck.url       https://github.com/rust-lang/rust/tags
147livecheck.regex     archive/(\[\\d\\.\]+).zip
148
149subport rust-src {
150    # remove dependencies
151    depends_build
152    depends_lib
153
154    description     Source code for the rust programming language
155    long_description ${description}
156
157    use_configure no
158
159    build {}
160
161    destroot {
162        xinstall -d ${destroot}${prefix}/share/rust
163        move ${worksrcpath}/src ${destroot}${prefix}/share/rust/src
164
165        # correct the permissions
166        system -W ${destroot}${prefix}/share/rust "find . -type d -exec chmod 755 {} \\;"
167        system -W ${destroot}${prefix}/share/rust "find . -type f -exec chmod 644 {} \\;"
168
169        # delete the test directories (which for some god awful reason contains binaries)
170        system -W ${destroot}${prefix}/share/rust "find . -type d -name test -print0 | xargs -0 rm -rf"
171    }
172}
Note: See TracBrowser for help on using the repository browser.