Browse Source

s3.TUP EXTRA_LDFLAGS autodetection freetz-ng (v0.22.2)

- autodetect use of LDFLAGS when building freetz-ng toolchains
- better commandline output formatting with -l (--libs) or -lv (--libs-version) parameters (use extened ansi background color variables from s3)
- add freetz-ng FNG_SEPARATE_DYNAMIC_LINKER variable to config template
- remove fix ldflags setting from cross toolchain template fos_m72x_mips
- fix some whitespaces
pull/57/head
WXbet 4 years ago
parent
commit
cdd094a2cd
  1. 3
      support/configs/plugin_update_toolchain.config.template
  2. 7
      support/crosstool/templates/fos_m72x_mips
  3. 46
      support/functions/_plugin_update_toolchain

3
support/configs/plugin_update_toolchain.config.template

@ -1,6 +1,6 @@
# List of setup, build and config commands below. All commands are executed in the context of the current user.
# Pay attention to the SEMICOLON at the end of EACH command and the correct quoting (' or ") for or to avoid expansion of variables.
S3TUP_CONFIG_VERSION="27";
S3TUP_CONFIG_VERSION="28";
# Tokens that are replaced automatically:
# @CTNGSOURCE@ crosstool-NG source folder; support/crosstool/crosstool-ng
@ -41,6 +41,7 @@ CTNG_SETUP_tasks+=('make;'); # setup command9
# freetz-NG toolchain build settings
FNG_REPO_URL="https://github.com/Freetz-NG/freetz-ng.git"; # Repository to load freetz-ng from
FNG_SEPARATE_DYNAMIC_LINKER="/usr/lib/freetz/ld-uClibc.so.0";
FNG_CONFIG_tasks=('make menuconfig;'); # config command1
FNG_CONFIG_tasks+=('TPL_SAVE=$($gui --defaultno --output-fd 1 --ok-label "${txt_s3tup_menu_command_label_yes}" --cancel-label "${txt_s3tup_menu_command_label_no}" --colors $bt_ "$title_ - \Z0$pdesc\Zn" --title "-[ ${txt_s3tup_menu_edit_title} ]-" --inputbox "\n${txt_s3tup_menu_edit_text}" 10 55 "@TEMPLATE@") && cp ".config" "$TPL_SAVE";'); # config command2
FNG_BUILD_tasks=('make olddefconfig | tee -a "@LOGFILE@";'); # build command1

7
support/crosstool/templates/fos_m72x_mips

@ -1,7 +1,6 @@
#toolchain template: FRITZ!Box 7590 and other GRX models 7.2x
#toolchain template version: 4
#toolchain template updated: 2020-10-18 21:25:17
#toolchain template ldflags: -Wl,-dynamic-linker,/usr/lib/freetz/ld-uClibc.so.0
#toolchain template: FRITZ!Box 7590|7490 7.2x
#toolchain template version: 5
#toolchain template updated: 2020-10-30 22:25:17
FREETZ_USER_LEVEL_EXPERT=y
FREETZ_SHOW_ADVANCED=y
FREETZ_SHOW_EXPERT=y

46
support/functions/_plugin_update_toolchain

@ -3,7 +3,7 @@
#simplebuild_plugin tcupdate
tcupdate(){
pversion="0.22.1";
pversion="0.22.2";
pname="s3.TUP";
pdesc="Plugin $pname v$pversion";
configname="$configdir/plugin_update_toolchain.config";
@ -15,7 +15,7 @@ tcupdate(){
andksrcdir="$ctdir/android-ndk";
cpus="$(getconf _NPROCESSORS_ONLN)";
[ -f "$workdir/DEVELOPMENT" ] && disable_syscheck="1" && disable_template_versioning="1";
s3_update_required=0;
s3_update_required=1;
CMDTC="$1";
OPTION1="$2";
@ -318,9 +318,9 @@ _integrate_libs(){
done;
};
_create_tc(){
_sz; # Prepare DIALOG settings
_sz; # Prepare DIALOG settings
unset TPL_LIST;
local menu_close libkeys use;
local menu_close libkeys use ldf;
while [ ! $menu_close ]
do
if [ "${#2}" -gt 0 ];then #Force setup call
@ -489,7 +489,6 @@ _create_tc(){
case "$tpl_type" in
"CTNG") #get target from build.log
target=$(sed -n -e '/target = / s/.*\= *//p' "$ctsrcdir/build.log");
use="";
#get CT_BUILD_TOP_DIR aka temporary toolchain build directory from build.log and delete it to save disk space
buildtopdir=$(sed -n -e '/CT_BUILD_TOP_DIR=\// s/.*\= *//p' "$ctsrcdir/build.log");
@ -498,7 +497,8 @@ _create_tc(){
btcbindir=$(grep -i '{ PATH=.*kernel.*' "$logfile" | head -n 1 | awk -F':|"' '{print $2}');
btcdir=$(realpath "$btcbindir/../");
target=$(basename "$btcdir");
use="";
#autodetect LDFLAGS depending on the freetz-ng configuration options
[ $(grep -i '^FREETZ_AVM_PROP_UCLIBC_SEPARATE=y' "$ctsrcdir/.config") ] && ldf="-Wl,-dynamic-linker,${FNG_SEPARATE_DYNAMIC_LINKER}";
#copy toolchain folder
rm -rf "$tcdir/$tpl";
@ -533,8 +533,9 @@ _create_tc(){
props=$(_get_template_properties "$cttpldir/$tpl");
desc=$(echo "$props" | awk -F'^' '{print $1}' | xargs);
cflags=$(echo "$props" | awk -F'^' '{print $3}' | xargs);
ldflags=$(echo "$props" | awk -F'^' '{print $4}' | xargs);
_create_toolchaincfg "$tcdir/$tpl" "$tpl" "$target" "$sysroot" "" "$desc" "" "$dldir/$(decode "$_t1e")$tpl.tar.xz" "yes" "$tpl_type_name" "$use" "$cflags" "$ldflags" "$tpl_type";
[ -z "$ldf" ] && ldf=$(echo "$props" | awk -F'^' '{print $4}' | xargs);
_create_toolchaincfg "$tcdir/$tpl" "$tpl" "$target" "$sysroot" "" "$desc" "" "$dldir/$(decode "$_t1e")$tpl.tar.xz" "yes" "$tpl_type_name" "$use" "$cflags" "$ldf" "$tpl_type";
else
_paktc_timer 10;
fi;
@ -622,7 +623,7 @@ _migrations(){
};
_backup(){
_sz; # Prepare DIALOG settings
_sz; # Prepare DIALOG settings
src=$1;
dest=$2;
newtccfgfile="$tccfgdir/$dest";
@ -642,7 +643,7 @@ _backup(){
[ -f "$newtccfgfile" ] && echo "$dest";
};
_build_library(){
_sz; # Prepare DIALOG settings
_sz; # Prepare DIALOG settings
local desc="$1" libsrcdir="$2" lf="$3"; # Save the first 3 arguments in variables
shift 3; # Shift all 3 arguments to the left (original $1,$2,$3 gets lost)
local tasks=("$@"); # Rebuild the array with rest of arguments
@ -717,7 +718,7 @@ _tpl_editor(){
) 2>&1;
};
_ctng_setup(){
_sz; # Prepare DIALOG settings
_sz; # Prepare DIALOG settings
logfile="$ldir/$(date +%F.%H%M%S)_tup_ctng_setup.log";
unset setuptasks;
(
@ -746,7 +747,7 @@ _ctng_setup(){
) | _log "$logfile" | "$gui" "$st_" "$bt_" "$title_ - \Z0$pdesc\Zn" "--colors" "--title" " -[ ${txt_s3tup_menu_ctng_setup_title} crosstool-NG ]- " "$pb_" "$_lines" "$_cols";
};
_fng_setup(){
_sz; # Prepare DIALOG settings
_sz; # Prepare DIALOG settings
logfile="$ldir/$(date +%F.%H%M%S)_tup_fng_setup.log";
unset setuptasks;
(
@ -776,7 +777,7 @@ _fng_setup(){
) | _log "$logfile" | "$gui" "$st_" "$bt_" "$title_ - \Z0$pdesc\Zn" "--colors" "--title" " -[ ${txt_s3tup_menu_fng_setup_title} Freetz-NG ]- " "$pb_" "$_lines" "$_cols";
};
_andk_setup(){
_sz; # Prepare DIALOG settings
_sz; # Prepare DIALOG settings
logfile="$ldir/$(date +%F.%H%M%S)_tup_andk_setup.log";
unset setuptasks;
(
@ -988,16 +989,16 @@ _get_toolchain_libs(){
};
_list_toolchain_libkeys(){
local tc tcs props pkgconfigdir version key compare libkey libkeys fmt CUR G P R updatable downgradable ADD=11;
#get toolchain list from parameter or from installed ones
[ -z "$1" ] && tcs="${INST_TCLIST[@]}" || tcs="$(echo "$1" | tr ',' '\n' | sort -h)";
for tc in $tcs;
do
if [ -d "$tcdir/$tc" ];then
#print out table header
[ -z "$props" -a -z "$2" ] && printf "\n%-30s %-45s %-30s %s\n" "${txt_tc}" "${txt_s3tup_msg_table_header_libs_col_key}" "${txt_s3tup_msg_table_header_libs_col_update}" "${txt_s3tup_msg_table_header_libs_col_downgrade}"
[ -z "$props" -a -n "$2" ] && printf "\n%-30s %-11s %21s %3s %-12s %-10s %s\n" "${txt_tc}" "${txt_s3tup_msg_table_header_libsversion_col_key}" "${txt_s3tup_msg_table_header_libsversion_col_curversion}" "" "${txt_s3tup_msg_table_header_libsversion_col_newversion}" "${txt_s3tup_msg_table_header_libsversion_col_update}" "${txt_s3tup_msg_table_header_libsversion_col_downgrade}"
[ -z "$props" -a -z "$2" ] && printf "${bk_n}${lg_lb}\n%-30s %-45s %-30s %s${re_}" "${txt_tc}" "${txt_s3tup_msg_table_header_libs_col_key}" "${txt_s3tup_msg_table_header_libs_col_update}" "${txt_s3tup_msg_table_header_libs_col_downgrade}"
[ -z "$props" -a -n "$2" ] && printf "${bk_n}${lg_lb}\n%-30s %-11s %21s %3s %-12s %-10s %s${re_}" "${txt_tc}" "${txt_s3tup_msg_table_header_libsversion_col_key}" "${txt_s3tup_msg_table_header_libsversion_col_curversion}" "" "${txt_s3tup_msg_table_header_libsversion_col_newversion}" "${txt_s3tup_msg_table_header_libsversion_col_update}" "${txt_s3tup_msg_table_header_libsversion_col_downgrade}"
#get toolchain properties
props=$(_get_toolchain_properties "$tc");
pkgconfigdir=$(echo "$props" | awk -F';' '{print $6}' | xargs);
@ -1023,7 +1024,7 @@ _list_toolchain_libkeys(){
#generate comma seperated library key list (if second function parameter is empty)
[ -n "$key" -a -z "$2" ] && libkeys+="${fmt}${key}${re_}," && ((CUR++));
#print out line for each toolchain library (if second function parameter exists)
if [ -n "$key" -a -n "$2" ];then
[ $(($G+$P+$R)) -gt 1 ] && tc="";
@ -1034,8 +1035,9 @@ _list_toolchain_libkeys(){
newversion="${fmt}${newversion::16}${re_}";
[ -z "$update" ] && update="-" || P2=1;
[ -z "$downgrade" ] && downgrade="-";
fmt="%-30s %-$((11+$ADD))b %$((21+$ADD))b %-$((1+$ADD))b %-$((16+$ADD))b %-$((11+$ADD*$P2))b %b\n";
printf "$fmt" "${tc::30}" "$libkey" "$curversion" "$compare" "$newversion" "$update" "$downgrade";
[ -n "$tc" ] && fmt="\n"
fmt="${fmt}%-30s %-$((11+$ADD))b %$((21+$ADD))b %-$((1+$ADD))b %-$((16+$ADD))b %-$((11+$ADD*$P2))b %b\n";
printf "$fmt" "$NL${tc::30}" "$libkey" "$curversion" "$compare" "$newversion" "$update" "$downgrade";
fi;
done;
@ -1047,13 +1049,13 @@ _list_toolchain_libkeys(){
[ "$R" -gt 0 ] && downgradable="${downgradable%?}";
[ -z "$downgradable" ] && downgradable="-";
fmt="%-30s %-$((45+$ADD*$CUR))b %-$((30+$ADD*$P))b %b\n";
fmt="\n%-30s %-$((45+$ADD*$CUR))b %-$((30+$ADD*$P))b %b";
printf "$fmt" "${tc::30}" "${libkeys%?}" "$updatable" "$downgradable";
fi;
fi;
done;
printf "\n";
};
};
_get_toolchain_date(){
local tc_date;
[ -f "$tcdir/$1/build.log.bz2" ] && tc_date="ct-ng.$(date -r "$tcdir/$1/build.log.bz2" "+%F %T")";

Loading…
Cancel
Save