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 g5pw@macports.org $ |
---|
3 | |
---|
4 | PortSystem 1.0 |
---|
5 | PortGroup active_variants 1.1 |
---|
6 | PortGroup compiler_blacklist_versions 1.0 |
---|
7 | |
---|
8 | name rust |
---|
9 | version 1.12.0 |
---|
10 | categories lang devel |
---|
11 | platforms darwin |
---|
12 | supported_archs i386 x86_64 |
---|
13 | # https://github.com/mozilla/rust/issues/2024 |
---|
14 | universal_variant no |
---|
15 | license {MIT Apache-2} BSD zlib NCSA Permissive |
---|
16 | maintainers g5pw |
---|
17 | |
---|
18 | description A safe, concurrent, practical language |
---|
19 | long_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. |
---|
27 | homepage http://www.rust-lang.org/ |
---|
28 | |
---|
29 | pre-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 | |
---|
40 | # patchfiles patch-missing-arena.diff |
---|
41 | |
---|
42 | # stage0 is found from |
---|
43 | # https://github.com/rust-lang/rust/blob/${version}/src/stage0.txt |
---|
44 | set stage0(date) 2016-08-16 |
---|
45 | set stage0(version) 1.11.0 |
---|
46 | set stage0(platform) ${configure.build_arch}-apple-darwin |
---|
47 | |
---|
48 | # Sigh... |
---|
49 | if { ${configure.build_arch} eq "i386"} { |
---|
50 | set stage0(platform) i686-apple-darwin |
---|
51 | } |
---|
52 | |
---|
53 | set stage0(distname) [join "rustc ${stage0(version)} |
---|
54 | ${stage0(platform)}" -] |
---|
55 | set stage0(distfile) ${stage0(distname)}${extract.suffix} |
---|
56 | |
---|
57 | master_sites https://static.rust-lang.org/dist/:main \ |
---|
58 | https://static.rust-lang.org/dist/${stage0(date)}/:snap |
---|
59 | |
---|
60 | distfiles ${name}c-${version}-src${extract.suffix}:main \ |
---|
61 | ${stage0(distfile)}:snap |
---|
62 | |
---|
63 | worksrcdir ${name}c-${version} |
---|
64 | |
---|
65 | checksums ${name}c-${version}-src${extract.suffix} \ |
---|
66 | rmd160 ae16a3abf2f7ab19ee1692b10e108528ce90a649 \ |
---|
67 | sha256 ac5907d6fa96c19bd5901d8d99383fb8755127571ead3d4070cce9c1fb5f337a |
---|
68 | |
---|
69 | switch ${configure.build_arch} { |
---|
70 | i386 {checksums-append ${stage0(distfile)} \ |
---|
71 | rmd160 30a5463f95f2421a29e8c28ab0605358f62adadf \ |
---|
72 | sha256 3ca52d9adfedc68c3509e3cdce232474fe6bbb6b4c284850bdef84fdabb955c3} |
---|
73 | default {checksums-append ${stage0(distfile)} \ |
---|
74 | rmd160 2077fbd2012ee29baa6f1affc1ba6d8e583bbc6e \ |
---|
75 | sha256 2dce620c8cf1d68babecfdb58f443fd1a6e5bcfd0e1c6a8c214ec0378cc2d056} |
---|
76 | } |
---|
77 | |
---|
78 | # Only use compilers supported by upstream |
---|
79 | # (https://github.com/rust-lang/rust#building-from-source). |
---|
80 | compiler.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.) |
---|
87 | depends_build bin:perl:perl5 \ |
---|
88 | bin:python2.6:python27 \ |
---|
89 | port:cmake |
---|
90 | depends_skip_archcheck python27 |
---|
91 | |
---|
92 | # The libs for both targets link to libgcc and libstdc++. |
---|
93 | if {[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. |
---|
102 | set 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 | |
---|
109 | if {${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. |
---|
118 | configure.args --disable-docs \ |
---|
119 | --enable-local-rust \ |
---|
120 | --enable-rpath \ |
---|
121 | --local-rust-root=${workpath}/${stage0(distname)}/rustc |
---|
122 | |
---|
123 | build.type gnu |
---|
124 | build.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. |
---|
132 | test.run yes |
---|
133 | test.target check |
---|
134 | test.env VERBOSE=1 |
---|
135 | |
---|
136 | destroot.args VERBOSE=1 |
---|
137 | post-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 | |
---|
145 | livecheck.type regex |
---|
146 | livecheck.url https://github.com/rust-lang/rust/tags |
---|
147 | livecheck.regex archive/(\[\\d\\.\]+).zip |
---|
148 | |
---|
149 | subport 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 | } |
---|