2013-11-23 22:18:36 +08:00
|
|
|
#!/bin/sh
|
2012-04-30 08:01:18 +08:00
|
|
|
|
2011-11-12 17:44:37 +08:00
|
|
|
# Slackware build script for Miredo
|
2012-04-30 08:01:18 +08:00
|
|
|
|
2013-07-01 22:01:55 +08:00
|
|
|
# Copyright 2011-2013 Fridrich von Stauffenberg <cancellor2@gmail.com>
|
2011-11-12 17:44: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.
|
|
|
|
|
|
|
|
PRGNAM=miredo
|
2017-03-21 16:24:11 +08:00
|
|
|
VERSION=${VERSION:-1.2.6}
|
2011-11-12 17:44:37 +08:00
|
|
|
BUILD=${BUILD:-1}
|
|
|
|
TAG=${TAG:-_SBo}
|
|
|
|
|
|
|
|
if [ -z "$ARCH" ]; then
|
|
|
|
case "$( uname -m )" in
|
2017-03-21 16:24:11 +08:00
|
|
|
i?86) ARCH=i586 ;;
|
2011-11-12 17:44:37 +08:00
|
|
|
arm*) ARCH=arm ;;
|
|
|
|
*) ARCH=$( uname -m ) ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
CWD=$(pwd)
|
|
|
|
TMP=${TMP:-/tmp/SBo}
|
|
|
|
PKG=$TMP/package-$PRGNAM
|
|
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
|
2017-03-21 16:24:11 +08:00
|
|
|
if [ "$ARCH" = "i586" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
|
2011-11-12 17:44:37 +08: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
|
|
|
|
|
|
|
|
if [ "${NOBODY:-no}" = "no" ]; then
|
|
|
|
if ! grep -q "^$PRGNAM:" /etc/passwd || ! grep -q "^$PRGNAM:" /etc/group; then
|
2012-04-30 08:01:18 +08:00
|
|
|
cat << EOF
|
|
|
|
You must have a $PRGNAM user and $PRGNAM group to run this script.
|
|
|
|
Something like this should suffice for most systems:
|
|
|
|
# groupadd -g 255 miredo
|
|
|
|
# useradd -u 255 -g 255 -c "Teredo IPv6 Tunneling" -d /dev/null -s /bin/false miredo
|
|
|
|
EOF
|
2011-11-12 17:44:37 +08:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
enable_user="--enable-$PRGNAM-user"
|
|
|
|
else
|
|
|
|
enable_user=""
|
|
|
|
fi
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
rm -rf $PKG
|
|
|
|
mkdir -p $TMP $PKG $OUTPUT
|
|
|
|
cd $TMP
|
|
|
|
rm -rf $PRGNAM-$VERSION
|
2012-04-30 08:01:18 +08:00
|
|
|
tar xvf $CWD/$PRGNAM-$VERSION.tar.xz
|
2011-11-12 17:44:37 +08:00
|
|
|
cd $PRGNAM-$VERSION
|
|
|
|
chown -R root:root .
|
|
|
|
|
|
|
|
CFLAGS="$SLKCFLAGS" \
|
2012-04-30 08:01:18 +08:00
|
|
|
CXXFLAGS="$SLKCFLAGS" \
|
2011-11-12 17:44:37 +08:00
|
|
|
./configure \
|
|
|
|
--prefix=/usr \
|
|
|
|
--sysconfdir=/etc \
|
|
|
|
--localstatedir=/var \
|
|
|
|
--mandir=/usr/man \
|
|
|
|
--docdir=/usr/doc/$PRGNAM-$VERSION \
|
|
|
|
--libdir=/usr/lib${LIBDIRSUFFIX} \
|
|
|
|
--build=$ARCH-slackware-linux \
|
|
|
|
$enable_user
|
|
|
|
|
|
|
|
make V=1
|
|
|
|
make install-strip DESTDIR=$PKG
|
|
|
|
|
|
|
|
install -D -m 0644 $CWD/rc.$PRGNAM $PKG/etc/rc.d/rc.$PRGNAM.new
|
|
|
|
( cd $PKG/etc/$PRGNAM ; mv $PRGNAM.conf{,.new} )
|
|
|
|
|
|
|
|
find $PKG/usr/man -type f -exec gzip -9 {} \;
|
2012-04-30 08:01:18 +08:00
|
|
|
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
|
2011-11-12 17:44:37 +08:00
|
|
|
|
2013-07-01 22:01:55 +08:00
|
|
|
cp -a ABOUT-NLS AUTHORS COPYING ChangeLog INSTALL NEWS README THANKS TODO \
|
2011-11-12 17:44:37 +08:00
|
|
|
$PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
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
|
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|