diff --git a/.travis.yml b/.travis.yml index 2a33498..a9ed93e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,10 +16,10 @@ 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 @@ -30,10 +30,10 @@ jobs: repo: dlang-community/D-Scanner 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 diff --git a/makefile b/makefile index e19c284..dc6361a 100644 --- a/makefile +++ b/makefile @@ -76,26 +76,5 @@ report: all dscanner --report src > src/dscanner-report.json sonar-runner -.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="dscanner-$$VERSION-$$OS-$$ARCH_SUFFIX.tar.gz" - - echo "Building $$archiveName" - ${MAKE} ldcbuild LDC_FLAGS="-flto=full" - tar cvfz "bin/$$archiveName" -C bin dscanner + ./release.sh diff --git a/release.sh b/release.sh new file mode 100755 index 0000000..775849b --- /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="dscanner-$VERSION-$OS-$ARCH_SUFFIX.tar.gz" + +echo "Building $archiveName" +${MAKE:-make} ldcbuild LDC_FLAGS="${LDC_FLAGS[*]}" +tar cvfz "bin/$archiveName" -C bin dscanner