|
| 1 | +#!/bin/bash |
| 2 | +# ----------------------------------------------------------------------------- |
| 3 | +# on-create.sh: postCreateCommand-hook for devcontainer.json (Cortex-M build) |
| 4 | +# |
| 5 | +# Author: Bernhard Bablok |
| 6 | +# |
| 7 | +# ----------------------------------------------------------------------------- |
| 8 | + |
| 9 | +echo -e "[on-create.sh] downloading and installing gcc-arm-non-eabi toolchain" |
| 10 | +cd /workspaces |
| 11 | +wget -qO gcc-arm-none-eabi.tar.bz2 https://adafru.it/Pid |
| 12 | +tar -xjf gcc-arm-none-eabi.tar.bz2 |
| 13 | +ln -s gcc-arm-none-eabi-10-2020-q4-major gcc-arm-none-eabi |
| 14 | +rm -f /workspaces/gcc-arm-none-eabi.tar.bz2 |
| 15 | +export PATH=/workspaces/gcc-arm-none-eabi/bin:$PATH |
| 16 | + |
| 17 | +# add repository and install tools |
| 18 | +echo -e "[on-create.sh] adding pybricks/ppa" |
| 19 | +sudo add-apt-repository -y ppa:pybricks/ppa |
| 20 | +echo -e "[on-create.sh] installing uncrustify and mtools" |
| 21 | +sudo apt-get -y install uncrustify mtools |
| 22 | + |
| 23 | +# dosfstools >= 4.2 needed, standard repo only has 4.1 |
| 24 | +echo -e "[on-create.sh] downloading and installing dosfstools" |
| 25 | +wget https://github.com/dosfstools/dosfstools/releases/download/v4.2/dosfstools-4.2.tar.gz |
| 26 | +tar -xzf dosfstools-4.2.tar.gz |
| 27 | +cd dosfstools-4.2/ |
| 28 | +./configure |
| 29 | +make -j $(nproc) |
| 30 | +sudo make install |
| 31 | +cd /workspaces |
| 32 | +rm -fr /workspaces/dosfstools-4.2 /workspaces/dosfstools-4.2.tar.gz |
| 33 | + |
| 34 | +# prepare source-code tree |
| 35 | +cd /workspaces/circuitpython/ |
| 36 | +echo -e "[on-create.sh] fetching submodules" |
| 37 | +make fetch-submodules |
| 38 | +echo -e "[on-create.sh] fetching tags" |
| 39 | +git fetch --tags --recurse-submodules=no --shallow-since="2021-07-01" https://github.com/adafruit/circuitpython HEAD |
| 40 | + |
| 41 | +# additional python requirements |
| 42 | +echo -e "[on-create.sh] pip-installing requirements" |
| 43 | +pip install --upgrade -r requirements-dev.txt |
| 44 | +pip install --upgrade -r requirements-doc.txt |
| 45 | + |
| 46 | +# add pre-commit |
| 47 | +echo -e "[on-create.sh] installing pre-commit" |
| 48 | +pre-commit install |
| 49 | + |
| 50 | +# create cross-compiler |
| 51 | +echo -e "[on-create.sh] building mpy-cross" |
| 52 | +make -j $(nproc) -C mpy-cross # time: about 36 sec |
| 53 | + |
| 54 | +# that's it! |
| 55 | +echo -e "[on-create.sh] setup complete" |
| 56 | + |
| 57 | +#commands to actually build CP: |
| 58 | +#cd ports/raspberrypi |
| 59 | +#time make -j $(nproc) BOARD=pimoroni_tufty2040 TRANSLATION=de_DE |
0 commit comments