summaryrefslogtreecommitdiffstats
path: root/source/l/zstd
diff options
context:
space:
mode:
Diffstat (limited to 'source/l/zstd')
-rw-r--r--source/l/zstd/slack-desc19
-rwxr-xr-xsource/l/zstd/zstd.SlackBuild152
-rw-r--r--source/l/zstd/zstd.dont.link.pzstd.to.static.libzstd.a.diff13
-rw-r--r--source/l/zstd/zstd.url1
4 files changed, 185 insertions, 0 deletions
diff --git a/source/l/zstd/slack-desc b/source/l/zstd/slack-desc
new file mode 100644
index 000000000..215674d54
--- /dev/null
+++ b/source/l/zstd/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------------------------------------------------------|
+zstd: zstd (real-time compression algorithm)
+zstd:
+zstd: Zstandard, or zstd for short, is a real-time compression algorithm
+zstd: providing high compression ratios. It offers a very wide range of
+zstd: compression/speed trade-off, while being backed by a very fast
+zstd: decoder. It also offers a special mode for small data, called
+zstd: dictionary compression, and can create dictionaries from any sample
+zstd: set.
+zstd:
+zstd: Homepage: http://zstd.net/
+zstd:
diff --git a/source/l/zstd/zstd.SlackBuild b/source/l/zstd/zstd.SlackBuild
new file mode 100755
index 000000000..94a2388b9
--- /dev/null
+++ b/source/l/zstd/zstd.SlackBuild
@@ -0,0 +1,152 @@
+#!/bin/sh
+# Copyright 2018 Eric Hameleers, Eindhoven, Netherlands
+# Copyright 2018 Patrick J. Volkerding, Sebeka, MN, USA
+# All rights reserved.
+#
+# Permission to use, copy, modify, and distribute this software for
+# any purpose with or without fee is hereby granted, provided that
+# the above copyright notice and this permission notice appear in all
+# copies.
+#
+# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+# CONTRIBUTORS 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.
+# -----------------------------------------------------------------------------
+
+
+PKGNAM=zstd
+VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
+BUILD=${BUILD:-1}
+
+NUMJOBS=${NUMJOBS:-" -j7 "}
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$(uname -m)" in
+ i?86) ARCH=i586 ;;
+ arm*) readelf /usr/bin/file -A | egrep -q "Tag_CPU.*[4,5]" && ARCH=arm || ARCH=armv7hl ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) ARCH=$(uname -m) ;;
+ esac
+ export ARCH
+fi
+
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ SLKLDFLAGS=""
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+ SLKLDFLAGS=""
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "s390" ]; then
+ SLKCFLAGS="-O2"
+ SLKLDFLAGS=""
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ SLKLDFLAGS="-L/usr/lib64"
+ LIBDIRSUFFIX="64"
+elif [ "$ARCH" = "armv7hl" ]; then
+ SLKCFLAGS="-O2 -march=armv7-a -mfpu=vfpv3-d16"
+ SLKLDFLAGS=""
+ LIBDIRSUFFIX=""
+else
+ SLKCFLAGS="-O2"
+ SLKLDFLAGS=""
+ LIBDIRSUFFIX=""
+fi
+
+NUMJOBS=${NUMJOBS:-" -j7 "}
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp}
+PKG=$TMP/package-$PKGNAM
+
+rm -rf $PKG
+mkdir -p $TMP $PKG
+cd $TMP
+rm -rf $PKGNAM-$VERSION
+tar xvf $CWD/$PKGNAM-$VERSION.tar.?z || exit 1
+cd $PKGNAM-$VERSION || exit 1
+
+zcat $CWD/zstd.dont.link.pzstd.to.static.libzstd.a.diff.gz | patch -p1 --verbose || exit 1
+
+# Make sure ownerships and permissions are sane:
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+# Compile it:
+make $NUMJOBS CFLAGS="$SLKCFLAGS" || exit 1
+make $NUMJOBS CFLAGS="$SLKCFLAGS" -C contrib/pzstd || exit 1
+
+# Install it:
+make \
+ prefix=/usr \
+ libdir=/usr/lib${LIBDIRSUFFIX} \
+ mandir=/usr/man \
+ DESTDIR=$PKG \
+ install || exit 1
+install -Dm755 contrib/pzstd/pzstd $PKG/usr/bin/pzstd || exit 1
+
+# Don't ship static library:
+rm -f $PKG/usr/lib${LIBDIRSUFFIX}/*.a
+
+# zstdmt as the same as zstd, so just make a symlink:
+( cd $PKG/usr/bin
+ ln -sf zstd zstdmt
+)
+
+# Strip binaries:
+find $PKG | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+find $PKG | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+
+# Compress and link manpages, if any:
+if [ -d $PKG/usr/man ]; then
+ ( cd $PKG/usr/man
+ for manpagedir in $(find . -type d -name "man*") ; do
+ ( cd $manpagedir
+ for eachpage in $( find . -type l -maxdepth 1) ; do
+ ln -s $( readlink $eachpage ).gz $eachpage.gz
+ rm $eachpage
+ done
+ gzip -9 *.?
+ )
+ done
+ )
+fi
+
+# Add a documentation directory:
+mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
+cp -a \
+ CONTRIBUTING* COPYING* LICENSE NEWS README* TESTING* \
+ $PKG/usr/doc/$PKGNAM-$VERSION
+
+# Add a package description:
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+# Build package:
+cd $PKG
+/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
diff --git a/source/l/zstd/zstd.dont.link.pzstd.to.static.libzstd.a.diff b/source/l/zstd/zstd.dont.link.pzstd.to.static.libzstd.a.diff
new file mode 100644
index 000000000..577ba7b04
--- /dev/null
+++ b/source/l/zstd/zstd.dont.link.pzstd.to.static.libzstd.a.diff
@@ -0,0 +1,13 @@
+--- ./contrib/pzstd/Makefile.orig 2017-12-21 03:16:40.000000000 -0600
++++ ./contrib/pzstd/Makefile 2018-02-12 16:25:19.626150873 -0600
+@@ -171,8 +171,8 @@
+ $(TESTPROG) ./test/RoundTripTest$(EXT) $(TESTFLAGS)
+
+ # Build the main binary
+-pzstd$(EXT): main.o Options.o Pzstd.o SkippableFrame.o $(ZSTDDIR)/libzstd.a
+- $(LD_COMMAND)
++pzstd$(EXT): main.o Options.o Pzstd.o SkippableFrame.o
++ $(LD_COMMAND) -L ../../lib -lzstd
+
+ # Target that depends on all the tests
+ .PHONY: tests
diff --git a/source/l/zstd/zstd.url b/source/l/zstd/zstd.url
new file mode 100644
index 000000000..0c9a52bc6
--- /dev/null
+++ b/source/l/zstd/zstd.url
@@ -0,0 +1 @@
+https://github.com/facebook/zstd/archive/v1.3.3/zstd-1.3.3.tar.gz