2012-09-17 12:46:57 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Slackware build script for psutil
|
|
|
|
|
2016-07-17 00:12:52 +08:00
|
|
|
# Copyright 2012-2016 Larry Hajali <larryhaja[at]gmail[dot]com>
|
2013-06-09 19:54:37 +08:00
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use of this script, with or without modification, is
|
|
|
|
# permitted provided that the following conditions are met:
|
|
|
|
#
|
|
|
|
# 1. Redistributions of this script must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS 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 AUTHOR 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.
|
2012-09-17 12:46:57 +08:00
|
|
|
|
|
|
|
PRGNAM=psutil
|
2016-09-19 07:40:03 +08:00
|
|
|
VERSION=${VERSION:-4.3.1}
|
2012-09-17 12:46:57 +08:00
|
|
|
BUILD=${BUILD:-1}
|
|
|
|
TAG=${TAG:-_SBo}
|
|
|
|
|
|
|
|
if [ -z "$ARCH" ]; then
|
|
|
|
case "$( uname -m )" in
|
|
|
|
i?86) ARCH=i486 ;;
|
|
|
|
arm*) ARCH=arm ;;
|
|
|
|
*) ARCH=$( uname -m ) ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
CWD=$(pwd)
|
|
|
|
TMP=${TMP:-/tmp/SBo}
|
|
|
|
PKG=$TMP/package-$PRGNAM
|
|
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
rm -rf $PKG
|
|
|
|
mkdir -p $TMP $PKG $OUTPUT
|
|
|
|
cd $TMP
|
2016-07-17 00:12:52 +08:00
|
|
|
rm -rf $PRGNAM-release-$VERSION
|
|
|
|
tar xvf $CWD/$PRGNAM-release-$VERSION.tar.gz
|
|
|
|
cd $PRGNAM-release-$VERSION
|
2012-09-17 12:46:57 +08:00
|
|
|
chown -R root:root .
|
2013-11-22 15:37:19 +08:00
|
|
|
find -L . \
|
2015-02-14 11:44:48 +08:00
|
|
|
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
|
|
|
|
-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 {} \;
|
2012-09-17 12:46:57 +08:00
|
|
|
|
2016-07-17 00:12:52 +08:00
|
|
|
# Remove shebangs
|
|
|
|
find psutil -name "*\.py" | while read line; do
|
|
|
|
sed -i.orig '/^#!/d' $line
|
|
|
|
touch -r ${line}.orig $line
|
|
|
|
rm ${line}.orig
|
|
|
|
done
|
|
|
|
|
2012-09-17 12:46:57 +08:00
|
|
|
python setup.py install --root=$PKG
|
|
|
|
|
2015-12-22 18:35:21 +08:00
|
|
|
# Install python3 bindings for psutil. Default is no.
|
|
|
|
if [ "${PYTHON3:-no}" == "yes" ]; then
|
2013-07-13 14:04:17 +08:00
|
|
|
python3 setup.py install --root=$PKG
|
|
|
|
fi
|
|
|
|
|
2012-09-17 12:46:57 +08:00
|
|
|
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
|
2016-07-17 00:12:52 +08:00
|
|
|
cp -a CREDITS IDEAS LICENSE *.rst $PKG/usr/doc/$PRGNAM-$VERSION
|
2012-09-17 12:46:57 +08:00
|
|
|
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
|
|
|
|
|
|
|
mkdir -p $PKG/install
|
|
|
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
|
|
|
|
|
|
|
cd $PKG
|
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|