Skip to content

Commit

Permalink
Merge pull request #463 from vbatts/platform.2
Browse files Browse the repository at this point in the history
make and travis: cross platform compile check
  • Loading branch information
mtrmac authored Jun 19, 2018
2 parents e1a17f7 + d615269 commit faaa175
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ script: >
-e GOPATH=/gopath -e TRASH_CACHE=/gopath/.trashcache
-v /etc/passwd:/etc/passwd -v /etc/sudoers:/etc/sudoers -v /etc/sudoers.d:/etc/sudoers.d
-v /var/run:/var/run:z -v $HOME/gopath:/gopath:Z
-w /gopath/src/github.com/containers/image image-test bash -c "PATH=$PATH:/gopath/bin make tools .gitvalidation validate test test-skopeo SUDO=sudo BUILDTAGS=\"$BUILDTAGS\""
-w /gopath/src/github.com/containers/image image-test bash -c "PATH=$PATH:/gopath/bin make cross tools .gitvalidation validate test test-skopeo SUDO=sudo BUILDTAGS=\"$BUILDTAGS\""
22 changes: 18 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,18 @@ SKOPEO_BRANCH = master
# Set SUDO=sudo to run container integration tests using sudo.
SUDO =

# when cross compiling _for_ a Darwin or windows host, then we must use openpgp
BUILD_TAGS_WINDOWS_CROSS = containers_image_ostree_stub containers_image_openpgp
BUILD_TAGS_DARWIN_CROSS = containers_image_ostree_stub containers_image_openpgp
# when compiling _on_ a Darwin host, then we can link against gpgme
BUILD_TAGS_DARWIN_NATIVE = containers_image_ostree_stub

ifeq ($(shell uname),Darwin)
DARWIN_BUILD_TAG = containers_image_ostree_stub
PLATFORM_BUILD_TAG = $(BUILD_TAGS_DARWIN_NATIVE)
endif
BUILDTAGS = btrfs_noversion libdm_no_deferred_remove $(DARWIN_BUILD_TAG)


BUILDTAGS = btrfs_noversion libdm_no_deferred_remove $(PLATFORM_BUILD_TAG)
BUILDFLAGS := -tags "$(BUILDTAGS)"

PACKAGES := $(shell go list $(BUILDFLAGS) ./... | grep -v github.com/containers/image/vendor)
Expand All @@ -25,8 +33,14 @@ GPGME_ENV = CGO_CFLAGS="$(shell gpgme-config --cflags 2>/dev/null)" CGO_LDFLAGS=

all: tools test validate .gitvalidation

build: vendor
@$(GPGME_ENV) go build $(BUILDFLAGS) $(PACKAGES)
build: vendor build-internal

build-internal:
$(GPGME_ENV) go build $(BUILDFLAGS) $(PACKAGES)

cross: vendor
GOOS=windows $(MAKE) build-internal BUILDTAGS="$(BUILDTAGS) $(BUILD_TAGS_WINDOWS_CROSS)"
GOOS=darwin $(MAKE) build-internal BUILDTAGS="$(BUILDTAGS) $(BUILD_TAGS_DARWIN_CROSS)"

tools: tools.timestamp

Expand Down
2 changes: 2 additions & 0 deletions vendor.conf
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ github.com/ostreedev/ostree-go aeb02c6b6aa2889db3ef62f7855650755befd460
github.com/gogo/protobuf fcdc5011193ff531a548e9b0301828d5a5b97fd8
github.com/pquerna/ffjson master
github.com/syndtr/gocapability master
github.com/Microsoft/go-winio ab35fc04b6365e8fcb18e6e9e41ea4a02b10b175
github.com/Microsoft/hcsshim eca7177590cdcbd25bbc5df27e3b693a54b53a6a

0 comments on commit faaa175

Please sign in to comment.