|
|
@ -1,6 +1,6 @@ |
|
|
|
#!/bin/bash |
|
|
|
|
|
|
|
#simplebuild_plugin tcupdate 0.2.0 |
|
|
|
#simplebuild_plugin tcupdate 0.3.0 |
|
|
|
|
|
|
|
tcupdate(){ |
|
|
|
clear; |
|
|
@ -21,22 +21,19 @@ tcupdate(){ |
|
|
|
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}); |
|
|
|
|
|
|
|
"$gui" "$st_" "$bt_" "$title_" "--default-item" "$3" "--cancel-label" "EXIT" "--help-button" "--help-label" "BACKUP" "--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;; |
|
|
|
_toolchain_repair "$(_backup "$tc_info")"; |
|
|
|
tcupdate "" "0" "$tc_info";; |
|
|
|
*) |
|
|
|
tc="$first"; |
|
|
|
tc_menu="1"; |
|
|
|
tc_menu="1";; |
|
|
|
esac; |
|
|
|
else |
|
|
|
tc="$1" |
|
|
@ -56,6 +53,7 @@ tcupdate(){ |
|
|
|
cd "$tcdir/$tc/bin"; |
|
|
|
else |
|
|
|
echo -e "$r_l $txt_error:$y_l $tc$w_l Toolchain $txt_n_installed""$rs_"; |
|
|
|
[ "$1" == "" ] && sleep 2 && tcupdate "" "0" "$tc"; |
|
|
|
_nl; |
|
|
|
exit; |
|
|
|
fi; |
|
|
@ -112,7 +110,7 @@ tcupdate(){ |
|
|
|
libs+=("(${lib[*]@Q})"); |
|
|
|
done; |
|
|
|
|
|
|
|
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_"\ |
|
|
|
opts=$("$gui" "--item-help" "--help-tags" "$st_" "$bt_" "$title_" "--default-item" "$3" "--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[@]}"); |
|
|
|
|
|
|
@ -124,14 +122,14 @@ tcupdate(){ |
|
|
|
libkey=$(echo "$opts" | awk '{printf $2}';); |
|
|
|
|
|
|
|
if [ "$first" == "HELP" ];then |
|
|
|
sp=$(printf '%*s' 90 | tr ' ' '=') |
|
|
|
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" |
|
|
|
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; |
|
|
|
tcupdate $tc $tc_menu $libkey; |
|
|
|
fi; |
|
|
|
|
|
|
|
#BUILD section |
|
|
@ -156,13 +154,56 @@ tcupdate(){ |
|
|
|
|
|
|
|
#Reopen update menu |
|
|
|
if [ ${#opts} -gt 0 ];then |
|
|
|
tcupdate $tc; |
|
|
|
tcupdate $tc $tc_menu $libkey; |
|
|
|
else |
|
|
|
[ "$tc_menu" == "1" ] && tcupdate; |
|
|
|
[ "$tc_menu" == "1" ] && tcupdate "" "0" "$tc"; |
|
|
|
fi; |
|
|
|
|
|
|
|
bye; |
|
|
|
}; |
|
|
|
_backup(){ |
|
|
|
|
|
|
|
_sz; # Prepare DIALOG settings |
|
|
|
nr=$(( $RANDOM % 100 )); |
|
|
|
newtc="$1-$nr"; |
|
|
|
newtccfgfile="$tccfgdir/$newtc"; |
|
|
|
xzfile="$dldir/Toolchain-$newtc.tar.xz"; |
|
|
|
|
|
|
|
( |
|
|
|
#generate xz-file |
|
|
|
XZ_OPT=-e9 tar -cvJf "$xzfile" -C "$tcdir/$1" . |
|
|
|
|
|
|
|
#create new toolchains.cfg file |
|
|
|
cp "$tccfgdir/$1" "$newtccfgfile"; |
|
|
|
|
|
|
|
if [ -f "$newtccfgfile" ];then |
|
|
|
#autodetect toolchain's sysroot folder |
|
|
|
source "$newtccfgfile"; |
|
|
|
cd "$tcdir/$1/bin"; |
|
|
|
compilername="$_compiler""gcc";compilername=$(realpath $compilername); |
|
|
|
sr=$("$compilername" -print-sysroot 2>/dev/null); |
|
|
|
sr=$(realpath -sm "$sr"); |
|
|
|
sysroot=${sr#"$tcdir/$1/"}; |
|
|
|
|
|
|
|
#update toolchains.cfg file |
|
|
|
#_toolchainname |
|
|
|
sed -i "s#.*_toolchainname=.*#_toolchainname=\"$newtc\";#g" "$newtccfgfile"; |
|
|
|
#_description |
|
|
|
sed -i "s#.*_description=.*#_description=\"$_description\";#g" "$newtccfgfile"; |
|
|
|
#_sysroot |
|
|
|
sed -i "s#.*_sysroot=.*#_sysroot=\"$sysroot\";#g" "$newtccfgfile"; |
|
|
|
#_toolchainfilename |
|
|
|
encfile=$(echo -en "$(basename "${xzfile%..*}")" | base64); |
|
|
|
sed -i "s#.*_toolchainfilename=.*#_toolchainfilename=\"$encfile\";#g" "$newtccfgfile"; |
|
|
|
#_md5sum |
|
|
|
cd "$dldir" && md5hash="$(md5sum $(basename "${xzfile%..*}"))"; |
|
|
|
sed -i "s#.*_md5sum=.*#_md5sum=\"$md5hash\";#g" "$newtccfgfile"; |
|
|
|
|
|
|
|
"$gui" "$st_" "$nc_" "$bt_" "$title_" "--textbox" "$newtccfgfile" 30 80; |
|
|
|
fi; |
|
|
|
) | "$gui" "$st_" --colors --title " -[ Backup $1 to $newtc ... ]- " "$pb_" "$_lines" "$_cols"; |
|
|
|
[ -f "$newtccfgfile" ] && echo "$newtc"; |
|
|
|
}; |
|
|
|
_build(){ |
|
|
|
|
|
|
|
_sz; # Prepare DIALOG settings |
|
|
|