Skip to content

Commit

Permalink
Build Windows binaries with Travis
Browse files Browse the repository at this point in the history
  • Loading branch information
nnicandro committed Feb 16, 2019
1 parent a9bf4cb commit c849610
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 30 deletions.
65 changes: 43 additions & 22 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,44 @@
language: emacs-lisp
dist: trusty
# https://github.com/travis-ci/travis-ci/issues/9061
sudo: required
matrix:
allow_failures:
- env: EMACS_VERSION=git-snapshot
env:
- EMACS_VERSION=26-pretest
- EMACS_VERSION=git-snapshot
before_install:
# Setup paths
- export PATH=${TRAVIS_BUILD_DIR}/.evm/bin:${PATH}
# Install emacs
- if [[ ${EMACS_VERSION} = git-snapshot ]]; then sudo apt-get install -y texinfo; fi
# Use this fork of EVM for dynamic module support
- git clone https://github.com/ubolonton/evm ${TRAVIS_BUILD_DIR}/.evm
- evm config path /tmp
- evm install emacs-${EMACS_VERSION} --use --skip
script:
- cd $TRAVIS_BUILD_DIR
- make
- make test
jobs:
include:
- stage: test
os: linux
sudo: required
env:
- EMACS_VERSION=26-pretest
- EMACS_VERSION=git-snapshot
allow_failures:
- env: EMACS_VERSION=git-snapshot
before_script:
- export PATH=${TRAVIS_BUILD_DIR}/.evm/bin:${PATH}
- if [[ ${EMACS_VERSION} = git-snapshot ]]; then sudo apt-get install texinfo; fi
- git clone https://github.com/ubolonton/evm ${TRAVIS_BUILD_DIR}/.evm
- evm config path /tmp
- evm install emacs-${EMACS_VERSION} --use --skip
script:
- cd $TRAVIS_BUILD_DIR
- make
- make test
- stage: deploy
if: tag IS present
os: osx
addons:
homebrew:
packages:
- mingw-w64
update: true
deploy:
provider: releases
api_key:
secure: fn9FUCzHKr6ZLj63Lgkgp4vepJrEEqwWLZX1nypfJRqEWFqfsfQOSU7AywIoxOaZmlsBBGehw9ae9weRXuv3X7Mq2v36oOYL5uits57cfXys6w1awxWtRQbsSEKcRDpqpq8k5Eyh4J586ogKltrxXCACunc0Ht3Jzz8lkL0iohi4/eFVs+SyW1/u9hGBrQT37IznJGfJPxhaPR+ftsDbGhQJEXjGLgK8rmS3BOGjxjea9ckyysPr7gsVVI+335ZWw2GNDjLrxfPzMgVpWlhos/M0EZseyOeto1xFFseII7+1h448MzhL5HszbBXdVhXCsqMFx+mAAWLSBmyULPglgI6Wl3y842AA4tlgZEs/XKbTiQdanV3cG/ylbubriCcX5+xNMS6E7VpPsVOOYgjuOL00SkwORqPIbRzFEIyNMNLJNYutGErzA/ZGXG7+N5zOFH4lVFKDa7CYN4dnvabVQzQzG3PWU3b9uA/FsK6Ht9vinpaLjnmdQAB5kiyUxGoQ4Joflop0dXQV1u6q3voH41UMl4yZmnZK1LQwnfelnIYmWAFqKGDuL1zf/H0lSTwh/tJUuwVt3HMlJDl7y0Iq455fjjLbd9eBmTpflmoRe06lLpeRitYZklQgAwgRGd8tpO5l+QFQKGqxIkNdolQ5jCVssqzx/rA4vnCGdf3nT2o=
file_glob: true
file: products/*
skip_cleanup: true
overwrite: true
on:
tags: true
env:
- ZMQ_BUILD_HOST=x86_64-w64-mingw32
script:
- cd $TRAVIS_BUILD_DIR
- make products
30 changes: 22 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ $(shell touch version)
endif
endif

ifneq (,$(or $(findstring mingw, $(ZMQ_BUILD_HOST)) \
$(findstring cygwin, $(ZMQ_BUILD_HOST)) \
$(findstring msys, $(ZMQ_BUILD_HOST)) \
ifneq (,$(or $(findstring mingw, $(ZMQ_BUILD_HOST)), \
$(findstring cygwin, $(ZMQ_BUILD_HOST)), \
$(findstring msys, $(ZMQ_BUILD_HOST)), \
$(findstring Windows_NT, $(OS))))
ZMQ_BUILD_FOR_WINDOWS = yes
endif

ifeq ($(ZMQ_BUILD_FOR_WINDOWS), yes)
ifneq ($(ZMQ_BUILD_FOR_WINDOWS),)
CXXFLAGS="-static-libgcc -static-libstdc++"
SHARED_EXT := .dll
else
Expand Down Expand Up @@ -65,10 +65,11 @@ test:
.PHONY: clean
clean:
$(MAKE) -C src clean
$(RM) libzmq.* emacs-zmq.* $(ELCFILES)
$(RM) emacs-zmq.* $(ELCFILES)

.PHONY: clean-zmq-build
clean-zmq-build:
$(RM) libzmq.*
$(RM) -r $(ZMQ_BASE_BUILD_DIR)

.PHONY: compile
Expand All @@ -77,6 +78,20 @@ compile: $(ELCFILES)
$(ELCFILES): %.elc: %.el
$(EMACS) --batch -Q -L . $(LIBS) -f batch-byte-compile $<

### Make products (mainly for Travis)
# But only if we are cross compiling. For testing purposes, be sure to call
# make clean first.

ifneq ($(ZMQ_BUILD_HOST),)
.PHONY: products
products:
make $(SHARED)
mkdir -p products
tar -czf products/emacs-zmq-$(ZMQ_BUILD_HOST).tar.gz *$(SHARED_EXT)
cd products && shasum -a 256 emacs-zmq-$(ZMQ_BUILD_HOST).tar.gz > \
emacs-zmq-$(ZMQ_BUILD_HOST).tar.gz.sha256
endif

### Building ZMQ locally

.PHONY: libzmq
Expand All @@ -85,9 +100,7 @@ ifneq ($(BUILD_ZMQ_LOCALLY),)
# since the configure script to build emacs-zmq will use pkg-config anyways.
libzmq: $(ZMQ_PKG_CONFIG_DIR)/libzmq.pc
ifneq ($(shell cat version), $(ZMQ_VERSION))
# Clean out object files so that we ensure that the right libzmq is linked in
# the case that a version of ZMQ is being linked and we had
# previously linked a different version.
# Clean out object files so that we ensure the right libzmq is linked.
$(MAKE) -i clean
echo $(ZMQ_VERSION) > version
endif
Expand All @@ -114,6 +127,7 @@ endif
./autogen.sh && \
./configure CXXFLAGS=$(CXXFLAGS) --quiet --without-docs --prefix=$(ZMQ_BUILD_DIR) \
--enable-drafts=yes --enable-libunwind=no --enable-static=no \
--disable-curve-keygen --disable-perf --disable-eventfd \
--host=$(ZMQ_BUILD_HOST) && \
$(MAKE) install
ifneq ($(ZMQ_BUILD_FOR_WINDOWS),)
Expand Down

0 comments on commit c849610

Please sign in to comment.