slackbuilds/generic-python.SlackBuild

64 lines
1.3 KiB
Text
Raw Normal View History

2021-09-07 11:42:27 +02:00
#!/bin/bash
# Generic python SlackBuild
# variables
2023-12-06 07:51:20 +01:00
TAG=${TAG:-pip3_gwh}
2021-09-07 11:42:27 +02:00
TMP=/tmp/$TAG
CWD=$(pwd)
OUTPUT=/tmp
PRGNAM=${PRGNAM:-$(basename $CWD)}
PKG=$TMP/pkg-$PRGNAM
VERSION=${VERSION:-"pip"}
ARCH=$(uname -m)
BUILD=1
# nettoyage pr<70>alable
rm -fr $PKG
mkdir -p $PKG
# installation
EXTRA=""
[ "x$VERSION" == "xpip" ] || EXTRA="==$VERSION"
2023-12-06 07:51:20 +01:00
pip3 install --ignore-installed --root $PKG --no-deps $PRGNAM$EXTRA
2021-09-07 11:42:27 +02:00
if [ -d $PKG/usr/share/man ]; then
mv $PKG/usr/share/man $PKG/usr/
find $PKG/usr/man -type f -not -name \*.gz -exec gzip -9 {} \;
fi
2021-09-07 11:42:27 +02:00
METADATA_FILE=$(find $PKG -name METADATA)
[ ! -e $METADATA_FILE ] && exit 1
VERSION=$(grep "^Version:" $METADATA_FILE | sed 's|^Version: ||')
SUMMARY=$(grep "^Summary:" $METADATA_FILE | sed 's|^Summary: ||')
HOMEPAGE=$(grep "^Home-page:" $METADATA_FILE | sed 's|^Home-page: ||')
# correction
cd $PKG
chown -R root:root *
# embaumement
mkdir -p $PKG/install
cat <<EOF > $PKG/install/slack-desc
$PRGNAM: $PRGNAM ($SUMMARY)
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM: $HOMEPAGE
$PRGNAM:
EOF
# empaquetage
cd $PKG
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
2023-12-06 07:51:20 +01:00
/sbin/makepkg --linkadd y --chown n --prepend $OUTPUT/python3-$PRGNAM-$(echo $VERSION | sed 's/-//g')-$ARCH-$BUILD$TAG.txz