From 4e396037a88fde24994444aa24110a6141b8c426 Mon Sep 17 00:00:00 2001 From: Michal Cieslakiewicz Date: Wed, 27 May 2020 23:01:50 +0200 Subject: [PATCH] ap/slirp4netns added. Required by podman components. Signed-off-by: Michal Cieslakiewicz --- BUILD_ORDER | 1 + ap/slirp4netns/get_sources.sh | 5 + ap/slirp4netns/slack-desc | 19 ++++ ap/slirp4netns/slirp4netns.SlackBuild | 131 ++++++++++++++++++++++++++ 4 files changed, 156 insertions(+) create mode 100755 ap/slirp4netns/get_sources.sh create mode 100644 ap/slirp4netns/slack-desc create mode 100755 ap/slirp4netns/slirp4netns.SlackBuild diff --git a/BUILD_ORDER b/BUILD_ORDER index 53655de..9195131 100644 --- a/BUILD_ORDER +++ b/BUILD_ORDER @@ -69,3 +69,4 @@ ap vifm l libslirp # podman l libseccomp # podman + ap slirp4netns # podman diff --git a/ap/slirp4netns/get_sources.sh b/ap/slirp4netns/get_sources.sh new file mode 100755 index 0000000..b18d5f3 --- /dev/null +++ b/ap/slirp4netns/get_sources.sh @@ -0,0 +1,5 @@ +#!/bin/bash +SRC=slirp4netns +VERSION=1.0.1 +set -x +wget -O ${SRC}-${VERSION}.tar.gz https://github.com/rootless-containers/${SRC}/archive/v${VERSION}.tar.gz diff --git a/ap/slirp4netns/slack-desc b/ap/slirp4netns/slack-desc new file mode 100644 index 0000000..1496ef1 --- /dev/null +++ b/ap/slirp4netns/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +slirp4netns: slirp4netns (non-root networking utility) +slirp4netns: +slirp4netns: slirp4netns provides user-mode networking ("slirp") for unprivileged +slirp4netns: network namespaces. +slirp4netns: +slirp4netns: +slirp4netns: +slirp4netns: +slirp4netns: +slirp4netns: +slirp4netns: diff --git a/ap/slirp4netns/slirp4netns.SlackBuild b/ap/slirp4netns/slirp4netns.SlackBuild new file mode 100755 index 0000000..116c063 --- /dev/null +++ b/ap/slirp4netns/slirp4netns.SlackBuild @@ -0,0 +1,131 @@ +#!/bin/sh +# Set initial variables: +CWD=$(pwd) + +APP=slirp4netns +VERSION=$(ls $APP-*.tar.?z* | sed -e 's/\.tar\..z.*//' | rev | cut -d- -f1 | rev) +MARCH=${MARCH:-sandybridge} +ARCH=${ARCH:-x86_64} +BUILD=${BUILD:-1} +TAG=${TAG:-micu} + +LIBSUFFIX="" + +if [ "$MARCH" = "i386" ]; then + SLKCFLAGS="-O2 -march=i386 -mtune=i686" +elif [ "$MARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" +elif [ "$MARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" +elif [ "$MARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686" +elif [ "$MARCH" = "nocona" ]; then + SLKCFLAGS="-O2 -march=nocona -mtune=generic -mmmx -msse -msse2 -msse3" +elif [ "$MARCH" = "core2" ]; then + SLKCFLAGS="-O2 -march=core2 -mtune=core2 -mmmx -msse -msse2 -msse3" +elif [ "$MARCH" = "atom" ]; then + SLKCFLAGS="-O2 -march=core2 -mcx16 -msahf --param l1-cache-size=24 --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=core2 -mfpmath=sse -mmmx -msse -msse2 -msse3" +elif [ "$MARCH" = "sandybridge" ]; then + SLKCFLAGS="-O2 -march=sandybridge" +elif [ "$MARCH" = "pentium3" ]; then + SLKCFLAGS="-O2 -march=pentium3 -mmmx -msse" +elif [ "$MARCH" = "pentium2" ]; then + SLKCFLAGS="-O2 -march=pentium2 -mmmx" +elif [ "$MARCH" = "s390" ]; then + SLKCFLAGS="-O2" +else + SLKCFLAGS="-O2 -march=$ARCH" +fi + +if [ "$ARCH" = "x86_64" ]; then + LIBSUFFIX=${LIBSUFFIX:-64} + SLKCFLAGS="$SLKCFLAGS -fPIC -m64" +fi + +MAKE="make -j 5" + +if [ "$TMP" = "" ]; then + TMP=/tmp +fi +PKG=$TMP/package-$APP +rm -rf $PKG +mkdir -p $PKG +cd $TMP +rm -rf $APP-$VERSION +tar xvf $CWD/$APP-$VERSION.tar.?z* || exit 1 +cd $APP-$VERSION || exit 1 +chown -R root.root . +find . -perm 444 -exec chmod 644 {} \; +find . -perm 777 -exec chmod 755 {} \; +find . -perm 666 -exec chmod 644 {} \; + +./autogen.sh || exit 1 + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --mandir=/usr/man \ + --libdir=/usr/lib$LIBSUFFIX \ + --docdir=/usr/doc/$APP-$VERSION \ + --build=$ARCH-slackware-linux || exit 1 + +$MAKE || exit 1 +make install DESTDIR=$PKG || exit 1 + +# Don't ship .la files: +rm -f $PKG/{,usr/}lib${LIBSUFFIX}/*.la + +chown -R root.bin $PKG/usr/bin $PKG/usr/sbin + +( cd $PKG + find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null + find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null + find . | xargs file | grep "current ar archive" | grep ELF | cut -f 1 -d : | xargs strip -g 2> /dev/null +) + +# Compress and if needed symlink the man pages: +if [ -d $PKG/usr/info ]; then + rm -f $PKG/usr/info/dir + gzip -9 $PKG/usr/info/* +fi +if [ -d $PKG/usr/man ]; then + ( cd $PKG/usr/man + for manpagedir in $(find . -type d -name "man*") ; do + ( cd $manpagedir + for eachpage in $( find . -type l -maxdepth 1) ; do + ln -s $( readlink $eachpage ).gz $eachpage.gz + rm $eachpage + done + gzip -9 *.? + ) + done + ) +fi + +mkdir -p $PKG/usr/doc/$APP-$VERSION +cp -a COPYING MAINTAINERS README.md SECURITY_CONTACTS \ + $PKG/usr/doc/$APP-$VERSION + +mkdir -p $PKG/install +[ -f $CWD/doinst.sh ] && cat $CWD/doinst.sh > $PKG/install/doinst.sh +[ -f $CWD/doinst.sh.gz ] && zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh +cat $CWD/slack-desc > $PKG/install/slack-desc + +# Allow to run as non-root until now: +if [ $(id -u) -ne 0 ]; then + echo "*** Running as non-root, skipping makepkg." + echo "*** Package contents is in $PKG directory." + exit 0 +fi + +cd $PKG +makepkg -l y -c n $TMP/$APP-$VERSION-$ARCH-${BUILD}${TAG}.txz + +# Clean up the extra stuff: +if [ "$1" = "--cleanup" ]; then + rm -rf $TMP/$APP-$VERSION + rm -rf $PKG +fi +