From 45aa94d4dccb02169da0717bdfece133d1ac0cbba38516f86f73d5547a9c0c5a Mon Sep 17 00:00:00 2001 From: Aleksa Sarai Date: Mon, 21 Mar 2016 12:15:39 +0000 Subject: [PATCH] * Make compilation work on gcc-go only systems (ppc and s390). OBS-URL: https://build.opensuse.org/package/show/Virtualization:containers/runc?expand=0&rev=2 --- runc.changes | 5 +++++ runc.spec | 27 ++++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/runc.changes b/runc.changes index aad2a48..91ea3f1 100644 --- a/runc.changes +++ b/runc.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Mar 21 12:04:59 UTC 2016 - asarai@suse.de + +* Make compilation work on gcc-go only systems (ppc and s390). + ------------------------------------------------------------------- Mon Mar 21 08:24:02 UTC 2016 - asarai@suse.de diff --git a/runc.spec b/runc.spec index b6272d9..28332a6 100644 --- a/runc.spec +++ b/runc.spec @@ -15,6 +15,15 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # +%define go_arches %ix86 x86_64 +%ifarch %go_arches +%define go_tool go +%define GO_BUILD_FLAGS "" +%else +%define go_tool go-5 +%define GO_BUILD_FLAGS "-gccgoflags=-Wl,--add-needed -Wl,--no-as-needed -static-libgo -ldl -lseccomp -lselinux -lapparmor" +%endif + %define version_unconverted 0.0.9 Name: runc @@ -26,7 +35,11 @@ Group: System/Management Url: https://github.com/opencontainers/runc Source: %{name}-%{version}.tar.xz Patch0: seccomp-use-pkg-config.patch +%ifarch %go_arches BuildRequires: go >= 1.5 +%else +BuildRequires: gcc5-go >= 5.0 +%endif BuildRequires: libapparmor-devel BuildRequires: libseccomp-devel BuildRequires: libselinux-devel @@ -44,12 +57,20 @@ and has grown to become a separate project entirely. %patch0 -p1 -d Godeps/_workspace/src/github.com/seccomp/libseccomp-golang %build -# TODO: Add support for gcc-go. +# Create buildir, +export GOPATH=$PWD/go +mkdir -pv $GOPATH/src/github.com/opencontainers/ + +# Copy the vendor directory into the GOPATH. +cp -rv $PWD/Godeps/_workspace/src/* $GOPATH/src/ +ln -svfn $PWD $GOPATH/src/github.com/opencontainers/runc + +# Build all features. export BUILDTAGS="seccomp apparmor selinux" -make BUILDTAGS="$BUILDTAGS" all +%go_tool build -tags "$BUILDTAGS" -x -o %{name}-%{version} %GO_BUILD_FLAGS %install -%{__install} -D -m755 %{name} %{buildroot}/%{_bindir}/%{name} +%{__install} -D -m755 %{name}-%{version} %{buildroot}/%{_bindir}/%{name} %post