source: flair-src/trunk/scripts/flair_compile_all.sh@ 460

Last change on this file since 460 was 369, checked in by Sanahuja Guillaume, 4 years ago

add status notifications

  • Property svn:executable set to *
File size: 1.8 KB
RevLine 
[302]1#!/bin/bash
2NB_THREADS=$(nproc)
3from_scratch=no
4IDE_SCRIPT=cmake_codelite_outofsource.sh
5toolchains=($OECORE_CMAKE_TOOLCHAINS)
6
[369]7
8function notify () {
9 notify=$(which notify-send)
10 if [ "$notify" != "" ]; then
11 notify-send Flair "$1" $2 $3
12 fi
13}
14
15function notify_ok () {
16 notify "$1" -i emblem-default
17}
18
19function notify_ko () {
20 notify "$1" -i error
21}
22
23
[302]24function green_echo () {
25 echo -e "\033[32m$1\033[0m"
26}
27
28function red_echo () {
29 echo -e "\033[31m$1\033[0m"
30}
31
32function 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
40function 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
52sanity_check
53
54printf "Compile all from scratch (flair-build directory will be erased) [Y/n]?"
55read answer
56
57if [ "$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/
62fi
63
64#iterate over available toolchains
65for 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
72done
73
74
75printf "Compile Flair libs documentation [Y/n]?"
76read answer
77
78if [ "$answer" = "" ] || [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
79 $OECORE_HOST_NATIVE_SYSROOT/usr/bin/doxygen $FLAIR_ROOT/flair-src/lib/Doxyfile.in
80fi
81
[369]82notify_ok "finished compilation"
[302]83
84exit 0
Note: See TracBrowser for help on using the repository browser.