Last active
August 29, 2015 14:15
-
-
Save 7shi/d9556be0474220916649 to your computer and use it in GitHub Desktop.
クロスコンパイラをビルド (binutils-2.25 + gcc-4.6.4)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
prefix=/opt/cross | |
cpu=4 | |
download-extract () | |
{ | |
f=`basename $1` | |
if [ -f _src/$f ]; then return; fi | |
mkdir -p _src | |
rm -f $f | |
wget $1 && tar xvf $f && mv $f _src | |
} | |
download-extract http://ftp.gnu.org/gnu/binutils/binutils-2.25.tar.bz2 | |
download-extract http://ftp.gnu.org/gnu/gcc/gcc-4.6.4/gcc-core-4.6.4.tar.bz2 | |
if [ `uname -o` = "Msys" ]; then | |
if [ ! -f binutils-trunk-msys2.patch ]; then | |
wget https://raw.githubusercontent.com/Alexpux/MSYS2-packages/1ec8aa42e0892f04400039ea1e5ede51ffc4d35e/binutils/binutils-trunk-msys2.patch | |
patch -p1 -d binutils-2.25 < binutils-trunk-msys2.patch | |
cp /usr/share/automake-1.15/config.* gcc-4.6.4 | |
fi | |
fi | |
build-binutils () | |
{ | |
arch=$1 | |
shift | |
if [ -f $prefix/bin/$arch-as ]; then return; fi | |
mkdir -p $arch/binutils | |
cd $arch/binutils | |
if [ ! -f Makefile ]; then | |
../../binutils-2.25/configure --prefix=$prefix $@ | |
fi | |
if [ -f Makefile ]; then | |
make -j$cpu && make install | |
fi | |
cd ../.. | |
} | |
build-gcc () | |
{ | |
arch=$1 | |
shift | |
if [ -f $prefix/bin/$arch-gcc ]; then return; fi | |
mkdir -p $arch/gcc | |
cd $arch/gcc | |
if [ ! -f Makefile ]; then | |
../../gcc-4.6.4/configure --prefix=$prefix $@ | |
fi | |
if [ -f Makefile ]; then | |
make -j$cpu all-gcc && make install-gcc | |
fi | |
cd ../.. | |
} | |
build () | |
{ | |
build-binutils $1 --target=$1 | |
build-gcc $1 --target=$@ | |
} | |
build-binutils all --enable-targets=all --enable-64-bit-bfd --program-prefix=all- | |
build alpha-netbsdelf | |
build arc-elf --enable-obsolete | |
build arm-elf | |
build avr-elf | |
build bfin-elf | |
build cris-elf | |
build fr30-elf | |
build frv-elf | |
build h8300-elf | |
build hppa-linux | |
build i386-elf | |
build ia64-elf | |
build m32c-elf | |
build m32r-elf | |
build m68k-elf | |
build mcore-elf | |
build microblaze-elf | |
build mips-elf | |
build mmix-mmixware | |
build mn10300-elf | |
build moxie-elf | |
build pdp11-aout | |
build powerpc-elf | |
build powerpc64-linux | |
build rx-elf | |
build s390-linux | |
build score-elf --enable-obsolete | |
build sh-elf | |
build sh64-elf | |
build sparc-elf | |
build sparc64-elf | |
build spu-elf | |
build v850-elf | |
build vax-netbsdelf | |
build x86_64-elf | |
build xstormy16-elf | |
build xtensa-elf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment