Contents of /smage/trunk/extras/rust/rust-1.22.1-r1.smage2
Parent Directory | Revision Log
Revision 11666 -
(show annotations)
(download)
Fri Dec 29 10:54:43 2017 UTC (6 years, 8 months ago) by niro
File size: 4362 byte(s)
Fri Dec 29 10:54:43 2017 UTC (6 years, 8 months ago) by niro
File size: 4362 byte(s)
-added build and llvm5 thinlto fixes
1 | # $Id$ |
2 | |
3 | PNAME="rust" |
4 | PVER="1.22.1" |
5 | PBUILD="r1" |
6 | |
7 | PCAT="dev-lang" |
8 | |
9 | DESCRIPTION="Systems programming language focused on safety, speed and concurrency." |
10 | HOMEPAGE="https://www.rust-lang.org/" |
11 | |
12 | # enable bootstrap of rust with prebuild binary rust |
13 | # 0=no, 1=yes |
14 | BOOTSTRAP=1 |
15 | |
16 | DEPEND=">= sys-libs/llvm-libs-5.0" |
17 | |
18 | SDEPEND=">= sys-dev/llvm-5.0 |
19 | >= dev-lang/perl-5.26 |
20 | >= dev-lang/python-2.7 |
21 | >= dev-libs/libffi-3.2 |
22 | >= dev-libs/jemalloc-5 |
23 | >= net-misc/curl-7 |
24 | >= net-misc/curl-dev-7 |
25 | >= app-arch/xz-utils-5 |
26 | >= dev-libs/libffi-dev-3.2 |
27 | >= dev-libs/jemalloc-dev-5" |
28 | |
29 | if [[ ${BOOTSTRAP} = 0 ]] |
30 | then |
31 | SDEPEND+=" |
32 | >= dev-lang/rust-1.21" |
33 | fi |
34 | |
35 | SRCFILE="${PNAME}c-${PVER}-src.tar.gz" |
36 | SRCDIR="${BUILDDIR}/${PNAME}c-${PVER}-src" |
37 | |
38 | msetfeature "!check" |
39 | sminclude mbuild mtools |
40 | |
41 | SRC_URI=( |
42 | https://static.rust-lang.org/dist/${SRCFILE} |
43 | mirror://${PNAME}/${SRCFILE} |
44 | mirror://${PNAME}/${PNAME}-${PVER}-thinlto-llvm5-fixes.patch |
45 | ) |
46 | |
47 | UP2DATE="updatecmd https://www.rust-lang.org/en-US/other-installers.html | grep 'rustc-.*-src.*' | sed 's:-src::g' | highesttarball gz" |
48 | |
49 | if [[ ${BOOTSTRAP} = 1 ]] |
50 | then |
51 | # see src/stage0.txt |
52 | RUSTBIN_PVER="1.21.0" |
53 | RUSTBIN_DATE="2017-10-12" |
54 | RUSTBIN_SRCFILE_x86_64="rustc-${RUSTBIN_PVER}-x86_64-unknown-linux-gnu.tar.gz" |
55 | RUSTBIN_SRCFILE_x86="rustc-${RUSTBIN_PVER}-i686-unknown-linux-gnu.tar.gz" |
56 | RUSTBIN_SRCFILE="$(marchsrcfile RUSTBIN_SRCFILE)" |
57 | RUSTSTD_SRCFILE_x86_64="rust-std-${RUSTBIN_PVER}-x86_64-unknown-linux-gnu.tar.gz" |
58 | RUSTSTD_SRCFILE_x86="rust-std-${RUSTBIN_PVER}-i686-unknown-linux-gnu.tar.gz" |
59 | RUSTSTD_SRCFILE="$(marchsrcfile RUSTSTD_SRCFILE)" |
60 | CARGOBIN_PVER="0.22.0" |
61 | CARGOBIN_SRCFILE_x86_64="cargo-${CARGOBIN_PVER}-x86_64-unknown-linux-gnu.tar.gz" |
62 | CARGOBIN_SRCFILE_x86="cargo-${CARGOBIN_PVER}-i686-unknown-linux-gnu.tar.gz" |
63 | CARGOBIN_SRCFILE="$(marchsrcfile CARGOBIN_SRCFILE)" |
64 | |
65 | SRC_URI+=( |
66 | https://static.rust-lang.org/dist/${RUSTBIN_DATE}/${RUSTBIN_SRCFILE_x86_64} |
67 | https://static.rust-lang.org/dist/${RUSTBIN_DATE}/${RUSTBIN_SRCFILE_x86} |
68 | https://static.rust-lang.org/dist/${RUSTBIN_DATE}/${RUSTSTD_SRCFILE_x86_64} |
69 | https://static.rust-lang.org/dist/${RUSTBIN_DATE}/${RUSTSTD_SRCFILE_x86} |
70 | https://static.rust-lang.org/dist/${RUSTBIN_DATE}/${CARGOBIN_SRCFILE_x86_64} |
71 | https://static.rust-lang.org/dist/${RUSTBIN_DATE}/${CARGOBIN_SRCFILE_x86} |
72 | ) |
73 | fi |
74 | |
75 | src_prepare() |
76 | { |
77 | munpack ${SRCFILE} || die |
78 | |
79 | if [[ ${BOOTSTRAP} = 1 ]] |
80 | then |
81 | install -d ${SRCDIR}/build/cache/${RUSTBIN_DATE} || die |
82 | ln -snf ${SOURCEDIR}/${PNAME}/${RUSTBIN_SRCFILE} ${SRCDIR}/build/cache/${RUSTBIN_DATE}/ || die |
83 | ln -snf ${SOURCEDIR}/${PNAME}/${RUSTSTD_SRCFILE} ${SRCDIR}/build/cache/${RUSTBIN_DATE}/ || die |
84 | ln -snf ${SOURCEDIR}/${PNAME}/${CARGOBIN_SRCFILE} ${SRCDIR}/build/cache/${RUSTBIN_DATE}/ || die |
85 | fi |
86 | |
87 | cd ${SRCDIR} |
88 | |
89 | # apply llvm5 thinLTO fixes |
90 | # see: https://github.com/rust-lang/rust/pull/45301, https://github.com/rust-lang/rust/pull/45301/files |
91 | mpatch ${PNAME}-${PVER}-thinlto-llvm5-fixes.patch || die |
92 | } |
93 | |
94 | src_compile() |
95 | { |
96 | cd ${SRCDIR} |
97 | |
98 | local myconf |
99 | |
100 | # enforce rust-bin chost |
101 | local myARCH |
102 | [[ ${ARCH} = i*86 ]] && myARCH=i686 |
103 | myconf+=" --host=${myARCH}-unknown-linux-gnu --build=${myARCH}-unknown-linux-gnu" |
104 | |
105 | if [[ ${BOOTSTRAP} = 0 ]] |
106 | then |
107 | myconf+=" --enable-local-rust" |
108 | fi |
109 | |
110 | # configure nor working after rewrite, duplicate options are not accepted anymore |
111 | # not working atm due bug: |
112 | # --infodir=/usr/share/info |
113 | # --localstatedir=/var/lib |
114 | # --datadir=/usr/share |
115 | ./configure \ |
116 | --prefix=/usr \ |
117 | --mandir=/usr/share/man \ |
118 | --sysconfdir=/etc \ |
119 | --libdir=/usr/$(mlibdir) \ |
120 | --release-channel=stable \ |
121 | --llvm-root=/usr \ |
122 | --enable-llvm-link-shared \ |
123 | --jemalloc-root=/usr/$(mlibdir) \ |
124 | --disable-codegen-tests \ |
125 | ${myconf} \ |
126 | || die |
127 | |
128 | # missing llvm link deps |
129 | export RUSTFLAGS="$RUSTFLAGS -C link-args=-lffi" |
130 | python2 ./x.py build --verbose || die |
131 | } |
132 | |
133 | src_install() |
134 | { |
135 | cd ${SRCDIR} |
136 | mmake DESTDIR=${BINDIR} install || die |
137 | |
138 | # remove unnecessary files |
139 | mdelete /usr/$(mlibdir)/rustlib/components || die |
140 | mdelete /usr/$(mlibdir)/rustlib/manifest-rustc || die |
141 | mdelete /usr/$(mlibdir)/rustlib/rust-installer-version || die |
142 | |
143 | # overwrite duplicate solibs with symlinks to safe space |
144 | local i |
145 | for i in ${BINDIR}/usr/$(mlibdir)/rustlib/${ARCH}-unknown-linux-gnu/lib/* |
146 | do |
147 | mlink rustlib/${ARCH}-unknown-linux-gnu/lib/$(basename ${i}) /usr/$(mlibdir)/ || die |
148 | done |
149 | |
150 | minstalldocs COPYRIGHT LICENSE-* ChangeLog README* || die |
151 | } |