From dac94f79fa909e66c0d40e1093d62b4e9c48db51 Mon Sep 17 00:00:00 2001 From: WXbet <57314510+WXbet@users.noreply.github.com> Date: Thu, 24 Dec 2020 12:23:00 +0100 Subject: [PATCH] s3.TUP Add compiler capability check (v0.23.0) - new compiler capability check to better preselect the correct library - colorize incompatible libraries in Library Update Menu - new config option _checkcc (e.g. LIB_USB_checkcc) to check compiler capabilities - updated language files --- .../plugin_update_toolchain.config.template | 3 +- support/functions/_plugin_update_toolchain | 29 +++++++++++++++---- support/translation/bg | 1 + support/translation/de | 1 + support/translation/en | 1 + support/translation/es | 1 + support/translation/fr | 1 + support/translation/it | 1 + support/translation/nl | 1 + support/translation/pl | 1 + support/translation/pt | 1 + support/translation/tr | 5 ++-- 12 files changed, 38 insertions(+), 8 deletions(-) diff --git a/support/configs/plugin_update_toolchain.config.template b/support/configs/plugin_update_toolchain.config.template index 4f22f92..e7c1eb7 100644 --- a/support/configs/plugin_update_toolchain.config.template +++ b/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="31"; +S3TUP_CONFIG_VERSION="32"; # Tokens that are replaced automatically: # @CTNGSOURCE@ crosstool-NG source folder; support/crosstool/crosstool-ng @@ -214,6 +214,7 @@ LIB_USB_beta="0"; LIB_USB_name="libusb"; LIB_USB_version="$(curl --silent "https://api.github.com/repos/libusb/libusb/releases/latest" | jq -r '.tag_name' | cut -c 2-)"; LIB_USB_check="libusb-1.0.pc $(printf "$LIB_USB_version")"; +LIB_USB_checkcc="c11"; LIB_USB_url="$(curl --silent "https://api.github.com/repos/libusb/libusb/releases/latest" | jq -r '.assets[2].browser_download_url')"; LIB_USB_tasks=('export TOOLCHAIN=@TOOLCHAIN@;'); LIB_USB_tasks+=('export PATH="$TOOLCHAIN/bin:$PATH";'); diff --git a/support/functions/_plugin_update_toolchain b/support/functions/_plugin_update_toolchain index 7fba8e9..cc4f6bc 100644 --- a/support/functions/_plugin_update_toolchain +++ b/support/functions/_plugin_update_toolchain @@ -3,7 +3,7 @@ #simplebuild_plugin tcupdate tcupdate(){ - pversion="0.22.6"; + pversion="0.23.0"; pname="s3.TUP"; pdesc="Plugin $pname v$pversion"; configname="$configdir/plugin_update_toolchain.config"; @@ -210,6 +210,7 @@ _integrate_libs(){ libcheck="$libkey"_check;libcheck="${!libcheck}"; libversioncheck=$(echo "$libcheck" | awk '{printf $2}') libcheck=$(echo "$libcheck" | awk '{printf $1}') + libcheckcc="$libkey"_checkcc;libcheckcc="${!libcheckcc}"; liburl="$libkey"_url;liburl="${!liburl}"; libtasks="$libkey"_tasks[@];libtasks=("${!libtasks}"); @@ -229,13 +230,15 @@ _integrate_libs(){ done; #Preselection and formatting + [ -n "$libcheckcc" ] && ! _check_compiler_capability "$libcheckcc" && libdescfmt="\Zr\Z1" || libdescfmt=""; #check compiler capabilities + [ ${#libdescfmt} -gt 0 ] && txthint="\n\Zr\Z1${txt_s3tup_menu_library_notsupported}\Zn"; [ "$libversioncompare" == "=" ] && libtxtfmt="\Z2" || libtxtfmt=""; [ "$libversioncompare" == "<" ] && libtxtfmt="\Z1"; [ "$libversioncompare" == ">" ] && [ "${#libversioncurrent}" -gt 0 ] && libselected="on" && libtxtfmt="\Z5" || libselected="off"; [ "$libcheckfile" == "$libselectedflag" ] && libselected="off"; libselectedflag="$libcheckfile"; - MENU_OPTIONS+=("$libkey" "${libdesc}$(printf '%*s' $((24-${#libdesc})))${libtxtfmt}$([ $libversioncurrent ] && echo $libversioncompare) $(echo $libversioncurrent | sed -e 's/^$/ ---/g')\Zn" "$(echo $libselected)" "$([ $libname ] && echo "${libdesc}: ${liburl}")");counter; + MENU_OPTIONS+=("$libkey" "${libdescfmt}${libdesc}\Zn$(printf '%*s' $((24-${#libdesc})))${libtxtfmt}$([ $libversioncurrent ] && echo $libversioncompare) $(echo $libversioncurrent | sed -e 's/^$/ ---/g')\Zn" "$(echo $libselected)" "$([ $libname ] && echo "${libdesc}: ${liburl}")");counter; # 0 key 1 desc 2 version 3 checkversion 4 checkfile 5 current version 6 url 7 tasks array lib=("$libkey" "$libname" "$libversion" "$libversioncheck" "$libcheck" "$libversioncurrent" "$liburl" "($(printf " %q" "${libtasks[@]}"))"); @@ -249,7 +252,7 @@ _integrate_libs(){ else clear;clear; opts=$("$gui" "--item-help" "--help-tags" "$st_" "$bt_" "$title_ - \Z0$pdesc\Zn" "--colors" "--default-item" "$lkey" "--ok-label" "${txt_s3tup_menu_command_label_start}" "--help-button" "--help-label" "${txt_s3tup_menu_command_label_info}" "--cancel-label" "$([ ! "$3" -gt 0 ] && echo "${txt_s3tup_menu_command_label_exit}" || echo "${txt_s3tup_menu_command_label_back}")" "--title" "-[ ${txt_s3tup_menu_library_title} - \Z2$tc\Zn ]-" "$cl_"\ - "\n${txt_s3tup_menu_library_text1}\n$prefixdir\n\n${txt_s3tup_menu_library_text2}" \ + "\n${txt_s3tup_menu_library_text1}\n\Z2$prefixdir\Zn${txthint}\n\n${txt_s3tup_menu_library_text2}" \ 0 0 "$COUNT" "${MENU_OPTIONS[@]}"); ret="$?" fi; @@ -972,11 +975,15 @@ _get_toolchain_libs(){ [ "${!key}" == "0" ] && continue; libcheck="$key"_check;libcheck="${!libcheck}"; libchecklib="$key"_checklib;libchecklib="${!libchecklib}"; + libcheckcc="$key"_checkcc;libcheckcc="${!libcheckcc}"; libversion="$key"_version;libversion="${!libversion}"; libversioncompare=$(_compare_version $libversion $version); if [[ "$pkg $version" =~ ^${libcheck}.* ]];then #regex match, don't quote the right side - if [ -n "$libchecklib" -a -f "$pkgconfigdir/../$libchecklib" -o -z "$libchecklib" ];then - libs+="$pkg\|$version\|$key\|$libversion\|$libversioncompare\|$name;"; + if [ -n "$libchecklib" -a -f "$pkgconfigdir/../$libchecklib" -o -z "$libchecklib" ];then #check existance of special libs + if [ -n "$libcheckcc" ] && _check_compiler_capability "$libcheckcc" || [ -z "$libcheckcc" ];then #check compiler capabilities + libs+="$pkg\|$version\|$key\|$libversion\|$libversioncompare\|$name;"; + break; + fi; fi; fi; done; @@ -1288,6 +1295,18 @@ _check_config(){ return 1; fi; }; +_check_compiler_capability(){ + case "$1" in + "c11") #checking if $CC supports -std=c11 + CFLAGS="-std=c11"; + echo "_Thread_local int x; int main(){x = 42; ; return 0;}" | "$compilername" -x c -o "/tmp/cc_cap_c11.chk" - >/dev/null 2>&1; + ret=$?; + [ -f "/tmp/cc_cap_c11.chk" ] && rm "/tmp/cc_cap_c11.chk"; + unset CFLAGS;; + *) ret=1; + esac; + return $ret; +}; _change_config(){ nok=1; [[ ! $2 =~ "(" ]] && [[ ! $2 =~ ")" ]] && qte="\"" || qte=""; #no quotes if value contains parentheses diff --git a/support/translation/bg b/support/translation/bg index 7b57f9d..0af6771 100644 --- a/support/translation/bg +++ b/support/translation/bg @@ -211,6 +211,7 @@ txt_s3tup_menu_toolchain_config="конфиг файл:" txt_s3tup_menu_library_title="${txt_lib} Меню опресняване" txt_s3tup_menu_library_text1="Изберете всички библиотеки да опресните в SYSROOT папката на ${txt_tc}:" txt_s3tup_menu_library_text2=" ${txt_lib} версия NEW CURRENT" #56 знака +txt_s3tup_menu_library_notsupported="${txt_lib} is not supported due to missing compiler capabilities!" txt_s3tup_menu_library_notfound="няма открити библиотеки" txt_s3tup_menu_library_wrong_selection="Не интегрирайте същите библиотеки с различна версия!" diff --git a/support/translation/de b/support/translation/de index f721e77..a5fee56 100644 --- a/support/translation/de +++ b/support/translation/de @@ -219,6 +219,7 @@ txt_s3tup_menu_toolchain_config="Konfigurationsdatei:" txt_s3tup_menu_library_title="${txt_lib} Aktualisierung Menü" txt_s3tup_menu_library_text1="Wählen Sie alle zu aktualisierenden ${txt_lib}en im SYSROOT-Verzeichnis der ${txt_tc} aus:" txt_s3tup_menu_library_text2=" ${txt_lib} Version NEU AKTUELL" #56 chars +txt_s3tup_menu_library_notsupported="${txt_lib} wird aufgrund fehlender Compiler-Funktionen nicht unterstützt!" txt_s3tup_menu_library_notfound="Keine ${txt_lib}en gefunden" txt_s3tup_menu_library_wrong_selection="Integrieren Sie nicht dieselbe Bibliothek mit verschiedenen Versionen!" diff --git a/support/translation/en b/support/translation/en index 83a5b48..2ccc8c8 100644 --- a/support/translation/en +++ b/support/translation/en @@ -210,6 +210,7 @@ txt_s3tup_menu_toolchain_config="config file:" txt_s3tup_menu_library_title="${txt_lib} Update Menu" txt_s3tup_menu_library_text1="Select all libraries to update in ${txt_tc,,}'s SYSROOT folder:" txt_s3tup_menu_library_text2=" ${txt_lib,,} version NEW CURRENT" #56 chars +txt_s3tup_menu_library_notsupported="${txt_lib} is not supported due to missing compiler capabilities!" txt_s3tup_menu_library_notfound="no libraries found" txt_s3tup_menu_library_wrong_selection="Don't integrate the same library with different versions!" diff --git a/support/translation/es b/support/translation/es index af19d68..74cd59e 100644 --- a/support/translation/es +++ b/support/translation/es @@ -198,6 +198,7 @@ txt_s3tup_menu_toolchain_config="archivo config:" txt_s3tup_menu_library_title="${txt_lib} Menu Actualización" txt_s3tup_menu_library_text1="Escoge todas las librerías a actualizar en la carpeta SYSROOT de ${txt_tc,,}:" txt_s3tup_menu_library_text2=" ${txt_lib,,} versión NUEVA ACTUAL" #56 chars +txt_s3tup_menu_library_notsupported="${txt_lib} is not supported due to missing compiler capabilities!" txt_s3tup_menu_library_notfound="no se han encontrado librerías" txt_s3tup_menu_library_wrong_selection="No integres la misma librería en diferentes versiones!" diff --git a/support/translation/fr b/support/translation/fr index 57d9c70..7347b3e 100644 --- a/support/translation/fr +++ b/support/translation/fr @@ -250,6 +250,7 @@ txt_s3tup_menu_toolchain_config="config file:" txt_s3tup_menu_library_title="${txt_lib} Update Menu" txt_s3tup_menu_library_text1="Select all libraries to update in ${txt_tc,,}'s SYSROOT folder:" txt_s3tup_menu_library_text2=" ${txt_lib,,} version NEW CURRENT" #56 chars +txt_s3tup_menu_library_notsupported="${txt_lib} is not supported due to missing compiler capabilities!" txt_s3tup_menu_library_notfound="no libraries found" txt_s3tup_menu_library_wrong_selection="Don't integrate the same library with different versions!" diff --git a/support/translation/it b/support/translation/it index feb1997..95a26df 100644 --- a/support/translation/it +++ b/support/translation/it @@ -277,6 +277,7 @@ txt_s3tup_menu_toolchain_config="file di configurazione:" txt_s3tup_menu_library_title="${txt_lib} Menu di aggiornamento" txt_s3tup_menu_library_text1="Seleziona tutte le librerie in cui aggiornare la cartella SYSROOT ${txt_tc}:" txt_s3tup_menu_library_text2=" ${txt_lib} versione nuova ATTUALE" #56 chars +txt_s3tup_menu_library_notsupported="${txt_lib} is not supported due to missing compiler capabilities!" txt_s3tup_menu_library_notfound="nessuna libreria trovata" txt_s3tup_menu_library_wrong_selection="Non integrare la stessa libreria con versioni differenti!" diff --git a/support/translation/nl b/support/translation/nl index 466cb42..2d02be5 100644 --- a/support/translation/nl +++ b/support/translation/nl @@ -213,6 +213,7 @@ txt_s3tup_menu_toolchain_config="config file:" txt_s3tup_menu_library_title="${txt_lib} Update Menu" txt_s3tup_menu_library_text1="Select all libraries to update in ${txt_tc,,}'s SYSROOT folder:" txt_s3tup_menu_library_text2=" ${txt_lib,,} version NEW CURRENT" #56 chars +txt_s3tup_menu_library_notsupported="${txt_lib} is not supported due to missing compiler capabilities!" txt_s3tup_menu_library_notfound="no libraries found" txt_s3tup_menu_library_wrong_selection="Don't integrate the same library with different versions!" diff --git a/support/translation/pl b/support/translation/pl index acb79a1..d70bdb2 100644 --- a/support/translation/pl +++ b/support/translation/pl @@ -213,6 +213,7 @@ txt_s3tup_menu_toolchain_config="config file:" txt_s3tup_menu_library_title="${txt_lib} Update Menu" txt_s3tup_menu_library_text1="Select all libraries to update in ${txt_tc,,}'s SYSROOT folder:" txt_s3tup_menu_library_text2=" ${txt_lib,,} version NEW CURRENT" #56 chars +txt_s3tup_menu_library_notsupported="${txt_lib} is not supported due to missing compiler capabilities!" txt_s3tup_menu_library_notfound="no libraries found" txt_s3tup_menu_library_wrong_selection="Don't integrate the same library with different versions!" diff --git a/support/translation/pt b/support/translation/pt index 8791f74..14b79f4 100644 --- a/support/translation/pt +++ b/support/translation/pt @@ -250,6 +250,7 @@ txt_s3tup_menu_toolchain_config="config file:" txt_s3tup_menu_library_title="${txt_lib} Update Menu" txt_s3tup_menu_library_text1="Select all libraries to update in ${txt_tc,,}'s SYSROOT folder:" txt_s3tup_menu_library_text2=" ${txt_lib,,} version NEW CURRENT" #56 chars +txt_s3tup_menu_library_notsupported="${txt_lib} is not supported due to missing compiler capabilities!" txt_s3tup_menu_library_notfound="no libraries found" txt_s3tup_menu_library_wrong_selection="Don't integrate the same library with different versions!" diff --git a/support/translation/tr b/support/translation/tr index 8bf3fa4..7abee89 100644 --- a/support/translation/tr +++ b/support/translation/tr @@ -88,8 +88,8 @@ txt_module_configure="oscam modüllerini seç"; txt_bmenu_use="USE_değişkenler "; txt_bmenu_build="şimdi oscam oluştur"; txt_bmenu_config="oscam/build yapılandırma"; -txt_bmenu_update="update ${txt_lib}"; -txt_bmenu_backup="backup ${txt_tc}"; +txt_bmenu_update="update ${txt_lib}" +txt_bmenu_backup="backup ${txt_tc" txt_bmenu_profile="mevcut $txt_profile ile yükle"; txt_bmenus_profile="$txt_profile $txt_save et"; txt_bmenu_log="göster lastbuild.log"; @@ -216,6 +216,7 @@ txt_s3tup_menu_toolchain_config="Yapılandırma dosyası:" txt_s3tup_menu_library_title="${txt_lib} Güncelleme menüsü" txt_s3tup_menu_library_text1="Güncellenecek icin hepsini seçiniz ${txt_lib}en SYSROOT kayıt defteri içinde ${txt_tc} bul:" txt_s3tup_menu_library_text2=" ${txt_lib} Version yeni MEVCUT" #56 chars +txt_s3tup_menu_library_notsupported="${txt_lib} is not supported due to missing compiler capabilities!" txt_s3tup_menu_library_notfound="yok ${txt_lib}en bulundu" txt_s3tup_menu_library_wrong_selection="Don't integrate the same library with different versions!"