2019-03-25 18:14:14 +00:00
|
|
|
#!/bin/sh
|
2017-11-04 00:56:05 +00:00
|
|
|
set -e
|
|
|
|
|
2019-04-18 12:52:24 +00:00
|
|
|
cd "$(dirname $0)/.."
|
|
|
|
|
2018-10-12 11:57:27 +00:00
|
|
|
if [ "$1" = "--gcc_source" ]; then
|
2018-10-12 12:13:39 +00:00
|
|
|
TOOLCHAIN_FLAVOR=src
|
2018-10-12 11:57:27 +00:00
|
|
|
shift
|
|
|
|
else
|
2018-10-12 12:13:39 +00:00
|
|
|
TOOLCHAIN_FLAVOR=linux
|
2018-10-12 11:57:27 +00:00
|
|
|
fi
|
|
|
|
|
2018-10-12 12:13:39 +00:00
|
|
|
IMAGE=trezor-core-build.$TOOLCHAIN_FLAVOR
|
2019-04-25 14:56:54 +00:00
|
|
|
TAG=${1:-master}
|
2018-07-01 18:17:20 +00:00
|
|
|
REPOSITORY=${2:-trezor}
|
2018-11-05 20:41:03 +00:00
|
|
|
PRODUCTION=${PRODUCTION:-0}
|
2019-09-04 10:16:55 +00:00
|
|
|
BITCOIN_ONLY=${BITCOIN_ONLY:-0}
|
2018-07-01 18:17:20 +00:00
|
|
|
|
|
|
|
if [ "$REPOSITORY" = "local" ]; then
|
|
|
|
REPOSITORY=file:///local/
|
|
|
|
else
|
2019-04-18 12:52:24 +00:00
|
|
|
REPOSITORY=https://github.com/$REPOSITORY/trezor-firmware.git
|
2018-07-01 18:17:20 +00:00
|
|
|
fi
|
2017-11-04 00:56:05 +00:00
|
|
|
|
2019-04-27 17:16:50 +00:00
|
|
|
docker build -t $IMAGE --build-arg TOOLCHAIN_FLAVOR=$TOOLCHAIN_FLAVOR ci/
|
2019-04-18 12:52:24 +00:00
|
|
|
|
|
|
|
USER=$(ls -lnd . | awk '{ print $3 }')
|
|
|
|
GROUP=$(ls -lnd . | awk '{ print $4 }')
|
2018-01-09 20:44:42 +00:00
|
|
|
|
2019-04-18 12:52:24 +00:00
|
|
|
mkdir -p $(pwd)/build/core
|
2019-09-04 10:16:55 +00:00
|
|
|
docker run -t -v $(pwd):/local -v $(pwd)/build/core:/build:z --env BITCOIN_ONLY="$BITCOIN_ONLY" --user="$USER:$GROUP" $IMAGE /bin/sh -c "\
|
2018-10-23 10:00:42 +00:00
|
|
|
cd /tmp && \
|
2019-04-18 12:52:24 +00:00
|
|
|
git clone $REPOSITORY trezor-firmware && \
|
|
|
|
cd trezor-firmware/core && \
|
2017-11-04 00:56:05 +00:00
|
|
|
ln -s /build build &&
|
|
|
|
git checkout $TAG && \
|
|
|
|
git submodule update --init --recursive && \
|
2019-04-30 11:13:57 +00:00
|
|
|
pipenv install && \
|
|
|
|
PRODUCTION=$PRODUCTION pipenv run make clean vendor build_boardloader build_bootloader build_firmware"
|