# Remark: this port is incompatible with other versions of arm-elf-gcc.
# If it's a problem, contact me. I'll see what I can do.
# Parameters for this port.
set crossgcc-target arm-elf
set default-languages --enable-languages="c,c++,objc"
description gcc 3.x cross-compilers for arm-elf, with newlib runtime library.
long_description gnu compilers collection version 3.x (including c++, fortran and objc) for \
arm-elf, with newlib runtime library.
homepage https://gcc.gnu.org/
license {GPL-2+ Permissive}
master_sites gnu:gcc/gcc-${version}/:gcc \
ftp://sources.redhat.com/pub/newlib/:newlib \
https://www.mirrorservice.org/sites/sourceware.org/pub/newlib/:newlib
distfiles gcc-${version}.tar.bz2:gcc newlib-${newlibversion}.tar.gz:newlib
worksrcdir gcc-${version}
checksums gcc-${version}.tar.bz2 \
md5 4a21ac777d4b5617283ce488b808da7b \
sha1 97b290fdc572c8e490b3b39f243e69bacad23c2b \
rmd160 b15003368cedc7964f6ceaee0c39ddc43a46c442 \
newlib-${newlibversion}.tar.gz \
md5 4020004b1b7a56ca4cf7f6d35b40a4cb \
sha1 f6860b36e48fb831a30bab491230bbc7ce2669a2 \
rmd160 e57cbb5b3f007ec26a4ec62f5652e23523357001
patchfiles patch-gcc-Makefile.in
# All cross ports violate the mtree layout.
destroot.violate_mtree yes
# Download everything to gcc/
depends_lib port:${crossgcc-target}-binutils
depends_build port:gettext
# arm-elf-binutils is not universal
# gcc is .bz2, newlib is .gz.
# let's extract only gcc with MacPorts infrastructure, we'll do newlib manually.
extract.only gcc-${version}.tar.bz2
# Extract newlib and create a symlink of newlib/newlib in gcc directory.
system "cd ${workpath} && gzip -dc ${distpath}/newlib-${newlibversion}.tar.gz | tar -xf -"
system "ln -s ${workpath}/newlib-${newlibversion}/newlib ${workpath}/gcc-${version}/"
# Since we don't build gcc and binutils at the same time, gcc's Makefile will try to transform
# program names as gcc's name (add -${version} with ${version} being the version of gcc).