2011-07-20 14:32:26 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Slackware build script for mksh
|
|
|
|
|
2017-05-01 16:06:11 +02:00
|
|
|
# Copyright (c) 2011-2017 Markus Reichelt, Aachen, DE
|
2011-07-20 14:32:26 +02:00
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Permission to use, copy, modify, and distribute this software for
|
|
|
|
# any purpose with or without fee is hereby granted, provided that
|
|
|
|
# the above copyright notice and this permission notice appear in all
|
|
|
|
# copies.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 AUTHORS AND COPYRIGHT HOLDERS AND THEIR
|
|
|
|
# CONTRIBUTORS 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.
|
|
|
|
#
|
2013-01-07 20:16:47 +01:00
|
|
|
# Markus Reichelt, slackbuilds@mareichelt.de, 0xCCEEF115
|
2011-07-20 14:32:26 +02:00
|
|
|
|
|
|
|
PRGNAM=mksh
|
2017-11-10 15:02:53 +01:00
|
|
|
VERSION=${VERSION:-R56b}
|
2012-05-05 18:33:33 +02:00
|
|
|
BUILD=${BUILD:-1}
|
2011-07-20 14:32:26 +02:00
|
|
|
TAG=${TAG:-_SBo}
|
|
|
|
|
|
|
|
if [ -z "$ARCH" ]; then
|
|
|
|
case "$( uname -m )" in
|
2016-09-13 18:36:48 +02:00
|
|
|
i?86) ARCH=i586 ;;
|
2011-07-20 14:32:26 +02:00
|
|
|
arm*) ARCH=arm ;;
|
|
|
|
*) ARCH=$( uname -m ) ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
CWD=$(pwd)
|
|
|
|
TMP=${TMP:-/tmp/SBo}
|
|
|
|
PKG=$TMP/package-$PRGNAM
|
|
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
|
2016-09-13 18:36:48 +02:00
|
|
|
if [ "$ARCH" = "i586" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
|
2011-07-20 14:32:26 +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
|
2013-01-07 20:16:47 +01:00
|
|
|
tar xf $CWD/$PRGNAM-$VERSION.tgz
|
2011-07-20 14:32:26 +02:00
|
|
|
cd $PRGNAM
|
|
|
|
|
|
|
|
if [ "$STATIC" = "yes" ]; then
|
|
|
|
LDFLAGS="${LDFLAGS} -static"
|
|
|
|
CPPFLAGS="${CPPFLAGS} -DMKSH_NOPWNAM"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$DIET" = "yes" ]; then
|
2011-10-15 15:27:59 +02:00
|
|
|
CC="diet -Os gcc"
|
|
|
|
SLKCFLAGS="${SLKCFLAGS} -Wall"
|
2011-07-20 14:32:26 +02:00
|
|
|
else
|
|
|
|
CC="gcc"
|
|
|
|
fi
|
|
|
|
|
|
|
|
chown -R root:root .
|
2013-11-25 12:23:31 +01:00
|
|
|
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 \
|
2014-12-29 17:45:14 +01:00
|
|
|
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
|
2011-07-20 14:32:26 +02:00
|
|
|
|
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
|
|
|
|
LDFLAGS=$LDFLAGS \
|
|
|
|
CPPFLAGS=$CPPFLAGS \
|
|
|
|
CFLAGS=$SLKCFLAGS \
|
|
|
|
CC=$CC \
|
2011-10-15 15:27:59 +02:00
|
|
|
sh ../Build.sh -r -c lto
|
2011-07-20 14:32:26 +02:00
|
|
|
|
2014-12-29 17:45:14 +01:00
|
|
|
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION $PKG/usr/man/man1 $PKG/install
|
|
|
|
|
2011-07-20 14:32:26 +02:00
|
|
|
ginstall -D -m 755 mksh $PKG/bin/mksh
|
2016-11-29 00:56:41 +01:00
|
|
|
ginstall -D -m 644 ../mksh.1 $PKG/usr/man/man1/
|
2013-12-26 21:09:07 +01:00
|
|
|
ginstall -D -m 644 ../dot.mkshrc $PKG/etc/skel/.mkshrc.new
|
2011-07-20 14:32:26 +02:00
|
|
|
|
2013-12-26 21:09:07 +01:00
|
|
|
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
|
2011-07-20 14:32:26 +02:00
|
|
|
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
|
|
|
|
2013-12-26 21:09:07 +01:00
|
|
|
cat ../dot.mkshrc > $PKG/usr/doc/$PRGNAM-$VERSION/dot.mkshrc
|
2011-07-20 14:32:26 +02:00
|
|
|
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
|
|
|
|
2014-12-29 17:45:14 +01:00
|
|
|
find $PKG/usr/man -type f -exec gzip -9 {} \;
|
|
|
|
|
2011-07-20 14:32:26 +02:00
|
|
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
|
|
|
cat $CWD/doinst.sh > $PKG/install/doinst.sh
|
|
|
|
|
|
|
|
cd $PKG
|
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|