diff options
author | fourtysixandtwo <fourtysixandtwo@sliderr.net> | 2023-09-16 14:22:33 -0600 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2023-09-23 11:33:49 +0700 |
commit | 896508436d670012bec899ed64363c4b82b10d48 (patch) | |
tree | 973e78d2ba400a93d7e6edb070b5cbf831eddec1 /python/jellyfish | |
parent | ccfef38374428a2084e70626615d4c8a0e6398fa (diff) |
python/jellyfish: Updated for version 1.0.0.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'python/jellyfish')
-rw-r--r-- | python/jellyfish/Cargo.toml.patch | 14 | ||||
-rw-r--r-- | python/jellyfish/jellyfish.SlackBuild | 45 | ||||
-rw-r--r-- | python/jellyfish/jellyfish.info | 10 | ||||
-rw-r--r-- | python/jellyfish/mkvendored.sh | 98 | ||||
-rw-r--r-- | python/jellyfish/pyproject.toml.patch | 11 |
5 files changed, 165 insertions, 13 deletions
diff --git a/python/jellyfish/Cargo.toml.patch b/python/jellyfish/Cargo.toml.patch new file mode 100644 index 000000000000..f6573bb96862 --- /dev/null +++ b/python/jellyfish/Cargo.toml.patch @@ -0,0 +1,14 @@ +diff --git a/Cargo.toml b/Cargo.toml +index d9ff039..f7f04ef 100644 +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -3,6 +3,9 @@ name = "jellyfish" + version = "1.0.0" + edition = "2021" + description = "Approximate and phonetic matching of strings." ++exclude = [ ++ "dist/*", ++] + authors = ["James Turk <dev@jamesturk.net>"] + repository = "https://github.com/jamesturk/jellyfish/" + license = "MIT" diff --git a/python/jellyfish/jellyfish.SlackBuild b/python/jellyfish/jellyfish.SlackBuild index 1af429bb8cb7..7fd0e3927251 100644 --- a/python/jellyfish/jellyfish.SlackBuild +++ b/python/jellyfish/jellyfish.SlackBuild @@ -2,7 +2,7 @@ # Slackware build script for jellyfish -# Copyright 2022 fourtysixandtwo <fourtysixandtwo@sliderr.net> +# Copyright 2022-23 fourtysixandtwo <fourtysixandtwo@sliderr.net> # Copyright 2015-2018 Dimitris Zlatanidis Orestiada, Greece # All rights reserved. # @@ -23,10 +23,12 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# 20230916 46and2: Updated version, changed build process. + cd $(dirname $0) ; CWD=$(pwd) PRGNAM=jellyfish -VERSION=${VERSION:-0.9.0} +VERSION=${VERSION:-1.0.0} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} @@ -39,9 +41,6 @@ if [ -z "$ARCH" ]; then esac 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 "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" exit 0 @@ -60,6 +59,9 @@ elif [ "$ARCH" = "i686" ]; then elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fPIC" LIBDIRSUFFIX="64" +elif [ "$ARCH" = "aarch64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" else SLKCFLAGS="-O2" LIBDIRSUFFIX="" @@ -72,21 +74,46 @@ mkdir -p $TMP $PKG $OUTPUT cd $TMP rm -rf $PRGNAM-$VERSION tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +tar xvf $CWD/$PRGNAM-vendored-sources-$VERSION-$BUILD.tar.?z cd $PRGNAM-$VERSION chown -R root:root . find -L . \ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ - -o -perm 511 \) -exec chmod 755 {} \; -o \ + -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 {} \; + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+ + +# patch pyproject.toml to allow maturin 1.x.x version +patch -Np1 < $CWD/pyproject.toml.patch + +# patch Cargo.toml to exclude dist dir and get rid of build warning +patch -Np1 < $CWD/Cargo.toml.patch + +# prevent cargo from using the network. +# this only works because we have a vendored sources tarball with +# everything cargo would have downloaded. +export CARGO_NET_OFFLINE=true + +# prevent cargo from writing outside of $TMP +export CARGO_HOME=$(pwd)/.cargo + +export PATH="/opt/rust16/bin:$PATH" +if [ -z "$LD_LIBRARY_PATH" ]; then + export LD_LIBRARY_PATH="/opt/rust16/lib$LIBDIRSUFFIX" +else + export LD_LIBRARY_PATH="/opt/rust16/lib$LIBDIRSUFFIX:$LD_LIBRARY_PATH" +fi + +export PYTHONPATH=/opt/python3.9/site-packages/ -python3 setup.py install --root=$PKG +python3 -m build --no-isolation +python3 -m installer -d "$PKG" dist/*.whl 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 README.md PKG-INFO LICENSE $PKG/usr/doc/$PRGNAM-$VERSION +cp -a README.md PKG-INFO LICENSE docs/* $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild mkdir -p $PKG/install diff --git a/python/jellyfish/jellyfish.info b/python/jellyfish/jellyfish.info index bbfe29248df5..7941ba10038f 100644 --- a/python/jellyfish/jellyfish.info +++ b/python/jellyfish/jellyfish.info @@ -1,10 +1,12 @@ PRGNAM="jellyfish" -VERSION="0.9.0" +VERSION="1.0.0" HOMEPAGE="https://github.com/sunlightlabs/jellyfish" -DOWNLOAD="https://files.pythonhosted.org/packages/26/18/cd485f3661c8e8c0ab864c2e54033371dcc1f7e75767318a4044b2808ed4/jellyfish-0.9.0.tar.gz" -MD5SUM="3c2a9d07102372dc673b1f74970d25b6" +DOWNLOAD="https://files.pythonhosted.org/packages/source/j/jellyfish/jellyfish-1.0.0.tar.gz \ + https://slackware.uk/~fourtysixandtwo/src/jellyfish-vendored-sources-1.0.0-1.tar.xz" +MD5SUM="9caeaa06e52abc7c570f893d3d7e87ee \ + e7067208cb400ba12964e6a2d627571a" DOWNLOAD_x86_64="" MD5SUM_x86_64="" -REQUIRES="" +REQUIRES="python3-maturin" MAINTAINER="fourtysixandtwo" EMAIL="fourtysixandtwo@sliderr.net" diff --git a/python/jellyfish/mkvendored.sh b/python/jellyfish/mkvendored.sh new file mode 100644 index 000000000000..054f3e64dbe9 --- /dev/null +++ b/python/jellyfish/mkvendored.sh @@ -0,0 +1,98 @@ +#!/bin/bash + +# create $PRGNAM-vendored-sources-$VERSION-$BUILD.tar.xz +# requires network access, but does not require root privilege. +# requires that $PRGNAM's REQUIRES need to be installed first +# and cargo-vendor-filterer if you want just the linux ones + +CWD=$(pwd) +PRGNAM=${CWD##*/} #basename $CWD equivalent +source ./$PRGNAM.info + +set -e +WORKDIR=$( mktemp -d ) +cd $WORKDIR + +# don't depend on user's ~/.cargo +mkdir -p cargohome +export CARGO_HOME=$(pwd)/cargohome + +egrep "^BUILD=|^PRGNAM=" $CWD/$PRGNAM.SlackBuild > 1 +source ./1 + +if [ -z $SRCNAM ]; then + echo "no SRCNAM" + SRCNAM=$PRGNAM +fi + +tar xvf $CWD/$SRCNAM-$VERSION.tar.gz +cd $SRCNAM-$VERSION + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +# check if rust16 is installed +if [ ! -d /opt/rust16/bin ]; then + echo "ERROR: The rust16 slackbuild is required to be installed" + exit 1 +else + export PATH="/opt/rust16/bin:$PATH" + if [ -z "$LD_LIBRARY_PATH" ]; then + export LD_LIBRARY_PATH="/opt/rust16/lib$LIBDIRSUFFIX" + else + export LD_LIBRARY_PATH="/opt/rust16/lib$LIBDIRSUFFIX:$LD_LIBRARY_PATH" + fi +fi + +# Configure cargo-vendor-filterer + cat << EOF >> Cargo.toml +[package.metadata.vendor-filter] +platforms = ["x86_64-unknown-linux-gnu", "i686-unknown-linux-gnu"] +all-features = true +EOF + +if [ -f ~/.cargo/bin/cargo-vendor-filterer ] || [ -f /usr/bin/cargo-vendor-filterer ]; then + echo "INFO: Creating filtered vendor libs tarball..." + ~/.cargo/bin/cargo-vendor-filterer +else + echo "WARNING: Creating unfiltered vendor libs tarball!" + cargo vendor +fi + +# build would fail if the .a files were removed +#find vendor -type f -a -name \*.a -print0 | xargs -0 rm -f + +mkdir -p .cargo + cat <<EOF >.cargo/config.toml +[source.crates-io] +replace-with = "vendored-sources" + +[source.vendored-sources] +directory = "vendor" +EOF +cd - + +cd $WORKDIR +tar cvfJ $CWD/$SRCNAM-vendored-sources-$VERSION-$BUILD.tar.xz \ + $SRCNAM-$VERSION/{vendor,.cargo} +cd $CWD +rm -rf $WORKDIR diff --git a/python/jellyfish/pyproject.toml.patch b/python/jellyfish/pyproject.toml.patch new file mode 100644 index 000000000000..848fee8feaeb --- /dev/null +++ b/python/jellyfish/pyproject.toml.patch @@ -0,0 +1,11 @@ +diff --git a/pyproject.toml b/pyproject.toml +index 7723cd8..5efd6ef 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -1,5 +1,5 @@ + [build-system] +-requires = ["maturin>=0.14,<0.15"] ++requires = ["maturin>=0.14,<2"] + build-backend = "maturin" + + [project] |