--- /dev/null
+From e858cfaf73eadb4cf4076a754c4836816c908d44 Mon Sep 17 00:00:00 2001
+From: Petr Votava <votava.petr@gene.com>
+Date: Thu, 29 Jun 2017 16:53:48 +0000
+Subject: [PATCH] A patch for slurm plugin build
+
+---
+ src/slurm/Makefile.am | 2 +-
+ src/slurm/singularity.c | 4 ++--
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/slurm/Makefile.am b/src/slurm/Makefile.am
+index 860c7667d..152e41450 100644
+--- a/src/slurm/Makefile.am
++++ b/src/slurm/Makefile.am
+@@ -4,7 +4,7 @@ plugindir = $(libdir)/slurm
+ if WITH_SLURM
+ plugin_LTLIBRARIES = singularity_spank.la
+ singularity_spank_la_SOURCES = singularity.c
+-singularity_spank_la_LIBADD = ../lib/libsingularity_internal.la
++singularity_spank_la_LIBADD = ../lib/runtime/libinternal.la
+ singularity_spank_la_LDFLAGS = -module -no-undefined -avoid-version -export-symbols-regex '^slurm_spank_|^plugin_'
+ endif
+
+diff --git a/src/slurm/singularity.c b/src/slurm/singularity.c
+index acddddfd1..3509f4d8e 100644
+--- a/src/slurm/singularity.c
++++ b/src/slurm/singularity.c
+@@ -22,6 +22,7 @@
+
+ #define _GNU_SOURCE 1
+
++#include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
+ #include <sys/types.h>
+@@ -29,9 +30,9 @@
+ #include <string.h>
+
+ #include "config.h"
+-#include "lib/singularity.h"
+ #include "util/util.h"
+ #include "util/file.h"
++#include "util/registry.h"
+
+ #include "slurm/spank.h"
+
+@@ -169,7 +170,6 @@ static int setup_container(spank_t spank)
+ }
+
+
+- char *image;
+ if ( ( image = singularity_registry_get("IMAGE") ) == NULL ) {
+ singularity_message(ERROR, "SINGULARITY_CONTAINER not defined!\n");
+ }
--- /dev/null
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python{2_7,3_{4,5,6}} )
+
+inherit autotools eutils python-single-r1
+
+DESCRIPTION="Application containers for Linux"
+HOMEPAGE="http://singularity.lbl.gov/"
+SRC_URI="https://github.com/${PN}ware/${PN}/releases/download/${PV}/${P}.tar.gz"
+
+SLOT="0"
+LICENSE="cctbx-2.0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="examples slurm static-libs +suid"
+
+RDEPEND="
+ sys-cluster/slurm
+"
+DEPEND="${RDEPEND}"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-slurm.patch
+)
+
+src_prepare() {
+ default
+ # automake version hardcoding
+ eautoreconf
+}
+
+src_configure() {
+ econf \
+ --with-userns \
+ $(use_with slurm) \
+ $(usex suid "" "--disable-suid") \
+ $(use_enable static-libs static)
+}
+
+src_install() {
+ MAKEOPTS+=" -j1"
+ default
+ prune_libtool_files
+ dodoc ChangeLog AUTHORS.md CONTRIBUTING.md
+ use examples && dodoc -r examples
+}