|
|
@ -1,23 +1,61 @@ |
|
|
|
#!/bin/bash |
|
|
|
|
|
|
|
#simplebuild_plugin tcupdate 0.1.7 |
|
|
|
#simplebuild_plugin tcupdate 0.2.0 |
|
|
|
|
|
|
|
tcupdate(){ |
|
|
|
clear; |
|
|
|
|
|
|
|
if [ "$1" == "" ];then |
|
|
|
_fill_tc_array; |
|
|
|
IFS="#"; |
|
|
|
unset MENU_OPTIONS;COUNT=0 |
|
|
|
if [ "$systype" == "ok" ];then |
|
|
|
if [ "$tcempty" == "0" ];then |
|
|
|
for i in "${INST_TCLIST[@]}";do |
|
|
|
if [ ! "$i" == "native" ];then |
|
|
|
source "$tccfgdir/$i"; |
|
|
|
MENU_OPTIONS+="$_toolchainname#$_description#"; |
|
|
|
counter; |
|
|
|
fi; |
|
|
|
done; |
|
|
|
fi; |
|
|
|
fi; |
|
|
|
out=$( |
|
|
|
"$gui" "$st_" "$bt_" "$title_" "--cancel-label" "EXIT" "--help-button" "--help-label" "INFO" "--title" "-[ Toolchain $txt_menu ]-" --menu "\nChoose on of the installed toolchains you want to update:\n " "${COUNT+10}" 0 0 ${MENU_OPTIONS}); |
|
|
|
|
|
|
|
IFS=$OIFS; |
|
|
|
[ "$out" == "" ] && bye; |
|
|
|
first=$(echo "$out" | awk '{printf $1}'); |
|
|
|
tc_info=$(echo "$out" | awk '{printf $2}';); |
|
|
|
case $first in |
|
|
|
HELP) |
|
|
|
if [ -f "$tccfgdir/$tc_info" ];then |
|
|
|
source "$tccfgdir/$tc_info"; |
|
|
|
"$gui" "$st_" "$nc_" "$bt_" "$title_" "--msgbox" "$_tc_info" $((_tc_infolines + 5)) 65; |
|
|
|
fi; |
|
|
|
tcupdate;; |
|
|
|
*) |
|
|
|
tc="$first"; |
|
|
|
tc_menu="1"; |
|
|
|
esac; |
|
|
|
else |
|
|
|
tc="$1" |
|
|
|
[ "$2" == "" ] && tc_menu="0" || tc_menu="$2"; |
|
|
|
fi; |
|
|
|
|
|
|
|
#toolchain native not supported |
|
|
|
if [ "$1" == "native" ];then |
|
|
|
echo -e "$r_l $txt_error:$y_l $1$w_l Toolchain library update not supported!""$rs_"; |
|
|
|
if [ "$tc" == "native" ];then |
|
|
|
echo -e "$r_l $txt_error:$y_l $tc$w_l Toolchain library update not supported!""$rs_"; |
|
|
|
_nl; |
|
|
|
exit; |
|
|
|
fi; |
|
|
|
|
|
|
|
#toolchain exists check |
|
|
|
[ -f "$tccfgdir/$1" ] && source "$tccfgdir/$1"; |
|
|
|
if [ -d "$tcdir/$1/bin" ];then |
|
|
|
cd "$tcdir/$1/bin"; |
|
|
|
[ -f "$tccfgdir/$tc" ] && source "$tccfgdir/$tc"; |
|
|
|
if [ -d "$tcdir/$tc/bin" ];then |
|
|
|
cd "$tcdir/$tc/bin"; |
|
|
|
else |
|
|
|
echo -e "$r_l $txt_error:$y_l $1$w_l Toolchain $txt_n_installed""$rs_"; |
|
|
|
echo -e "$r_l $txt_error:$y_l $tc$w_l Toolchain $txt_n_installed""$rs_"; |
|
|
|
_nl; |
|
|
|
exit; |
|
|
|
fi; |
|
|
@ -38,11 +76,12 @@ tcupdate(){ |
|
|
|
ranlibname="$_compiler""ranlib";ranlibname=$(realpath $ranlibname); |
|
|
|
hostname=${_compiler%?}; |
|
|
|
sr=$("$compilername" -print-sysroot 2>/dev/null); |
|
|
|
sr=$(realpath -sm "$sr"); |
|
|
|
if [ ${#sr} -gt ${#tcdir} ];then |
|
|
|
[ -d "$sr/include" ] && cd "$sr" |
|
|
|
[ -d "$sr/usr/include" ] && cd "$sr/usr" |
|
|
|
else |
|
|
|
cd "$tcdir/$1/$_sysroot" |
|
|
|
cd "$tcdir/$tc/$_sysroot" |
|
|
|
fi; |
|
|
|
prefixdir="$PWD" |
|
|
|
pkg=$(find * | grep -m1 "/pkgconfig") && pkgdir="$prefixdir/$pkg"; |
|
|
@ -73,12 +112,29 @@ tcupdate(){ |
|
|
|
libs+=("(${lib[*]@Q})"); |
|
|
|
done; |
|
|
|
|
|
|
|
opts=$("$gui" "--item-help" "$st_" "$bt_" "$title_" --title "-[ Library Update for Toolchain $1 ]-" "$cl_" \ |
|
|
|
opts=$("$gui" "--item-help" "--help-tags" "$st_" "$bt_" "$title_" "--help-button" "--help-label" "INFO" "--cancel-label" "$([ "$tc_menu" == "1" ] && echo "BACK" || echo "EXIT")" --title "-[ Library Update for Toolchain $tc ]-" "$cl_"\ |
|
|
|
"\nSelect all libraries to update in toolchain's SYSROOT folder:\n$prefixdir\n\n library version NEW CURRENT" \ |
|
|
|
"${COUNT+12}" 70 0 "${MENU_OPTIONS[@]}"); |
|
|
|
|
|
|
|
[ $(echo $opts | tr ' ' '\n' | grep -c "SSL_") -gt 1 ] && echo -e $r_l"\n\nPlease select only one SSL version!"$re_ && sleep 3 && tcupdate $1; |
|
|
|
#SSL select check |
|
|
|
[ $(echo $opts | tr ' ' '\n' | grep -c "SSL_") -gt 1 ] && echo -e $r_l"\n\nPlease select only one SSL version!"$re_ && sleep 3 && tcupdate $tc; |
|
|
|
|
|
|
|
#HELP section |
|
|
|
first=$(echo "$opts" | awk '{printf $1}'); |
|
|
|
libkey=$(echo "$opts" | awk '{printf $2}';); |
|
|
|
|
|
|
|
if [ "$first" == "HELP" ];then |
|
|
|
sp=$(printf '%*s' 90 | tr ' ' '=') |
|
|
|
txt=$(cat "$configname" | grep ""$libkey"=\|"$libkey"_"); |
|
|
|
bcd=$(cat "$configname" | grep ""$libkey"_tasks"); |
|
|
|
txt=$(echo -e "Toolchain: $tcdir/$tc\nCompiler: $compilername\nSysroot: $sr\nPrefix: $prefixdir\n$sp\n\nLibrary configuration:\n$txt\n\nBuild command:\n$(_replace_tokens "$(_tidy_tasks "$bcd" "$libkey")")") |
|
|
|
tempfile=$(mktemp) && echo -e "$txt" > "$tempfile" |
|
|
|
"$gui" "$st_" "$nc_" "$bt_" "$title_" "--textbox" "$tempfile" 30 80; |
|
|
|
rm "$tempfile" 2>/dev/null; |
|
|
|
tcupdate $tc $tc_menu; |
|
|
|
fi; |
|
|
|
|
|
|
|
#BUILD section |
|
|
|
icount=$(echo $opts | wc -w);i=0; |
|
|
|
for o in $opts;do |
|
|
|
unset buildtasks; |
|
|
@ -89,13 +145,8 @@ tcupdate(){ |
|
|
|
|
|
|
|
#generate build command list |
|
|
|
declare -a libtasks="${lib[7]}"; #populate tasks array element |
|
|
|
for task in "${libtasks[@]}";do #replace tokens |
|
|
|
task=$(echo $task | sed -e "s#@TOOLCHAIN@#$tcdir/$1#g; \ |
|
|
|
s#@CC@#$compilername#g; \ |
|
|
|
s#@RANLIB@#$ranlibname#g; \ |
|
|
|
s#@PREFIX@#$prefixdir#g; \ |
|
|
|
s#@HOST@#$hostname#g" \ |
|
|
|
); |
|
|
|
for task in "${libtasks[@]}";do |
|
|
|
task=$(_replace_tokens "$task"); #replace tokens |
|
|
|
buildtasks+=("$task"); |
|
|
|
done |
|
|
|
|
|
|
@ -104,12 +155,13 @@ tcupdate(){ |
|
|
|
done; |
|
|
|
|
|
|
|
#Reopen update menu |
|
|
|
[ ${#opts} -gt 0 ] && tcupdate $1; |
|
|
|
if [ ${#opts} -gt 0 ];then |
|
|
|
tcupdate $tc; |
|
|
|
else |
|
|
|
[ "$tc_menu" == "1" ] && tcupdate; |
|
|
|
fi; |
|
|
|
|
|
|
|
clear; |
|
|
|
echo -e "$w_l"; |
|
|
|
s3logo; |
|
|
|
exit; |
|
|
|
bye; |
|
|
|
}; |
|
|
|
_build(){ |
|
|
|
|
|
|
@ -194,6 +246,21 @@ _extract(){ |
|
|
|
done |
|
|
|
exit; |
|
|
|
}; |
|
|
|
_replace_tokens(){ |
|
|
|
echo -e "$1" | sed -e "s#@TOOLCHAIN@#$tcdir/$tc#g; \ |
|
|
|
s#@CC@#$compilername#g; \ |
|
|
|
s#@RANLIB@#$ranlibname#g; \ |
|
|
|
s#@PREFIX@#$prefixdir#g; \ |
|
|
|
s#@HOST@#$hostname#g"; |
|
|
|
}; |
|
|
|
_tidy_tasks(){ |
|
|
|
echo -e "$1" | sed -e "s#$2"_tasks=\(\""##g; \ |
|
|
|
s#$2"_tasks=\(\'"##g; \ |
|
|
|
s#$2"_tasks+=\(\""##g; \ |
|
|
|
s#$2"_tasks+=\(\'"##g; \ |
|
|
|
s#"\"\)\;"##g; \ |
|
|
|
s#"\'\)\;"##g;"; |
|
|
|
}; |
|
|
|
_get_version(){ |
|
|
|
r=""; |
|
|
|
if [ -f "$1" ];then |
|
|
|