summaryrefslogtreecommitdiff
path: root/network/newsboat/newsboat.SlackBuild
diff options
context:
space:
mode:
authorAndrew Clemons <andrew.clemons@gmail.com>2019-01-03 15:21:15 +1300
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2019-01-05 07:49:21 +0700
commit1a83048ee9b331d0fcafd02fcbefb1683d6acda8 (patch)
treeed809bea102a6305cf3c128b554eb1ca39f44772 /network/newsboat/newsboat.SlackBuild
parent7d8c00f6d91a0c31d33ece472b3b3c59705dc2c6 (diff)
downloadslackbuilds-1a83048ee9b331d0fcafd02fcbefb1683d6acda8.tar.gz
network/newsboat: Updated for version 2.14.
Signed-off-by: Andrew Clemons <andrew.clemons@gmail.com> Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'network/newsboat/newsboat.SlackBuild')
-rw-r--r--network/newsboat/newsboat.SlackBuild73
1 files changed, 70 insertions, 3 deletions
diff --git a/network/newsboat/newsboat.SlackBuild b/network/newsboat/newsboat.SlackBuild
index f93d035df6..9edcbd341b 100644
--- a/network/newsboat/newsboat.SlackBuild
+++ b/network/newsboat/newsboat.SlackBuild
@@ -3,6 +3,7 @@
# Slackware build script for newsboat
# Copyright 2017-2018 Benjamin Trigona-Harany <slackbuilds@jaxartes.net>
+# Copyright 2019 Andrew Clemons, Wellington New Zealand
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -23,7 +24,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=newsboat
-VERSION=${VERSION:-2.13}
+VERSION=${VERSION:-2.14}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
@@ -33,6 +34,12 @@ if [ -z "$ARCH" ]; then
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
+
+ if [ "$ARCH" = "i586" ]; then
+ if rustc -Vv | grep host | grep i686 > /dev/null ; then
+ ARCH=i686
+ fi
+ fi
fi
CWD=$(pwd)
@@ -43,15 +50,19 @@ 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
@@ -62,6 +73,57 @@ cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.xz
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
+
+ grep -h -A 3 "\[\[package\]\]" $(find ../ -maxdepth 1 -mindepth 1 -name Cargo.lock | tr '\n' ' ') | \
+ sed 's/[[:space:]]*=[[:space:]]*/=/g;s/^--//;s/^\[\[/--\n[[/' | \
+ awk 'BEGIN { RS = "--\n" ; FS="\n" } { print $2, $3, $4 }' | sed 's/"//g;s/name=//;s/ version=/=/' | \
+ grep crates\.io-index | sed 's/ source=.*$//' | sort -u | while read -r dep ; do
+
+ ver="$(printf "%s\n" "$dep" | cut -d= -f2)"
+ dep="$(printf "%s\n" "$dep" | cut -d= -f1)"
+
+ 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
+)
+
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
@@ -69,9 +131,14 @@ 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 {} \;
+if [ "$CARGOTARGET" != "" ] ; then
+ RELEASEDIR="$(echo "$CARGOTARGET" | cut -d' ' -f2)"
+ sed -i "s|target/release|target/$RELEASEDIR/release|" Makefile
+fi
+
CXXFLAGS="$SLKCFLAGS" \
-make \
- prefix=/usr
+CARGO_FLAGS="$CARGOTARGET" \
+make -j1 prefix=/usr
make doc
make install \
prefix=/usr \