Changeset 0c2d9bb in mainline for tools


Ignore:
Timestamp:
2013-12-25T22:54:29Z (12 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b51cf2c
Parents:
f7a33de (diff), ac36aed (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:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • tools/autotool.py

    rf7a33de r0c2d9bb  
    186186        gnu_target = None
    187187        clang_target = None
     188        helenos_target = None
    188189        cc_args = []
    189190       
     
    195196                        gnu_target = "arm-linux-gnueabi"
    196197                        clang_target = "arm-unknown-linux"
     198                        helenos_target = "arm-helenos-gnueabi"
    197199               
    198200                if (config['CROSS_TARGET'] == "ia32"):
    199201                        gnu_target = "i686-pc-linux-gnu"
    200202                        clang_target = "i386-unknown-linux"
     203                        helenos_target = "i686-pc-helenos"
    201204               
    202205                if (config['CROSS_TARGET'] == "mips32"):
    203206                        gnu_target = "mipsel-linux-gnu"
    204207                        clang_target = "mipsel-unknown-linux"
     208                        helenos_target = "mipsel-helenos"
    205209                        common['CC_ARGS'].append("-mabi=32")
    206210       
     
    209213                gnu_target = "amd64-linux-gnu"
    210214                clang_target = "x86_64-unknown-linux"
     215                helenos_target = "amd64-helenos"
    211216       
    212217        if (config['PLATFORM'] == "arm32"):
     
    214219                gnu_target = "arm-linux-gnueabi"
    215220                clang_target = "arm-unknown-linux"
     221                helenos_target = "arm-helenos-gnueabi"
    216222       
    217223        if (config['PLATFORM'] == "ia32"):
     
    219225                gnu_target = "i686-pc-linux-gnu"
    220226                clang_target = "i386-unknown-linux"
     227                helenos_target = "i686-pc-helenos"
    221228       
    222229        if (config['PLATFORM'] == "ia64"):
    223230                target = config['PLATFORM']
    224231                gnu_target = "ia64-pc-linux-gnu"
     232                helenos_target = "ia64-pc-helenos"
    225233       
    226234        if (config['PLATFORM'] == "mips32"):
     
    232240                        gnu_target = "mipsel-linux-gnu"
    233241                        clang_target = "mipsel-unknown-linux"
     242                        helenos_target = "mipsel-helenos"
    234243               
    235244                if ((config['MACHINE'] == "bmalta")):
     
    237246                        gnu_target = "mips-linux-gnu"
    238247                        clang_target = "mips-unknown-linux"
     248                        helenos_target = "mips-helenos"
    239249       
    240250        if (config['PLATFORM'] == "mips64"):
     
    246256                        gnu_target = "mips64el-linux-gnu"
    247257                        clang_target = "mips64el-unknown-linux"
     258                        helenos_target = "mips64el-helenos"
    248259       
    249260        if (config['PLATFORM'] == "ppc32"):
     
    251262                gnu_target = "ppc-linux-gnu"
    252263                clang_target = "powerpc-unknown-linux"
     264                helenos_target = "ppc-helenos"
     265       
     266        if (config['PLATFORM'] == "sparc32"):
     267                target = config['PLATFORM'];
     268                gnu_target = "sparc-leon3-linux-gnu"
     269                helenos_target = "sparc-leon3-helenos"
    253270       
    254271        if (config['PLATFORM'] == "sparc64"):
     
    256273                gnu_target = "sparc64-linux-gnu"
    257274                clang_target = "sparc-unknown-linux"
    258 
    259         if (config['PLATFORM'] == "sparc32"):
    260                 target = config['PLATFORM'];
    261                 gnu_target = "sparc-leon3-linux-gnu"
    262        
    263         return (target, cc_args, gnu_target, clang_target)
     275                helenos_target = "sparc64-helenos"
     276       
     277        return (target, cc_args, gnu_target, clang_target, helenos_target)
    264278
    265279def check_app(args, name, details):
     
    701715                cross_prefix = "/usr/local/cross"
    702716       
     717        # HelenOS cross-compiler prefix
     718        if ('CROSS_HELENOS_PREFIX' in os.environ):
     719                cross_helenos_prefix = os.environ['CROSS_HELENOS_PREFIX']
     720        else:
     721                cross_helenos_prefix = "/usr/local/cross-helenos"
     722       
    703723        # Prefix binutils tools on Solaris
    704724        if (os.uname()[0] == "SunOS"):
     
    723743                common['CC_ARGS'] = []
    724744                if (config['COMPILER'] == "gcc_cross"):
    725                         target, cc_args, gnu_target, clang_target = get_target(config)
     745                        target, cc_args, gnu_target, clang_target, helenos_target = get_target(config)
    726746                       
    727747                        if (target is None) or (gnu_target is None):
     
    731751                        path = "%s/%s/bin" % (cross_prefix, target)
    732752                        prefix = "%s-" % gnu_target
     753                       
     754                        check_gcc(path, prefix, common, PACKAGE_CROSS)
     755                        check_binutils(path, prefix, common, PACKAGE_CROSS)
     756                       
     757                        check_common(common, "GCC")
     758                        common['CC'] = common['GCC']
     759                        common['CC_ARGS'].extend(cc_args)
     760               
     761                if (config['COMPILER'] == "gcc_helenos"):
     762                        target, cc_args, gnu_target, clang_target, helenos_target = get_target(config)
     763                       
     764                        if (target is None) or (helenos_target is None):
     765                                print_error(["Unsupported compiler target for GNU GCC.",
     766                                             "Please contact the developers of HelenOS."])
     767                       
     768                        path = "%s/%s/bin" % (cross_helenos_prefix, target)
     769                        prefix = "%s-" % helenos_target
    733770                       
    734771                        check_gcc(path, prefix, common, PACKAGE_CROSS)
  • tools/config.py

    rf7a33de r0c2d9bb  
    363363def create_output(mkname, mcname, config, rules):
    364364        "Create output configuration"
    365        
    366         timestamp = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
     365
     366        timestamp_unix = int(time.time())
     367        timestamp = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(timestamp_unix))
    367368       
    368369        sys.stderr.write("Fetching current revision identifier ... ")
     
    423424                outmc.write('#define REVISION %s\n' % revision)
    424425                defs += ' "-DREVISION=%s"' % revision
     426       
     427        outmk.write('TIMESTAMP_UNIX = %d\n' % timestamp_unix)
     428        outmc.write('#define TIMESTAMP_UNIX %d\n' % timestamp_unix)
     429        defs += ' "-DTIMESTAMP_UNIX=%d"\n' % timestamp_unix
    425430       
    426431        outmk.write('TIMESTAMP = %s\n' % timestamp)
  • tools/ew.py

    rf7a33de r0c2d9bb  
    3434
    3535import os
     36import sys
    3637import subprocess
    3738import autotool
    3839import platform
    3940
     41overrides = {}
     42
     43def is_override(str):
     44        if str in overrides.keys():
     45                return overrides[str]
     46        return False
     47
     48def cfg_get(platform, machine):
     49        if machine == "":
     50                return emulators[platform]
     51        else:
     52                return emulators[platform][machine]
     53
    4054def run_in_console(cmd, title):
    4155        cmdline = 'xterm -T ' + '"' + title + '"' + ' -e ' + cmd
    4256        print(cmdline)
    43         subprocess.call(cmdline, shell = True);
     57        if not is_override('dryrun'):
     58                subprocess.call(cmdline, shell = True);
    4459
    4560def get_host_native_width():
     
    5267        # on 32 bits host
    5368        host_width = get_host_native_width()
    54         if guest_width <= host_width:
     69        if guest_width <= host_width and not is_override('nokvm'):
    5570                opts = opts + ' -enable-kvm'
    5671       
     
    7994
    8095def qemu_bd_options():
     96        if is_override('nohdd'):
     97                return ''
     98
    8199        if not os.path.exists('hdisk.img'):
    82100                subprocess.call('tools/mkfat.py 1048576 uspace/dist/data hdisk.img', shell = True)
     101
    83102        return ' -hda hdisk.img'
    84103
     
    93112
    94113def qemu_net_options():
    95         nic_options = qemu_nic_e1k_options()
     114        if is_override('nonet'):
     115                return ''
     116
     117        nic_options = ''
     118        if 'net' in overrides.keys():
     119                if 'e1k' in overrides['net'].keys():
     120                        nic_options += qemu_nic_e1k_options()
     121                if 'rtl8139' in overrides['net'].keys():
     122                        nic_options += qemu_nic_rtl8139_options()
     123                if 'ne2k' in overrides['net'].keys():
     124                        nic_options += qemu_nic_ne2k_options()
     125        else:
     126                # Use the default NIC
     127                nic_options += qemu_nic_e1k_options()
     128
    96129        return nic_options + ' -net user -redir udp:8080::8080 -redir udp:8081::8081 -redir tcp:8080::8080 -redir tcp:8081::8081 -redir tcp:2223::2223'
    97130
    98131def qemu_usb_options():
    99         return ''
    100 
    101 def qemu_run(platform, machine, console, image, networking, storage, usb):
     132        if is_override('nousb'):
     133                return ''
     134        return ' -usb'
     135
     136def qemu_audio_options():
     137        if is_override('nosnd'):
     138                return ''
     139        return ' -soundhw sb16'
     140
     141def qemu_run(platform, machine):
     142        cfg = cfg_get(platform, machine)
    102143        suffix, options = platform_to_qemu_options(platform, machine)
    103144        cmd = 'qemu-' + suffix
     
    107148                cmdline += ' ' + options
    108149
    109         if storage:
    110                 cmdline += qemu_bd_options()
    111         if networking:
     150        cmdline += qemu_bd_options()
     151
     152        if (not 'net' in cfg.keys()) or cfg['net']:
    112153                cmdline += qemu_net_options()
    113         if usb:
     154        if (not 'usb' in cfg.keys()) or cfg['usb']:
    114155                cmdline += qemu_usb_options()
     156        if (not 'audio' in cfg.keys()) or cfg['audio']:
     157                cmdline += qemu_audio_options()
    115158       
    116         if image == 'image.iso':
     159        if cfg['image'] == 'image.iso':
    117160                cmdline += ' -boot d -cdrom image.iso'
    118         elif image == 'image.boot':
     161        elif cfg['image'] == 'image.boot':
    119162                cmdline += ' -kernel image.boot'
    120163
    121         if not console:
     164        if ('console' in cfg.keys()) and not cfg['console']:
    122165                cmdline += ' -nographic'
    123166
     
    128171        else:
    129172                print(cmdline)
    130                 subprocess.call(cmdline, shell = True)
     173                if not is_override('dryrun'):
     174                        subprocess.call(cmdline, shell = True)
    131175               
    132 def ski_run(platform, machine, console, image, networking, storage, usb):
     176def ski_run(platform, machine):
    133177        run_in_console('ski -i contrib/conf/ski.conf', 'HelenOS/ia64 on ski')
    134178
    135 def msim_run(platform, machine, console, image, networking, storage, usb):
     179def msim_run(platform, machine):
    136180        run_in_console('msim -c contrib/conf/msim.conf', 'HelenOS/mips32 on msim')
    137181
    138 emulators = {}
    139 emulators['amd64'] = {}
    140 emulators['arm32'] = {}
    141 emulators['ia32'] = {}
    142 emulators['ia64'] = {}
    143 emulators['mips32'] = {}
    144 emulators['ppc32'] = {}
    145 emulators['sparc64'] = {}
    146 
    147 emulators['amd64'][''] = qemu_run, True, 'image.iso', True, True, True
    148 emulators['arm32']['integratorcp'] = qemu_run, True, 'image.boot', False, False, False
    149 emulators['ia32'][''] = qemu_run, True, 'image.iso', True, True, True
    150 emulators['ia64']['ski'] = ski_run, False, 'image.boot', False, False, False
    151 emulators['mips32']['msim'] = msim_run, False, 'image.boot', False, False, False
    152 emulators['mips32']['lmalta'] = qemu_run, False, 'image.boot', False, False, False
    153 emulators['mips32']['bmalta'] = qemu_run, False, 'image.boot', False, False, False
    154 emulators['ppc32'][''] = qemu_run, True, 'image.iso', True, True, True
    155 emulators['sparc64']['generic'] = qemu_run, True, 'image.iso', True, True, True
     182
     183emulators = {
     184        'amd64' : {
     185                'run' : qemu_run,
     186                'image' : 'image.iso'
     187        },
     188        'arm32' : {
     189                'integratorcp' : {
     190                        'run' : qemu_run,
     191                        'image' : 'image.boot',
     192                        'net' : False,
     193                        'audio' : False
     194                }
     195        },
     196        'ia32' : {
     197                'run' : qemu_run,
     198                'image' : 'image.iso'
     199        },
     200        'ia64' : {
     201                'ski' : {
     202                        'run' : ski_run
     203                }
     204        },
     205        'mips32' : {
     206                'msim' : {
     207                        'run' : msim_run
     208                },
     209                'lmalta' : {
     210                        'run' : qemu_run,
     211                        'image' : 'image.boot',
     212                        'console' : False
     213                },
     214                'bmalta' : {
     215                        'run' : qemu_run,
     216                        'image' : 'image.boot',
     217                        'console' : False
     218                },
     219        },
     220        'ppc32' : {
     221                'run' : qemu_run,
     222                'image' : 'image.iso',
     223                'audio' : False
     224        },
     225        'sparc64' : {
     226                'generic' : {
     227                        'run' : qemu_run,
     228                        'image' : 'image.iso',
     229                        'audio' : False
     230                }
     231        },
     232}
     233
     234def usage():
     235        print("%s - emulator wrapper for running HelenOS\n" % os.path.basename(sys.argv[0]))
     236        print("%s [-d] [-h] [-net e1k|rtl8139|ne2k] [-nohdd] [-nokvm] [-nonet] [-nosnd] [-nousb]\n" %
     237            os.path.basename(sys.argv[0]))
     238        print("-d\tDry run: do not run the emulation, just print the command line.")
     239        print("-h\tPrint the usage information and exit.")
     240        print("-nohdd\tDisable hard disk, if applicable.")
     241        print("-nokvm\tDisable KVM, if applicable.")
     242        print("-nonet\tDisable networking support, if applicable.")
     243        print("-nosnd\tDisable sound, if applicable.")
     244        print("-nousb\tDisable USB support, if applicable.")
    156245
    157246def run():
     247        expect_nic = False
     248
     249        for i in range(1, len(sys.argv)):
     250
     251                if expect_nic:
     252                        expect_nic = False
     253                        if not 'net' in overrides.keys():
     254                                overrides['net'] = {}
     255                        if sys.argv[i] == 'e1k':
     256                                overrides['net']['e1k'] = True
     257                        elif sys.argv[i] == 'rtl8139':
     258                                overrides['net']['rtl8139'] = True
     259                        elif sys.argv[i] == 'ne2k':
     260                                overrides['net']['ne2k'] = True
     261                        else:
     262                                usage()
     263                                exit()
     264
     265                elif sys.argv[i] == '-h':
     266                        usage()
     267                        exit()
     268                elif sys.argv[i] == '-d':
     269                        overrides['dryrun'] = True
     270                elif sys.argv[i] == '-net' and i < len(sys.argv) - 1:
     271                        expect_nic = True
     272                elif sys.argv[i] == '-nohdd':
     273                        overrides['nohdd'] = True
     274                elif sys.argv[i] == '-nokvm':
     275                        overrides['nokvm'] = True
     276                elif sys.argv[i] == '-nonet':
     277                        overrides['nonet'] = True
     278                elif sys.argv[i] == '-nosnd':
     279                        overrides['nosnd'] = True
     280                elif sys.argv[i] == '-nousb':
     281                        overrides['nousb'] = True
     282                else:
     283                        usage()
     284                        exit()
     285
    158286        config = {}
    159287        autotool.read_config(autotool.CONFIG, config)
    160288
     289        if 'PLATFORM' in config.keys():
     290                platform = config['PLATFORM']
     291        else:
     292                platform = ''
     293
     294        if 'MACHINE' in config.keys():
     295                mach = config['MACHINE']
     296        else:
     297                mach = ''
     298
    161299        try:
    162                 platform = config['PLATFORM']
     300                emu_run = cfg_get(platform, mach)['run']
    163301        except:
    164                 platform = ''
    165 
    166         try:
    167                 mach = config['MACHINE']
    168         except:
    169                 mach = ''
    170 
    171         try:
    172                 emu_run, console, image, networking, storage, usb = emulators[platform][mach]
    173         except:
    174                 print("Cannot start emulation for the chosen configuration.")
     302                print("Cannot start emulation for the chosen configuration. (%s/%s)" % (platform, mach))
    175303                return
    176304
    177         emu_run(platform, mach, console, image, networking, storage, usb)
     305        emu_run(platform, mach)
    178306
    179307run()
  • tools/toolchain.sh

    rf7a33de r0c2d9bb  
    3636        GCC_GMP_VERSION_NUM(__GNU_MP_VERSION, __GNU_MP_VERSION_MINOR, __GNU_MP_VERSION_PATCHLEVEL)
    3737
    38 #if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4,3,2)
     38#if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4, 3, 2)
    3939        choke me
    4040#endif
     
    5555BINUTILS_VERSION="2.23.1"
    5656BINUTILS_RELEASE=""
     57BINUTILS_PATCHES="toolchain-binutils-2.23.1.patch"
    5758GCC_VERSION="4.8.1"
    58 GDB_VERSION="7.6"
     59GCC_PATCHES="toolchain-gcc-4.8.1-targets.patch toolchain-gcc-4.8.1-headers.patch"
     60GDB_VERSION="7.6.1"
     61GDB_PATCHES="toolchain-gdb-7.6.1.patch"
    5962
    6063BASEDIR="`pwd`"
     64SRCDIR="$(readlink -f $(dirname "$0"))"
    6165BINUTILS="binutils-${BINUTILS_VERSION}${BINUTILS_RELEASE}.tar.bz2"
    6266GCC="gcc-${GCC_VERSION}.tar.bz2"
    6367GDB="gdb-${GDB_VERSION}.tar.bz2"
     68
     69REAL_INSTALL=true
     70USE_HELENOS_TARGET=false
     71INSTALL_DIR="${BASEDIR}/PKG"
    6472
    6573#
     
    135143        echo
    136144        echo "Syntax:"
    137         echo " $0 <platform>"
     145        echo " $0 [--no-install] [--helenos-target] <platform>"
    138146        echo
    139147        echo "Possible target platforms are:"
     
    147155        echo " ppc32      32-bit PowerPC"
    148156        echo " ppc64      64-bit PowerPC"
     157        echo " sparc32    SPARC V8"
    149158        echo " sparc64    SPARC V9"
    150         echo " sparc32    SPARC V8"
    151159        echo " all        build all targets"
    152160        echo " parallel   same as 'all', but all in parallel"
    153161        echo " 2-way      same as 'all', but 2-way parallel"
    154162        echo
    155         echo "The toolchain will be installed to the directory specified by"
    156         echo "the CROSS_PREFIX environment variable. If the variable is not"
    157         echo "defined, /usr/local/cross will be used by default."
     163        echo "The toolchain is installed into directory specified by the"
     164        echo "CROSS_PREFIX environment variable. If the variable is not"
     165        echo "defined, /usr/local/cross/ is used as default."
     166        echo
     167        echo "If --no-install is present, the toolchain still uses the"
     168        echo "CROSS_PREFIX as the target directory but the installation"
     169        echo "copies the files into PKG/ subdirectory without affecting"
     170        echo "the actual root file system. That is only useful if you do"
     171        echo "not want to run the script under the super user."
     172        echo
     173        echo "The --helenos-target will build HelenOS-specific toolchain"
     174        echo "(i.e. it will use *-helenos-* triplet instead of *-linux-*)."
     175        echo "This toolchain is installed into /usr/local/cross-helenos by"
     176        echo "default. The settings can be changed by setting environment"
     177        echo "variable CROSS_HELENOS_PREFIX."
     178        echo "Using the HelenOS-specific toolchain is still an experimental"
     179        echo "feature that is not fully supported."
    158180        echo
    159181       
     
    255277}
    256278
     279check_dirs() {
     280        OUTSIDE="$1"
     281        BASE="$2"
     282        ORIGINAL="`pwd`"
     283       
     284        cd "${OUTSIDE}"
     285        check_error $? "Unable to change directory to ${OUTSIDE}."
     286        ABS_OUTSIDE="`pwd`"
     287       
     288        cd "${BASE}"
     289        check_error $? "Unable to change directory to ${BASE}."
     290        ABS_BASE="`pwd`"
     291       
     292        cd "${ORIGINAL}"
     293        check_error $? "Unable to change directory to ${ORIGINAL}."
     294       
     295        BASE_LEN="${#ABS_BASE}"
     296        OUTSIDE_TRIM="${ABS_OUTSIDE:0:${BASE_LEN}}"
     297       
     298        if [ "${OUTSIDE_TRIM}" == "${ABS_BASE}" ] ; then
     299                echo
     300                echo "CROSS_PREFIX cannot reside within the working directory."
     301               
     302                exit 5
     303        fi
     304}
     305
    257306unpack_tarball() {
    258307        FILE="$1"
     
    264313        tar -xjf "${FILE}"
    265314        check_error $? "Error unpacking ${DESC}."
     315}
     316
     317patch_sources() {
     318        PATCH_FILE="$1"
     319        PATCH_STRIP="$2"
     320        DESC="$3"
     321       
     322        change_title "Patching ${DESC}"
     323        echo " >>> Patching ${DESC} with ${PATCH_FILE}"
     324       
     325        patch -t "-p${PATCH_STRIP}" <"$PATCH_FILE"
     326        check_error $? "Error patching ${DESC}."
    266327}
    267328
     
    277338        download_fetch "${BINUTILS_SOURCE}" "${BINUTILS}" "33adb18c3048d057ac58d07a3f1adb38"
    278339        download_fetch "${GCC_SOURCE}" "${GCC}" "3b2386c114cd74185aa3754b58a79304"
    279         download_fetch "${GDB_SOURCE}" "${GDB}" "fda57170e4d11cdde74259ca575412a8"
     340        download_fetch "${GDB_SOURCE}" "${GDB}" "fbc4dab4181e6e9937075b43a4ce2732"
     341}
     342
     343set_target_from_platform() {
     344        case "$1" in
     345                "amd64")
     346                        LINUX_TARGET="amd64-linux-gnu"
     347                        HELENOS_TARGET="amd64-helenos"
     348                        ;;
     349                "arm32")
     350                        LINUX_TARGET="arm-linux-gnueabi"
     351                        HELENOS_TARGET="arm-helenos-gnueabi"
     352                        ;;
     353                "ia32")
     354                        LINUX_TARGET="i686-pc-linux-gnu"
     355                        HELENOS_TARGET="i686-pc-helenos"
     356                        ;;
     357                "ia64")
     358                        LINUX_TARGET="ia64-pc-linux-gnu"
     359                        HELENOS_TARGET="ia64-pc-helenos"
     360                        ;;
     361                "mips32")
     362                        LINUX_TARGET="mipsel-linux-gnu"
     363                        HELENOS_TARGET="mipsel-helenos"
     364                        ;;
     365                "mips32eb")
     366                        LINUX_TARGET="mips-linux-gnu"
     367                        HELENOS_TARGET="mips-helenos"
     368                        ;;
     369                "mips64")
     370                        LINUX_TARGET="mips64el-linux-gnu"
     371                        HELENOS_TARGET="mips64el-helenos"
     372                        ;;
     373                "ppc32")
     374                        LINUX_TARGET="ppc-linux-gnu"
     375                        HELENOS_TARGET="ppc-helenos"
     376                        ;;
     377                "ppc64")
     378                        LINUX_TARGET="ppc64-linux-gnu"
     379                        HELENOS_TARGET="ppc64-helenos"
     380                        ;;
     381                "sparc32")
     382                        LINUX_TARGET="sparc-leon3-linux-gnu"
     383                        HELENOS_TARGET="sparc-leon3-helenos"
     384                        ;;
     385                "sparc64")
     386                        LINUX_TARGET="sparc64-linux-gnu"
     387                        HELENOS_TARGET="sparc64-helenos"
     388                        ;;
     389                *)
     390                        check_error 1 "No target known for $1."
     391                        ;;
     392        esac
    280393}
    281394
    282395build_target() {
    283396        PLATFORM="$1"
    284         TARGET="$2"
     397        # This sets the *_TARGET variables
     398        set_target_from_platform "$PLATFORM"
     399        if $USE_HELENOS_TARGET; then
     400                TARGET="$HELENOS_TARGET"
     401        else
     402                TARGET="$LINUX_TARGET"
     403        fi
    285404       
    286405        WORKDIR="${BASEDIR}/${PLATFORM}"
     
    293412                CROSS_PREFIX="/usr/local/cross"
    294413        fi
    295        
    296         PREFIX="${CROSS_PREFIX}/${PLATFORM}"
     414        if [ -z "${CROSS_HELENOS_PREFIX}" ] ; then
     415                CROSS_HELENOS_PREFIX="/usr/local/cross-helenos"
     416        fi
     417       
     418        if $USE_HELENOS_TARGET; then
     419                PREFIX="${CROSS_HELENOS_PREFIX}/${PLATFORM}"
     420        else
     421                PREFIX="${CROSS_PREFIX}/${PLATFORM}"
     422        fi
    297423       
    298424        echo ">>> Downloading tarballs"
     
    302428       
    303429        echo ">>> Removing previous content"
    304         cleanup_dir "${PREFIX}"
     430        $REAL_INSTALL && cleanup_dir "${PREFIX}"
    305431        cleanup_dir "${WORKDIR}"
    306432       
    307         create_dir "${PREFIX}" "destination directory"
     433        $REAL_INSTALL && create_dir "${PREFIX}" "destination directory"
    308434        create_dir "${OBJDIR}" "GCC object directory"
     435       
     436        check_dirs "${PREFIX}" "${WORKDIR}"
    309437       
    310438        echo ">>> Unpacking tarballs"
     
    316444        unpack_tarball "${BASEDIR}/${GDB}" "GDB"
    317445       
     446        echo ">>> Applying patches"
     447        for p in $BINUTILS_PATCHES; do
     448                patch_sources "${SRCDIR}/${p}" 0 "binutils"
     449        done
     450        for p in $GCC_PATCHES; do
     451                patch_sources "${SRCDIR}/${p}" 0 "GCC"
     452        done
     453        for p in $GDB_PATCHES; do
     454                patch_sources "${SRCDIR}/${p}" 0 "GDB"
     455        done
     456       
    318457        echo ">>> Processing binutils (${PLATFORM})"
    319458        cd "${BINUTILSDIR}"
     
    321460       
    322461        change_title "binutils: configure (${PLATFORM})"
    323         CFLAGS=-Wno-error ./configure "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" --disable-nls --disable-werror
     462        CFLAGS=-Wno-error ./configure \
     463                "--target=${TARGET}" \
     464                "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" \
     465                --disable-nls --disable-werror
    324466        check_error $? "Error configuring binutils."
    325467       
    326468        change_title "binutils: make (${PLATFORM})"
    327         make all install
    328         check_error $? "Error compiling/installing binutils."
     469        make all
     470        check_error $? "Error compiling binutils."
     471       
     472        change_title "binutils: install (${PLATFORM})"
     473        if $REAL_INSTALL; then
     474                make install
     475        else
     476                make install "DESTDIR=${INSTALL_DIR}"
     477        fi
     478        check_error $? "Error installing binutils."
     479       
    329480       
    330481        echo ">>> Processing GCC (${PLATFORM})"
     
    333484       
    334485        change_title "GCC: configure (${PLATFORM})"
    335         "${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 --disable-werror
     486        PATH="$PATH:${INSTALL_DIR}/${PREFIX}/bin" "${GCCDIR}/configure" \
     487                "--target=${TARGET}" \
     488                "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" \
     489                --with-gnu-as --with-gnu-ld --disable-nls --disable-threads \
     490                --enable-languages=c,objc,c++,obj-c++ \
     491                --disable-multilib --disable-libgcj --without-headers \
     492                --disable-shared --enable-lto --disable-werror
    336493        check_error $? "Error configuring GCC."
    337494       
    338495        change_title "GCC: make (${PLATFORM})"
    339         PATH="${PATH}:${PREFIX}/bin" make all-gcc install-gcc
    340         check_error $? "Error compiling/installing GCC."
     496        PATH="${PATH}:${PREFIX}/bin:${INSTALL_DIR}/${PREFIX}/bin" make all-gcc
     497        check_error $? "Error compiling GCC."
     498       
     499        change_title "GCC: install (${PLATFORM})"
     500        if $REAL_INSTALL; then
     501                PATH="${PATH}:${PREFIX}/bin" make install-gcc
     502        else
     503                PATH="${PATH}:${INSTALL_DIR}/${PREFIX}/bin" make install-gcc "DESTDIR=${INSTALL_DIR}"
     504        fi
     505        check_error $? "Error installing GCC."
     506       
    341507       
    342508        echo ">>> Processing GDB (${PLATFORM})"
     
    345511       
    346512        change_title "GDB: configure (${PLATFORM})"
    347         ./configure "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-"
     513        PATH="$PATH:${INSTALL_DIR}/${PREFIX}/bin" ./configure \
     514                "--target=${TARGET}" \
     515                "--prefix=${PREFIX}" "--program-prefix=${TARGET}-"
    348516        check_error $? "Error configuring GDB."
    349517       
    350518        change_title "GDB: make (${PLATFORM})"
    351         make all install
    352         check_error $? "Error compiling/installing GDB."
     519        PATH="${PATH}:${PREFIX}/bin:${INSTALL_DIR}/${PREFIX}/bin" make all
     520        check_error $? "Error compiling GDB."
     521       
     522        change_title "GDB: make (${PLATFORM})"
     523        if $REAL_INSTALL; then
     524                PATH="${PATH}:${PREFIX}/bin" make install
     525        else
     526                PATH="${PATH}:${INSTALL_DIR}/${PREFIX}/bin" make install "DESTDIR=${INSTALL_DIR}"
     527        fi
     528        check_error $? "Error installing GDB."
     529       
    353530       
    354531        cd "${BASEDIR}"
     
    361538        echo ">>> Cross-compiler for ${TARGET} installed."
    362539}
     540
     541while [ "$#" -gt 1 ]; do
     542        case "$1" in
     543                --no-install)
     544                        REAL_INSTALL=false
     545                        shift
     546                        ;;
     547                --helenos-target)
     548                        USE_HELENOS_TARGET=true
     549                        shift
     550                        ;;
     551                *)
     552                        show_usage
     553                        ;;
     554        esac
     555done
    363556
    364557if [ "$#" -lt "1" ]; then
     
    367560
    368561case "$1" in
    369         "amd64")
     562        amd64|arm32|ia32|ia64|mips32|mips32eb|mips64|ppc32|ppc64|sparc32|sparc64)
    370563                prepare
    371                 build_target "amd64" "amd64-linux-gnu"
    372                 ;;
    373         "arm32")
    374                 prepare
    375                 build_target "arm32" "arm-linux-gnueabi"
    376                 ;;
    377         "ia32")
    378                 prepare
    379                 build_target "ia32" "i686-pc-linux-gnu"
    380                 ;;
    381         "ia64")
    382                 prepare
    383                 build_target "ia64" "ia64-pc-linux-gnu"
    384                 ;;
    385         "mips32")
    386                 prepare
    387                 build_target "mips32" "mipsel-linux-gnu"
    388                 ;;
    389         "mips32eb")
    390                 prepare
    391                 build_target "mips32eb" "mips-linux-gnu"
    392                 ;;
    393         "mips64")
    394                 prepare
    395                 build_target "mips64" "mips64el-linux-gnu"
    396                 ;;
    397         "ppc32")
    398                 prepare
    399                 build_target "ppc32" "ppc-linux-gnu"
    400                 ;;
    401         "ppc64")
    402                 prepare
    403                 build_target "ppc64" "ppc64-linux-gnu"
    404                 ;;
    405         "sparc64")
    406                 prepare
    407                 build_target "sparc64" "sparc64-linux-gnu"
    408                 ;;
    409         "sparc32")
    410                 prepare
    411                 build_target "sparc32" "sparc-leon3-linux-gnu"
     564                build_target "$1"
    412565                ;;
    413566        "all")
    414567                prepare
    415                 build_target "amd64" "amd64-linux-gnu"
    416                 build_target "arm32" "arm-linux-gnueabi"
    417                 build_target "ia32" "i686-pc-linux-gnu"
    418                 build_target "ia64" "ia64-pc-linux-gnu"
    419                 build_target "mips32" "mipsel-linux-gnu"
    420                 build_target "mips32eb" "mips-linux-gnu"
    421                 build_target "mips64" "mips64el-linux-gnu"
    422                 build_target "ppc32" "ppc-linux-gnu"
    423                 build_target "ppc64" "ppc64-linux-gnu"
    424                 build_target "sparc64" "sparc64-linux-gnu"
    425                 build_target "sparc32" "sparc-leon3-linux-gnu"
     568                build_target "amd64"
     569                build_target "arm32"
     570                build_target "ia32"
     571                build_target "ia64"
     572                build_target "mips32"
     573                build_target "mips32eb"
     574                build_target "mips64"
     575                build_target "ppc32"
     576                build_target "ppc64"
     577                build_target "sparc32"
     578                build_target "sparc64"
    426579                ;;
    427580        "parallel")
    428581                prepare
    429                 build_target "amd64" "amd64-linux-gnu" &
    430                 build_target "arm32" "arm-linux-gnueabi" &
    431                 build_target "ia32" "i686-pc-linux-gnu" &
    432                 build_target "ia64" "ia64-pc-linux-gnu" &
    433                 build_target "mips32" "mipsel-linux-gnu" &
    434                 build_target "mips32eb" "mips-linux-gnu" &
    435                 build_target "mips64" "mips64el-linux-gnu" &
    436                 build_target "ppc32" "ppc-linux-gnu" &
    437                 build_target "ppc64" "ppc64-linux-gnu" &
    438                 build_target "sparc64" "sparc64-linux-gnu" &
    439                 build_target "sparc32" "sparc-leon3-linux-gnu" &
     582                build_target "amd64" &
     583                build_target "arm32" &
     584                build_target "ia32" &
     585                build_target "ia64" &
     586                build_target "mips32" &
     587                build_target "mips32eb" &
     588                build_target "mips64" &
     589                build_target "ppc32" &
     590                build_target "ppc64" &
     591                build_target "sparc32" &
     592                build_target "sparc64" &
    440593                wait
    441594                ;;
    442595        "2-way")
    443596                prepare
    444                 build_target "amd64" "amd64-linux-gnu" &
    445                 build_target "arm32" "arm-linux-gnueabi" &
     597                build_target "amd64" &
     598                build_target "arm32" &
    446599                wait
    447600               
    448                 build_target "ia32" "i686-pc-linux-gnu" &
    449                 build_target "ia64" "ia64-pc-linux-gnu" &
     601                build_target "ia32" &
     602                build_target "ia64" &
    450603                wait
    451604               
    452                 build_target "mips32" "mipsel-linux-gnu" &
    453                 build_target "mips32eb" "mips-linux-gnu" &
     605                build_target "mips32" &
     606                build_target "mips32eb" &
    454607                wait
    455608               
    456                 build_target "mips64" "mips64el-linux-gnu" &
    457                 build_target "ppc32" "ppc-linux-gnu" &
     609                build_target "mips64" &
     610                build_target "ppc32" &
    458611                wait
    459612               
    460                 build_target "ppc64" "ppc64-linux-gnu" &
    461                 build_target "sparc64" "sparc64-linux-gnu" &
     613                build_target "ppc64" &
     614                build_target "sparc32" &
    462615                wait
    463 
    464                 build_target "sparc32" "sparc-leon3-linux-gnu" &
     616               
     617                build_target "sparc64" &
    465618                wait
    466619                ;;
Note: See TracChangeset for help on using the changeset viewer.