GithubHelp home page GithubHelp logo

ekanar-eklectic / build-gcc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jwt27/build-gcc

1.0 0.0 0.0 528 KB

Shell scripts to build various gcc cross-compilers (primarily djgpp)

License: GNU General Public License v3.0

Shell 88.27% C 0.85% Roff 10.87%

build-gcc's Introduction

Build gcc cross compiler on Windows, Mac OSX, Linux and FreeBSD.

Upgrade notes:

  • 2020-02-13: default target for djgpp has changed to i386-pc-msdosdjgpp.
    If you require compatibility with distributions that use i586, you can either:
    • run sudo i386-pc-msdosdjgpp-link-i586 after installing, or
    • build with ./build-djgpp.sh --prefix=i586-pc-msdosdjgpp.
  • 2020-02-07: setenv script is now installed to $PREFIX/bin/$TARGET-setenv.
  • 2019-06-06: master is now the default branch again.

Current package versions, as of 2021-04-30:

  • gcc 10.2.0
  • binutils 2.36.1
  • gdb 10.1
  • djgpp 2.05 / cvs
  • newlib 4.1.0
  • avr-libc 2.0.0
  • avrdude 6.3
  • avarice 2.13
  • simulavr git

Tested targets:

  • i386-pc-msdosdjgpp
  • ia16
  • arm-eabi
  • avr

See the Actions tab on Github for a detailed status of individual targets.

Requirements

Before running this script, you need to install these programs first:

  • g++
  • gcc
  • unzip
  • tar
  • bzip2
  • gzip
  • xz
  • bison
  • flex
  • make (or gmake for FreeBSD)
  • makeinfo
  • patch
  • zlib header/library
  • curl or wget
  • bash (for FreeBSD)
  • python2 headers (for gdb)
  • python3 headers (for gdb >= 9.0)

Depending on your system, installation procedure maybe different.

On Debian/Ubuntu, you can install these programs by :

sudo apt-get update
sudo apt-get install bison flex curl gcc g++ make texinfo zlib1g-dev tar bzip2 gzip xz-utils unzip python{2,3}-dev

Fedora :

sudo yum install gcc-c++ bison flex texinfo patch zlib-devel tar bzip2 gzip xz unzip python-devel

mingw-w64 (msys2) :

pacman -Syuu base-devel mingw-w64-x86_64-{toolchain,curl,zlib,python{2,3}} compression

Configuration

The following command line options are recognized:

  --prefix=...              # Install location (default: /usr/local/cross)
  --target=...              # Target name
  --enable-languages=...    # Comma-separated list of languages to build compilers for (default: c,c++)
  --no-download             # Do not download any files
  --only-download           # Download source files, then exit
  --ignore-dependencies     # Do not check package dependencies
  --batch                   # Run in batch mode (will not prompt or delay to confirm settings)

Several environment variables also control the build process:

MAKE_JOBS=                  # Number of parallel build threads (auto-detected)
GCC_CONFIGURE_OPTIONS=      # Extra options to pass to gcc's ./configure
BINUTILS_CONFIGURE_OPTIONS= # Same, for binutils
GDB_CONFIGURE_OPTIONS=      # Same, for gdb
NEWLIB_CONFIGURE_OPTIONS=   # Same, for newlib
AVRLIBC_CONFIGURE_OPTIONS=  # Same, for avr-libc
CFLAGS_FOR_TARGET=          # CFLAGS used to build target libraries
HOST=                       # The platform you are building for, when building a cross-cross compiler
BUILD=                      # The platform you are building on (auto-detected)
MAKE_CHECK=                 # Run test suites on built programs.
MAKE_CHECK_GCC=             # Run gcc test suites.

Building

Pick the script you want to use:

build-djgpp.sh      # builds a toolchain targeting djgpp (default TARGET: i386-pc-msdosdjgpp)
build-newlib.sh     # builds a toolchain with the newlib C library
build-ia16.sh       # builds a toolchain targeting 8086 processors, with the newlib C library (fixed TARGET: ia16-elf)
build-avr.sh        # builds a toolchain targeting AVR microcontrollers (fixed TARGET: avr)

To build DJGPP, just run:

./build-djgpp.sh [options...] [packages...]

Run with no arguments to see a list of supported packages and versions.

For example, to build gcc 9.2.0 with the latest djgpp C library from CVS and latest binutils:

./build-djgpp.sh --prefix=/usr/local djgpp-cvs binutils gcc-9.2.0

To install or upgrade all packages:

./build-djgpp.sh --prefix=/usr/local all

It will download all necessary files, build DJGPP compiler, binutils, and gdb, and install it.

Using

In order to use your new compiler, you must add its bin/ directory to your PATH.
You can then access the compiler through its target-prefixed name: ($PREFIX and $TARGET in these examples are the variables you used to build)

$ PATH=$PREFIX/bin/:$PATH
$ $TARGET-g++ hello.cpp

To use the short name variant, and access documentation with man and info, use the installed setenv script:

$ source $TARGET-setenv
$ g++ hello.cpp

If you are using Windows command prompt :

> PATH=$PREFIX/bin;%PATH%
> $TARGET-g++ hello.cpp
> $TARGET-setenv
> g++ hello.cpp

Supported DJGPP utilities

  • dxe3gen
  • dxe3res
  • dxegen
  • exe2coff
  • stubedit
  • stubify
  • djasm

Supported AVR utilities

  • avrdude
  • avarice
  • simulavr

Thanks

These scripts are based on Andrew Wu's build-djgpp script:
https://github.com/andrewwutw/build-djgpp
Which in turn is based on spec file from DJGPP source rpm files by Andris Pavenis:
http://ap1.pp.fi/djgpp/index.html

build-gcc's People

Contributors

andrewwutw avatar dajoho avatar gitmensch avatar jwt27 avatar ravyne avatar rutsky avatar sezero avatar stsp avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.