[302] | 1 | #!/bin/bash
|
---|
| 2 | NB_THREADS=$(nproc)
|
---|
| 3 | from_scratch=no
|
---|
| 4 | IDE_SCRIPT=cmake_codelite_outofsource.sh
|
---|
| 5 | toolchains=($OECORE_CMAKE_TOOLCHAINS)
|
---|
| 6 |
|
---|
[369] | 7 |
|
---|
| 8 | function notify () {
|
---|
| 9 | notify=$(which notify-send)
|
---|
| 10 | if [ "$notify" != "" ]; then
|
---|
| 11 | notify-send Flair "$1" $2 $3
|
---|
| 12 | fi
|
---|
| 13 | }
|
---|
| 14 |
|
---|
| 15 | function notify_ok () {
|
---|
| 16 | notify "$1" -i emblem-default
|
---|
| 17 | }
|
---|
| 18 |
|
---|
| 19 | function notify_ko () {
|
---|
| 20 | notify "$1" -i error
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 |
|
---|
[302] | 24 | function green_echo () {
|
---|
| 25 | echo -e "\033[32m$1\033[0m"
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | function red_echo () {
|
---|
| 29 | echo -e "\033[31m$1\033[0m"
|
---|
| 30 | }
|
---|
| 31 |
|
---|
| 32 | function check_error () {
|
---|
| 33 | if [ "$?" != "0" ]; then
|
---|
| 34 | red_echo "Error, exiting"
|
---|
[369] | 35 | notify_ko "error while compiling"
|
---|
[302] | 36 | exit 1
|
---|
| 37 | fi
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | function sanity_check () {
|
---|
| 41 | if [ -z $FLAIR_ROOT ]; then
|
---|
| 42 | red_echo "You must set the FLAIR_ROOT environement variable"
|
---|
| 43 | exit 1
|
---|
| 44 | fi
|
---|
| 45 |
|
---|
| 46 | if ! [ -d $FLAIR_ROOT/flair-build ]; then
|
---|
| 47 | green_echo "Creating $FLAIR_ROOT/flair-build directory"
|
---|
| 48 | mkdir -p $FLAIR_ROOT/flair-build
|
---|
| 49 | fi
|
---|
| 50 | }
|
---|
| 51 |
|
---|
| 52 | sanity_check
|
---|
| 53 |
|
---|
| 54 | printf "Compile all from scratch (flair-build directory will be erased) [Y/n]?"
|
---|
| 55 | read answer
|
---|
| 56 |
|
---|
| 57 | if [ "$answer" = "" ] || [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
|
---|
[369] | 58 | notify "started configuration"
|
---|
| 59 | rm -rf $FLAIR_ROOT/flair-build/*
|
---|
[302] | 60 | cd $FLAIR_ROOT/flair-build
|
---|
| 61 | $FLAIR_ROOT/flair-src/scripts/$IDE_SCRIPT $FLAIR_ROOT/flair-src/
|
---|
| 62 | fi
|
---|
| 63 |
|
---|
| 64 | #iterate over available toolchains
|
---|
| 65 | for arch in ${toolchains[@]}; do
|
---|
| 66 | green_echo "Compiling and installing for $arch"
|
---|
[369] | 67 | notify "compiling and installing for $arch"
|
---|
[302] | 68 | cd $FLAIR_ROOT/flair-build/build_$arch
|
---|
| 69 | make -j$NB_THREADS
|
---|
| 70 | check_error
|
---|
| 71 | make install
|
---|
| 72 | done
|
---|
| 73 |
|
---|
| 74 |
|
---|
| 75 | printf "Compile Flair libs documentation [Y/n]?"
|
---|
| 76 | read answer
|
---|
| 77 |
|
---|
| 78 | if [ "$answer" = "" ] || [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
|
---|
| 79 | $OECORE_HOST_NATIVE_SYSROOT/usr/bin/doxygen $FLAIR_ROOT/flair-src/lib/Doxyfile.in
|
---|
| 80 | fi
|
---|
| 81 |
|
---|
[369] | 82 | notify_ok "finished compilation"
|
---|
[302] | 83 |
|
---|
| 84 | exit 0
|
---|