aboutsummaryrefslogtreecommitdiff
path: root/development/mrustc/mrustc.SlackBuild
diff options
context:
space:
mode:
authorAndrew Clemons <andrew.clemons@gmail.com>2018-07-01 17:32:46 +1200
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2018-07-07 06:54:28 +0700
commit6ebb98ce64a51a966ee062332a12afdd0ff8990f (patch)
tree37f9eaae50405d9bafff73031b702a8ea5638b2d /development/mrustc/mrustc.SlackBuild
parent8b628b989a6ac55167a314cae769aea99e6253ae (diff)
development/mrustc: Updated for version gitc1d4b60.
Diffstat (limited to 'development/mrustc/mrustc.SlackBuild')
-rw-r--r--development/mrustc/mrustc.SlackBuild51
1 files changed, 34 insertions, 17 deletions
diff --git a/development/mrustc/mrustc.SlackBuild b/development/mrustc/mrustc.SlackBuild
index 13174dda1456f..aee05459ab160 100644
--- a/development/mrustc/mrustc.SlackBuild
+++ b/development/mrustc/mrustc.SlackBuild
@@ -23,7 +23,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=mrustc
-GITREV=${GITREV:-b03d61ed130dad6fa88a3beb4c32e48f86fdf84e}
+GITREV=${GITREV:-35c11b8e48fc92ad4b0992cf0b73f3e570468874}
VERSION=${VERSION:-git$(echo "$GITREV" | sed 's/^\(.\{7\}\).*$/\1/')}
RUSTCVERSION=${RUSTCVERSION:-1.19.0}
BUILD=${BUILD:-1}
@@ -43,25 +43,26 @@ PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i586" ]; then
+ RUSTC_TARGET="i586-unknown-linux-gnu"
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
+ RUSTC_TARGET="i686-unknown-linux-gnu"
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
+ RUSTC_TARGET="x86_64-unknown-linux-gnu"
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
+elif [ "$ARCH" = "arm" ] ; then
+ RUSTC_TARGET="arm-unknown-linux-gnueabi"
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
-# https://github.com/thepowersgang/mrustc/issues/38#issuecomment-352158861
-if [ "$ARCH" != "x86_64" ]; then
- echo "Sorry, mrustc currently only supports x86_64."
- exit 1
-fi
-
set -e
rm -rf $PKG
@@ -84,15 +85,29 @@ find -L . \
make RUSTCSRC
+LLVM_TARGETS="X86"
+
+if [ "$ARCH" = "arm" ] ; then
+ LLVM_TARGETS="$LLVM_TARGETS;ARM"
+fi
+
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
+RUSTC_TARGET="$RUSTC_TARGET" \
+LLVM_TARGETS="$LLVM_TARGETS" \
CC=gcc \
make -f minicargo.mk
-CFLAGS="$SLKCFLAGS" \
-CXXFLAGS="$SLKCFLAGS" \
-CC=gcc \
-make -j1 -C run_rustc
+WITH_RUSTC=${WITH_RUSTC:-yes}
+
+if [ "$WITH_RUSTC" = "yes" ] ; then
+ CFLAGS="$SLKCFLAGS" \
+ CXXFLAGS="$SLKCFLAGS" \
+ RUSTC_TARGET="$RUSTC_TARGET" \
+ LLVM_TARGETS="$LLVM_TARGETS" \
+ CC=gcc \
+ make -j1 -C run_rustc
+fi
mkdir -p $PKG/usr/bin
install -m 0755 bin/mrustc $PKG/usr/bin/mrustc
@@ -101,14 +116,16 @@ install -m 0755 tools/bin/minicargo $PKG/usr/bin/minicargo
mkdir -p $PKG/usr/share/mrustc
find output -name '*.hir' -maxdepth 1 -exec install -m 0644 {} $PKG/usr/share/mrustc/ \;
-mkdir -p $PKG/usr/lib$LIBDIRSUFFIX/rustlib/$ARCH-unknown-linux-gnu/lib/
-cp -a run_rustc/prefix/lib/rustlib/$ARCH-unknown-linux-gnu/lib/* $PKG/usr/lib$LIBDIRSUFFIX/rustlib/$ARCH-unknown-linux-gnu/lib/
+if [ "$WITH_RUSTC" = "yes" ] ; then
+ mkdir -p $PKG/usr/lib$LIBDIRSUFFIX/rustlib/$ARCH-unknown-linux-gnu/lib/
+ cp -a run_rustc/prefix/lib/rustlib/$ARCH-unknown-linux-gnu/lib/* $PKG/usr/lib$LIBDIRSUFFIX/rustlib/$ARCH-unknown-linux-gnu/lib/
-find $PKG/usr/lib$LIBDIRSUFFIX -name "*.so" -exec chmod 755 "{}" \;
+ find $PKG/usr/lib$LIBDIRSUFFIX -name "*.so" -exec chmod 755 "{}" \;
-install -m 0755 output/rustc $PKG/usr/bin/rustc
-install -m 0755 output/cargo $PKG/usr/bin/cargo
-install -m 0755 output/rustc-build/rustdoc $PKG/usr/bin/rustdoc
+ install -m 0755 output/rustc $PKG/usr/bin/rustc
+ install -m 0755 output/cargo $PKG/usr/bin/cargo
+ install -m 0755 output/rustc-build/rustdoc $PKG/usr/bin/rustdoc
+fi
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true