sfizz/.travis/environment.sh
Jean Pierre Cimalando e975b35a93 Add MinGW 64-bit
2020-02-02 21:25:08 +01:00

31 lines
1.1 KiB
Bash

# ---------------------------------------------------------------------------- #
# Global environment included from all scripts #
# ---------------------------------------------------------------------------- #
# add /usr/local/bin to path, for custom cmake installs
if [[ ${TRAVIS_OS_NAME} == "linux" || ${TRAVIS_OS_NAME} == "osx" ]]; then
export PATH="/usr/local/bin:$PATH"
fi
# buildenv runs a command in host machine or container, depending on build
if [[ ${CROSS_COMPILE} == "mingw32" || ${CROSS_COMPILE} == "mingw64" ]]; then
buildenv() {
setup_container archlinux
docker exec -w "$(pwd)" -i -t "$container" "$@"
}
else
buildenv() {
"$@"
}
fi
# create a container based on given image if not existing
# the container id is persisted in a file across different scripts
setup_container() {
if [ -f ${TRAVIS_BUILD_DIR}/docker-container-id ]; then
container=$(cat ${TRAVIS_BUILD_DIR}/docker-container-id)
else
container=$(docker run -d -i -t -v /home:/home "$1" /bin/bash)
echo "$container" > ${TRAVIS_BUILD_DIR}/docker-container-id
fi
}