From c8496103b6e671661d10973481b4385065ca7e8f Mon Sep 17 00:00:00 2001 From: Nathaniel Nicandro Date: Sun, 10 Feb 2019 17:45:24 -0600 Subject: [PATCH] Build Windows binaries with Travis --- .travis.yml | 65 +++++++++++++++++++++++++++++++++++------------------ Makefile | 30 ++++++++++++++++++------- 2 files changed, 65 insertions(+), 30 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5a5ee00..bf6c4e4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/Makefile b/Makefile index 9d6c817..a68c8b4 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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 @@ -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 @@ -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 @@ -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),)