Skip to content

Commit

Permalink
make and travis: cross platform compile check
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
  • Loading branch information
vbatts committed Jun 19, 2018
1 parent ca5b302 commit d615269
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -24,4 +24,4 @@ script: >
-e GOPATH=/gopath -e TRASH_CACHE=/gopath/.trashcache -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 /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 -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
Expand Up @@ -6,10 +6,18 @@ SKOPEO_BRANCH = master
# Set SUDO=sudo to run container integration tests using sudo. # Set SUDO=sudo to run container integration tests using sudo.
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) ifeq ($(shell uname),Darwin)
DARWIN_BUILD_TAG = containers_image_ostree_stub PLATFORM_BUILD_TAG = $(BUILD_TAGS_DARWIN_NATIVE)
endif endif
BUILDTAGS = btrfs_noversion libdm_no_deferred_remove $(DARWIN_BUILD_TAG)

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


PACKAGES := $(shell go list $(BUILDFLAGS) ./... | grep -v github.com/containers/image/vendor) 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 all: tools test validate .gitvalidation


build: vendor build: vendor build-internal
@$(GPGME_ENV) go build $(BUILDFLAGS) $(PACKAGES)
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 tools: tools.timestamp


Expand Down

0 comments on commit d615269

Please sign in to comment.