File: release.sh

package info (click to toggle)
dub 1.16.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 5,168 kB
  • sloc: sh: 1,577; xml: 37; makefile: 17; ansic: 11
file content (39 lines) | stat: -rwxr-xr-x 901 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash

set -eux -o pipefail

VERSION=$(git describe --abbrev=0 --tags)
ARCH="${ARCH:-64}"
CUSTOM_FLAGS=()
unameOut="$(uname -s)"
case "$unameOut" in
    Linux*)
        OS=linux
        CUSTOM_FLAGS+=("-L--export-dynamic")
        ;;
    Darwin*)
        OS=osx
        CUSTOM_FLAGS+=("-L-dead_strip")
        ;;
    *) echo "Unknown OS: $unameOut"; exit 1
esac

if [[ $(basename "$DMD") =~ ldmd.* ]] ; then
    CUSTOM_FLAGS+=("-flto=full")
    # ld.gold is required on Linux
    if [ ${OS:-} == "linux" ] ; then
        CUSTOM_FLAGS+=("-linker=gold")
    fi
fi

case "$ARCH" in
    64) ARCH_SUFFIX="x86_64";;
    32) ARCH_SUFFIX="x86";;
    *) echo "Unknown ARCH: $ARCH"; exit 1
esac

archiveName="dub-$VERSION-$OS-$ARCH_SUFFIX.tar.gz"

echo "Building $archiveName"
DFLAGS="-release -m$ARCH ${CUSTOM_FLAGS[@]}" DMD="$(command -v $DMD)" ./build.sh
tar cvfz "bin/$archiveName" -C bin dub