# Parameters for this port.
set crossgcc-target m68k-elf
set default-languages --enable-languages="c,c++,f77,objc"
description gcc cross-compilers for m68k-elf, with newlib runtime library.
long_description gnu compilers collection (including c++, fortran and objc) for \
m68k-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 \
ftp://ftp.mirror.ac.uk/sites/sources.redhat.com/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
# 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).
# But it won't work because binutils binaries don't have the ${version} suffix, and even if they
# had, they would actually have the binutils' version suffix (and not gcc's version).
# So let's tell gcc's Makefile not to do that mistake.
set environment [list AR_FOR_TARGET=${crossgcc-target}-ar \
AS_FOR_TARGET=${crossgcc-target}-as \
LD_FOR_TARGET=${crossgcc-target}-ld \