📄 libupdte.tcl
字号:
[destDirGet] target h make make.$cpu$tool] } if {[file exists $mFile] == 0} { continue } # don't backup library if this is the first installation # Backup only if the .a exists if {[file extension $setupVals(uninstFile)] != ".001"} { set aFile [file join [destDirGet] target lib \ lib$cpu$tool$type.a] if {[file exists $aFile]} { backup target/lib/lib$cpu$tool$type.a # immediately flush the queue; otherwise we may not # be backing up the old archive backupFileQueueFlush } } cd [file join [destDirGet] target lib \ obj$cpu$tool$type$typex] set numArchivedSoFar \ [expr $numArchivedSoFar + $objsArchived($arPassId)] set percent [expr $numArchivedSoFar * 100 / $totalObjFile] libUpdateHelper $cpu $tool $type ar \ $prodARFlag $objs($arPassId) # Ranlib to update the lib table of content. libUpdateHelper $cpu $tool $type ranlib meterUpdate $percent "Updating lib$cpu$tool${type}.a" dbgputs " AR pass Id: $arPassId" dbgputs " Library: \ lib$cpu$tool$type.a" dbgputs " Object directory: [pwd]" dbgputs " ARFLAGS: $prodARFlag" dbgputs "Number of objects in this AR pass: \ $objsArchived($arPassId)" dbgputs "Number of objects archived so far: \ $numArchivedSoFar" dbgputs " Percent archived so far: \ $percent% of $totalObjFile objects" dbgputs "------------------------------------------------" # log it for uninstall set f [file join target lib lib$cpu$tool${type}.a] uninstLog file "wind_base\t$f" dbgputs "uninstLog file $f" } else { puts "librariesUpdate: cannot get arPassId" } } meterUpdate 100 "" }}################################################################################ libUpdateHelper - invokes make to carry out the requested action.## a -n option is used to obtain a list of commands that 'make' supposes to# carry out. Each command is then evaluated separately. Asking make to carry# out the real action will cause many console windows to pop up.### SYNOPSIS# libUpdateHelper <cpu> <tool> <type> <action> [arFlags] [objs]## PARAMETERS:# <cpu> : CPU family, i.e. MC68000# <tool>: compiler family, i.e 'gnu' or 'sfgnule'# <type>: library type, i.e. 'vx'# <action>: build target, i.e. 'ar' or 'ranlib'# <DIR_TOOL>: name of tool directory, i.e. 'gnu' or 'diab'# [arFlags] : the default value is -crus# [objs] : object file list separated by space, needed when <action> is ar## RETURNS: N/A## ERRORS: N/A#proc libUpdateHelper {cpu tool type action {arFlags "-crus"} {objs ""}} { set binDir [file join [destDirGet] host [windHostTypeGet] bin] regsub -all {\\} $binDir {/} binDir set dirTool "" if { [regexp {.*(gnu).*} $tool] } { set dirTool "gnu" } elseif { [regexp {.*(diab).*} $tool] } { set dirTool "diab" } if {![catch {exec $binDir/make -n -f [makefileCreate] CPU=$cpu \ TOOL=$tool TYPE=$type \ OBJS=$objs DIR_TOOL=$dirTool \ ARFLAGS=$arFlags $action} retVal]} { regsub -all {\\} $retVal {/} retVal # location of diab archiver (but not for ranlib) if { $action != "ranlib" } { if { [string match $dirTool "diab"] } { set binDir "" if { [isUnix] } { set binDir [file join [destDirGet] host diab SUNS bin] } else { set binDir [file join [destDirGet] host diab WIN32 bin] } } regsub -all {\\} $binDir {/} binDir } if {[catch {eval "exec $binDir/$retVal"} error1]} { if {[catch {eval "exec $retVal"} error2]} { puts "$error1\n$error2" uninstLog setup "\t$error1" uninstLog setup "\t$error2" } else { dbgputs "\n$retVal" } } else { dbgputs "\n$binDir/$retVal" } } else { puts "libUpdate: $retVal" uninstLog setup "\t$retVal" }}################################################################################ makefileCreate - create a makefile for use with the archiver and# vxWorks libraries.## SYNOPSIS# makefileCreate## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc makefileCreate {} { if {[windHostTypeGet] == "x86-win32"} { set Makefile "[tempDirGet]\\Makefile" } else { set Makefile "[tempDirGet]/Makefile" } set windowsIncludeLine "include [destDirGet]\\target\\h\\tool\\$(DIR_TOOL)\\make.$(CPU)$(TOOL)" set unixIncludeLine "include [destDirGet]/target/h/tool/$(DIR_TOOL)/make.$(CPU)$(TOOL)" # Check to see if target/h/tool exists, thus signifying a Tornado 2.2 tree. # For installation of an optional product into a Tornado 2.0.x tree, # make.$cpu$tool exists in target/h/make, and the above include lines must # change accordingly. set mFile [file join \ [destDirGet] target h tool] if {[file exists $mFile] == 0} { set windowsIncludeLine "include [destDirGet]\\target\\h\\make\\make.$(CPU)$(TOOL)" set unixIncludeLine "include [destDirGet]/target/h/make/make.$(CPU)$(TOOL)" } if ![file exists $Makefile] { set f [open $Makefile "w"] if {"[windHostTypeGet]" == "x86-win32"} { puts $f "TGT_DIR = [destDirGet]\\target" puts $f $windowsIncludeLine puts $f "ARFLAGS = -crus" puts $f "ar:" puts $f "\t- $(AR) $(ARFLAGS) ..\\lib$(CPU)$(TOOL)$(TYPE).a $(OBJS)" puts $f "ranlib:" puts $f "\t- $(RANLIB) ..\\lib$(CPU)$(TOOL)$(TYPE).a" } else { puts $f "TGT_DIR = [destDirGet]/target" puts $f $unixIncludeLine puts $f "ARFLAGS = -crus" puts $f "ar:" puts $f "\t- $(AR) $(ARFLAGS) ../lib$(CPU)$(TOOL)$(TYPE).a $(OBJS)" puts $f "ranlib:" puts $f "\t- $(RANLIB) ../lib$(CPU)$(TOOL)$(TYPE).a" } close $f } return $Makefile}################################################################################ newLibrariesUpdate - update the vxWorks libraries for new format of archives## Format: target/lib/<FAMILY>/<CPU>/<TOOL>/obj<type>/*.o# (ex: target/lib/mips/MIPS32/sfcommonle/objarch/foo.o)# (ex: target/lib/mips/MIPS32/sfgnule/objcplus/foo2.o)## This routine walks thru each product, updates the vxWorks libraries w/ the# object list which was obtained and saved by the archListPut() function. The# default updating flag is -crus. A particular product can override this# default setting by provide a postInstall.tcl file that contains a call to# the arFlagsSet() function. To speed up the archiving process, a minimum# amount of AR invocations is made. This is achieved by grouping the object# list into smaller lists of distinct flags and libraries, then archiving# each list of objects via an AR invocation.## SYNOPSIS# newLibrariesUpdate## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc newLibrariesUpdate {} { global setupVals global setup_objects dbgputs "\nnewLibrariesUpdate...\n" set setupVals(cancel) 0 # Determine the total number of new object files for GUI updating purpose. set totalObjFile 0 foreach objDir [array names setup_objects] { incr totalObjFile [llength $setup_objects($objDir)] } set percent 0 # Updating the libraries. if {$totalObjFile != "0"} { meterUpdate $percent "" foreach prodIndex [cdInfoGet selectedProdIndexList] { searchAndProcessSection ArFlags [chooseInfFile $prodIndex] \ $prodIndex set prodARFlag [arFlagsGet $prodIndex] foreach archKey [array names setup_objects] { if {[regexp {^(.*),(.*),(.*),(.*),(.*),(.*)$} $archKey \ junk index obj family cpu tool type] && \ "$prodIndex" == "$index"} { # An arPassId is characterized by the following variables: # "$prodARFlag,$family,$cpu,$tool,$type,". It corresponds # to one AR call. For example, # prodARFlag, family, cpu, tool, type, # -cru, mips, MIPS32, sfgnule, cplus, set arPassId $prodARFlag,$family,$cpu,$tool,$type, #initialize objs and objsArchived if necessary if ![info exists objs($arPassId)] { set objs($arPassId) "" } if ![info exists objsArchived($arPassId) ] { set objsArchived($arPassId) 0 } # now group objects by arPassId and update the # number of objects archived for each arPassId foreach objFile $setup_objects($archKey) { # avoid duplicate objects being added onto the # object list if {[lsearch $objs($arPassId) $objFile] == "-1"} { set objs($arPassId) "$objFile $objs($arPassId)" incr objsArchived($arPassId) } else { #dbgputs "duplicate objects($cpu): $objFile"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -