#!/bin/bash KERNEL=$(uname -s) DIR=$(pwd) function clean_up { # Perform program exit housekeeping #mv $DIR/.cargo/config.tmp $DIR/.cargo/config # Optionally accepts an exit status exit $1 } trap clean_up SIGHUP SIGINT SIGTERM if [[ -n $TMP ]]; then TEMP=$TMP elif [[ -n $TMPDIR ]]; then TEMP=$TMPDIR else TEMP=/tmp fi #mv $DIR/.cargo/config $DIR/.cargo/config.tmp if [ "$KERNEL" = "Linux" ]; then echo "Building wgetj for Linux" echo TARGETS=( i686-unknown-linux-gnu x86_64-unknown-linux-gnu ) RELEASES=( dev ) elif [ "$KERNEL" = "MINGW64_NT-6.1" ]; then echo "Building wgetj for Windows" TARGETS=( x86_64-pc-windows-gnu ) RELEASES=( dev ) fi if cargo clean && cargo update; then for target in ${TARGETS[*]}; do for release in ${RELEASES[*]}; do echo "Building wgetj for '$target ($release)'" if [ "$release" == "dev" ] && cargo build --target=$target && cp target/$target/debug/wgetj ~/bin/$target/dev; then echo "Dev Built!" elif [ "$release" == "release" ] && cargo build --release --target=$target && cp target/$target/release/wgetj ~/bin/$target; then echo "Release Built!" else break 2; fi echo done done fi #mv $DIR/.cargo/config.tmp $DIR/.cargo/config