Magellan Linux

Diff of /smage/trunk/extras/rust/rust-1.28.0-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 12431 by niro, Wed Sep 12 09:25:58 2018 UTC revision 12432 by niro, Thu Sep 13 13:25:13 2018 UTC
# Line 4  PNAME="rust" Line 4  PNAME="rust"
4  PVER="1.28.0"  PVER="1.28.0"
5  PBUILD="r1"  PBUILD="r1"
6    
7    SPLIT_PACKAGES="rust cargo rustfmt rust-rls"
8  PCAT="dev-lang"  PCAT="dev-lang"
9    
10  DESCRIPTION="Systems programming language focused on safety, speed and concurrency."  DESCRIPTION="Systems programming language focused on safety, speed and concurrency."
# Line 13  HOMEPAGE="https://www.rust-lang.org/" Line 14  HOMEPAGE="https://www.rust-lang.org/"
14  # 0=no, 1=yes  # 0=no, 1=yes
15  BOOTSTRAP=1  BOOTSTRAP=1
16    
17  DEPEND=">= sys-libs/llvm-libs-6.0"  # provided rust pver
18    RUST_PVER="${PVER}"
19    # provided pver of cargo, see src/tools/cargo/Cargo.toml
20    CARGO_PVER="0.29.0"
21    # provided pver of rls, see src/tools/rustfmt/Cargo.toml
22    RUSTFMT_PVER="0.8.2"
23    # provided pver of rls, see src/tools/rls/Cargo.toml
24    RLS_PVER="0.128.0"
25    
26    # required pver of llvm and gcc
27    GCC_PVER="8.2.0"
28    LLVM_PVER="6.0.1"
29    
30    COMMON_DEPEND=">= net-misc/curl-7
31     >= dev-libs/openssl-1.1
32     >= sys-libs/zlib-1.2
33     >= net-libs/libssh2-1.8"
34    
35    RUST_DEPEND=">= sys-libs/llvm-libs-${LLVM_PVER}
36     >= sys-libs/libstdc++-${GCC_PVER}"
37    
38    CARGO_DEPEND="${COMMON_DEPEND}"
39    
40  SDEPEND=">= sys-dev/llvm-6.0  RUSTFMT_DEPEND=">= virtual/glibc
41     >= sys-libs/libgcc-${GCC_PVER}"
42    
43    RUSTRLS_DEPEND="${COMMON_DEPEND}"
44    
45    SDEPEND=">= sys-dev/llvm-${LLVM_PVER}
46     >= sys-dev/clang-${LLVM_PVER}
47   >= dev-lang/perl-5.26   >= dev-lang/perl-5.26
48   >= dev-lang/python-2.7   >= dev-lang/python-2.7
49   >= dev-libs/libffi-3.2   >= dev-libs/libffi-3.2
50   >= dev-libs/jemalloc-5.1   >= dev-libs/jemalloc-5.1
  >= net-misc/curl-7  
51   >= dev-util/cmake-3.12   >= dev-util/cmake-3.12
52     >= dev-util/ninja-1.8
53     ${RUST_DEPEND}
54     ${CARGO_DEPEND}
55     ${RUSTFMT_DEPEND}
56     ${RUSTRLS_DEPEND}
57   >= net-misc/curl-dev-7   >= net-misc/curl-dev-7
58   >= app-arch/xz-utils-dev-5   >= app-arch/xz-utils-dev-5
59   >= dev-libs/libffi-dev-3.2   >= dev-libs/libffi-dev-3.2
60   >= dev-libs/jemalloc-dev-5.1"   >= dev-libs/jemalloc-dev-5.1
61     >= dev-libs/openssl-dev-1.1
62     >= net-libs/libssh2-dev-1.8
63     >= sys-libs/zlib-dev-1.2"
64    
65  if [[ ${BOOTSTRAP} = 0 ]]  if [[ ${BOOTSTRAP} = 0 ]]
66  then  then
67     # see src/stage0.txt
68   SDEPEND+="   SDEPEND+="
69   >= dev-lang/rust-1.27"   >= dev-lang/rust-1.27
70     >= dev-lang/cargo-0.28"
71  fi  fi
72    
73  SRCFILE="${PNAME}c-${PVER}-src.tar.gz"  SRCFILE="${PNAME}c-${PVER}-src.tar.gz"
# Line 72  then Line 109  then
109   )   )
110  fi  fi
111    
112    split_info_rust()
113    {
114     DESCRIPTION="Systems programming language focused on safety, speed and concurrency."
115     DEPEND="${RUST_DEPEND}"
116    }
117    
118    split_info_cargo()
119    {
120     DESCRIPTION="Rust's package manager and build tool."
121     DEPEND="== dev-lang/rust-${RUST_PVER}
122     ${CARGO_DEPEND}"
123     PCAT="dev-util"
124     PVER="${CARGO_PVER}"
125    }
126    
127    split_info_rustfmt()
128    {
129     DESCRIPTION="Tool to find and fix Rust formatting issues."
130     DEPEND="== dev-lang/rust-${RUST_PVER}
131     == dev-util/cargo-${CARGO_PVER}
132     ${RUSTFMT_DEPEND}"
133     PCAT="dev-util"
134     PVER="${RUSTFMT_PVER}"
135    }
136    
137    split_info_rust-rls()
138    {
139     DESCRIPTION="Rust Language Server for IDE integration."
140     DEPEND="== dev-lang/rust-${RUST_PVER}
141     ${RUSTRLS_DEPEND}"
142     PCAT="dev-util"
143     PVER="${RLS_PVER}"
144    }
145    
146  src_prepare()  src_prepare()
147  {  {
148   munpack ${SRCFILE} || die   munpack ${SRCFILE} || die
# Line 89  src_compile() Line 160  src_compile()
160  {  {
161   cd ${SRCDIR}   cd ${SRCDIR}
162    
163   local myconf   local myARCH
164     local myRUSTHOST
165   # enforce rust-bin chost   myARCH="${ARCH}"
166   local myARCH="${ARCH}"   [[ ${ARCH} = i*86 ]] && myARCH="i686"
167   [[ ${ARCH} = i*86 ]] && myARCH=i686   myRUSTCHOST="${myARCH}-unknown-linux-gnu"
168   myconf+=" --host=${myARCH}-unknown-linux-gnu --build=${myARCH}-unknown-linux-gnu"  
169     # create a custom build config
170     cat <<- EOF > ${SRCDIR}/config.toml
171     [llvm]
172     # enable ninja
173     ninja = true
174     # prefer shared libraries
175     link-shared = true
176    
177     [build]
178     EOF
179   if [[ ${BOOTSTRAP} = 0 ]]   if [[ ${BOOTSTRAP} = 0 ]]
180   then   then
181   myconf+=" --enable-local-rust"   # use local rust if no bootstrap was requested
182     cat <<- EOF >> ${SRCDIR}/config.toml
183     cargo = "/usr/bin/cargo"
184     rustc = "/usr/bin/rustc"
185     EOF
186   fi   fi
187     cat <<- EOF >> ${SRCDIR}/config.toml
188   # configure not working after rewrite, duplicate options are not accepted anymore   submodules = false
189   # not working atm due bug:   python = "python2"
190   # --infodir=/usr/share/info   # build cargo too
191   # --localstatedir=/var/lib   extended = true
192   # --datadir=/usr/share  
193   ./configure \   [install]
194   --prefix=/usr \   prefix = "/usr"
195   --mandir=/usr/share/man \   libdir = "$(mlibdir)"
196   --sysconfdir=/etc \   docdir = "share/doc/${PNAME}-${PVER}"
197   --libdir=/usr/$(mlibdir) \   mandir = "share/man"
198   --release-channel=stable \  
199   --llvm-root=/usr \   [rust]
200   --enable-llvm-link-shared \   channel = "stable"
201   --jemalloc-root=/usr/$(mlibdir) \   rpath = false
202   --disable-codegen-tests \   # disable codegen tests
203   ${myconf} \   codegen-tests = false
204   || die   use-jemalloc = true
205     # Work around https://github.com/rust-lang/rust/issues/51650
206     deny-warnings = false
207    
208     [target.${myRUSTCHOST}]
209     llvm-config = "/usr/bin/llvm-config"
210     EOF
211    
212   ## missing llvm link deps   ## missing llvm link deps
213   #export RUSTFLAGS="$RUSTFLAGS -C link-args=-lffi"   export RUSTFLAGS="$RUSTFLAGS -C link-args=-lffi"
214   python2 ./x.py build --verbose || die   python2 ./x.py build --verbose || die
215  }  }
216    
217  src_install()  src_install_rust()
218  {  {
219   cd ${SRCDIR}   cd ${SRCDIR}
220   mmake DESTDIR=${BINDIR} install || die   DESTDIR=${BINDIR} python2 ./x.py install || die
221    
222   # remove unnecessary files   # remove unnecessary files
223   mdelete /usr/$(mlibdir)/rustlib/components || die   mdelete /usr/$(mlibdir)/rustlib/components || die
# Line 135  src_install() Line 225  src_install()
225   mdelete /usr/$(mlibdir)/rustlib/rust-installer-version || die   mdelete /usr/$(mlibdir)/rustlib/rust-installer-version || die
226    
227   # overwrite duplicate solibs with symlinks to safe space   # overwrite duplicate solibs with symlinks to safe space
228   local myARCH="${ARCH}"   local myARCH
229   [[ ${ARCH} = i*86 ]] && myARCH=i686   local myRUSTHOST
230     myARCH="${ARCH}"
231     [[ ${ARCH} = i*86 ]] && myARCH="i686"
232     myRUSTCHOST="${myARCH}-unknown-linux-gnu"
233   local i   local i
234   for i in ${BINDIR}/usr/$(mlibdir)/rustlib/${myARCH}-unknown-linux-gnu/lib/*   for i in ${BINDIR}/usr/$(mlibdir)/rustlib/${myRUSTCHOST}/lib/*.so
235   do   do
236   mlink rustlib/${myARCH}-unknown-linux-gnu/lib/$(basename ${i}) /usr/$(mlibdir)/ || die   mlink rustlib/${myRUSTCHOST}/lib/$(basename ${i}) /usr/$(mlibdir)/ || die
237   done   done
238    
239     # move split packages out of the way
240     install -d ${SRCDIR}/rust-split-packages/rls/usr/bin || die
241     install -d ${SRCDIR}/rust-split-packages/fmt/usr/bin || die
242     install -d ${SRCDIR}/rust-split-packages/cargo/usr/bin || die
243     install -d ${SRCDIR}/rust-split-packages/cargo/usr/share/man/man1 || die
244     install -d ${SRCDIR}/rust-split-packages/cargo/usr/share/doc/${PNAME}-${PVER}/html || die
245     mv ${BINDIR}/usr/bin/rls ${SRCDIR}/rust-split-packages/rls/usr/bin/ || die
246     mv ${BINDIR}/usr/bin/cargo-fmt ${SRCDIR}/rust-split-packages/fmt/usr/bin/ || die
247     mv ${BINDIR}/usr/bin/rustfmt ${SRCDIR}/rust-split-packages/fmt/usr/bin/ || die
248     mv ${BINDIR}/usr/bin/cargo ${SRCDIR}/rust-split-packages/cargo/usr/bin/ || die
249     mv ${BINDIR}/etc ${SRCDIR}/rust-split-packages/cargo/ || die
250     mv ${BINDIR}/usr/share/doc/${PNAME}-${PVER}/html/cargo ${SRCDIR}/rust-split-packages/cargo/usr/share/doc/${PNAME}-${PVER}/html/ || die
251     mv ${BINDIR}/usr/share/man/man1/cargo*.1 ${SRCDIR}/rust-split-packages/cargo/usr/share/man/man1/ || die
252    
253   minstalldocs COPYRIGHT LICENSE-* ChangeLog README* || die   minstalldocs COPYRIGHT LICENSE-* ChangeLog README* || die
254  }  }
255    
256    src_install_cargo()
257    {
258     install -d ${BINDIR} || die
259     mv ${SRCDIR}/rust-split-packages/cargo/* ${BINDIR}/ || die
260     local docsubdir="src/tools/cargo"
261     minstalldocs ${docsubdir}/COPYRIGHT* ${docsubdir}/CHANGELOG* ${docsubdir}/LICENSE* ${docsubdir}/README* || die
262    }
263    
264    src_install_rustfmt()
265    {
266     install -d ${BINDIR} || die
267     mv ${SRCDIR}/rust-split-packages/fmt/* ${BINDIR}/ || die
268     local docsubdir="src/tools/rustfmt"
269     minstalldocs ${docsubdir}/COPYRIGHT* ${docsubdir}/CHANGELOG* ${docsubdir}/LICENSE* ${docsubdir}/README* || die
270    }
271    
272    src_install_rust-rls()
273    {
274     install -d ${BINDIR} || die
275     mv ${SRCDIR}/rust-split-packages/rls/* ${BINDIR}/ || die
276     local docsubdir="src/tools/rls"
277     minstalldocs ${docsubdir}/COPYRIGHT* ${docsubdir}/CHANGELOG* ${docsubdir}/LICENSE* ${docsubdir}/README* || die
278    }

Legend:
Removed from v.12431  
changed lines
  Added in v.12432