diff options
author | Vincenzo Maffione | 2015-07-04 17:29:51 +0200 |
---|---|---|
committer | Vincenzo Maffione | 2015-07-04 17:29:51 +0200 |
commit | b1dcac5ec922f48cab528061fd6e9b11636bc332 (patch) | |
tree | 9d4be2d96f37f6cab32bf174733a51193409cb14 | |
download | aur-b1dcac5ec922f48cab528061fd6e9b11636bc332.tar.gz |
Initial import
-rw-r--r-- | .SRCINFO | 23 | ||||
-rw-r--r-- | PKGBUILD | 111 | ||||
-rw-r--r-- | netmap.install | 20 |
3 files changed, 154 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..2e075bbac2bf --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,23 @@ +pkgbase = netmap + pkgdesc = Netmap is a framework for high speed network packet I/O. + pkgver = 3.18 + pkgrel = 1 + url = http://info.iet.unipi.it/~luigi/netmap + install = netmap.install + arch = any + license = BSD + makedepends = git + makedepends = sed + makedepends = gzip + makedepends = linux-headers + makedepends = abs + makedepends = pacman + makedepends = xmlto + makedepends = docbook-xsl + depends = linux + depends = glibc + source = netmap.install + md5sums = 047aa5adec4c52ddbf86d12dbf300f71 + +pkgname = netmap + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..e5ffeb6c04f9 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,111 @@ +# See http://wiki.archlinux.org/index.php/VCS_PKGBUILD_Guidelines +# for more information on packaging from GIT sources. + +# Maintainer: Vincenzo Maffione <v.maffione@gmail.com> +pkgname=netmap +pkgver=3.18 +pkgrel=1 +pkgdesc="Netmap is a framework for high speed network packet I/O." +arch=('any') +url="http://info.iet.unipi.it/~luigi/netmap" +license=('BSD') +groups=() +depends=('linux' 'glibc') +makedepends=('git' 'sed' 'gzip' 'linux-headers' 'abs' 'pacman' 'xmlto' 'docbook-xsl') +provides=() +conflicts=() +replaces=() +backup=() +options=() +install="netmap.install" +source=("netmap.install") +noextract=() +md5sums=("047aa5adec4c52ddbf86d12dbf300f71") + +_gitroot="https://v.maffione@code.google.com/p/netmap/" +_gitname="netmap" + +build() { + # Download the latest netmap code from the public repository + cd "$srcdir" + msg "Connecting to GIT server...." + if [[ -d "$_gitname" ]]; then + cd "$_gitname" && git pull origin + msg "The local files are updated." + else + git clone "$_gitroot" "$_gitname" + cd "$srcdir/$_gitname" + git branch next origin/next + git checkout next + fi + msg "GIT checkout done or server timeout" + + # Download kernel sources using ABS, checking that the version is the + # same as the running kernel + msg "Downloading kernel sources..." + mkdir -p $srcdir/abs + cd $srcdir/abs + ABSROOT=. abs core/linux + cd $srcdir/abs/core/linux + grep "pkgver[ ]*=" PKGBUILD > .ksver + KSVER=$(sed 's|pkgver[ ]*=[ ]*||g' .ksver) + rm .ksver + RKVER=$(uname -r | sed 's|-.*||g') + if [ "$KSVER" != "$RKVER" ]; then + msg "Kernel sources version ($KSVER) differs from running kernel version ($RKVER): Cannot continue" + return 1 + fi + KMAJVER=$(echo "$KSVER" | sed 's|\.[0-9]\+$||g') + makepkg --nobuild --skippgpcheck + msg "Kernel sources are ready" + + # Build the netmap kernel module and all modified drivers, using the + # kernel sources downloaded in the previous steps to copy the NIC + # drivers. Note however that the kernel modules are built against the + # running kernel, and not against the downloaded sources. + msg "Starting to build netmap" + cd "$srcdir/$_gitname/LINUX" + ./configure --kernel-sources=$srcdir/abs/core/linux/src/linux-$KMAJVER --no-drivers=virtio_net.c,e1000 + make || return 1 + # Build pkt-gen and vale-ctl + cd "$srcdir/$_gitname/examples" + make clean # amend for existing .o + make pkt-gen vale-ctl || return 1 + msg "Build complete" +} + +package() { + # Compute the version numbers of the running kernel + KVER1=$(uname -r) + KVER2=$(uname -r | sed 's/\.[0-9]\+-[0-9]\+//') + + # Install the netmap module into the extramodules-VERSION directory + mkdir -p "$pkgdir/usr/lib/modules/extramodules-${KVER2}" + cp "$srcdir/$_gitname/LINUX/netmap.ko" "$pkgdir/usr/lib/modules/extramodules-${KVER2}" + + # Install pkt-gen and valectl into /usr/bin + mkdir -p "$pkgdir/usr/bin" + cp "$srcdir/$_gitname/examples/pkt-gen" "$pkgdir/usr/bin" + cp "$srcdir/$_gitname/examples/vale-ctl" "$pkgdir/usr/bin" + + # Install the netmap public headers + mkdir -p "$pkgdir/usr/include/net" + cp "$srcdir/$_gitname/sys/net/netmap.h" "$srcdir/$_gitname/sys/net/netmap_user.h" "$pkgdir/usr/include/net" + + # Install the netmap man page + mkdir -p "$pkgdir/usr/share/man/man4" + cp "$srcdir/$_gitname/share/man/man4/netmap.4" "$pkgdir/usr/share/man/man4" + gzip "$pkgdir/usr/share/man/man4/netmap.4" + + #Find and install the modified NIC drivers + cd "$srcdir/$_gitname/LINUX" + DRIVERS=$(find . -name "*.ko" -and ! -name "netmap.ko") + if [ -n "$DRIVERS" ]; then + mkdir -p "$pkgdir/usr/lib/modules/extramodules-${KVER2}/netmap-drivers" + cp --parent $DRIVERS "$pkgdir/usr/lib/modules/extramodules-${KVER2}/netmap-drivers" + cd "$pkgdir/usr/lib/modules/extramodules-${KVER2}/netmap-drivers" + find . -name "*.ko" -exec sh -c "mv {} \$(echo {} | sed 's|\.ko|_netmap\.ko|g')" \; + fi +} + +# vim:set ts=2 sw=2 et: diff --git a/netmap.install b/netmap.install new file mode 100644 index 000000000000..d8951c29f863 --- /dev/null +++ b/netmap.install @@ -0,0 +1,20 @@ +post_common() { + depmod -a +} + +## arg 1: the new package version +post_install() { + post_common +} + +## arg 1: the new package version +## arg 2: the old package version +post_upgrade() { + post_common +} + +## arg 1: the old package version +post_remove() { + post_common +} + |