Skip to content

Commit ee83c1f

Browse files
linrssbo-bot[bot]
authored andcommitted
development/mrustc: Added (Rust Compiler).
1 parent 025fc8f commit ee83c1f

File tree

4 files changed

+150
-0
lines changed

4 files changed

+150
-0
lines changed

development/mrustc/README

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
mrustc (Mutabah's Rust Compiler)
2+
3+
mrustc is a "simple" rust compiler written in C++ that is able to
4+
bootstrap a "recent" rustc.
5+
6+
As mrustc's primary goal is bootstrapping rustc, and as such it
7+
tends to assume that the code it's compiling is valid (and any
8+
errors in the generated code are mrustc bugs). Code generation is
9+
done by emitting a high-level assembly (currently very ugly C, but
10+
LLVM/cretone/GIMPLE/... could work) and getting an external tool
11+
(i.e. gcc) to do the heavy-lifting of optimising and machine code
12+
generation.
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
#!/bin/bash
2+
3+
# Slackware build script for mrustc
4+
5+
# Copyright 2026 Ruoh-Shoei LIN
6+
# All rights reserved.
7+
#
8+
# Redistribution and use of this script, with or without modification, is
9+
# permitted provided that the following conditions are met:
10+
#
11+
# 1. Redistributions of this script must retain the above copyright
12+
# notice, this list of conditions and the following disclaimer.
13+
#
14+
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
15+
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16+
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
17+
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19+
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
20+
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
21+
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
22+
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
23+
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24+
25+
26+
cd $(dirname $0) ; CWD=$(pwd)
27+
28+
PRGNAM=mrustc
29+
VERSION=${VERSION:-0.11.2}
30+
BUILD=${BUILD:-1}
31+
TAG=${TAG:-_SBo}
32+
PKGTYPE=${PKGTYPE:-tgz}
33+
34+
if [ -z "$ARCH" ]; then
35+
case "$( uname -m )" in
36+
i?86) ARCH=i586 ;;
37+
arm*) ARCH=arm ;;
38+
*) ARCH=$( uname -m ) ;;
39+
esac
40+
fi
41+
42+
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
43+
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
44+
exit 0
45+
fi
46+
47+
TMP=${TMP:-/tmp/SBo}
48+
PKG=$TMP/package-$PRGNAM
49+
OUTPUT=${OUTPUT:-/tmp}
50+
51+
if [ "$ARCH" = "i586" ]; then
52+
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
53+
LIBDIRSUFFIX=""
54+
elif [ "$ARCH" = "i686" ]; then
55+
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
56+
LIBDIRSUFFIX=""
57+
elif [ "$ARCH" = "x86_64" ]; then
58+
SLKCFLAGS="-O2 -fPIC"
59+
LIBDIRSUFFIX="64"
60+
else
61+
SLKCFLAGS="-O2"
62+
LIBDIRSUFFIX=""
63+
fi
64+
65+
set -e
66+
67+
rm -rf $PKG
68+
mkdir -p $TMP $PKG $OUTPUT
69+
cd $TMP
70+
rm -rf $PRGNAM-$VERSION
71+
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
72+
cd $PRGNAM-$VERSION
73+
cp -a $CWD/rustc-1.29.0-src.tar.gz .
74+
chown -R root:root .
75+
find -L . \
76+
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
77+
-o -perm 511 \) -exec chmod 755 {} \+ -o \
78+
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
79+
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+
80+
81+
export CFLAGS="$SLKCFLAGS"
82+
export CXXFLAGS="$SLKCFLAGS"
83+
make
84+
make LIBS
85+
make test
86+
87+
install -Dm755 bin/{mrustc,minicargo} \
88+
-t $PKG/usr/bin
89+
install -Dm644 output/*rlib{,.o,.hir} \
90+
-t $PKG/usr/lib${LIBDIRSUFFIX}/$PRGNAM
91+
install -Dm644 rustc-*.{patch,toml} \
92+
-t $PKG/usr/share/$PRGNAM
93+
94+
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
95+
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
96+
97+
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
98+
cp -a \
99+
README.md ReleaseNotes.md LICENCE-MIT docs \
100+
$PKG/usr/doc/$PRGNAM-$VERSION
101+
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
102+
103+
mkdir -p $PKG/install
104+
cat $CWD/slack-desc > $PKG/install/slack-desc
105+
106+
cd $PKG
107+
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE

development/mrustc/mrustc.info

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
PRGNAM="mrustc"
2+
VERSION="0.11.2"
3+
HOMEPAGE="https://github.com/thepowersgang/mrustc"
4+
DOWNLOAD="UNSUPPORTED"
5+
MD5SUM=""
6+
DOWNLOAD_x86_64="https://github.com/thepowersgang/mrustc/archive/v0.11.2/mrustc-0.11.2.tar.gz \
7+
https://static.rust-lang.org/dist/rustc-1.29.0-src.tar.gz"
8+
MD5SUM_x86_64="bc85a8cbc0c82c6c1128c42c7fd55c59 \
9+
54c3f0ffb826bdcc2a7395468828a94c"
10+
REQUIRES=""
11+
MAINTAINER="Ruoh-Shoei LIN"
12+

development/mrustc/slack-desc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# HOW TO EDIT THIS FILE:
2+
# The "handy ruler" below makes it easier to edit a package description.
3+
# Line up the first '|' above the ':' following the base package name, and
4+
# the '|' on the right side marks the last column you can put a character in.
5+
# You must make exactly 11 lines for the formatting to be correct. It's also
6+
# customary to leave one space after the ':' except on otherwise blank lines.
7+
8+
|-----handy-ruler------------------------------------------------------|
9+
mrustc: mrustc (Mutabah's Rust Compiler)
10+
mrustc:
11+
mrustc: mrustc is a simple rust compiler written in C++ that is able
12+
mrustc: to bootstrap a recent rustc.
13+
mrustc:
14+
mrustc:
15+
mrustc:
16+
mrustc:
17+
mrustc:
18+
mrustc:
19+
mrustc:

0 commit comments

Comments
 (0)