diff --git a/srcpkgs/openvswitch-devel b/srcpkgs/openvswitch-devel new file mode 120000 index 00000000000..e91066d6e7d --- /dev/null +++ b/srcpkgs/openvswitch-devel @@ -0,0 +1 @@ +openvswitch \ No newline at end of file diff --git a/srcpkgs/openvswitch/files/ovs-vswitchd/run b/srcpkgs/openvswitch/files/ovs-vswitchd/run new file mode 100755 index 00000000000..a0a6c98f997 --- /dev/null +++ b/srcpkgs/openvswitch/files/ovs-vswitchd/run @@ -0,0 +1,5 @@ +#!/bin/sh +modprobe -q openvswitch || exit 1 +sv check ovsdb-server >/dev/null || exit 1 +install -d /run/openvswitch +exec ovs-vswitchd diff --git a/srcpkgs/openvswitch/files/ovsdb-server/run b/srcpkgs/openvswitch/files/ovsdb-server/run new file mode 100755 index 00000000000..36528368a4d --- /dev/null +++ b/srcpkgs/openvswitch/files/ovsdb-server/run @@ -0,0 +1,7 @@ +#!/bin/sh +if [ ! -f /etc/openvswitch/conf.db ]; then + install -d /etc/openvswitch + ovsdb-tool create /etc/openvswitch/conf.db /usr/share/openvswitch/vswitch.ovsschema || exit 1 +fi +install -d /run/openvswitch +exec ovsdb-server --remote=punix:/run/openvswitch/db.sock diff --git a/srcpkgs/openvswitch/patches/0001-ovs-thread-Set-stacksize-to-1M.patch b/srcpkgs/openvswitch/patches/0001-ovs-thread-Set-stacksize-to-1M.patch new file mode 100644 index 00000000000..96365c4047e --- /dev/null +++ b/srcpkgs/openvswitch/patches/0001-ovs-thread-Set-stacksize-to-1M.patch @@ -0,0 +1,59 @@ +From 92ae6e162812876c082fd9d05a0eeac062f832ae Mon Sep 17 00:00:00 2001 +From: Natanael Copa +Date: Mon, 25 Aug 2014 08:50:26 +0000 +Subject: [PATCH] ovs-thread: Set stacksize to 1M + +With musl libc the default stacksize is 80k which is too small and +makes it segfault. + +We increase it to 1MB. +http://permalink.gmane.org/gmane.linux.network.openvswitch.general/5831 + +Signed-off-by: Natanael Copa +--- + lib/ovs-thread.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +--- lib/ovs-thread.c 2014-10-02 14:37:47.196714056 -0300 ++++ lib/ovs-thread.c 2014-10-02 14:38:10.826714288 -0300 +@@ -28,6 +28,9 @@ + #include "socket-util.h" + #include "util.h" + ++/* set default stack size to 1M */ ++#define OVS_STACK_SIZE (1024 * 1024) ++ + #ifdef __CHECKER__ + /* Omit the definitions in this file because they are somewhat difficult to + * write without prompting "sparse" complaints, without ugliness or +@@ -329,6 +332,7 @@ + { + struct ovsthread_aux *aux; + pthread_t thread; ++ pthread_attr_t attr; + int error; + + forbid_forking("multiple threads exist"); +@@ -340,10 +344,21 @@ + aux->arg = arg; + ovs_strlcpy(aux->name, name, sizeof aux->name); + +- error = pthread_create(&thread, NULL, ovsthread_wrapper, aux); ++ error = pthread_attr_init(&attr); ++ if (error) { ++ ovs_abort(error, "pthread_attr_init failed"); ++ } ++ error = pthread_attr_setstacksize(&attr, OVS_STACK_SIZE); ++ if (error) { ++ ovs_abort(error, "pthread_attr_setstacksize failed"); ++ } ++ ++ error = pthread_create(&thread, &attr, ovsthread_wrapper, aux); + if (error) { + ovs_abort(error, "pthread_create failed"); + } ++ pthread_attr_destroy(&attr); ++ + return thread; + } + diff --git a/srcpkgs/openvswitch/patches/musl-if_packet.patch b/srcpkgs/openvswitch/patches/musl-if_packet.patch new file mode 100644 index 00000000000..18875fa5714 --- /dev/null +++ b/srcpkgs/openvswitch/patches/musl-if_packet.patch @@ -0,0 +1,14 @@ +--- lib/netdev-linux.c 2015-08-20 00:33:42.960971996 +0000 ++++ lib/netdev-linux.c 2015-08-22 18:16:10.741115156 +0000 +@@ -37,10 +37,9 @@ + #include + #include + #include +-#include + #include + #include +-#include ++#include + #include + #include + #include diff --git a/srcpkgs/openvswitch/template b/srcpkgs/openvswitch/template new file mode 100644 index 00000000000..25e713ca849 --- /dev/null +++ b/srcpkgs/openvswitch/template @@ -0,0 +1,42 @@ +# Template file for 'openvswitch' +pkgname=openvswitch +version=2.4.0 +revision=1 +build_style=gnu-configure +configure_args="--with-rundir=/run/openvswitch" +hostmakedepends="python perl" +makedepends="libressl-devel ${hostmakedepends}" +depends="python" +short_desc="Production quality, multilayer virtual switch" +maintainer="Renato Aguiar " +license="Apache-2.0" +homepage="http://openvswitch.org/" +distfiles="http://openvswitch.org/releases/${pkgname}-${version}.tar.gz" +checksum=424c5a8dea1c5b153e8c1803bb041d0495e81379fb6f386dd58ee903a7681b9a +only_for_archs="i686 i686-musl x86_64 x86_64-musl" +_completiondir="/usr/share/bash-completion/completions" +make_install_args+=" completiondir=${_completiondir}" +pycompile_dirs="usr/share/openvswitch/python" + +post_install() { + for cmd in ovs-appctl ovs-vsctl; do + chmod 0644 ${DESTDIR}${_completiondir}/$cmd-bashcomp.bash + mv ${DESTDIR}${_completiondir}/$cmd-bashcomp.bash \ + ${DESTDIR}${_completiondir}/$cmd + done + for cmd in ovs-ofctl ovs-dpctl ovsdb-tool; do + ln -s ovs-appctl ${DESTDIR}${_completiondir}/$cmd + done + vsv ovsdb-server + vsv ovs-vswitchd +} + +openvswitch-devel_package() { + depends="${sourcepkg}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove usr/lib/pkgconfig + vmove usr/lib/*.a + } +}