narke / gcc-cross-compiler

A script to cross-compile GCC toolchain for various target architectures.
BSD 3-Clause "New" or "Revised" License
51 stars 11 forks source link

support for fortran? #15

Open edisonchan opened 1 year ago

edisonchan commented 1 year ago

./toolchain.py --arch aarch64 --install no --cores 4 --enable-languages={c,c++,fortran} usage: toolchain.py [-h] -a {aarch64,amd64,arm32,armhf,ia32,ia64,mips32,mips32eb,mips64,ppc32,ppc64,sparc32,sparc64,lm32} -i {yes,no} [-c CORES] [--enable-cxx] toolchain.py: error: unrecognized arguments: --enable-languages=c --enable-languages=c++ --enable-languages=fortran edison@vpc:~/Downloads/gcc-cross-compiler$ python ./toolchain.py --arch aarch64 --install no --cores 4 --enable-languages={c,c++,fortran}

how can I enable c,c++,fortran at same time?

adazem009 commented 1 year ago

Maybe I'll make another contribution for this, but for now, please edit the toolchain.py file and add the following line into the build_gcc() function:

languages += ',fortran'

For example:

def build_gcc(*args):
    """Build GCC."""

    install, nb_cores, obj_directory, prefix, gcc_directory, target, enable_cxx = args
    languages = 'c'

    if enable_cxx:
        languages += ',cxx'

    languages += ',fortran' # Add this line

    os.chdir(obj_directory)
    ...