diff options
author | Arn0 <yth@ythogtha.org> | 2023-03-08 15:43:40 +0100 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2023-03-12 08:48:15 +0700 |
commit | e35b4618d3ee651fa3c1a600224edcef69527cea (patch) | |
tree | 422b95a9c99fafe77db30ad1c758babcc568ffcb /python/python3-bcrypt/python3-bcrypt.SlackBuild | |
parent | f90f6999c9bb02bbbbbff6940afe02711a4d75f8 (diff) | |
download | slackbuilds-e35b4618d3ee651fa3c1a600224edcef69527cea.tar.gz slackbuilds-e35b4618d3ee651fa3c1a600224edcef69527cea.tar.xz |
python/python3-bcrypt: Updated for version 4.0.1.
Signed-off-by: Andrew Clemons <andrew.clemons@gmail.com>
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'python/python3-bcrypt/python3-bcrypt.SlackBuild')
-rw-r--r-- | python/python3-bcrypt/python3-bcrypt.SlackBuild | 100 |
1 files changed, 96 insertions, 4 deletions
diff --git a/python/python3-bcrypt/python3-bcrypt.SlackBuild b/python/python3-bcrypt/python3-bcrypt.SlackBuild index c2155df029..f0658054f2 100644 --- a/python/python3-bcrypt/python3-bcrypt.SlackBuild +++ b/python/python3-bcrypt/python3-bcrypt.SlackBuild @@ -24,7 +24,7 @@ cd $(dirname $0) ; CWD=$(pwd) PRGNAM=python3-bcrypt SRCNAM=${PRGNAM#python3-*} -VERSION=${VERSION:-3.2.2} +VERSION=${VERSION:-4.0.1} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} @@ -35,11 +35,14 @@ 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 -# 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 @@ -49,6 +52,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 $ARCH-unknown-linux-gnu" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" + CARGOTARGET="--target $ARCH-unknown-linux-gnu" +elif [ "$ARCH" = "x86_64" ] || [ "$ARCH" = "aarch64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" + CARGOTARGET="--target $ARCH-unknown-linux-gnu" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" + CARGOTARGET="" +fi + set -e rm -rf $PKG @@ -57,6 +78,71 @@ cd $TMP rm -rf $SRCNAM-$VERSION tar xvf $CWD/$SRCNAM-$VERSION.tar.gz cd $SRCNAM-$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.toml +[source] +[source.crates-io] +replace-with = "vendored-sources" + +[source.vendored-sources] +directory = "vendor" +EOF + +# deps and versions come from Cargo.lock +mkdir vendor +( + cd vendor + + grep -h -A 4 "\[\[package\]\]" \ + $(find "../" -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, $5 }' | \ + sed 's/"//g;s/name=//;s/ version=/=/' | \ + grep " source=" | \ + sed 's/ dependencies=.*$//' | \ + sed 's/ source=[^ ]*//' | \ + sed 's/ checksum=/=/' | \ + sort -u | \ + while read -r dep ; do + + cksum="$(printf "%s\n" "$dep" | cut -d= -f3)" + ver="$(printf "%s\n" "$dep" | cut -d= -f2)" + dep="$(printf "%s\n" "$dep" | cut -d= -f1)" + + CRATE_FILE=$CWD/$dep-$ver.crate + + if [ -z "$cksum" ] ; then + mkdir $dep-$ver + tar xvf $CRATE_FILE -C $dep-$ver --strip-components=1 + cksum="null" + else + tar xvf $CRATE_FILE + fi + + 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": "%s"' "$cksum" + + printf "}\n" + } > $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 \ @@ -64,8 +150,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 {} \; +CARGO_HOME=.cargo \ +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ python3 setup.py install --root=$PKG +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.rst LICENSE MANIFEST.in $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild |