Changeset bbe5e34 in mainline for tools/autotool.py


Ignore:
Timestamp:
2018-08-31T14:32:39Z (7 years ago)
Author:
GitHub <noreply@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
58e7b26
Parents:
fa86fff
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-08-31 14:32:39)
git-committer:
GitHub <noreply@…> (2018-08-31 14:32:39)
Message:

Switch completely to HelenOS-specific toolchain target (#44)

As previously discussed, utilizing the compiler-provided headers and libraries would
allow us to avoid a number of problems and reduce the amount of architecture-support
code that we have to implement ourselves. With this change, the support for using
Linux-targeted toolchain, or even the host toolchain itself, is removed, due to the
inherent issues caused by such setup.

Additionally, the toolchain installation is a bit simplified to install all targets into a single
prefix. This prefix can be added to the PATH so that one can simply execute
e.g. amd64-helenos-gcc instead of needing to use the whole path.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/autotool.py

    rfa86fff rbbe5e34  
    178178def get_target(config):
    179179        platform = None
    180         gnu_target = None
    181         helenos_target = None
    182180        target = None
    183181        cc_args = []
     
    188186
    189187                if (config['CROSS_TARGET'] == "arm32"):
    190                         gnu_target = "arm-linux-gnueabi"
    191                         helenos_target = "arm-helenos"
     188                        target = "arm-helenos"
    192189
    193190                if (config['CROSS_TARGET'] == "ia32"):
    194                         gnu_target = "i686-pc-linux-gnu"
    195                         helenos_target = "i686-helenos"
     191                        target = "i686-helenos"
    196192
    197193                if (config['CROSS_TARGET'] == "mips32"):
    198194                        cc_args.append("-mabi=32")
    199                         gnu_target = "mipsel-linux-gnu"
    200                         helenos_target = "mipsel-helenos"
     195                        target = "mipsel-helenos"
    201196
    202197        if (config['PLATFORM'] == "amd64"):
    203198                platform = config['PLATFORM']
    204                 gnu_target = "amd64-unknown-elf"
    205                 helenos_target = "amd64-helenos"
     199                target = "amd64-helenos"
    206200
    207201        if (config['PLATFORM'] == "arm32"):
    208202                platform = config['PLATFORM']
    209                 gnu_target = "arm-linux-gnueabi"
    210                 helenos_target = "arm-helenos"
     203                target = "arm-helenos"
    211204
    212205        if (config['PLATFORM'] == "ia32"):
    213206                platform = config['PLATFORM']
    214                 gnu_target = "i686-pc-linux-gnu"
    215                 helenos_target = "i686-helenos"
     207                target = "i686-helenos"
    216208
    217209        if (config['PLATFORM'] == "ia64"):
    218210                platform = config['PLATFORM']
    219                 gnu_target = "ia64-pc-linux-gnu"
    220                 helenos_target = "ia64-helenos"
     211                target = "ia64-helenos"
    221212
    222213        if (config['PLATFORM'] == "mips32"):
     
    226217                if ((config['MACHINE'] == "msim") or (config['MACHINE'] == "lmalta")):
    227218                        platform = config['PLATFORM']
    228                         gnu_target = "mipsel-linux-gnu"
    229                         helenos_target = "mipsel-helenos"
     219                        target = "mipsel-helenos"
    230220
    231221                if ((config['MACHINE'] == "bmalta")):
    232222                        platform = "mips32eb"
    233                         gnu_target = "mips-linux-gnu"
    234                         helenos_target = "mips-helenos"
     223                        target = "mips-helenos"
    235224
    236225        if (config['PLATFORM'] == "mips64"):
     
    240229                if (config['MACHINE'] == "msim"):
    241230                        platform = config['PLATFORM']
    242                         gnu_target = "mips64el-linux-gnu"
    243                         helenos_target = "mips64el-helenos"
     231                        target = "mips64el-helenos"
    244232
    245233        if (config['PLATFORM'] == "ppc32"):
    246234                platform = config['PLATFORM']
    247                 gnu_target = "ppc-linux-gnu"
    248                 helenos_target = "ppc-helenos"
     235                target = "ppc-helenos"
    249236
    250237        if (config['PLATFORM'] == "riscv64"):
    251238                platform = config['PLATFORM']
    252                 gnu_target = "riscv64-unknown-linux-gnu"
    253                 helenos_target = "riscv64-helenos"
     239                target = "riscv64-helenos"
    254240
    255241        if (config['PLATFORM'] == "sparc64"):
    256242                platform = config['PLATFORM']
    257                 gnu_target = "sparc64-linux-gnu"
    258                 helenos_target = "sparc64-helenos"
    259 
    260         if (config['COMPILER'] == "gcc_helenos"):
    261                 target = helenos_target
    262         else:
    263                 target = gnu_target
     243                target = "sparc64-helenos"
    264244
    265245        return (platform, cc_args, target)
     
    279259
    280260        sys.stderr.write("ok\n")
     261
     262def check_path_gcc(target):
     263        "Check whether GCC for a given target is present in $PATH."
     264
     265        try:
     266                subprocess.Popen([ "%s-gcc" % target, "--version" ], stdout = subprocess.PIPE, stderr = subprocess.PIPE).wait()
     267                return True
     268        except:
     269                return False
    281270
    282271def check_app_alternatives(alts, args, name, details):
     
    561550                cross_prefix = "/usr/local/cross"
    562551
    563         # HelenOS cross-compiler prefix
    564         if ('CROSS_HELENOS_PREFIX' in os.environ):
    565                 cross_helenos_prefix = os.environ['CROSS_HELENOS_PREFIX']
    566         else:
    567                 cross_helenos_prefix = "/usr/local/cross-helenos"
    568 
    569         # Prefix binutils tools on Solaris
    570         if (os.uname()[0] == "SunOS"):
    571                 binutils_prefix = "g"
    572         else:
    573                 binutils_prefix = ""
    574 
    575552        owd = sandbox_enter()
    576553
     
    593570                                     "Please contact the developers of HelenOS."])
    594571
    595                 path = "%s/%s/bin" % (cross_prefix, target)
    596 
    597                 # Compatibility with earlier toolchain paths.
    598                 if not os.path.exists(path):
    599                         if (config['COMPILER'] == "gcc_helenos"):
    600                                 check_path = "%s/%s/%s" % (cross_helenos_prefix, platform, target)
    601                                 if not os.path.exists(check_path):
    602                                         print_error(TOOLCHAIN_FAIL)
    603                                 path = "%s/%s/bin" % (cross_helenos_prefix, platform)
    604                         else:
    605                                 check_path = "%s/%s/%s" % (cross_prefix, platform, target)
    606                                 if not os.path.exists(check_path):
    607                                         print_error(TOOLCHAIN_FAIL)
    608                                 path = "%s/%s/bin" % (cross_prefix, platform)
     572                path = None
     573
     574                if not check_path_gcc(target):
     575                        path = "%s/bin" % cross_prefix
    609576
    610577                common['TARGET'] = target
     
    612579
    613580                # Compiler
    614                 if (config['COMPILER'] == "gcc_cross" or config['COMPILER'] == "gcc_helenos"):
     581                if (config['COMPILER'] == "gcc_cross"):
    615582                        check_gcc(path, prefix, common, PACKAGE_CROSS)
    616583                        check_binutils(path, prefix, common, PACKAGE_CROSS)
     
    622589                        check_common(common, "GXX")
    623590                        common['CXX'] = common['GXX']
    624 
    625                 if (config['COMPILER'] == "gcc_native"):
    626                         check_gcc(None, "", common, PACKAGE_GCC)
    627                         check_binutils(None, binutils_prefix, common, PACKAGE_BINUTILS)
    628 
    629                         check_common(common, "GCC")
    630                         common['CC'] = common['GCC']
    631                         common['CC_AUTOGEN'] = common['CC']
    632591
    633592                if (config['COMPILER'] == "clang"):
Note: See TracChangeset for help on using the changeset viewer.