summaryrefslogtreecommitdiffstats
path: root/system/dynamips/dynamips.SlackBuild
diff options
context:
space:
mode:
author Markus Hutmacher <mailing@markhu.de>2014-09-07 07:51:32 +0700
committer Willy Sudiarto Raharjo <willysr@slackbuilds.org>2014-09-07 07:51:32 +0700
commit794616b50a070b9d164ce76d8b2e30a6bfd97513 (patch)
treeae2737ca0f2c9376ddae6c0a5dc9957817f6bcb6 /system/dynamips/dynamips.SlackBuild
parentf0df45a0a51cb061a50a20cf6ac59fff444ca1ee (diff)
downloadslackbuilds-794616b50a070b9d164ce76d8b2e30a6bfd97513.tar.gz
slackbuilds-794616b50a070b9d164ce76d8b2e30a6bfd97513.tar.xz
system/dynamips: Added (Emulator for Cisco IOS).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/dynamips/dynamips.SlackBuild')
-rw-r--r--system/dynamips/dynamips.SlackBuild104
1 files changed, 104 insertions, 0 deletions
diff --git a/system/dynamips/dynamips.SlackBuild b/system/dynamips/dynamips.SlackBuild
new file mode 100644
index 0000000000..77685c3673
--- /dev/null
+++ b/system/dynamips/dynamips.SlackBuild
@@ -0,0 +1,104 @@
+#!/bin/sh
+
+# Slackware build script for dynamips
+
+# Copyright 2014 Markus Hutmacher Germany
+# 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=dynamips
+VERSION=${VERSION:-0.2.8_RC3}
+SRCVER=$(echo $VERSION | tr _ -)
+SUFFIX=community # additional suffix in tarball-name
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i486 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ 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-$SRCVER-$SUFFIX
+tar xvf $CWD/$PRGNAM-$SRCVER-$SUFFIX.tar.gz
+cd $PRGNAM-$SRCVER-$SUFFIX
+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 {} \;
+
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+
+sed -i 's/<\(libelf.h\)>/<libelf\/\1>/' common/dynamips.h common/rom2c.c
+sed -i 's/^\(\.PHONY: all dynamips\)/# \1/' Makefile
+
+if [ $ARCH == "x86_64" ]
+then
+ make dynamips.stable DYNAMIPS_ARCH=amd64 DYNAMIPS_LIB=lib64
+else
+ make dynamips.stable
+fi
+
+make install DESTDIR=$PKG/usr
+
+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
+
+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
+
+chmod 644 README.community
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a COPYING README README.community README.hypervisor TODO $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
+
+cd $PKG
+/sbin/makepkg -l n -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}