2021-07-03 19:48:15 +02:00
|
|
|
#!/bin/bash
|
2015-04-12 03:08:59 +02:00
|
|
|
|
|
|
|
# Slackware build script for atasm
|
|
|
|
|
|
|
|
# Written by B. Watson (yalhcru@gmail.com)
|
|
|
|
|
|
|
|
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
|
|
|
|
|
2021-07-04 11:41:06 +02:00
|
|
|
cd $(dirname $0) ; CWD=$(pwd)
|
|
|
|
|
2015-04-12 03:08:59 +02:00
|
|
|
PRGNAM=atasm
|
2016-10-15 10:53:46 +02:00
|
|
|
VERSION=${VERSION:-1.07d}
|
2015-04-12 03:08:59 +02:00
|
|
|
BUILD=${BUILD:-1}
|
|
|
|
TAG=${TAG:-_SBo}
|
2021-07-04 12:23:38 +02:00
|
|
|
PKGTYPE=${PKGTYPE:-tgz}
|
2015-04-12 03:08:59 +02:00
|
|
|
|
|
|
|
if [ -z "$ARCH" ]; then
|
|
|
|
case "$( uname -m )" in
|
2016-08-19 10:59:30 +02:00
|
|
|
i?86) ARCH=i586 ;;
|
2015-04-12 03:08:59 +02:00
|
|
|
arm*) ARCH=arm ;;
|
|
|
|
*) ARCH=$( uname -m ) ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2021-07-04 12:23:38 +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
|
|
|
|
|
2015-04-12 03:08:59 +02:00
|
|
|
TMP=${TMP:-/tmp/SBo}
|
|
|
|
PKG=$TMP/package-$PRGNAM
|
|
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
|
2016-08-19 10:59:30 +02:00
|
|
|
if [ "$ARCH" = "i586" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
|
2015-04-12 03:08:59 +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
|
|
|
|
|
2016-10-15 10:53:46 +02:00
|
|
|
SRCNAM="${PRGNAM}${VERSION/./}"
|
|
|
|
ZIPFILE="$SRCNAM.zip"
|
|
|
|
SRCDIR="$( echo "$SRCNAM" | sed 's,[a-z]$,,' )"
|
2015-04-12 03:08:59 +02:00
|
|
|
|
|
|
|
rm -rf $PKG
|
|
|
|
mkdir -p $TMP $PKG $OUTPUT
|
|
|
|
cd $TMP
|
|
|
|
rm -rf $SRCDIR
|
|
|
|
unzip $CWD/$ZIPFILE
|
|
|
|
cd $SRCDIR
|
|
|
|
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 \
|
|
|
|
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
|
|
|
|
|
2016-10-15 10:53:46 +02:00
|
|
|
DOCDIR=/usr/doc/$PRGNAM-$VERSION
|
|
|
|
|
|
|
|
# fix reference to full documentation.
|
|
|
|
sed -i \
|
|
|
|
-e "s,$PRGNAM\.txt,$PRGNAM.pdf," \
|
|
|
|
-e "s,%%DOCDIR%%,$DOCDIR," \
|
|
|
|
src/$PRGNAM.1.in
|
|
|
|
|
2015-04-12 03:08:59 +02:00
|
|
|
sed -i "s,-O3.*,$SLKCFLAGS," src/Makefile
|
|
|
|
mkdir -p $PKG/usr/bin $PKG/usr/man/man1 $PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
|
|
|
|
# 'make install' chokes because this file's missing:
|
|
|
|
touch $PRGNAM.txt
|
|
|
|
|
|
|
|
# N.B. nonstandard use of DESTDIR and MANDIR here.
|
|
|
|
make -C src all install \
|
|
|
|
DESTDIR=$PKG/usr/bin \
|
|
|
|
MANDIR=$PKG/usr/man/man1 \
|
2016-10-15 10:53:46 +02:00
|
|
|
DOCDIR=$PKG/$DOCDIR
|
2015-04-12 03:08:59 +02:00
|
|
|
|
|
|
|
strip $PKG/usr/bin/$PRGNAM
|
|
|
|
gzip $PKG/usr/man/man1/$PRGNAM.1
|
|
|
|
|
2016-10-15 10:53:46 +02:00
|
|
|
rm -f $PKG/$DOCDIR/$PRGNAM.txt
|
|
|
|
cp -a LICENSE *.TXT docs/* examples $PKG/$DOCDIR
|
2015-04-12 03:08:59 +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
|
|
|
|
|
|
|
|
cd $PKG
|
2021-07-04 12:23:38 +02:00
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
|