diff --git a/.travis.yml b/.travis.yml index 049291a..bfd6319 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,14 +17,13 @@ env: - BUILD=dub script: ./.travis.sh - jobs: include: - stage: GitHub Release - if: tag IS present - d: ldc + #if: tag IS present + d: ldc-1.8.0 os: linux - script: echo "Deploying to GitHub releases ..." && make release + script: echo "Deploying to GitHub releases ..." && ./release.sh deploy: provider: releases api_key: $GH_REPO_TOKEN @@ -35,10 +34,10 @@ jobs: repo: dlang-community/dcd tags: true - stage: GitHub Release - if: tag IS present - d: ldc + #if: tag IS present + d: ldc-1.8.0 os: osx - script: echo "Deploying to GitHub releases ..." && make release + script: echo "Deploying to GitHub releases ..." && ./release.sh deploy: provider: releases api_key: $GH_REPO_TOKEN @@ -48,3 +47,27 @@ jobs: on: repo: dlang-community/dcd tags: true + - stage: GitHub Release + #if: tag IS present + d: dmd + os: linux + language: generic + sudo: yes + script: echo "Deploying to GitHub releases ..." && ./release-windows.sh + addons: + apt: + packages: + - p7zip-full + - wine + deploy: + provider: releases + api_key: $GH_REPO_TOKEN + file_glob: true + file: bin/dcd-.*.zip + skip_cleanup: true + on: + repo: dlang-community/dcd + tags: true +stages: + - name: test + if: type = pull_request or (type = push and branch = master) diff --git a/makefile b/makefile index 955f467..a7f41e4 100644 --- a/makefile +++ b/makefile @@ -150,27 +150,5 @@ ldcserver: githash test: debugserver dmdclient cd tests && ./run_tests.sh -.ONESHELL: release: - @set -eux -o pipefail - VERSION=$$(git describe --abbrev=0 --tags) - ARCH="$${ARCH:-64}" - unameOut="$$(uname -s)" - case "$$unameOut" in - Linux*) OS=linux; ;; - Darwin*) OS=osx; ;; - *) echo "Unknown OS: $$unameOut"; exit 1 - esac - - case "$$ARCH" in - 64) ARCH_SUFFIX="x86_64";; - 32) ARCH_SUFFIX="x86";; - *) echo "Unknown ARCH: $$ARCH"; exit 1 - esac - - archiveName="dcd-$$VERSION-$$OS-$$ARCH_SUFFIX.tar.gz" - - echo "Building $$archiveName" - ${MAKE} ldcclient - ${MAKE} ldcserver - tar cvfz "bin/$$archiveName" -C bin dcd-client dcd-server + ./release.sh diff --git a/release-windows.sh b/release-windows.sh new file mode 100755 index 0000000..19bd29c --- /dev/null +++ b/release-windows.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +# Build the Windows binaries under Linux (requires wine) +set -eux -o pipefail +VERSION=$(git describe --abbrev=0 --tags) +OS=windows +ARCH_SUFFIX="x86" + +# Allow the script to be run from anywhere +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd $DIR + +# Step 1: download the DMD binaries +if [ ! -d dmd2 ] ; then + wget http://downloads.dlang.org/releases/2.x/2.079.0/dmd.2.079.0.windows.7z + 7z x dmd.2.079.0.windows.7z > /dev/null +fi + +# Step 2: Run DMD via wineconsole +archiveName="dcd-$VERSION-$OS-$ARCH_SUFFIX.zip" +echo "Building $archiveName" +mkdir -p bin +DC="$DIR/dmd2/windows/bin/dmd.exe" wine cmd /C build.bat + +cd bin +zip "$archiveName" dcd-server.exe dcd-client.exe diff --git a/release.sh b/release.sh new file mode 100755 index 0000000..3c24e70 --- /dev/null +++ b/release.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +set -eux -o pipefail +VERSION=$(git describe --abbrev=0 --tags) +ARCH="${ARCH:-64}" +LDC_FLAGS=() +unameOut="$(uname -s)" +case "$unameOut" in + Linux*) OS=linux; LDC_FLAGS=("-flto=full" "-linker=gold" "-static") ;; + Darwin*) OS=osx; LDC_FLAGS+=("-L-macosx_version_min" "-L10.7" "-L-lcrt1.o"); ;; + *) echo "Unknown OS: $unameOut"; exit 1 +esac + +case "$ARCH" in + 64) ARCH_SUFFIX="x86_64";; + 32) ARCH_SUFFIX="x86";; + *) echo "Unknown ARCH: $ARCH"; exit 1 +esac + +archiveName="dcd-$VERSION-$OS-$ARCH_SUFFIX.tar.gz" + +echo "Building $archiveName" +${MAKE:-make} ldcclient ldcserver LDC_FLAGS="${LDC_FLAGS[*]}" +tar cvfz "bin/$archiveName" -C bin dcd-server dcd-client