Magellan Linux

Contents of /trunk/deprecated/cargo/cargo-0.18.0-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31823 - (show annotations) (download)
Wed Dec 12 15:40:08 2018 UTC (5 years, 5 months ago) by niro
File size: 2242 byte(s)
-moved to 'deprecated'
1 # $Id$
2
3 PNAME="cargo"
4 PVER="0.18.0"
5 PBUILD="r1"
6
7 PCAT="dev-util"
8
9 DESCRIPTION="Systems programming language focused on safety, speed and concurrency."
10 HOMEPAGE="https://crates.io/"
11
12 # enable bootstrap of cargo with prebuild binary cargo
13 # 0=no, 1=yes
14 BOOTSTRAP=1
15
16 DEPEND=">= dev-lang/rust-1.18
17 >= net-misc/curl-7"
18
19 SDEPEND=">= dev-util/cmake-3.6
20 >= dev-lang/python-2.7"
21
22 if [[ ${BOOTSTRAP} = 0 ]]
23 then
24 SDEPEND="${SDEPEND}
25 >= dev-util/cargo-0.18"
26 fi
27
28 SRCFILE="${PVER}.tar.gz"
29 SRCDIR="${BUILDDIR}/${PNAME}-${PVER}"
30
31 msetfeature "!check" # no check target in makefile
32 sminclude mbuild mtools
33
34 SRC_URI=(
35 https://github.com/rust-lang/${PNAME}/archive/${SRCFILE}
36 mirror://${PNAME}/${SRCFILE}
37 )
38
39 UP2SEPERATOR="\/"
40 UP2DATE="updatecmd https://github.com/rust-lang/cargo/releases | highesttarball gz"
41
42 if [[ ${BOOTSTRAP} = 1 ]]
43 then
44 CARGOBIN_PVER="${PVER}"
45 CARGOBIN_SRCFILE_x86_64="cargo-${CARGOBIN_PVER}-x86_64-unknown-linux-gnu.tar.gz"
46 CARGOBIN_SRCDIR_x86_64="${BUILDDIR}/cargo-${CARGOBIN_PVER}-x86_64-unknown-linux-gnu"
47 CARGOBIN_SRCFILE_x86="cargo-${CARGOBIN_PVER}-i686-unknown-linux-gnu.tar.gz"
48 CARGOBIN_SRCDIR_x86="${BUILDDIR}/cargo-${CARGOBIN_PVER}-i686-unknown-linux-gnu"
49 CARGOBIN_SRCFILE="$(marchsrcfile CARGOBIN_SRCFILE)"
50 CARGOBIN_SRCDIR="$(marchsrcdir CARGOBIN_SRCDIR)"
51
52 SRC_URI+=(
53 https://static.rust-lang.org/dist/${CARGOBIN_SRCFILE_x86_64}
54 https://static.rust-lang.org/dist/${CARGOBIN_SRCFILE_x86}
55 )
56 fi
57
58 src_prepare()
59 {
60 munpack ${SRCFILE} || die
61
62 if [[ ${BOOTSTRAP} = 1 ]]
63 then
64 munpack ${CARGOBIN_SRCFILE} || die
65 fi
66 }
67
68 src_compile()
69 {
70 cd ${SRCDIR}
71
72 local myconf
73
74 # enforce rust-bin chost
75 local myARCH
76 [[ ${ARCH} = i*86 ]] && myARCH=i686
77 myconf+=" --host=${myARCH}-unknown-linux-gnu --build=${myARCH}-unknown-linux-gnu"
78
79 if [[ ${BOOTSTRAP} = 1 ]]
80 then
81 myconf+=" --cargo=${CARGOBIN_SRCDIR}/cargo/bin/cargo"
82 fi
83
84 mconfigure \
85 --release-channel=stable \
86 --enable-optimize \
87 ${myconf} \
88 || die
89
90 mmake VERBOSE=1 || die
91 }
92
93 src_install()
94 {
95 cd ${SRCDIR}
96
97 local myARCH
98 [[ ${ARCH} = i*86 ]] && myARCH=i686
99 make prepare-image-${myARCH}-unknown-linux-gnu IMGDIR_${myARCH}-unknown-linux-gnu=${BINDIR}/usr || die
100
101 # remove unnecessary files
102 mdelete -r /usr/etc || die
103
104 minstalldocs LICENSE-* || die
105 }