Browse Source

cleanup _gui_build

pull/16/head
gorgone 5 years ago
parent
commit
755dc727de
  1. 12
      support/functions/_compress
  2. 197
      support/functions/_gui_build

12
support/functions/_compress

@ -31,11 +31,11 @@ compress_cam_gui(){
e2="$(echo "$erg"| awk '{printf("%4.2fk\n", $2 /1024)}')" e2="$(echo "$erg"| awk '{printf("%4.2fk\n", $2 /1024)}')"
e3="$(echo "$erg"| awk '{print $3}')" e3="$(echo "$erg"| awk '{print $3}')"
echo -e "\n echo -en "
$txt_compress1\t= $e1\n $txt_compress1\t= $e1
$txt_compress2\t= $e2\n $txt_compress2\t= $e2
$txt_compress3\t= $e3" $txt_compress3\t= $e3"
}; }
tar_cam_gui(){ tar_cam_gui(){
cd "$bdir" cd "$bdir"
@ -48,10 +48,10 @@ tar_cam_gui(){
then then
rm -rf "$adir/$1.tar.gz" rm -rf "$adir/$1.tar.gz"
mv -f "$1.tar.gz" "$adir" mv -f "$1.tar.gz" "$adir"
printf "\n $1.tar.gz\n moved to $workdir/archive\n" printf "\n $1.tar.gz\n $txt_to\n $workdir/archive\n"
else else
mv -f "$1.tar.gz" "$adir" mv -f "$1.tar.gz" "$adir"
printf "\n $1.tar.gz\n moved to $workdir/archive\n" printf "\n $1.tar.gz\n $txt_to\n $workdir/archive\n"
fi fi
else else
printf "\nerror\n no $1.tar.gz\n created\n" printf "\nerror\n no $1.tar.gz\n created\n"

197
support/functions/_gui_build

@ -3,116 +3,149 @@
_gui_build(){ _gui_build(){
#init #init
oc_size=${#_oscamconfdir_custom}; oc_size=${#_oscamconfdir_custom}
[ "$oc_size" -gt "4" ] && _oscamconfdir_default="$_oscamconfdir_custom"; [ "$oc_size" -gt "4" ] && _oscamconfdir_default="$_oscamconfdir_custom"
if [ "$_toolchainname" == "native" ];then if [ "$_toolchainname" == "native" ]
log_name="$(date +%F).$(date +%X).$(hostname).log"; then
log_name="$(date +%F).$(date +%X).$(hostname).log"
else else
log_name="$(date +%F).$(date +%X).$_toolchainname.log"; log_name="$(date +%F).$(date +%X).$_toolchainname.log"
fi; fi
ologo >"$ldir/$log_name"; ologo >"$ldir/$log_name"
[ -f "$configdir/max_cpus" ] && cpus="$(cat "$configdir/max_cpus")" || cpus="$(CPUS)"; [ -f "$configdir/max_cpus" ] && cpus="$(cat "$configdir/max_cpus")" || cpus="$(CPUS)"
CROSS="$tcdir/$_toolchainname/bin/$_compiler";
[ "$_stagingdir" == "1" ] && export STAGING_DIR="$tcdir/$_toolchainname"; CROSS="$tcdir/$_toolchainname/bin/$_compiler"
[ -f "$configdir/compiler_option" ] && co=$(cat "$configdir/compiler_option") || co="-O2";
[ "$_stagingdir" == "1" ] && export STAGING_DIR="$tcdir/$_toolchainname"
[ -f "$configdir/compiler_option" ] && co=$(cat "$configdir/compiler_option") || co="-O2"
#make clean #make clean
cd "$svndir"; cd "$svndir"
make distclean > /dev/null 2>&1; make distclean > /dev/null 2>&1
USESTRING_=''; USESTRING_=''
#do use_vars #do use_vars
for e2 in $USESTRING;do for e2 in $USESTRING
[ "USE_$e2" == "USE_PATCH" ] && _apply_menupatch;is_blocked=0; do
for e1 in $_block;do [ "USE_$e2" == "USE_PATCH" ] && _apply_menupatch
if [ "$e1" == "USE_$e2" ];then is_blocked=0
is_blocked=1;
[ "USE_$e2" == "USE_LIBUSB" ] && silent=$(./config.sh -D CARDREADER_SMARGO); for e1 in $_block
fi; do
done;
[ "$is_blocked" == "0" ] && _us="USE_$e2 $_us"; if [ "$e1" == "USE_$e2" ]
done; then
is_blocked=1
for e in $_us;do [ "USE_$e2" == "USE_LIBUSB" ] && silent=$(./config.sh -D CARDREADER_SMARGO)
if [ ! "$e" == "USE_TARGZ" ] && [ ! "$e" == "USE_COMPRESS" ] && [ ! "$e" == "USE_PATCH" ];then fi
USESTRING_="$e=1 $USESTRING_";
fi; done
done; [ "$is_blocked" == "0" ] && _us="USE_$e2 $_us"
done
if [ "${USE_vars[USE_PCSC]}" == "USE_PCSC=1" ];then
_pcsc="-pcsc" ; for e in $_us
do
if [ ! "$e" == "USE_TARGZ" ] && [ ! "$e" == "USE_COMPRESS" ] && [ ! "$e" == "USE_PATCH" ]
then
USESTRING_="$e=1 $USESTRING_"
fi
done
if [ "${USE_vars[USE_PCSC]}" == "USE_PCSC=1" ]
then
_pcsc="-pcsc"
else else
_pcsc=; _pcsc=
fi; fi
if [ "${USE_vars[USE_LIBUSB]}" == "USE_LIBUSB=1" ];then
_usb="-libusb"; if [ "${USE_vars[USE_LIBUSB]}" == "USE_LIBUSB=1" ]
then
_usb="-libusb"
else else
_usb=; _usb=
fi; fi
USESTRING_=${USE_vars[@]};
USESTRING_=${USE_vars[@]}
#todo add switch for verbose #todo add switch for verbose
_generate_oscam_name "$_toolchainname"; _generate_oscam_name "$_toolchainname"
targztmp="$(mktemp)"; targztmp="$(mktemp)"
if [ ! "${USE_vars[USE_TARGZ]}" == "USE_TARGZ=1" ];then
s3cfg_vars[USE_TARGZ]=0; if [ ! "${USE_vars[USE_TARGZ]}" == "USE_TARGZ=1" ]
fi; then
check_smargo; s3cfg_vars[USE_TARGZ]=0
fi
check_smargo
#build #build
_sz; _sz
(ologo; _nl; (ologo; _nl
timer_start; timer_start
make -j"$cpus" \ make -j"$cpus" \
"CONF_DIR=$_oscamconfdir_default" "OSCAM_BIN=$bdir/$oscam_name" "CC_OPTS=$co $cc_opts" "CC_WARN=$cc_warn" "CROSS=$CROSS" $stapivar $USESTRING_ 2>&1 \ "CONF_DIR=$_oscamconfdir_default" "OSCAM_BIN=$bdir/$oscam_name" "CC_OPTS=$co $cc_opts" "CC_WARN=$cc_warn" "CROSS=$CROSS" $stapivar $USESTRING_ 2>&1 \
|tee "$ldir/$log_name" \ |tee "$ldir/$log_name" \
|grep --line-buffered -v 'BFD\|^/' \ |grep --line-buffered -v 'BFD\|^/' \
|grep --line-buffered '^CC\|^GEN\|UseFlags\| CONF_DIR =\|Binary\|LINK\|STRIP\|BUILD\|Addons\|Protocols\|Readers\|CardRdrs\|^/' \ |grep --line-buffered '^CC\|^GEN\|UseFlags\| CONF_DIR =\|Binary\|LINK\|STRIP\|BUILD\|Addons\|Protocols\|Readers\|CardRdrs\|^/' \
|sed -u "s/^|/ |/g;s/^LINK/ LINK >/g;s/^STRIP/ STRIP >/g;s/^CC\|^BUILD/ BUILD >/g;s/^GEN/ GEN >/g;s/WEBIF_//g;s/WITH_//g;s/MODULE_//g;s/CS_//g;s/HAVE_//g;s/_CHARSETS//g;s/CW_CYCLE_CHECK/CWCC/g;s/SUPPORT//g;" |sed -u "s/^|/ |/g;s/^LINK/ | LINK >/g;s/^STRIP/ | STRIP >/g;s/^CC\|^BUILD/ | BUILD >/g;s/^GEN/ | GEN >/g;s/WEBIF_//g;s/WITH_//g;s/MODULE_//g;s/CS_//g;s/HAVE_//g;s/_CHARSETS//g;s/CW_CYCLE_CHECK/CWCC/g;s/SUPPORT//g;"
timer_stop; timer_stop
timer_calc; timer_calc
#save list_smargo #save list_smargo
cd "$svndir/Distribution"; cd "$svndir/Distribution"
lsmn="$(ls list_smargo* 2> /dev/null)"; lsmn="$(ls list_smargo* 2> /dev/null)"
if [ "${s3cfg_vars[SAVE_LISTSMARGO]}" == "1" ] && [ -f "$svndir/Distribution/$lsmn" ];then
if [ "$_toolchainname" == "native" ];then if [ "${s3cfg_vars[SAVE_LISTSMARGO]}" == "1" ] && [ -f "$svndir/Distribution/$lsmn" ]
echo -e "SAVE\t$lsmn $txt_as oscam-svn$(REVISION)-$(hostname)-list_smargo"| tee -a "$ldir/$log_name"; then
mv -f "$lsmn" "$bdir/oscam-svn$(REVISION)-$(hostname)-list_smargo";
echo "oscam-svn$(REVISION)-$(hostname)-list_smargo" >"$targztmp"; if [ "$_toolchainname" == "native" ]
then
printf "SAVE\t$lsmn $txt_as oscam-svn$(REVISION)-$(hostname)-list_smargo"| tee -a "$ldir/$log_name"
mv -f "$lsmn" "$bdir/oscam-svn$(REVISION)-$(hostname)-list_smargo"
printf "oscam-svn$(REVISION)-$(hostname)-list_smargo" >"$targztmp"
else else
echo -e "SAVE\t$lsmn $txt_as oscam-svn$(REVISION)-$_toolchainname-list_smargo"|tee -a "$ldir/$log_name"; printf -e "SAVE\t$lsmn $txt_as oscam-svn$(REVISION)-$_toolchainname-list_smargo"|tee -a "$ldir/$log_name"
mv -f "$lsmn" "$bdir/oscam-svn$(REVISION)-$_toolchainname-list_smargo"; mv -f "$lsmn" "$bdir/oscam-svn$(REVISION)-$_toolchainname-list_smargo"
echo "oscam-svn$(REVISION)-$_toolchainname-list_smargo" >"$targztmp"; printf "oscam-svn$(REVISION)-$_toolchainname-list_smargo" >"$targztmp\n"
fi; fi
fi;
fi
#show buildtime #show buildtime
echo -e "\n TIME\t[ $txt_buildtime $((Tcalc / 60)) min(s) $((Tcalc % 60)) secs ]"| tee -a "$ldir/$log_name";sleep 1; printf "\n | TIME >\t[ $txt_buildtime $((Tcalc / 60)) min(s) $((Tcalc % 60)) secs ]"| tee -a "$ldir/$log_name"
sleep 1
#remove debug binary #remove debug binary
if [ "${s3cfg_vars[delete_oscamdebugbinary]}" == "1" ] && [ -f "$bdir/$oscam_name.debug" ];then if [ "${s3cfg_vars[delete_oscamdebugbinary]}" == "1" ] && [ -f "$bdir/$oscam_name.debug" ]
rm "$bdir/$oscam_name.debug"; then
echo -e "\n $txt_delete $oscam_name.debug\n"|tee -a "$ldir/$log_name"; rm "$bdir/$oscam_name.debug"
fi;) | "$gui" "$st_" --colors --title " -[ Build ]- " "$pb_" "$_lines" "$_cols";sleep 2; printf "\n $txt_delete $oscam_name.debug\n"|tee -a "$ldir/$log_name"
fi;) | "$gui" "$st_" --colors --title " -[ Build ]- " "$pb_" "$_lines" "$_cols"
sleep 2
#COMPRESS #COMPRESS
if [ ! "$stapi_allowed" == "1" ];then if [ ! "$stapi_allowed" == "1" ]
if [ "${s3cfg_vars[COMPRESS]}" == "1" ] || [ "${USE_vars[USE_COMPRESS]}" == "USE_COMPRESS=1" ];then then
(compress_cam_gui "$oscam_name") |tee -a "$ldir/$log_name"| "$gui" "$st_" --title " -[ COMPRESS ]- " "$pb_" 7 50;
sleep 2; if [ "${s3cfg_vars[COMPRESS]}" == "1" ] || [ "${USE_vars[USE_COMPRESS]}" == "USE_COMPRESS=1" ]
fi; then
fi; (compress_cam_gui "$oscam_name") |tee -a "$ldir/$log_name"| "$gui" "$st_" --title " -[ COMPRESS ]- " "$pb_" 7 50
sleep 2
fi
fi
#tar #tar
if [ "${USE_vars[USE_TARGZ]}" == "USE_TARGZ=1" ];then if [ "${USE_vars[USE_TARGZ]}" == "USE_TARGZ=1" ]
(tar_cam_gui "$oscam_name" "$(cat "$targztmp")") |tee -a "$ldir/$log_name"| "$gui" "$st_" --title " -[ TAR Binary ]- " "$pb_" 10 70; then
sleep 2; (tar_cam_gui "$oscam_name" "$(cat "$targztmp")") |tee -a "$ldir/$log_name"| "$gui" "$st_" --title " -[ TAR Binary ]- " "$pb_" 10 70
fi; sleep 2
fi
#link log #link log
ln -sf "$ldir/$log_name" "$workdir/lastbuild.log"; ln -sf "$ldir/$log_name" "$workdir/lastbuild.log"
[ -f "$targztmp" ] && rm -rf "$targztmp"; [ -f "$targztmp" ] && rm -rf "$targztmp"
}; }

Loading…
Cancel
Save