Add buildflags to allow crosscompilation for apparmor

Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
This commit is contained in:
Guillaume J. Charmes 2014-03-06 12:04:51 -08:00
parent f0f833c6d7
commit c89fa6645e
No known key found for this signature in database
GPG Key ID: B33E4642CB6E3FF3
5 changed files with 19 additions and 2 deletions

View File

@ -84,7 +84,8 @@ fi
# Use these flags when compiling the tests and final binary
LDFLAGS='-X github.com/dotcloud/docker/dockerversion.GITCOMMIT "'$GITCOMMIT'" -X github.com/dotcloud/docker/dockerversion.VERSION "'$VERSION'" -w'
LDFLAGS_STATIC='-X github.com/dotcloud/docker/dockerversion.IAMSTATIC true -linkmode external -extldflags "-lpthread -static -Wl,--unresolved-symbols=ignore-in-object-files"'
BUILDFLAGS='-tags netgo -a'
BUILDFLAGS='-a'
BUILDTAGS="apparmor netgo"
HAVE_GO_TEST_COVER=
if \

View File

@ -2,5 +2,5 @@
DEST=$1
go build -o $DEST/docker-$VERSION -ldflags "$LDFLAGS $LDFLAGS_STATIC" $BUILDFLAGS ./docker
go build -o $DEST/docker-$VERSION -ldflags "$LDFLAGS $LDFLAGS_STATIC" $BUILDFLAGS -tags "$BUILDTAGS" ./docker
echo "Created binary: $DEST/docker-$VERSION"

View File

@ -18,6 +18,7 @@ for platform in $DOCKER_CROSSPLATFORMS; do
export GOOS=${platform%/*}
export GOARCH=${platform##*/}
export LDFLAGS_STATIC="" # we just need a simple client for these platforms (TODO this might change someday)
export BUILDTAGS="netgo"
source "$(dirname "$BASH_SOURCE")/binary" "$DEST/$platform"
)
done

View File

@ -1,3 +1,5 @@
// +build apparmor
package apparmor
// #cgo LDFLAGS: -lapparmor

View File

@ -0,0 +1,13 @@
// +build !apparmor
package apparmor
import ()
func IsEnabled() bool {
return false
}
func ApplyProfile(pid int, name string) error {
return nil
}