2022-05-12 16:55:32 +02:00
|
|
|
#!/bin/bash
|
2014-06-04 12:43:51 +02:00
|
|
|
|
|
|
|
# Slackware build script for slpkg
|
|
|
|
|
2023-01-11 19:03:28 +01:00
|
|
|
# Copyright 2014-2023 Dimitris Zlatanidis Orestiada, Greece
|
2014-06-04 12:43:51 +02: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.
|
|
|
|
|
2015-04-14 03:23:41 +02:00
|
|
|
__version() {
|
2015-02-22 08:26:01 +01:00
|
|
|
# Grab version from __metadata_.py file
|
2022-12-07 18:12:34 +01:00
|
|
|
cat ../setup.cfg | grep "version =" | tr -d "[:space:]" | cut -c9-13 | tr , .
|
2015-02-22 08:26:01 +01:00
|
|
|
}
|
|
|
|
|
2022-04-04 18:03:13 +02:00
|
|
|
cd $(dirname $0) ; CWD=$(pwd)
|
|
|
|
|
2014-06-04 12:43:51 +02:00
|
|
|
PRGNAM=slpkg
|
2015-04-14 03:23:41 +02:00
|
|
|
VERSION=${VERSION:-$(__version)}
|
2014-06-04 12:43:51 +02:00
|
|
|
BUILD=${BUILD:-1}
|
2014-10-03 15:58:07 +02:00
|
|
|
TAG=${TAG:-_dsw}
|
2022-04-04 18:03:13 +02:00
|
|
|
PKGTYPE=${PKGTYPE:-txz}
|
2015-09-17 05:44:26 +02:00
|
|
|
INSTALL="upgradepkg --install-new"
|
2014-06-04 12:43:51 +02:00
|
|
|
|
2014-08-18 00:00:28 +02:00
|
|
|
if [ -z "$ARCH" ]; then
|
|
|
|
case "$( uname -m )" in
|
2017-02-07 17:22:29 +01:00
|
|
|
i?86) ARCH=i586 ;;
|
2014-08-18 00:00:28 +02:00
|
|
|
arm*) ARCH=arm ;;
|
|
|
|
*) ARCH=$( uname -m ) ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2022-04-04 18:03:13 +02:00
|
|
|
# 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
|
|
|
|
fi
|
|
|
|
|
2014-06-04 12:43:51 +02:00
|
|
|
TMP=${TMP:-/tmp/SBo}
|
|
|
|
PKG=$TMP/package-$PRGNAM
|
|
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
|
2017-02-07 17:22:29 +01:00
|
|
|
if [ "$ARCH" = "i586" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
|
2014-06-04 12:43:51 +02:00
|
|
|
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
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
rm -rf $PKG
|
|
|
|
mkdir -p $TMP $PKG $OUTPUT
|
|
|
|
cd $TMP
|
|
|
|
rm -rf $PRGNAM-$VERSION
|
2015-02-12 10:30:19 +01:00
|
|
|
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz || tar xvf $CWD/v$VERSION.tar.gz \
|
2020-02-17 15:40:12 +01:00
|
|
|
|| tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2 || unzip $CWD/$PRGNAM-$VERSION.zip \
|
2020-02-17 09:50:44 +01:00
|
|
|
|| unzip $CWD/v$VERSION.zip
|
2014-06-04 12:43:51 +02:00
|
|
|
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 \
|
|
|
|
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
|
2016-06-13 02:06:09 +02:00
|
|
|
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
|
2014-06-04 12:43:51 +02:00
|
|
|
|
2019-11-30 22:56:50 +01:00
|
|
|
python3 setup.py install --root=$PKG
|
2016-10-26 19:03:52 +02:00
|
|
|
|
2022-06-17 16:39:33 +02:00
|
|
|
mkdir -p $PKG/usr/sbin
|
|
|
|
cp bin/slpkg $PKG/usr/sbin/slpkg
|
2023-03-14 18:18:13 +01:00
|
|
|
cp bin/slpkg_new-configs $PKG/usr/sbin/slpkg_new-configs
|
2022-06-17 16:39:33 +02:00
|
|
|
|
2014-06-04 12:43:51 +02: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
|
|
|
|
|
2022-09-28 19:01:16 +02:00
|
|
|
# Install configuration files and creating lib directory
|
2022-10-28 08:12:37 +02:00
|
|
|
mkdir -p $PKG/etc/$PRGNAM
|
2022-11-30 17:44:09 +01:00
|
|
|
install -D -m0644 configs/slpkg.toml $PKG/etc/slpkg/slpkg.toml.new
|
2022-12-01 20:56:37 +01:00
|
|
|
install -D -m0644 configs/blacklist.toml $PKG/etc/slpkg/blacklist.toml.new
|
2022-06-17 18:36:07 +02:00
|
|
|
|
2023-03-05 19:03:47 +01:00
|
|
|
mkdir -p $PKG/var/lib/$PRGNAM/repositories/ponce
|
|
|
|
cp tools/gen_sbo_txt.sh $PKG/var/lib/$PRGNAM/repositories/ponce
|
2023-03-04 17:44:17 +01:00
|
|
|
|
2023-01-27 20:02:18 +01:00
|
|
|
mkdir -p $PKG/usr/man/man1 & mkdir -p $PKG/usr/man/fr/man1
|
2022-06-17 18:36:07 +02:00
|
|
|
cp man/slpkg.1 $PKG/usr/man/man1
|
2023-01-07 16:09:55 +01:00
|
|
|
cp man/slpkg-fr.1 $PKG/usr/man/fr/man1/slpkg.1
|
2022-06-17 18:36:07 +02:00
|
|
|
|
|
|
|
find $PKG/usr/man -type f -exec gzip -9 {} \;
|
|
|
|
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz; rm $i ; done
|
2018-04-27 18:33:58 +02:00
|
|
|
|
2014-06-04 12:43:51 +02:00
|
|
|
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
2022-06-28 16:56:05 +02:00
|
|
|
cp -a README.rst ChangeLog.txt LICENSE requirements.txt $PKG/usr/doc/$PRGNAM-$VERSION
|
2014-06-04 12:43:51 +02:00
|
|
|
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
|
|
|
|
|
|
|
mkdir -p $PKG/install
|
|
|
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
|
|
|
cat $CWD/doinst.sh > $PKG/install/doinst.sh
|
|
|
|
|
|
|
|
cd $PKG
|
2022-04-04 18:03:13 +02:00
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
|
2015-09-17 05:44:26 +02:00
|
|
|
|
2020-02-17 09:50:44 +01:00
|
|
|
$INSTALL $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.txz
|