⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 install.old

📁 好东西,欢迎下在,联系方式E-mail:xoming117@tom.com
💻 OLD
📖 第 1 页 / 共 5 页
字号:
    }
}

##############################################################################
#
# makefileCreate - creating a make file for use in the updating library step.
#
# SYNOPSIS
# makefileCreate
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc makefileCreate {} {

    if {[windHostTypeGet] == "x86-win32"} {
        set Makefile "[tempDirGet]\\Makefile"
    } {
        set Makefile "[tempDirGet]/Makefile"
    }

    if ![file exists $Makefile] {
        set f [open $Makefile "w"]
    
        if {"[windHostTypeGet]" == "x86-win32"} {
            puts $f "include [destDirGet]\\target\\h\\make\\make.$(CPU)$(TOOL)"
            puts $f "ARFLAGS = -cru"
            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"
        } { 
            puts $f "include [destDirGet]/target/h/make/make.$(CPU)$(TOOL)"
            puts $f "ARFLAGS = -cru"
            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
}

##############################################################################
#
# 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'
#    <type>: library type, i.e. 'vx'
#    <action>: build target, i.e. 'ar' or 'ranlib'
#    [arFlags] : the default value is -cru
#    [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 "-cru"} {objs ""}} {

    set binDir [destDirGet]/host/[windHostTypeGet]/bin
    regsub -all {\\} $binDir {/} binDir

    if {![catch {exec $binDir/make -n -f [makefileCreate] CPU=$cpu \
                              TOOL=$tool TYPE=$type \
                              OBJS=$objs \
                              ARFLAGS=$arFlags $action} retVal]} {

        regsub -all {\\} $retVal {/} retVal

        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"
            } elseif {[debug]} {
                puts "\n$retVal"
            }
        } elseif {[debug]} {
            puts "\n$binDir/$retVal"
        }
    } {
        puts $retVal
        uninstLog setup "\t$retVal"
    }
}

##############################################################################
#
# librariesUpdate - updating the vxWorks libraries.
#
# 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 -cru.  A particular product can override this default
# setting by provide a postInstall.tcl file that contains a call to the
# arFlagsSet() function.  The object list is broken into smaller list to 
# accommodate the limitation on command line length.
#
# SYNOPSIS
# librariesUpdate
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc librariesUpdate {} {
    global setupVals
    global objects

    set setupVals(cancel) 0

    # Determine the total number of new object files for GUI updating purpose.

    set totalObjFile 0

    foreach objDir [array names objects] {
        incr totalObjFile [llength $objects($objDir)]
    }
 
    set i 0
    set percent 0

    # Updating the libraries.

    if {$totalObjFile != "0"} {
        meterUpdate $percent ""

        foreach prodIndex [cdInfoGet selectedProdIndexList] { 

            foreach archKey [array names objects] {

                # typex is useful when updating special component.  
                # ex: windview,...

                if {[regexp {^(.*),(.*),(.*),(.*),(.*),(.*)$} $archKey \
                        junk index obj cpu tool type typex] && \
                    "$prodIndex" == "$index"} {

                    set archiveFile \
                            [destDirGet]/target/lib/lib$cpu$tool$type.a

                    if {[file exists $archiveFile]} {

                        meterUpdate $percent "Updating lib$cpu$tool${type}.a"

                        # don't backup library if this is the first installation

			if {[file extension $setupVals(uninstFile)] != ".001"} {
                            backup target/lib/lib$cpu$tool$type.a
                        }

                        cd [destDirGet]/target/lib/obj$cpu$tool$type$typex

                        if [debug] {
                            puts "\nProduct: [productInfoGet desc $prodIndex]"
                            puts "Library: lib$cpu$tool$type.a"
                            puts "Object directory: [pwd]"
                            puts "ARFLAGS: [arFlagsGet $prodIndex]"
                            puts "Objects: $objects($archKey)"
                        }

                        set objs ""

                        foreach objFile $objects($archKey) {
                            if {"$setupVals(cancel)" == "1"} { return }

                            # ar the new objects into the lib

                            if {[string length $objs] > 200} {
                                set objs "$objs $objFile"
                                libUpdateHelper $cpu $tool $type ar \
                                                [arFlagsGet $prodIndex] $objs
                                set objs ""
                            } {
                                # Gather a bunch of obj files, then ar them all.
                                # This technique improves speed of installation.

                                set objs "$objs $objFile"
                            }

                            set tag "Updating lib$cpu$tool${type}.a"
                            set percent [expr $i * 100 / $totalObjFile]
                            meterUpdate $percent $tag
                            incr i
                        }

                        if {[string length $objs] > 0} {
                            libUpdateHelper $cpu $tool $type ar \
                                            [arFlagsGet $prodIndex] $objs
                        }

                        # Ranlib to update the lib table of content.

                        libUpdateHelper $cpu $tool $type ranlib

                    } elseif {[debug]} {
                        puts "skip updating $archiveFile : no such file" 
                    }
                }
            }
        }
    }
}

##############################################################################
#
# torVarsCreate - creates a Tornado environment variables startup file.
#
# SYNOPSIS
# torVarsCreate
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc torVarsCreate {} {
    global setupVals

    set binDir [destDirGet]/host/[windHostTypeGet]/bin

    if {"[windHostTypeGet]" == "x86-win32" && [file isdirectory $binDir]} {

        if ![file exists $binDir/torVars.bat] {
            uninstLog file "wind_base\thost/[windHostTypeGet]/bin/torVars.bat"
	}

        if ![catch {open $binDir/torVars.bat "w"} f] {
            puts $f "rem Command line build environments"
            puts $f "set WIND_HOST_TYPE=[windHostTypeGet]"
            puts $f "set WIND_BASE=[destDirGet]"

            if [info exists setupVals(regHost)] {
                puts $f "set WIND_REGISTRY=$setupVals(regHost)"
            }

            puts $f "set PATH=%WIND_BASE%\\host\\%WIND_HOST_TYPE%\\bin;%PATH%"
            close $f
        }

    } elseif [file isdirectory $binDir] {

        if ![file exists $binDir/torVars.csh] {
            uninstLog file "wind_base\thost/[windHostTypeGet]/bin/torVars.csh"
	}

        if ![catch {open $binDir/torVars.csh "w"} f] {

            puts $f "# Command line build environments"
            puts $f "setenv WIND_HOST_TYPE [windHostTypeGet]"
            puts $f "setenv WIND_BASE [destDirGet]"

            if [info exists setupVals(regHost)] {
                puts $f "setenv WIND_REGISTRY $setupVals(regHost)"
            }

            puts $f {setenv PATH $WIND_BASE/host/$WIND_HOST_TYPE/bin:$PATH}
            close $f
        }

        if ![file exists $binDir/torVars.sh] {
            uninstLog file "wind_base\thost/[windHostTypeGet]/bin/torVars.sh"
	}

        if ![catch {open $binDir/torVars.sh "w"} f] {

            puts $f "# Command line build environments"
            puts $f "WIND_HOST_TYPE=[windHostTypeGet]"
            puts $f "export WIND_HOST_TYPE"
            puts $f "WIND_BASE=[destDirGet]"
            puts $f "export WIND_BASE"

            if [info exists setupVals(regHost)] {
                puts $f "WIND_REGISTRY=$setupVals(regHost)"
                puts $f "export WIND_REGISTRY"
            }

            puts $f {PATH=$WIND_BASE/host/$WIND_HOST_TYPE/bin:$PATH}
            puts $f "export PATH"
            close $f
        }
    }
}

##############################################################################
#
# umaskGet - getting the user umask value
#
# This routine gets the current umask setting, converts it to file permision
# format.
#
# SYNOPSIS
# umaskGet
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc umaskGet {} {
    global setupVals

    set setupVals(umask) [split [setupUmaskSet [format "%d" 022]] ""]
    setupUmaskSet $setupVals(umask)

    #initialize all to 0
    set setupVals(ur) 0
    set setupVals(uw) 0
    set setupVals(gr) 0
    set setupVals(gw) 0
    set setupVals(or) 0
    set setupVals(ow) 0

    set noRead {7 6 5 4}
    set noWrite {7 6 3 2} 

    set user [lindex $setupVals(umask) 1]
    if {[lsearch $noRead $user] == "-1"}  { set setupVals(ur) 1 }
    if {[lsearch $noWrite $user] == "-1"} { set setupVals(uw) 1 }

    set group [lindex $setupVals(umask) 2]
    if {[lsearch $noRead $group] == "-1"}  { set setupVals(gr) 1 }
    if {[lsearch $noWrite $group] == "-1"} { set setupVals(gw) 1 }

    set other [lindex $setupVals(umask) 3]
    if {[lsearch $noRead $other] == "-1"}  { set setupVals(or) 1 }
    if {[lsearch $noWrite $other] == "-1"} { set setupVals(ow) 1 }
}

##############################################################################
#
# umaskSet - sets new umask value
#
# This routine gets the user file permision request, converts it to a umask
# value then set it for the current process.  A global variable fileMode is 
# also created in 'chmod' flag syntax for later use.
#
# SYNOPSIS
# umaskSet
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc umaskSet {} {
    global setupVals

    set user  [expr 6 - ( $setupVals(ur)*4 + $setupVals(uw)*2 )]
    set group [expr 6 - ( $setupVals(gr)*4 + $setupVals(gw)*2 )]
    set other [expr 6 - ( $setupVals(or)*4 + $setupVals(ow)*2 )]
    setupUmaskSet [format "%d" 0$user$group$other]

    set plus "+"
    set minus "-"
    set setupVals(fileMode) [format "u%sr,u%sw,g%sr,g%sw,o%sr,o%sw" \
	                         [expr $setupVals(ur) == 1 ? \$plus:\$minus] \
                                 [expr $setupVals(uw) == 1 ? \$plus:\$minus] \
	                         [expr $setupVals(gr) == 1 ? \$plus:\$minus] \
                                 [expr $setupVals(gw) == 1 ? \$plus:\$minus] \
	                         [expr $setupVals(or) == 1 ? \$plus:\$minus] \
                                 [expr $setupVals(ow) == 1 ? \$plus:\$minus]]
}

##############################################################################
#
# debug - turns on debug mode
#
# SYNOPSIS
# debug
#
# PARAMETERS: N/A
#
# RETURNS: true if the environment var SETUP_DEBUG exists, otherwise false
#
# ERRORS: N/A
#

proc debug {} {
    global env

    if {[info exists env(SETUP_DEBUG)]} {
        return 1
    } {
        return 0
    }
}

##############################################################################
#
# fileDup - copies a file
#
# This routine copies srcFile to destFile.  The default option flag is 'none' 
# which means doing nothing if destFile exists, update: if srcFile is newer, 
# backup destFile then copies, overwrite: backup then copies.  In case of
# failure, a message will be displayed, and user has a chance to decide next
# action.  All successful copied filename will be logged for later uninstall.
#
# SYNOPSIS
# fileDup <srcFile> <destFile> [option]
#
# PARAMETERS: 
#    <srcFile> : an absolute path filename

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -