Win32: made toolchain compilable on windows with mingw32

This commit is contained in:
Federico Fissore 2014-12-22 12:06:23 +01:00 committed by Federico Fissore
parent 51c22fd02f
commit 13c4f78834
9 changed files with 56 additions and 6 deletions

2
.gitignore vendored
View file

@ -5,6 +5,8 @@
objdir
toolsdir
*-build
autoconf-2.64/
automake-1.11.1/
avr-libc-1.8.0/
avr8-headers-6.2.0.334/
binutils-2.24

View file

@ -42,6 +42,13 @@ You need to install Cygwin: http://www.cygwin.com/. Once you have run `setup-x86
A note on texinfo: due to dependencies, each time you update/modify your cygwin installation (for example: you install an additional package), texinfo will be upgraded to version 5+, while you need version 4+!
Easy solution: as soon as you've installed the additional package, re-run cygwin setup, search texinfo, triple click on "Keep" until you read version 4, then click next.
You also need to install MinGW: http://www.mingw.org/. Once you have run mingw-get-setup.exe, select and install (clicking on "Installation" -> "Apply changes") the following packages:
- mingw-developer-toolkit
- mingw32-base
- mingw32-gcc-g++
- msys-base
### Upstream credits
Build process ported from Debian. Most patches come from Atmel. Thank you guys for your awesome work.

View file

@ -1,9 +1,13 @@
#!/bin/bash -ex
export PATH=/cygdrive/c/cygwin/bin:$PATH
CFLAGS="-DWIN32" CXXFLAGS="-DWIN32" LDFLAGS="-DWIN32" CC="gcc -m32" CXX="g++ -m32" ./build.all.bash
export PATH=$PATH:/c/MinGW/bin/:/c/cygwin/bin/
CFLAGS="-DWIN32" CXXFLAGS="-DWIN32" LDFLAGS="-DWIN32" CC="mingw32-gcc -m32" CXX="mingw32-g++ -m32" ./build.all.bash
rm -f avr-toolchain-*.zip
cd objdir
for folder in avr/bin bin libexec/gcc/avr/4.8.1/
do
cp /c/MinGW/bin/libiconv-2.dll $folder
done
zip -r -9 ../avr-toolchain-win32-3.4.4.zip .

View file

@ -0,0 +1,13 @@
--- a/avr/lib/avr5/Makefile 2014-12-19 10:46:26.000000000 +0100
+++ b/avr/lib/avr5/Makefile 2014-12-19 10:47:55.246486311 +0100
@@ -1444,7 +1444,9 @@
-test -z "$(avr_LIBRARIES)" || rm -f $(avr_LIBRARIES)
libc.a: $(libc_a_OBJECTS) $(libc_a_DEPENDENCIES)
-rm -f libc.a
- $(libc_a_AR) libc.a $(libc_a_OBJECTS) $(libc_a_LIBADD)
+ $(libc_a_AR) libc.a $(libc_a_OBJECTS)
+ $(libc_a_AR) libc.a $(stdio_a_libadd)
+ $(libc_a_AR) libc.a $(misc_a_libadd)
$(RANLIB) libc.a
libm.a: $(libm_a_OBJECTS) $(libm_a_DEPENDENCIES)
-rm -f libm.a

View file

@ -55,6 +55,8 @@ CONFARGS=" \
PATH=$PREFIX/bin:$PATH CC="avr-gcc" CXX="avr-g++" CFLAGS="-w -Os $CFLAGS" CXXFLAGS="-w -Os $CXXFLAGS" LDFLAGS="-s $LDFLAGS" ../avr-libc-1.8.0/configure $CONFARGS
for p in ../avr-libc-patches/*.patch.post.automake; do echo Applying $p; patch -p1 < $p; done
if [ -z "$MAKE_JOBS" ]; then
MAKE_JOBS="2"
fi

View file

@ -1,5 +1,17 @@
#!/bin/bash -ex
if [[ ! -d toolsdir ]] ;
then
echo "You must first build the tools: run build_tools.bash"
exit 1
fi
cd toolsdir/bin
TOOLS_BIN_PATH=`pwd`
cd -
export PATH="$TOOLS_BIN_PATH:$PATH"
if [[ ! -f avrdude-6.0.1.tar.gz ]] ;
then
wget http://download.savannah.gnu.org/releases/avrdude/avrdude-6.0.1.tar.gz
@ -9,6 +21,10 @@ tar xfzv avrdude-6.0.1.tar.gz
cd avrdude-6.0.1
for p in ../avrdude-patches/*.patch; do echo Applying $p; patch -p0 < $p; done
if [[ `uname -s` != CYGWIN* && `uname -s` != MINGW* ]]
then
for p in ../avrdude-patches/*.patch.optional; do echo Applying $p; patch -p0 < $p; done
fi
./bootstrap
cd -
@ -17,7 +33,7 @@ cd objdir
PREFIX=`pwd`
cd -
if [[ `uname -s` == CYGWIN* ]]
if [[ `uname -s` == CYGWIN* || `uname -s` == MINGW* ]]
then
cd tmp/libusb-win32-bin*
LIBUSB_DIR=`pwd`
@ -40,8 +56,13 @@ cd avrdude-build
CONFARGS=" \
--prefix=$PREFIX \
--enable-linuxgpio \
--enable-arduinotre"
--enable-linuxgpio"
if [[ `uname -s` != CYGWIN* && `uname -s` != MINGW* ]]
then
CONFARGS="$CONFARGS \
--enable-arduinotre"
fi
CFLAGS="-w -O2 $CFLAGS" CXXFLAGS="-w -O2 $CXXFLAGS" LDFLAGS="-s $LDFLAGS" ../avrdude-6.0.1/configure $CONFARGS

View file

@ -35,6 +35,7 @@ CONFARGS=" \
--prefix=$PREFIX \
--disable-nls \
--disable-werror \
--disable-binutils \
--target=avr"
CFLAGS="-w -O2 -g0 $CFLAGS" CXXFLAGS="-w -O2 -g0 $CXXFLAGS" LDFLAGS="-s $LDFLAGS" ../gdb-7.7/configure $CONFARGS

View file

@ -5,7 +5,7 @@ cd objdir
PREFIX=`pwd`
cd -
if [[ `uname -s` == CYGWIN* ]]
if [[ `uname -s` == CYGWIN* || `uname -s` == MINGW* ]]
then
if [[ ! -f libusb-win32-bin-1.2.6.0.zip ]] ;
then