File: environment.sh

package info (click to toggle)
audacity 3.2.4%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 106,704 kB
  • sloc: cpp: 277,038; ansic: 73,623; lisp: 7,761; python: 3,305; sh: 2,715; perl: 821; xml: 275; makefile: 119
file content (44 lines) | stat: -rw-r--r-- 1,253 bytes parent folder | download
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
40
41
42
43
44
#!/usr/bin/env bash

if [[ "$0" == "${BASH_SOURCE}" ]]; then
    echo >&2 "$0: Please source this script instead of running it."
    exit 1
fi

((${BASH_VERSION%%.*} >= 4)) || { echo >&2 "${BASH_SOURCE}: Error: Please upgrade Bash."; return 1; }

function gh_export()
{
    [[ "${GITHUB_ENV-}" ]] || local -r GITHUB_ENV="/dev/null"
    export -- "$@" && printf "%s\n" "$@" >> "${GITHUB_ENV}"
}

repository_root="$(cd "$(dirname "${BASH_SOURCE}")/../.."; echo "${PWD}")"

gh_export GIT_HASH="$(git show -s --format='%H')"
gh_export GIT_HASH_SHORT="$(git show -s --format='%h')"

gh_export AUDACITY_BUILD_TYPE="RelWithDebInfo"
gh_export AUDACITY_INSTALL_PREFIX="${repository_root}/build/install"

gh_export GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)

if [[ "${OSTYPE}" == msys* ]]; then # Windows

    # On Windows, we pin the MSVC version
    # Compiler version stands to MSVC version here

    compiler_version=$(echo "${AUDACITY_CMAKE_GENERATOR}" | grep -m 1 -Eo "[[:digit:]]+" | head -1)

elif [[ "${OSTYPE}" == darwin* ]]; then # macOS

    compiler_version="$(clang -dumpversion)"

else # Linux & others

    compiler_version="$(cc -dumpversion)"

fi

gh_export COMPILER_VERSION="${compiler_version}"
gh_export CONAN_VERSION="$(conan --version)"