PortSystem 1.0
name mips-elf-gcc
version 3.4.6
# Parameters for this port.
set newlibversion 1.15.0
set crossgcc-target mips-elf
set default-languages --enable-languages="c,c++,f77,objc"
description gcc cross-compilers for mips-elf, with newlib runtime library.
long_description gnu compilers collection (including c++, fortran and objc) for \
mips-elf, with newlib runtime library.
homepage https://gcc.gnu.org/
platforms darwin
categories cross devel
license GPL-2+
maintainers nomaintainer
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/
dist_subdir 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.
use_bzip2 yes
extract.only gcc-${version}.tar.bz2
# Extract newlib and create a symlink of newlib/newlib in gcc directory.
post-extract {
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 \
NM_FOR_TARGET=${crossgcc-target}-nm \
RANLIB_FOR_TARGET=${crossgcc-target}-ranlib]
# Build in a different directory, as advised in the README file.
pre-configure {
file mkdir "${workpath}/build"
}
configure.dir ${workpath}/build
configure.cmd ${workpath}/gcc-${version}/configure
configure.env ${environment}
configure.pipe no
configure.cflags-append -DLIBICONV_PLUG
configure.args --infodir='${prefix}/share/info' \
--mandir='${prefix}/share/man' \
--target=${crossgcc-target} \
--program-prefix=${crossgcc-target}- \
--program-suffix=-${version} \
--with-included-gettext \
--enable-obsolete \
--with-newlib \
--enable-multilib \
--with-gxx-include-dir=${prefix}/${crossgcc-target}/include/c++/${version}/ \
${default-languages}
# the generated compiler doesn't accept -arch
configure.cc_archflags
configure.cxx_archflags
configure.objc_archflags
configure.ld_archflags