Multiarchitecture toolchain buildscripts

@ 2012-04-17 by João Paulo Pizani Flor

As some of you might have known, lately I’ve been messing with some embedded systems programming, more specifically with the AVR series of 8-bit microcontrollers. Well, I also like to be on the so called “bleeding edge” when it comes to software, always running the latest stable versions of everything… So the first step when I wanted to program in C for AVR was to get hold of a fairly recent version of the GNU Compiler Collection.

Some time ago I had trouble trying to compile a complete C/C++ toolchain for AVR, but this time I summoned all my skill, patience and shell-script kung-fu, which this time resulted in a QUITE NICE and generic toolchain buildscript, I must say. But first, before diving into my work, let me just thank the GCC team from the bottom of my heart! You guys (and girls) are great! :D

Still before I show you the code, here are some important remarks about the script(s), which BTW you can find here - :

So, enough propaganda, let me first show you the generic part of the buildscript suite, which is supposed to be “called” (sourced) from the (target-specific) variable definitions file:

Of course the heart of all action involved in this piece of shell script is the usual pipeline: Download packages - Unpack - Configure - Make - Make install. All done using some shell-script kung-fu such as shell metaprogramming (using eval) and shell arrays. With this, you can get:

Okay, so after taking this look at the generic “core” of the script suite, take now a look at what a target-specific part looks like. This is a “template”, which you should fill with some definitions (mostly target architecture, package versions and configure options). Fill this and run, it’s as simple as that!

WOW, I know, that’s a lot of comments… :) But really, I wanted - as much as possible - everyone to understand what’s going on and what the variables mean. So, after you read the whole thing, don’t believe me: grab the script suite - at - and build a toolchain yourself! For AVR, MIPS, ARM or whatever arch you want… And of course, help me fix problems with pull requests :)