Changeset 4687a26c in mainline for tools


Ignore:
Timestamp:
2010-11-02T18:29:01Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4f35b9ff
Parents:
76e1121f (diff), 28f4adb (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

Location:
tools
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • tools/autotool.py

    r76e1121f r4687a26c  
    7575        "Read HelenOS build configuration"
    7676       
    77         inf = file(fname, 'r')
     77        inf = open(fname, 'r')
    7878       
    7979        for line in inf:
     
    191191        check_common(common, "CC")
    192192       
    193         outf = file(PROBE_SOURCE, 'w')
     193        outf = open(PROBE_SOURCE, 'w')
    194194        outf.write(PROBE_HEAD)
    195195       
     
    212212        if (not os.path.isfile(PROBE_OUTPUT)):
    213213                sys.stderr.write("failed\n")
    214                 print output[1]
     214                print(output[1])
    215215                print_error(["Error executing \"%s\"." % " ".join(args),
    216216                             "The compiler did not produce the output file \"%s\"." % PROBE_OUTPUT,
     
    221221        sys.stderr.write("ok\n")
    222222       
    223         inf = file(PROBE_OUTPUT, 'r')
     223        inf = open(PROBE_OUTPUT, 'r')
    224224        lines = inf.readlines()
    225225        inf.close()
     
    343343        "Create makefile output"
    344344       
    345         outmk = file(mkname, 'w')
     345        outmk = open(mkname, 'w')
    346346       
    347347        outmk.write('#########################################\n')
     
    357357        "Create header output"
    358358       
    359         outhd = file(hdname, 'w')
     359        outhd = open(hdname, 'w')
    360360       
    361361        outhd.write('/***************************************\n')
  • tools/checkers/clang.py

    r76e1121f r4687a26c  
    4242def usage(prname):
    4343        "Print usage syntax"
    44         print prname + " <ROOT>"
     44        print(prname + " <ROOT>")
    4545
    4646def clang(root, job):
     
    5050       
    5151        if (not os.path.isfile(inname)):
    52                 print "Unable to open %s" % inname
    53                 print "Did you run \"make precheck\" on the source tree?"
     52                print("Unable to open %s" % inname)
     53                print("Did you run \"make precheck\" on the source tree?")
    5454                return False
    5555       
    56         inf = file(inname, "r")
     56        inf = open(inname, "r")
    5757        records = inf.read().splitlines()
    5858        inf.close()
     
    6464               
    6565                if (len(arg) < 6):
    66                         print "Not enought jobfile record arguments"
     66                        print("Not enought jobfile record arguments")
    6767                        return False
    6868               
     
    7676                srcfqname = os.path.join(base, srcfname)
    7777                if (not os.path.isfile(srcfqname)):
    78                         print "Source %s not found" % srcfqname
     78                        print("Source %s not found" % srcfqname)
    7979                        return False
    8080               
     
    108108       
    109109        if (not os.path.isfile(config)):
    110                 print "%s not found." % config
    111                 print "Please specify the path to HelenOS build tree root as the first argument."
     110                print("%s not found." % config)
     111                print("Please specify the path to HelenOS build tree root as the first argument.")
    112112                return
    113113       
     
    115115                if (not clang(rootdir, job)):
    116116                        print
    117                         print "Failed job: %s" % job
     117                        print("Failed job: %s" % job)
    118118                        return
    119119       
    120120        print
    121         print "All jobs passed"
     121        print("All jobs passed")
    122122
    123123if __name__ == '__main__':
  • tools/checkers/jobfile.py

    r76e1121f r4687a26c  
    5454                                nil = True
    5555                        else:
    56                                 print "Unexpected '%s'" % record[i]
     56                                print("Unexpected '%s'" % record[i])
    5757                                return False
    5858               
  • tools/checkers/stanse.py

    r76e1121f r4687a26c  
    4343def usage(prname):
    4444        "Print usage syntax"
    45         print prname + " <ROOT>"
     45        print(prname + " <ROOT>")
    4646
    4747def stanse(root, job):
     
    5454       
    5555        if (not os.path.isfile(inname)):
    56                 print "Unable to open %s" % inname
    57                 print "Did you run \"make precheck\" on the source tree?"
     56                print("Unable to open %s" % inname)
     57                print("Did you run \"make precheck\" on the source tree?")
    5858                return False
    5959       
    60         inf = file(inname, "r")
     60        inf = open(inname, "r")
    6161        records = inf.read().splitlines()
    6262        inf.close()
     
    6969               
    7070                if (len(arg) < 6):
    71                         print "Not enought jobfile record arguments"
     71                        print("Not enought jobfile record arguments")
    7272                        return False
    7373               
     
    8181                srcfqname = os.path.join(base, srcfname)
    8282                if (not os.path.isfile(srcfqname)):
    83                         print "Source %s not found" % srcfqname
     83                        print("Source %s not found" % srcfqname)
    8484                        return False
    8585               
     
    9090                output.append([srcfname, tgtfname, base, options])
    9191       
    92         outf = file(outname, "w")
     92        outf = open(outname, "w")
    9393        for record in output:
    9494                outf.write("{%s},{%s},{%s},{%s}\n" % (record[0], record[1], record[2], record[3]))
     
    121121       
    122122        if (not os.path.isfile(config)):
    123                 print "%s not found." % config
    124                 print "Please specify the path to HelenOS build tree root as the first argument."
     123                print("%s not found." % config)
     124                print("Please specify the path to HelenOS build tree root as the first argument.")
    125125                return
    126126       
     
    128128                if (not stanse(rootdir, job)):
    129129                        print
    130                         print "Failed job: %s" % job
     130                        print("Failed job: %s" % job)
    131131                        return
    132132       
    133133        print
    134         print "All jobs passed"
     134        print("All jobs passed")
    135135
    136136if __name__ == '__main__':
  • tools/checkers/vcc.py

    r76e1121f r4687a26c  
    4949def usage(prname):
    5050        "Print usage syntax"
    51         print prname + " <ROOT> [VCC_PATH]"
     51        print(prname + " <ROOT> [VCC_PATH]")
    5252
    5353def cygpath(upath):
     
    7272        preproc = subprocess.Popen(args, stdout = subprocess.PIPE).communicate()[0]
    7373       
    74         tmpf = file(tmpfname, "w")
     74        tmpf = open(tmpfname, "w")
    7575        tmpf.write(specification)
    7676       
     
    108108       
    109109        if (not os.path.isfile(inname)):
    110                 print "Unable to open %s" % inname
    111                 print "Did you run \"make precheck\" on the source tree?"
     110                print("Unable to open %s" % inname)
     111                print("Did you run \"make precheck\" on the source tree?")
    112112                return False
    113113       
    114         inf = file(inname, "r")
     114        inf = open(inname, "r")
    115115        records = inf.read().splitlines()
    116116        inf.close()
     
    122122               
    123123                if (len(arg) < 6):
    124                         print "Not enought jobfile record arguments"
     124                        print("Not enought jobfile record arguments")
    125125                        return False
    126126               
     
    134134                srcfqname = os.path.join(base, srcfname)
    135135                if (not os.path.isfile(srcfqname)):
    136                         print "Source %s not found" % srcfqname
     136                        print("Source %s not found" % srcfqname)
    137137                        return False
    138138               
     
    153153               
    154154                # Run Vcc
    155                 print " -- %s --" % srcfname           
     155                print(" -- %s --" % srcfname)
    156156                retval = subprocess.Popen([vcc_path, '/pointersize:32', '/newsyntax', cygpath(tmpfqname)]).wait()
    157157               
     
    182182       
    183183        if (not os.path.isfile(vcc_path)):
    184                 print "%s is not a binary." % vcc_path
    185                 print "Please supply the full Cygwin path to Vcc as the second argument."
     184                print("%s is not a binary." % vcc_path)
     185                print("Please supply the full Cygwin path to Vcc as the second argument.")
    186186                return
    187187       
     
    189189       
    190190        if (not os.path.isfile(config)):
    191                 print "%s not found." % config
    192                 print "Please specify the path to HelenOS build tree root as the first argument."
     191                print("%s not found." % config)
     192                print("Please specify the path to HelenOS build tree root as the first argument.")
    193193                return
    194194       
    195195        specpath = os.path.join(rootdir, "tools/checkers/vcc.h")
    196196        if (not os.path.isfile(specpath)):
    197                 print "%s not found." % config
     197                print("%s not found." % config)
    198198                return
    199199       
     
    205205                if (not vcc(vcc_path, rootdir, job)):
    206206                        print
    207                         print "Failed job: %s" % job
     207                        print("Failed job: %s" % job)
    208208                        return
    209209       
    210210        print
    211         print "All jobs passed"
     211        print("All jobs passed")
    212212
    213213if __name__ == '__main__':
  • tools/config.py

    r76e1121f r4687a26c  
    4848        "Read saved values from last configuration run"
    4949       
    50         inf = file(fname, 'r')
     50        inf = open(fname, 'r')
    5151       
    5252        for line in inf:
     
    103103                condval = res.group(3)
    104104               
    105                 if (not defaults.has_key(condname)):
     105                if (not condname in defaults):
    106106                        varval = ''
    107107                else:
     
    131131        "Parse configuration file"
    132132       
    133         inf = file(fname, 'r')
     133        inf = open(fname, 'r')
    134134       
    135135        name = ''
     
    219219                        continue
    220220               
    221                 if (not defaults.has_key(varname)):
     221                if (not varname in defaults):
    222222                        return False
    223223       
     
    232232       
    233233        try:
    234                 version = subprocess.Popen(['bzr', 'version-info', '--custom', '--template={clean}:{revno}:{revision_id}'], stdout = subprocess.PIPE).communicate()[0].split(':')
     234                version = subprocess.Popen(['bzr', 'version-info', '--custom', '--template={clean}:{revno}:{revision_id}'], stdout = subprocess.PIPE).communicate()[0].decode().split(':')
    235235                sys.stderr.write("ok\n")
    236236        except:
     
    246246                revision = None
    247247       
    248         outmk = file(mkname, 'w')
    249         outmc = file(mcname, 'w')
     248        outmk = open(mkname, 'w')
     249        outmc = open(mcname, 'w')
    250250       
    251251        outmk.write('#########################################\n')
     
    263263                        continue
    264264               
    265                 if (not defaults.has_key(varname)):
     265                if (not varname in defaults):
    266266                        default = ''
    267267                else:
     
    368368                        # Cancel out all defaults which have to be deduced
    369369                        for varname, vartype, name, choices, cond in ask_names:
    370                                 if ((vartype == 'y') and (defaults.has_key(varname)) and (defaults[varname] == '*')):
     370                                if ((vartype == 'y') and (varname in defaults) and (defaults[varname] == '*')):
    371371                                        defaults[varname] = None
    372372                       
     
    385385                                        position = cnt
    386386                               
    387                                 if (not defaults.has_key(varname)):
     387                                if (not varname in defaults):
    388388                                        default = None
    389389                                else:
     
    428428                                cnt += 1
    429429                       
    430                         if (position >= options):
     430                        if (position != None) and (position >= len(options)):
    431431                                position = None
    432432                       
     
    449449                       
    450450                        position = None
    451                         if (not opt2row.has_key(value)):
     451                        if (not value in opt2row):
    452452                                raise RuntimeError("Error selecting value: %s" % value)
    453453                       
    454454                        (selname, seltype, name, choices) = opt2row[value]
    455455                       
    456                         if (not defaults.has_key(selname)):
     456                        if (not selname in defaults):
    457457                                        default = None
    458458                        else:
  • tools/jobfile.py

    r76e1121f r4687a26c  
    3838def usage(prname):
    3939        "Print usage syntax"
    40         print prname + " <JOBFILE> <SOURCE> <TARGET> <TOOL> <CATEGORY> [OPTIONS ...]"
     40        print(prname + " <JOBFILE> <SOURCE> <TARGET> <TOOL> <CATEGORY> [OPTIONS ...]")
    4141
    4242def main():
     
    5353        options = " ".join(sys.argv[6:])
    5454       
    55         jobfile = file(jobfname, "a")
     55        jobfile = open(jobfname, "a")
    5656        fcntl.lockf(jobfile, fcntl.LOCK_EX)
    5757        jobfile.write("{%s},{%s},{%s},{%s},{%s},{%s}\n" % (srcfname, tgtfname, toolname, category, cwd, options))
  • tools/mkfat.py

    r76e1121f r4687a26c  
    4646                return size
    4747       
    48         return (((size / alignment) + 1) * alignment)
     48        return ((size // alignment) + 1) * alignment
    4949
    5050def subtree_size(root, cluster_size, dirent_size):
     
    7979        first = 0
    8080       
    81         inf = file(path, "r")
     81        inf = open(path, "rb")
    8282        rd = 0;
    8383        while (rd < size):
     
    9292                prev = empty_cluster
    9393               
    94                 data = inf.read(cluster_size);
     94                data = bytes(inf.read(cluster_size));
    9595                outf.seek(data_start + (empty_cluster - reserved_clusters) * cluster_size)
    9696                outf.write(data)
     
    120120                prev = empty_cluster
    121121               
    122                 data = ''
     122                data = bytes()
    123123                data_len = 0
    124124                while ((i < length) and (data_len < cluster_size)):
     
    343343def usage(prname):
    344344        "Print usage syntax"
    345         print prname + " <EXTRA_BYTES> <PATH> <IMAGE>"
     345        print(prname + " <EXTRA_BYTES> <PATH> <IMAGE>")
    346346
    347347def main():
     
    351351       
    352352        if (not sys.argv[1].isdigit()):
    353                 print "<EXTRA_BYTES> must be a number"
     353                print("<EXTRA_BYTES> must be a number")
    354354                return
    355355       
     
    358358        path = os.path.abspath(sys.argv[2])
    359359        if (not os.path.isdir(path)):
    360                 print "<PATH> must be a directory"
     360                print("<PATH> must be a directory")
    361361                return
    362362       
     
    372372        # Make sure the filesystem is large enought for FAT16
    373373        size = subtree_size(path, cluster_size, dirent_size) + reserved_clusters * cluster_size + extra_bytes
    374         while (size / cluster_size < fat16_clusters):
     374        while (size // cluster_size < fat16_clusters):
    375375                if (cluster_size > sector_size):
    376                         cluster_size /= 2
     376                        cluster_size = cluster_size // 2
    377377                        size = subtree_size(path, cluster_size, dirent_size) + reserved_clusters * cluster_size + extra_bytes
    378378                else:
     
    381381        root_size = align_up(root_entries(path) * dirent_size, cluster_size)
    382382       
    383         fat_size = align_up(align_up(size, cluster_size) / cluster_size * fatent_size, sector_size)
    384        
    385         sectors = (cluster_size + fat_count * fat_size + root_size + size) / sector_size
     383        fat_size = align_up(align_up(size, cluster_size) // cluster_size * fatent_size, sector_size)
     384       
     385        sectors = (cluster_size + fat_count * fat_size + root_size + size) // sector_size
    386386        root_start = cluster_size + fat_count * fat_size
    387387        data_start = root_start + root_size
    388388       
    389         outf = file(sys.argv[3], "w")
     389        outf = open(sys.argv[3], "wb")
    390390       
    391391        boot_sector = xstruct.create(BOOT_SECTOR)
    392392        boot_sector.jmp = [0xEB, 0x3C, 0x90]
    393         boot_sector.oem = "MSDOS5.0"
     393        boot_sector.oem = b'MSDOS5.0'
    394394        boot_sector.sector = sector_size
    395         boot_sector.cluster = cluster_size / sector_size
    396         boot_sector.reserved = cluster_size / sector_size
     395        boot_sector.cluster = cluster_size // sector_size
     396        boot_sector.reserved = cluster_size // sector_size
    397397        boot_sector.fats = fat_count
    398         boot_sector.rootdir = root_size / dirent_size
     398        boot_sector.rootdir = root_size // dirent_size
    399399        if (sectors <= 65535):
    400400                boot_sector.sectors = sectors
     
    402402                boot_sector.sectors = 0
    403403        boot_sector.descriptor = 0xF8
    404         boot_sector.fat_sectors = fat_size / sector_size
     404        boot_sector.fat_sectors = fat_size // sector_size
    405405        boot_sector.track_sectors = 63
    406406        boot_sector.heads = 6
     
    414414        boot_sector.extboot_signature = 0x29
    415415        boot_sector.serial = random.randint(0, 0x7fffffff)
    416         boot_sector.label = "HELENOS"
    417         boot_sector.fstype = "FAT16   "
     416        boot_sector.label = b'HELENOS'
     417        boot_sector.fstype = b'FAT16   '
    418418        boot_sector.boot_signature = [0x55, 0xAA]
    419419       
     
    423423       
    424424        # Reserved sectors
    425         for i in range(1, cluster_size / sector_size):
     425        for i in range(1, cluster_size // sector_size):
    426426                outf.write(empty_sector.pack())
    427427       
    428428        # FAT tables
    429429        for i in range(0, fat_count):
    430                 for j in range(0, fat_size / sector_size):
     430                for j in range(0, fat_size // sector_size):
    431431                        outf.write(empty_sector.pack())
    432432       
    433433        # Root directory
    434         for i in range(0, root_size / sector_size):
     434        for i in range(0, root_size // sector_size):
    435435                outf.write(empty_sector.pack())
    436436       
    437437        # Data
    438         for i in range(0, size / sector_size):
     438        for i in range(0, size // sector_size):
    439439                outf.write(empty_sector.pack())
    440440       
    441         fat = array.array('L', [0] * (fat_size / fatent_size))
     441        fat = array.array('L', [0] * (fat_size // fatent_size))
    442442        fat[0] = 0xfff8
    443443        fat[1] = 0xffff
     
    449449        for i in range(0, fat_count):
    450450                outf.seek(cluster_size + i * fat_size)
    451                 for j in range(0, fat_size / fatent_size):
     451                for j in range(0, fat_size // fatent_size):
    452452                        fat_entry.next = fat[j]
    453453                        outf.write(fat_entry.pack())
  • tools/mkhord.py

    r76e1121f r4687a26c  
    5252def usage(prname):
    5353        "Print usage syntax"
    54         print prname + " <ALIGNMENT> <FS_IMAGE> <HORD_IMAGE>"
     54        print(prname + " <ALIGNMENT> <FS_IMAGE> <HORD_IMAGE>")
    5555
    5656def main():
     
    6060       
    6161        if (not sys.argv[1].isdigit()):
    62                 print "<ALIGNMENT> must be a number"
     62                print("<ALIGNMENT> must be a number")
    6363                return
    6464       
    6565        align = int(sys.argv[1], 0)
    6666        if (align <= 0):
    67                 print "<ALIGNMENT> must be positive"
     67                print("<ALIGNMENT> must be positive")
    6868                return
    6969       
    7070        fs_image = os.path.abspath(sys.argv[2])
    7171        if (not os.path.isfile(fs_image)):
    72                 print "<FS_IMAGE> must be a file"
     72                print("<FS_IMAGE> must be a file")
    7373                return
    7474       
    75         inf = file(fs_image, "rb")
    76         outf = file(sys.argv[3], "wb")
     75        inf = open(fs_image, "rb")
     76        outf = open(sys.argv[3], "wb")
    7777       
    7878        header = xstruct.create(HEADER)
  • tools/mktmpfs.py

    r76e1121f r4687a26c  
    6666def usage(prname):
    6767        "Print usage syntax"
    68         print prname + " <PATH> <IMAGE>"
     68        print(prname + " <PATH> <IMAGE>")
    6969
    7070def recursion(root, outf):
     
    8585                        outf.write(dentry.pack())
    8686                       
    87                         inf = file(canon, "r")
     87                        inf = open(canon, "rb")
    8888                        rd = 0;
    8989                        while (rd < size):
     
    116116        path = os.path.abspath(sys.argv[1])
    117117        if (not os.path.isdir(path)):
    118                 print "<PATH> must be a directory"
     118                print("<PATH> must be a directory")
    119119                return
    120120       
    121         outf = file(sys.argv[2], "w")
     121        outf = open(sys.argv[2], "wb")
    122122       
    123123        header = xstruct.create(HEADER)
  • tools/mkuimage.py

    r76e1121f r4687a26c  
    7272                        start_addr = (int)(optarg, 0)
    7373                else:
    74                         print base_name + ": Unrecognized option."
     74                        print(base_name + ": Unrecognized option.")
    7575                        print_syntax(cmd_name)
    7676                        return
    7777
    7878        if len(args) < 2:
    79                 print base_name + ": Argument missing."
     79                print(base_name + ": Argument missing.")
    8080                print_syntax(cmd_name)
    8181                return
     
    9191
    9292def mkuimage(inf_name, outf_name, image_name, load_addr, start_addr):
    93         inf = file(inf_name, 'rb')
    94         outf = file(outf_name, 'wb')
     93        inf = open(inf_name, 'rb')
     94        outf = open(outf_name, 'wb')
    9595
    9696        header = xstruct.create(UIMAGE_HEADER)
     
    140140        signed_crc = zlib.crc32(byteseq, 0)
    141141        if signed_crc < 0:
    142                 return (long(signed_crc) + 4294967296L) # 2^32L
     142                return (long(signed_crc) + (long(2) ** long(32))) # 2^32L
    143143        else:
    144144                return signed_crc
     
    147147#
    148148def print_syntax(cmd):
    149         print "syntax: " + cmd + " [<options>] <raw_image> <uImage>"
     149        print("syntax: " + cmd + " [<options>] <raw_image> <uImage>")
    150150        print
    151         print "\traw_image\tInput image name (raw binary data)"
    152         print "\tuImage\t\tOutput uImage name (U-Boot image)"
     151        print("\traw_image\tInput image name (raw binary data)")
     152        print("\tuImage\t\tOutput uImage name (U-Boot image)")
    153153        print
    154         print "options:"
    155         print "\t-name <name>\tImage name (default: 'Noname')"
    156         print "\t-laddr <name>\tLoad address (default: 0x00000000)"
    157         print "\t-saddr <name>\tStart address (default: 0x00000000)"
     154        print("options:")
     155        print("\t-name <name>\tImage name (default: 'Noname')")
     156        print("\t-laddr <name>\tLoad address (default: 0x00000000)")
     157        print("\t-saddr <name>\tStart address (default: 0x00000000)")
    158158
    159159if __name__ == '__main__':
  • tools/pack.py

    r76e1121f r4687a26c  
    4343def usage(prname):
    4444        "Print usage syntax"
    45         print "%s <OBJCOPY> <FORMAT> <ARCH> <ARCH_PATH> [COMPONENTS ...]" % prname
     45        print("%s <OBJCOPY> <FORMAT> <ARCH> <ARCH_PATH> [COMPONENTS ...]" % prname)
    4646
    4747def deflate(data):
     
    110110                symbol = "_binary_%s" % basename.replace(".", "_")
    111111               
    112                 print "%s -> %s" % (component, obj)
     112                print("%s -> %s" % (component, obj))
    113113               
    114                 comp_in = file(component, "rb")
    115                 comp_data = comp_in.read();
     114                comp_in = open(component, "rb")
     115                comp_data = comp_in.read()
    116116                comp_in.close()
    117117               
     
    121121               
    122122                try:
    123                         comp_out = file(basename, "wb")
     123                        comp_out = open(basename, "wb")
    124124                        comp_out.write(comp_deflate)
    125125                        comp_out.close()
     
    151151                cnt += 1
    152152       
    153         header = file(os.path.join(arch_path, "include", "%s.h" % COMPONENTS), "w")
     153        header = open(os.path.join(arch_path, "include", "%s.h" % COMPONENTS), "w")
    154154       
    155155        header.write('/***************************************\n')
     
    173173        header.close()
    174174       
    175         data = file(os.path.join(arch_path, "src", "%s.c" % COMPONENTS), "w")
     175        data = open(os.path.join(arch_path, "src", "%s.c" % COMPONENTS), "w")
    176176       
    177177        data.write('/***************************************\n')
     
    187187        data.close()
    188188       
    189         link_in = file(os.path.join(arch_path, "%s.in" % LINK), "r")
     189        link_in = open(os.path.join(arch_path, "%s.in" % LINK), "r")
    190190        template = link_in.read()
    191191        link_in.close()
    192192       
    193         link_out = file(os.path.join(arch_path, "%s.comp" % LINK), "w")
     193        link_out = open(os.path.join(arch_path, "%s.comp" % LINK), "w")
    194194        link_out.write(template.replace("[[COMPONENTS]]", "\n".join(link_ctx)))
    195195        link_out.close()
  • tools/toolchain.sh

    r76e1121f r4687a26c  
    1 #!/bin/bash
     1#! /bin/bash
    22
    33#
     
    3333                echo
    3434                echo "Script failed: $2"
     35               
    3536                exit 1
    3637        fi
     
    4546                echo
    4647                echo "Checksum of ${FILE} does not match."
     48               
    4749                exit 2
    4850        fi
     
    7173}
    7274
     75change_title() {
     76        echo -en "\e]0;$1\a"
     77}
     78
     79show_countdown() {
     80        TM="$1"
     81       
     82        if [ "${TM}" -eq 0 ] ; then
     83                echo
     84                return 0
     85        fi
     86       
     87        echo -n "${TM} "
     88        change_title "${TM}"
     89        sleep 1
     90       
     91        TM="`expr "${TM}" - 1`"
     92        show_countdown "${TM}"
     93}
     94
     95show_dependencies() {
     96        echo "IMPORTANT NOTICE:"
     97        echo
     98        echo "For a successful compilation and use of the cross-compiler"
     99        echo "toolchain you need at least the following dependencies."
     100        echo
     101        echo "Please make sure that the dependencies are present in your"
     102        echo "system. Otherwise the compilation process might fail after"
     103        echo "a few seconds or minutes."
     104        echo
     105        echo " - SED, AWK, Flex, Bison, gzip, bzip2, Bourne Shell"
     106        echo " - gettext, zlib, Texinfo, libelf, libgomp"
     107        echo " - GNU Multiple Precision Library (GMP)"
     108        echo " - GNU Make"
     109        echo " - GNU tar"
     110        echo " - GNU Coreutils"
     111        echo " - GNU Sharutils"
     112        echo " - MPFR"
     113        echo " - MPC"
     114        echo " - Parma Polyhedra Library (PPL)"
     115        echo " - ClooG-PPL"
     116        echo " - native C compiler, assembler and linker"
     117        echo " - native C library with headers"
     118        echo
     119       
     120        show_countdown 10
     121}
     122
    73123download_check() {
    74124        SOURCE="$1"
     
    77127       
    78128        if [ ! -f "${FILE}" ]; then
     129                change_title "Downloading ${FILE}"
    79130                wget -c "${SOURCE}${FILE}"
    80131                check_error $? "Error downloading ${FILE}."
     
    88139       
    89140        if [ -d "${DIR}" ]; then
     141                change_title "Removing ${DIR}"
    90142                echo " >>> Removing ${DIR}"
    91143                rm -fr "${DIR}"
     
    97149        DESC="$2"
    98150       
     151        change_title "Creating ${DESC}"
    99152        echo ">>> Creating ${DESC}"
    100153       
     
    108161        DESC="$2"
    109162       
    110         echo " >>> ${DESC}"
     163        change_title "Unpacking ${DESC}"
     164        echo " >>> Unpacking ${DESC}"
    111165       
    112166        tar -xjf "${FILE}"
     
    142196       
    143197        BINUTILS_VERSION="2.20"
    144         GCC_VERSION="4.5.0"
     198        GCC_VERSION="4.5.1"
    145199       
    146200        BINUTILS="binutils-${BINUTILS_VERSION}.tar.bz2"
     
    165219        echo ">>> Downloading tarballs"
    166220        download_check "${BINUTILS_SOURCE}" "${BINUTILS}" "ee2d3e996e9a2d669808713360fa96f8"
    167         download_check "${GCC_SOURCE}" "${GCC_CORE}" "58eda33c3184303628f91c42a7ab15b5"
    168         download_check "${GCC_SOURCE}" "${GCC_OBJC}" "8d8c01b6631b020cc6c167860fde2398"
    169         download_check "${GCC_SOURCE}" "${GCC_CPP}" "5ab93605af40def4844eda09ca769c2d"
     221        download_check "${GCC_SOURCE}" "${GCC_CORE}" "dc8959e31b01a65ce10d269614815054"
     222        download_check "${GCC_SOURCE}" "${GCC_OBJC}" "3c11b7037896e967eddf8178af2ddd98"
     223        download_check "${GCC_SOURCE}" "${GCC_CPP}" "b294953ff0bb2f20c7acb2bf005d832a"
    170224       
    171225        echo ">>> Removing previous content"
     
    184238        unpack_tarball "${GCC_CPP}" "C++"
    185239       
    186         echo ">>> Compiling and installing binutils"
     240        echo ">>> Processing binutils (${PLATFORM})"
    187241        cd "${BINUTILSDIR}"
    188242        check_error $? "Change directory failed."
    189243        patch_binutils "${PLATFORM}"
    190         ./configure "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" "--disable-nls"
     244       
     245        change_title "binutils: configure (${PLATFORM})"
     246        ./configure "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" --disable-nls
    191247        check_error $? "Error configuring binutils."
     248       
     249        change_title "binutils: make (${PLATFORM})"
    192250        make all install
    193251        check_error $? "Error compiling/installing binutils."
    194252       
    195         echo ">>> Compiling and installing GCC"
     253        echo ">>> Processing GCC (${PLATFORM})"
    196254        cd "${OBJDIR}"
    197255        check_error $? "Change directory failed."
     256       
     257        change_title "GCC: configure (${PLATFORM})"
    198258        "${GCCDIR}/configure" "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" --with-gnu-as --with-gnu-ld --disable-nls --disable-threads --enable-languages=c,objc,c++,obj-c++ --disable-multilib --disable-libgcj --without-headers --disable-shared --enable-lto
    199259        check_error $? "Error configuring GCC."
     260       
     261        change_title "GCC: make (${PLATFORM})"
    200262        PATH="${PATH}:${PREFIX}/bin" make all-gcc install-gcc
    201263        check_error $? "Error compiling/installing GCC."
     
    216278        show_usage
    217279fi
     280
     281show_dependencies
    218282
    219283case "$1" in
Note: See TracChangeset for help on using the changeset viewer.