diff options
Diffstat (limited to 'development/rust')
-rw-r--r-- | development/rust/README | 40 | ||||
-rw-r--r-- | development/rust/rust.SlackBuild | 137 | ||||
-rw-r--r-- | development/rust/rust.info | 20 | ||||
-rw-r--r-- | development/rust/slack-desc | 2 |
4 files changed, 130 insertions, 69 deletions
diff --git a/development/rust/README b/development/rust/README index ff69812bdf..8bb1852467 100644 --- a/development/rust/README +++ b/development/rust/README @@ -1,34 +1,16 @@ -Rust +Rust is a systems programming language that runs blazingly fast, +prevents segfaults, and guarantees thread safety. -Rust is a curly-brace, block-structured expression language. +https://www.rust-lang.org -It visually resembles the C language family, but differs significantly -in syntactic and semantic details. +This will build rust from source, which requires using the "official" stage0 +compiler for the version being built from rust-lang.org. Currently, "official" +means the previous stable version. -Its design is oriented toward concerns of "programming in the large", that -is, of creating and maintaining boundaries - both abstract and operational -- that preserve large-system integrity, availability and concurrency. +If you already have rust and cargo installed, this slackbuild will use these to +bootstrap itself. -It supports a mixture of imperative procedural, concurrent actor, -object-oriented and pure functional styles. Rust also supports generic -programming and metaprogramming, in both static and dynamic styles. +You can also force either behaviour through the LOCAL_BOOTSTRAP=yes|no +parameter. -Cargo - the Rust package manager - is included in this build. - -A short summary of features: - -Type system: static, nominal, linear, algebraic, locally inferred - -Memory safety: no null or dangling pointers, no buffer overflows - -Concurrency: lightweight tasks with message passing, no shared memory - -Generics: type parameterization with type classes - -Exception handling: unrecoverable unwinding with task isolation - -Memory model: optional task-local GC, safe pointer types with region analysis - -Compilation model: ahead-of-time, C/C++ compatible - -License: dual MIT / Apache 2 + LOCAL_BOOTSTRAP=no ./rust.SlackBuild diff --git a/development/rust/rust.SlackBuild b/development/rust/rust.SlackBuild index 5371758206..08543c000a 100644 --- a/development/rust/rust.SlackBuild +++ b/development/rust/rust.SlackBuild @@ -2,7 +2,6 @@ # Slackware build script for rust -# Copyright 2014-2015 Dmitrii Sosedov, United States # Copyright 2017 Andrew Clemons, Wellington New Zealand # All rights reserved. # @@ -24,36 +23,93 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. PRGNAM=rust -PRGNAM2=cargo +SRCNAM="$PRGNAM"c VERSION=${VERSION:-1.16.0} -BUILD=${BUILD:-1} +RSTAGE0_VERSION=${RSTAGE0_VERSION:-1.15.1} +RSTAGE0_DIR=${RSTAGE0_DIR:-2017-02-09} +CSTAGE0_VERSION=${CSTAGE0_VERSION:-nightly} +CSTAGE0_DIR=${CSTAGE0_DIR:-6e0c18cccc8b0c06fba8a8d76486f81a792fb420} +BUILD=${BUILD:-2} TAG=${TAG:-_SBo} -ARCH=${ARCH:-$(uname -m)} -case "$ARCH" in - i?86) ARCH=i686 - LIBDIRSUFFIX="" - ;; - x86_64) LIBDIRSUFFIX="64" - ;; - *) echo "$ARCH is not supported" - exit 1 - ;; -esac +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i686) ARCH=i686 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi CWD=$(pwd) TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} +if [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + echo "$ARCH is unsupported" + exit 1 +fi + set -e rm -rf $PKG -mkdir -p $TMP $PKG $PKG/usr $OUTPUT +mkdir -p $TMP $PKG $OUTPUT cd $TMP -rm -rf $PRGNAM-$VERSION-$ARCH-unknown-linux-gnu -tar xvf $CWD/$PRGNAM-$VERSION-$ARCH-unknown-linux-gnu.tar.gz -cd $PRGNAM-$VERSION-$ARCH-unknown-linux-gnu +rm -rf $SRCNAM-$VERSION-src +tar xvf $CWD/$SRCNAM-$VERSION-src.tar.gz +cd $SRCNAM-$VERSION-src + +# if you already have rust and cargo installed, you can bootstrap from the +# previous version. +if [ "$LOCAL_BOOTSTRAP" = "" ] && [ -x /usr/bin/cargo ] && [ -x /usr/bin/rustc ] ; then + LOCAL_BOOTSTRAP=yes +fi + +if [ "$LOCAL_BOOTSTRAP" != "yes" ] ; then + # rust requires bootstrapping with the previous rust version. + # versions are defined in src/stage0.txt + mkdir -p build/cache/$RSTAGE0_DIR + cp $CWD/$PRGNAM-std-$RSTAGE0_VERSION-$ARCH-unknown-linux-gnu.tar.gz \ + $CWD/$SRCNAM-$RSTAGE0_VERSION-$ARCH-unknown-linux-gnu.tar.gz \ + build/cache/$RSTAGE0_DIR + + mkdir -p build/cache/$CSTAGE0_DIR + cp $CWD/cargo-$CSTAGE0_VERSION-$ARCH-unknown-linux-gnu.tar.gz build/cache/$CSTAGE0_DIR +fi + +# src/bootstrap/config.toml.example +cat <<EOF > config.toml +[build] +vendor = true +extended = false +submodules = false + +[install] +prefix = "$PKG/usr" +libdir = "lib$LIBDIRSUFFIX" +mandir = "man" + +[rust] +channel = "stable" +rpath = false +codegen-tests = false + +[target.$ARCH-unknown-linux-gnu] +llvm-config = "/usr/bin/llvm-config" +# build fails using the system jemalloc +# jemalloc = "/usr/lib$LIBDIRSUFFIX/libjemalloc_pic.a" +EOF + +if [ "$LOCAL_BOOTSTRAP" = "yes" ] ; then + sed -i "s|^\(vendor = true\)$|\1\nrustc = \"/usr/bin/rustc\"\ncargo = \"/usr/bin/cargo\"|" config.toml +fi + chown -R root:root . find -L . \ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ @@ -61,33 +117,44 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; -chmod 755 ${PRGNAM}c/{bin,lib,share} -chmod 755 ${PRGNAM2}/{bin,etc,lib,share} +export RUSTFLAGS="$RUSTFLAGS -C link-args=-lffi" +export CC=clang +export CXX=clang++ + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +python x.py build --verbose + +python x.py dist --verbose + +for dist in rustc rust-std rust-docs ; do + mkdir unpack + ( + cd unpack + + tar xvf ../build/dist/$dist-$VERSION-$ARCH-unknown-linux-gnu.tar.gz + + cd $dist-$VERSION-$ARCH-unknown-linux-gnu + ./install.sh --prefix="$PKG/usr" --mandir="$PKG/usr/man" + ) + rm -rf unpack +done + +if [ "$ARCH" = "x86_64" ]; then + mv $PKG/usr/lib $PKG/usr/lib$LIBDIRSUFFIX +fi -mv ${PRGNAM}c/bin $PKG/usr/ -mv ${PRGNAM}c/lib $PKG/usr/lib${LIBDIRSUFFIX} -mv ${PRGNAM}c/share $PKG/usr/ -mv ${PRGNAM2}/bin/* $PKG/usr/bin/ -mv ${PRGNAM2}/etc $PKG/usr/ -mv ${PRGNAM2}/lib/* $PKG/usr/lib${LIBDIRSUFFIX} -cp -rf ${PRGNAM2}/share/* $PKG/usr/share -mv $PRGNAM-std-$ARCH-unknown-linux-gnu/lib/rustlib/$ARCH-unknown-linux-gnu $PKG/usr/lib$LIBDIRSUFFIX/rustlib/ -find -L $PKG -type d -exec chmod 755 {} \; -chmod 755 $PKG/usr/bin/* +mv $PKG/usr/share/doc $PKG/usr/ 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 -mv $PKG/usr/share/man $PKG/usr/ find $PKG/usr/man -type f -exec gzip -9 {} \; for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION -mv $PRGNAM-docs/share/* $PKG/usr/doc/$PRGNAM-$VERSION/ +cp -a *.md COPYRIGHT LICENSE-APACHE LICENSE-MIT $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild -rm -rf $PKG/usr/doc/$PRGNAM-$VERSION/doc/$PRGNAM/html -cp -rf $PKG/usr/share/doc $PKG/usr/ -rm -rf $PKG/usr/share/doc $PKG/usr/doc/$PRGNAM-$VERSION/doc mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc diff --git a/development/rust/rust.info b/development/rust/rust.info index 56f220ed6b..eeedf83b9b 100644 --- a/development/rust/rust.info +++ b/development/rust/rust.info @@ -1,10 +1,22 @@ PRGNAM="rust" VERSION="1.16.0" HOMEPAGE="http://www.rust-lang.org" -DOWNLOAD="https://static.rust-lang.org/dist/rust-1.16.0-i686-unknown-linux-gnu.tar.gz" -MD5SUM="52393f468be6797d8bf66bbc51d5ad6e" -DOWNLOAD_x86_64="https://static.rust-lang.org/dist/rust-1.16.0-x86_64-unknown-linux-gnu.tar.gz" -MD5SUM_x86_64="5effa7068c26151029432466235089a9" +DOWNLOAD="https://static.rust-lang.org/dist/rustc-1.16.0-src.tar.gz \ + https://s3.amazonaws.com/rust-lang-ci/cargo-builds/6e0c18cccc8b0c06fba8a8d76486f81a792fb420/cargo-nightly-i686-unknown-linux-gnu.tar.gz \ + https://static.rust-lang.org/dist/2017-02-09/rust-std-1.15.1-i686-unknown-linux-gnu.tar.gz \ + https://static.rust-lang.org/dist/2017-02-09/rustc-1.15.1-i686-unknown-linux-gnu.tar.gz" +MD5SUM="c11d94d9e62f71838b20058f0797357a \ + 24d4eda62991bfbaecb3a6d1e09df143 \ + ee62d3b9e1c17d1e87c1bf0578eab3f9 \ + 523c90836120f3388d7c7a1eaa4df6ab" +DOWNLOAD_x86_64="https://static.rust-lang.org/dist/rustc-1.16.0-src.tar.gz \ + https://s3.amazonaws.com/rust-lang-ci/cargo-builds/6e0c18cccc8b0c06fba8a8d76486f81a792fb420/cargo-nightly-x86_64-unknown-linux-gnu.tar.gz \ + https://static.rust-lang.org/dist/2017-02-09/rust-std-1.15.1-x86_64-unknown-linux-gnu.tar.gz \ + https://static.rust-lang.org/dist/2017-02-09/rustc-1.15.1-x86_64-unknown-linux-gnu.tar.gz" +MD5SUM_x86_64="c11d94d9e62f71838b20058f0797357a \ + ad2b513d591f35271f1041e2e04f484c \ + da2469eacf2a079563d6d7e6f5319efa \ + 6d01f429917fa6b7053054e6b5cba138" REQUIRES="" MAINTAINER="Andrew Clemons" EMAIL="andrew.clemons@gmail.com" diff --git a/development/rust/slack-desc b/development/rust/slack-desc index c5b9708d16..bdb5cd0336 100644 --- a/development/rust/slack-desc +++ b/development/rust/slack-desc @@ -15,5 +15,5 @@ rust: operational - that preserve large-system integrity, availability and rust: concurrency. rust: rust: Homepage: http://rust-lang.org -rust: Release date: Dec 10, 2015 +rust: rust: |