summaryrefslogtreecommitdiffstats
path: root/system/vtcol/vtcol.SlackBuild
diff options
context:
space:
mode:
Diffstat (limited to 'system/vtcol/vtcol.SlackBuild')
-rw-r--r--system/vtcol/vtcol.SlackBuild77
1 files changed, 55 insertions, 22 deletions
diff --git a/system/vtcol/vtcol.SlackBuild b/system/vtcol/vtcol.SlackBuild
index caaa3fed6a..3363476630 100644
--- a/system/vtcol/vtcol.SlackBuild
+++ b/system/vtcol/vtcol.SlackBuild
@@ -24,7 +24,7 @@
PRGNAM=vtcol
VERSION=${VERSION:-0.42.2}
-BUILD=${BUILD:-2}
+BUILD=${BUILD:-3}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
@@ -40,6 +40,24 @@ 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
@@ -55,6 +73,8 @@ 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 {} \;
+patch -p1 < $CWD/9dda18921a25f64e0a0da06e3417ce99f8bf9b41.patch
+
# build offline
# configuration tells cargo to use the configured directory
# for dependencies intead of downloading from crates.io
@@ -68,35 +88,48 @@ replace-with = 'vendored-sources'
directory = '$(pwd)/vendor'
EOF
-if [ -e $CWD/$PRGNAM-$VERSION-vendor.tar.gz ] ; then
- tar xvf $CWD/$PRGNAM-$VERSION-vendor.tar.gz
-else
- # deps and versions come from Cargo.lock
- # cargo vender can be used to generate the checksums
- mkdir vendor
- (
- cd vendor
+# deps and versions come from Cargo.lock
+# cargo vender can be used to generate the checksums
+mkdir vendor
+(
+ cd vendor
- for dependency in getopts=0.2.14 \
- libc=0.2.19 ; do
- dep="$(echo "$dependency" | cut -d= -f1)"
- ver="$(echo "$dependency" | cut -d= -f2)"
+ for dependency in getopts=0.2.14 \
+ libc=0.2.19; do
+ dep="$(echo "$dependency" | cut -d= -f1)"
+ ver="$(echo "$dependency" | cut -d= -f2)"
- tar xvf $CWD/$dep-$ver.crate
+ tar xvf $CWD/$dep-$ver.crate
- mv $dep-$ver $dep
+ touch $dep-$ver/.cargo-ok
- touch $dep/.cargo-ok
- zcat $CWD/checksums/$dep-cargo-checksum.json.gz > $dep/.cargo-checksum.json
- done
- )
-fi
+ # 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
+)
-cargo build --release
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+cargo build --release $CARGOTARGET
mkdir -p $PKG/usr/bin/
-install -m 755 target/release/vtcol $PKG/usr/bin
+find target -name vtcol -exec install -m 755 {} $PKG/usr/bin/vtcol \;
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