1#!/bin/bash 2PICOLIBC=$(realpath $(dirname "$0")/..) 3case "$ARM_TK" in 4 "") 5 echo "Need to set ARM_TK before running $0" 6 exit 1 7 ;; 8esac 9README="$ARM_TK/share/doc/arm-none-eabi/readme.txt" 10if [ ! -f "$README" ]; then 11 echo "ARM_TK '$ARM_TK' doesn't appear valid?" 12 exit 1 13fi 14TK_VERSION=$(head -n 1 "$README" | awk '{ print $NF; }') 15PICOLIBC_VERSION=$(cd "$PICOLIBC" && git describe) 16echo Toolkit "$ARM_TK" 17echo Toolkit version "$TK_VERSION" 18echo Picolibc "$PICOLIBC" 19echo Picolibc version "$PICOLIBC_VERSION" 20 21case "$TK_VERSION" in 22 [12]*) 23 ;; 24 *) 25 echo "Toolkit version '$TK_VERSION' doesn't appear valid?" 26 exit 1 27 ;; 28esac 29 30export PATH=$ARM_TK/bin:$PATH 31 32MINSIZE_DIR="$PICOLIBC"/builds/build-arm-tk-minsize 33RELEASE_DIR="$PICOLIBC"/builds/build-arm-tk-release 34export DESTDIR="$PICOLIBC"/builds/dist 35 36rm -r "$MINSIZE_DIR" 37rm -r "$RELEASE_DIR" 38rm -r "$DESTDIR"/"$ARM_TK" 39 40mkdir -p "$MINSIZE_DIR" "$RELEASE_DIR" "$DESTDIR" 41 42set -e 43 44 45echo '###################################' 46echo '####' ../../scripts/do-arm-configure -Dsysroot-install=true --buildtype=minsize 47echo '###################################' 48 49cd "$MINSIZE_DIR" 50../../scripts/do-arm-configure -Dsysroot-install=true --buildtype=minsize 51ninja test install 52 53echo '###################################' 54echo '####' ../../scripts/do-arm-configure -Dsysroot-install=true -Dbuild-type-subdir=release --buildtype=release 55echo '###################################' 56 57cd "$RELEASE_DIR" 58../../scripts/do-arm-configure -Dsysroot-install=true -Dbuild-type-subdir=release --buildtype=release 59ninja test install 60 61cd "$DESTDIR"/"$ARM_TK" 62 63ZIP="$DESTDIR"/picolibc-"$PICOLIBC_VERSION"-"$TK_VERSION".zip 64 65rm "$ZIP" 66 67zip -r "$ZIP" . 68