2021-07-04 01:48:15 +08:00
|
|
|
#!/bin/bash
|
2010-12-13 01:45:45 +08:00
|
|
|
|
|
|
|
# Slackware build script for icon
|
2013-10-27 11:10:53 +08:00
|
|
|
|
2022-07-29 11:35:54 +08:00
|
|
|
# Copyright 2010-2022 Kyle Guinn <elyk03@gmail.com>
|
2013-10-27 11:10:53 +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
|
2019-07-08 03:24:42 +08:00
|
|
|
# notice, this list of conditions and the following disclaimer.
|
2013-10-27 11:10:53 +08:00
|
|
|
#
|
2019-07-08 03:24:42 +08:00
|
|
|
# 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.
|
2010-12-13 01:45:45 +08:00
|
|
|
|
2021-07-04 17:41:06 +08:00
|
|
|
cd $(dirname $0) ; CWD=$(pwd)
|
|
|
|
|
2010-12-13 01:45:45 +08:00
|
|
|
PRGNAM=icon
|
2022-07-29 11:35:54 +08:00
|
|
|
VERSION=${VERSION:-9.5.22e}
|
2021-01-02 16:48:29 +08:00
|
|
|
BUILD=${BUILD:-1}
|
2010-12-13 01:45:45 +08:00
|
|
|
TAG=${TAG:-_SBo}
|
2021-07-04 18:23:38 +08:00
|
|
|
PKGTYPE=${PKGTYPE:-tgz}
|
2010-12-13 01:45:45 +08:00
|
|
|
|
|
|
|
if [ -z "$ARCH" ]; then
|
2019-07-08 03:24:42 +08:00
|
|
|
case "$(uname -m)" in
|
|
|
|
i?86) ARCH=i586 ;;
|
|
|
|
arm*) ARCH=arm ;;
|
|
|
|
*) ARCH=$(uname -m) ;;
|
|
|
|
esac
|
2010-12-13 01:45:45 +08:00
|
|
|
fi
|
|
|
|
|
2021-07-04 18:23:38 +08:00
|
|
|
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
|
|
|
|
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2010-12-13 01:45:45 +08:00
|
|
|
TMP=${TMP:-/tmp/SBo}
|
|
|
|
PKG=$TMP/package-$PRGNAM-$VERSION
|
|
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
|
2019-07-08 03:24:42 +08:00
|
|
|
# At one point, enabling "-O2" appeared to cause
|
|
|
|
# "Run-time error 302", "memory violation" (from the SIGSEGV trap)
|
|
|
|
# whenever running icon programs. I can't reproduce it.
|
|
|
|
# However, one of the tests fails with "-O2". Use "-O" instead
|
|
|
|
# since it is the default in config/linux/Makedefs.
|
2022-03-19 10:17:08 +08:00
|
|
|
if [ "$ARCH" = "i586" ]; then
|
2019-07-08 03:24:42 +08:00
|
|
|
SLKCFLAGS="-O -march=i586 -mtune=i686"
|
|
|
|
LIBDIRSUFFIX=""
|
2010-12-13 01:45:45 +08:00
|
|
|
elif [ "$ARCH" = "i686" ]; then
|
2019-07-08 03:24:42 +08:00
|
|
|
SLKCFLAGS="-O -march=i686 -mtune=i686"
|
|
|
|
LIBDIRSUFFIX=""
|
2010-12-13 01:45:45 +08:00
|
|
|
elif [ "$ARCH" = "x86_64" ]; then
|
2019-07-08 03:24:42 +08:00
|
|
|
SLKCFLAGS="-O -fPIC"
|
|
|
|
LIBDIRSUFFIX="64"
|
2010-12-13 01:45:45 +08:00
|
|
|
else
|
2019-07-08 03:24:42 +08:00
|
|
|
SLKCFLAGS="-O"
|
|
|
|
LIBDIRSUFFIX=""
|
2010-12-13 01:45:45 +08:00
|
|
|
fi
|
|
|
|
|
2016-02-25 08:23:51 +08:00
|
|
|
set -e
|
|
|
|
|
2010-12-13 01:45:45 +08:00
|
|
|
rm -rf $PKG
|
|
|
|
mkdir -p $TMP $PKG $OUTPUT
|
|
|
|
cd $TMP
|
2021-01-02 16:48:29 +08:00
|
|
|
rm -rf $PRGNAM-$VERSION
|
|
|
|
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
|
|
|
|
cd $PRGNAM-$VERSION
|
2010-12-13 01:45:45 +08:00
|
|
|
chown -R root:root .
|
2019-07-08 03:24:42 +08:00
|
|
|
chmod -R u+w,go-w,a+rX-st .
|
|
|
|
|
|
|
|
# Installation creates bin, lib, man, and doc dirs inside the "dest" dir.
|
|
|
|
# Edit the Install rule to avoid having to manually rearrange files.
|
|
|
|
# The bin and lib dirs need to share a parent directory, but we don't want
|
|
|
|
# to clutter /usr/lib with icon files, nor /usr/bin with demo programs and
|
|
|
|
# a shared lib. Move both to /opt/icon, the suggested canonical location.
|
|
|
|
sed -i -e "s|mkdir|mkdir -p|" \
|
|
|
|
-e "s|\$D/bin|\$D/opt/$PRGNAM/bin|g" \
|
|
|
|
-e "s|\$D/lib|\$D/opt/$PRGNAM/lib|g" \
|
|
|
|
-e "s|\$D/man|\$D/usr/man|g" \
|
|
|
|
-e "s|\$D/doc|\$D/usr/doc/$PRGNAM-$VERSION|g" Makefile
|
|
|
|
|
2022-03-24 09:55:56 +08:00
|
|
|
# Disable parallel building otherwise build fails
|
|
|
|
MAKEFLAGS=-j1
|
|
|
|
|
2010-12-13 01:45:45 +08:00
|
|
|
make X-Configure name=linux
|
|
|
|
make CFLAGS="$SLKCFLAGS"
|
2019-07-08 03:24:42 +08:00
|
|
|
make Test
|
|
|
|
make Samples
|
|
|
|
make Install dest=$PKG
|
2010-12-13 01:45:45 +08:00
|
|
|
|
|
|
|
# Create symlinks from /usr/bin to /opt/icon/bin.
|
2019-07-08 03:24:42 +08:00
|
|
|
# Anything not symlinked is a demo/sample program.
|
2010-12-13 01:45:45 +08:00
|
|
|
mkdir -p $PKG/usr/bin
|
|
|
|
for i in icon icont iconx vib; do
|
2019-07-08 03:24:42 +08:00
|
|
|
ln -s /opt/$PRGNAM/bin/$i $PKG/usr/bin/$i
|
2010-12-13 01:45:45 +08:00
|
|
|
done
|
|
|
|
|
2019-07-08 03:24:42 +08:00
|
|
|
find $PKG -exec file {} + | grep -e "executable" -e "shared object" | grep ELF \
|
2010-12-13 01:45:45 +08:00
|
|
|
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
|
|
|
|
2019-07-08 03:24:42 +08:00
|
|
|
find $PKG/usr/man -type f -exec gzip -9 {} +
|
2010-12-13 01:45:45 +08:00
|
|
|
|
2019-07-08 03:24:42 +08:00
|
|
|
mv $PKG/README $PKG/usr/doc/$PRGNAM-$VERSION
|
2021-01-02 16:48:29 +08:00
|
|
|
rm $PKG/usr/doc/$PRGNAM-$VERSION/*.sed
|
2010-12-13 01:45:45 +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
|
2021-07-04 18:23:38 +08:00
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
|