diff options
author | Andrew Clemons <andrew.clemons@gmail.com> | 2017-10-17 12:58:59 +0100 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2017-10-21 07:08:31 +0700 |
commit | 538a9af63bfac7712eac5c83e53eabe8cc0cabf7 (patch) | |
tree | 7bd682067c6a7eb7cf09f49a900dce5e5df097fb | |
parent | db06e89bcd262167bd2fc32b4d9f47120562dd28 (diff) | |
download | slackbuilds-538a9af63bfac7712eac5c83e53eabe8cc0cabf7.tar.gz |
development/rustfmt: Added (Format Rust code).
Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
-rw-r--r-- | development/rustfmt/README | 1 | ||||
-rw-r--r-- | development/rustfmt/rustfmt.SlackBuild | 182 | ||||
-rw-r--r-- | development/rustfmt/rustfmt.info | 94 | ||||
-rw-r--r-- | development/rustfmt/slack-desc | 19 |
4 files changed, 296 insertions, 0 deletions
diff --git a/development/rustfmt/README b/development/rustfmt/README new file mode 100644 index 0000000000..23b68f5d2c --- /dev/null +++ b/development/rustfmt/README @@ -0,0 +1 @@ +rustfmt - a tool for formatting Rust code according to style guidelines. diff --git a/development/rustfmt/rustfmt.SlackBuild b/development/rustfmt/rustfmt.SlackBuild new file mode 100644 index 0000000000..18bb835fdc --- /dev/null +++ b/development/rustfmt/rustfmt.SlackBuild @@ -0,0 +1,182 @@ +#!/bin/sh + +# Slackware build script for rustfmt + +# Copyright 2017 Andrew Clemons, Wellington New Zealand +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=rustfmt +VERSION=${VERSION:-0.9.0} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" + CARGOTARGET="--target i586-unknown-linux-gnu" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" + CARGOTARGET="--target i686-unknown-linux-gnu" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" + CARGOTARGET="--target x86_64-unknown-linux-gnu" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" + CARGOTARGET="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION + +# build offline +# configuration tells cargo to use the configured directory +# for dependencies intead of downloading from crates.io +mkdir .cargo +cat << EOF >> .cargo/config +[source.crates-io] +registry = 'https://github.com/rust-lang/crates.io-index' +replace-with = 'vendored-sources' + +[source.vendored-sources] +directory = '$(pwd)/vendor' +EOF + +# deps and versions come from Cargo.lock +mkdir vendor +( + cd vendor + + for dependency in aho-corasick=0.6.3 \ + bitflags=0.9.1 \ + diff=0.1.10 \ + dtoa=0.4.1 \ + env_logger=0.4.3 \ + extprim=1.2.2 \ + getopts=0.2.14 \ + itoa=0.3.1 \ + kernel32-sys=0.2.2 \ + libc=0.2.23 \ + log=0.3.8 \ + memchr=1.0.1 \ + num-traits=0.1.39 \ + quote=0.3.15 \ + rand=0.3.15 \ + regex=0.2.2 \ + regex-syntax=0.4.1 \ + rustc_version=0.2.1 \ + semver=0.6.0 \ + semver-parser=0.7.0 \ + serde=1.0.8 \ + serde_derive=1.0.8 \ + serde_derive_internals=0.15.1 \ + serde_json=1.0.2 \ + strings=0.1.0 \ + syn=0.11.11 \ + synom=0.11.3 \ + syntex_errors=0.59.0 \ + syntex_pos=0.59.0 \ + syntex_syntax=0.59.0 \ + term=0.4.5 \ + thread-id=3.1.0 \ + thread_local=0.3.3 \ + toml=0.4.1 \ + unicode-segmentation=1.2.0 \ + unicode-xid=0.0.4 \ + unicode-xid=0.1.0 \ + unreachable=0.1.1 \ + utf8-ranges=1.0.0 \ + void=1.0.2 \ + winapi=0.2.8 \ + winapi-build=0.1.1; do + dep="$(echo "$dependency" | cut -d= -f1)" + ver="$(echo "$dependency" | cut -d= -f2)" + + tar xvf $CWD/$dep-$ver.crate + + touch $dep-$ver/.cargo-ok + + # generate checksum + { + printf "{\n" + printf ' "files": {\n' + + ( + cd $dep-$ver + find . -type f -print0 | xargs -0 sha256sum | sed -n '/\.cargo-checksum\.json/!p' | sed 's/\.\///;s/^\([^ ]*\)[[:space:]][[:space:]]*\(.*\)$/"\2":"\1",/' + ) | sed '$ s/,$//' + + printf " },\n" + printf ' "package": "' + + sha256sum "$CWD/$dep-$ver.crate" | cut -f1 -d' ' | sed 's/$/"/' + + printf "}\n" + } | python -c "import sys, json; data = sys.stdin.read(); print json.dumps(json.loads(data), sort_keys=True, indent=4, separators=(',', ' : '))" > $dep-$ver/.cargo-checksum.json + done +) + +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +cargo build --release $CARGOTARGET + +mkdir -p $PKG/usr/bin +find target -name rustfmt -exec install -m 755 {} $PKG/usr/bin/rustfmt \; +find target -name cargo-fmt -exec install -m 755 {} $PKG/usr/bin/cargo-fmt \; + +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 + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a Configurations.md Contributing.md Design.md LICENSE-APACHE LICENSE-MIT README.md $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/development/rustfmt/rustfmt.info b/development/rustfmt/rustfmt.info new file mode 100644 index 0000000000..8eb212d246 --- /dev/null +++ b/development/rustfmt/rustfmt.info @@ -0,0 +1,94 @@ +PRGNAM="rustfmt" +VERSION="0.9.0" +HOMEPAGE="https://github.com/rust-lang-nursery/rustfmt" +DOWNLOAD="https://github.com/rust-lang-nursery/rustfmt/archive/0.9.0/rustfmt-0.9.0.tar.gz \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/aho-corasick/aho-corasick-0.6.3.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/bitflags/bitflags-0.9.1.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/diff/diff-0.1.10.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/dtoa/dtoa-0.4.1.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/env_logger/env_logger-0.4.3.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/extprim/extprim-1.2.2.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/getopts/getopts-0.2.14.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/itoa/itoa-0.3.1.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/kernel32-sys/kernel32-sys-0.2.2.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/libc/libc-0.2.23.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/log/log-0.3.8.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/memchr/memchr-1.0.1.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/num-traits/num-traits-0.1.39.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/quote/quote-0.3.15.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/rand/rand-0.3.15.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/regex/regex-0.2.2.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/regex-syntax/regex-syntax-0.4.1.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/rustc_version/rustc_version-0.2.1.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/semver/semver-0.6.0.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/semver-parser/semver-parser-0.7.0.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/serde/serde-1.0.8.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/serde_derive/serde_derive-1.0.8.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/serde_derive_internals/serde_derive_internals-0.15.1.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/serde_json/serde_json-1.0.2.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/strings/strings-0.1.0.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/syn/syn-0.11.11.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/synom/synom-0.11.3.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/syntex_errors/syntex_errors-0.59.0.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/syntex_pos/syntex_pos-0.59.0.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/syntex_syntax/syntex_syntax-0.59.0.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/term/term-0.4.5.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/thread-id/thread-id-3.1.0.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/thread_local/thread_local-0.3.3.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/toml/toml-0.4.1.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/unicode-segmentation/unicode-segmentation-1.2.0.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/unicode-xid/unicode-xid-0.0.4.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/unicode-xid/unicode-xid-0.1.0.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/unreachable/unreachable-0.1.1.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/utf8-ranges/utf8-ranges-1.0.0.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/void/void-1.0.2.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/winapi/winapi-0.2.8.crate \ + https://crates-io.s3-us-west-1.amazonaws.com/crates/winapi-build/winapi-build-0.1.1.crate" +MD5SUM="e498ebfb206dc9ab99f2c134843cb156 \ + f2904b4b227389e7453f14b769bdbe5b \ + 8db34042da9ec719905b996a5b7182e1 \ + eb3ce72fc6042bf2ab606ef88bc4e96d \ + 091914141d6c6a003b17eefd5fbde19a \ + fe1872f7c0d006fbc2b6212eaa42d56f \ + 8ace682f0e0893dbcba1a872a1cdb97b \ + 6d59f4fa29cab7bcc7ea7e0c8f96e27d \ + 9cf474a5a1e37a3cbcadd340dede4bd3 \ + 9d033cc2daa6924420a4a89e6705773f \ + 20b7ccc0e2e953b247c219698ec5b86a \ + 3aeec0abc69e407a94677199cd6a0b4b \ + 046c7f6cbfec17e33a7868d2743f91a6 \ + 89df5f2ba26e17ed31e8ea82ae8a9763 \ + e4dce2134a2e4ae3bc240f8b09287d8f \ + 7caa61be90bbd2509a18866cc8fe1217 \ + 5604a7f31b772bfb8b1d92eb82ce1c73 \ + bc864dd8474a0c6dac7d492b7dec392b \ + 32a2ed6e4f7972d2d2c7cf17a27d0b3b \ + 3c48c45246233d12467ad39032884429 \ + 8b4d8c7b6e3a060d365bc1ad650929fa \ + 62bce669a382e3fd99512dbb42bafb8a \ + 27666f3e8f291c0400c308c55f65a4cf \ + 1df496a3a9e4ee8616ad33abb20b646e \ + 7319716186c2007617be89eb69ce4402 \ + 3623fdc75789da60ea82ae47b62fbad3 \ + fb6a01d30312127d808564d7e918dcb8 \ + d2d3ab7036ea1566ac40bb395eee6a83 \ + 95fea8cf6ccde74041017492cbe9d120 \ + ea3023a3aa242da29297fd920e97b047 \ + 0844e1e4d2abae79345c65e2cc94c509 \ + 7173846c666cadc48d5a8d9cd47cb38a \ + 9b42f4ebea0d52e9cac4298e1d1ea9c7 \ + 3a690521b0f9fd39d6ae3a63be8109ca \ + 01497e00d66c0a94668ca25aadf281bb \ + 006dd221f179cceeedb8ddcad9ce7814 \ + a1fa72c3ccb83dba31faa1d22122e5c1 \ + 5aaf04f9a94a6450e3e4963ddd62b92d \ + 38e5de44567753e985dbcbfc0941dba2 \ + 7293a4349a42c9b7ef8866cca981ed83 \ + 689203efc084fc0f1d1f74f5d354ae75 \ + b44489eb4799c4fabac3fceb48de54f7 \ + c900e7dbce808ff8ced375077b17a163" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="rust" +MAINTAINER="Andrew Clemons" +EMAIL="andrew.clemons@gmail.com" diff --git a/development/rustfmt/slack-desc b/development/rustfmt/slack-desc new file mode 100644 index 0000000000..8eaf418d3b --- /dev/null +++ b/development/rustfmt/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +rustfmt: rustfmt (Format Rust code) +rustfmt: +rustfmt: rustfmt - A tool for formatting Rust code according to style +rustfmt: guidelines. +rustfmt: +rustfmt: https://github.com/rust-lang-nursery/rustfmt +rustfmt: +rustfmt: +rustfmt: +rustfmt: +rustfmt: |