gcc-or1k: Initial gcc package for or1k arch

This commit is contained in:
Jernej Skrabec 2022-04-13 23:08:48 +02:00
parent 9b054862bd
commit 45256cbe36
3 changed files with 131 additions and 0 deletions

View File

@ -0,0 +1,68 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="gcc-or1k"
PKG_VERSION="11.2.0"
PKG_SHA256="d08edc536b54c372a1010ff6619dd274c0f1603aa49212ba20f7aa2cda36fa8b"
PKG_LICENSE="GPL-2.0-or-later"
PKG_SITE="http://gcc.gnu.org/"
PKG_URL="http://ftpmirror.gnu.org/gcc/gcc-${PKG_VERSION}/gcc-${PKG_VERSION}.tar.xz"
PKG_DEPENDS_HOST="toolchain ccache:host autoconf:host binutils-or1k:host gmp:host mpfr:host mpc:host zstd:host"
PKG_LONGDESC="This package contains the GNU Compiler Collection for OpenRISC 1000."
PKG_CONFIGURE_OPTS_HOST="--target=or1k-none-elf \
--with-sysroot=${SYSROOT_PREFIX} \
--with-gmp=${TOOLCHAIN} \
--with-mpfr=${TOOLCHAIN} \
--with-mpc=${TOOLCHAIN} \
--with-zstd=${TOOLCHAIN} \
--with-gnu-as \
--with-gnu-ld \
--with-newlib \
--without-ppl \
--without-headers \
--without-cloog \
--enable-__cxa_atexit \
--enable-checking=release \
--enable-gold \
--enable-languages=c \
--enable-ld=default \
--enable-lto \
--enable-plugin \
--enable-static \
--disable-decimal-float \
--disable-gcov \
--disable-libada \
--disable-libatomic \
--disable-libgomp \
--disable-libitm \
--disable-libmpx \
--disable-libmudflap \
--disable-libquadmath \
--disable-libquadmath-support \
--disable-libsanitizer \
--disable-libssp \
--disable-multilib \
--disable-nls \
--disable-shared \
--disable-threads"
post_makeinstall_host() {
PKG_GCC_PREFIX="${TOOLCHAIN}/bin/or1k-none-elf-"
GCC_VERSION=$(${PKG_GCC_PREFIX}gcc -dumpversion)
DATE="0501$(echo ${GCC_VERSION} | sed 's/\./0/g')"
CROSS_CC=${PKG_GCC_PREFIX}gcc-${GCC_VERSION}
rm -f ${PKG_GCC_PREFIX}gcc
cat > ${PKG_GCC_PREFIX}gcc <<EOF
#!/bin/sh
${TOOLCHAIN}/bin/ccache ${CROSS_CC} "\$@"
EOF
chmod +x ${PKG_GCC_PREFIX}gcc
# To avoid cache trashing
touch -c -t ${DATE} ${CROSS_CC}
}

View File

@ -0,0 +1,32 @@
From c611cd5416ff1042a4adec0e1b12c71e307b508d Mon Sep 17 00:00:00 2001
From: Stefan Saraev <stefan@saraev.ca>
Date: Thu, 24 Apr 2014 22:33:27 +0300
Subject: [PATCH] allow newer autoconf
---
config/override.m4 | 9 ---------
1 files changed, 0 insertions(+), 9 deletions(-)
diff --git a/config/override.m4 b/config/override.m4
index 52bd1c3..6c39656 100644
--- a/config/override.m4
+++ b/config/override.m4
@@ -38,15 +38,6 @@ dnl m4_define([_GCC_AUTOCONF_VERSION], [X.Y])
dnl in configure.ac before AC_INIT,
dnl without rewriting this file.
dnl Or for updating the whole tree at once with the definition above.
-AC_DEFUN([_GCC_AUTOCONF_VERSION_CHECK],
-[m4_if(m4_defn([_GCC_AUTOCONF_VERSION]),
- m4_defn([m4_PACKAGE_VERSION]), [],
- [m4_fatal([Please use exactly Autoconf ]_GCC_AUTOCONF_VERSION[ instead of ]m4_defn([m4_PACKAGE_VERSION])[.])])
-])
-m4_define([AC_INIT], m4_defn([AC_INIT])[
-_GCC_AUTOCONF_VERSION_CHECK
-])
-
dnl Ensure we do not use a buggy M4.
m4_if(m4_index([..wi.d.], [.d.]), [-1],
--
1.7.2.5

View File

@ -0,0 +1,31 @@
Index: gcc-4.4+svnr145550/gcc/incpath.c
===================================================================
--- gcc-4.4+svnr145550.orig/gcc/incpath.c 2009-04-04 13:48:31.000000000 -0700
+++ gcc-4.4+svnr145550/gcc/incpath.c 2009-04-04 14:49:29.000000000 -0700
@@ -417,6 +417,26 @@
p->construct = 0;
p->user_supplied_p = user_supplied_p;
+ /* A common error when cross compiling is including
+ host headers. This code below will try to fail fast
+ for cross compiling. Currently we consider /usr/include,
+ /opt/include and /sw/include as harmful. */
+
+ {
+ /* printf("Adding Path: %s\n", p->name ); */
+ if( strstr(p->name, "/usr/include" ) == p->name ) {
+ fprintf(stderr, _("CROSS COMPILE Badness: /usr/include in INCLUDEPATH: %s\n"), p->name);
+ abort();
+ } else if( strstr(p->name, "/sw/include") == p->name ) {
+ fprintf(stderr, _("CROSS COMPILE Badness: /sw/include in INCLUDEPATH: %s\n"), p->name);
+ abort();
+ } else if( strstr(p->name, "/opt/include") == p->name ) {
+ fprintf(stderr, _("CROSS COMPILE Badness: /opt/include in INCLUDEPATH: %s\n"), p->name);
+ abort();
+ }
+ }
+
+
add_cpp_dir_path (p, chain);
}