[PATCH] [RSB] Add support for building Epiphany tools.

Hesham ALMatary heshamelmatary at gmail.com
Tue Apr 21 12:05:00 UTC 2015


This patch adds support for building Epiphany tools. Currently some tools
are fetched from my repositories (until my pull requests get merged), and
other tools are fetched from Adapteva repositories. In the future, the 
tools should be fetched from GNU upstreams when Adapteva folks push
their latest changes there.

---
 rtems/config/4.11/rtems-epiphany.bset              |  22 +++
 .../config/tools/rtems-binutils-2.23-epiphany.cfg  |  25 +++
 .../tools/rtems-gcc-4.9-newlib-git-epiphany.cfg    |  43 +++++
 rtems/config/tools/rtems-gdb-7.8-epiphany.cfg      |  28 +++
 .../binutils-2-23-1-epiphany-software-cache.cfg    | 107 +++++++++++
 source-builder/config/gcc-4.9-epiphany.cfg         | 207 +++++++++++++++++++++
 source-builder/config/gdb-7-8-epiphany.cfg         | 129 +++++++++++++
 7 files changed, 561 insertions(+)
 create mode 100644 rtems/config/4.11/rtems-epiphany.bset
 create mode 100644 rtems/config/tools/rtems-binutils-2.23-epiphany.cfg
 create mode 100644 rtems/config/tools/rtems-gcc-4.9-newlib-git-epiphany.cfg
 create mode 100644 rtems/config/tools/rtems-gdb-7.8-epiphany.cfg
 create mode 100644 source-builder/config/binutils-2-23-1-epiphany-software-cache.cfg
 create mode 100644 source-builder/config/gcc-4.9-epiphany.cfg
 create mode 100644 source-builder/config/gdb-7-8-epiphany.cfg

diff --git a/rtems/config/4.11/rtems-epiphany.bset b/rtems/config/4.11/rtems-epiphany.bset
new file mode 100644
index 0000000..878af12
--- /dev/null
+++ b/rtems/config/4.11/rtems-epiphany.bset
@@ -0,0 +1,22 @@
+#
+# Tools Set for RTEMS Epiphany 4.11 Stable
+#
+
+%define release 1
+
+%define rtems_arch epiphany 
+
+#
+# The RTEMS 4.11 base defines.
+#
+%include rtems-4.11-base.bset
+
+#
+# Tools configuration.
+#
+4.11/rtems-autotools
+devel/expat-2.1.0-1
+tools/rtems-binutils-2.23-epiphany
+ools/rtems-gcc-4.9-newlib-git-epiphany
+tools/rtems-gdb-7.8-epiphany
+tools/rtems-tools-4.11-1
diff --git a/rtems/config/tools/rtems-binutils-2.23-epiphany.cfg b/rtems/config/tools/rtems-binutils-2.23-epiphany.cfg
new file mode 100644
index 0000000..b21a88f
--- /dev/null
+++ b/rtems/config/tools/rtems-binutils-2.23-epiphany.cfg
@@ -0,0 +1,25 @@
+#
+# Binutils 2.23.
+#
+
+%include %{_configdir}/checks.cfg
+%include %{_configdir}/base.cfg
+
+%define binutils_version 2.23.1
+
+#
+# Enable deterministic archives by default. This will be the default
+# there all tools using this binutils will create deterministic
+# archives.
+#
+%define with_deterministic_archives 1
+
+#
+# Adapteva binutils stable repository 
+#
+%source set binutils https://github.com/adapteva/epiphany-binutils-gdb/archive/epiphany-binutils-2.23-software-cache.zip
+
+#
+# The binutils build instructions. We use 2.xx Release 1.
+#
+%include %{_configdir}/binutils-2-23-1-epiphany-software-cache
diff --git a/rtems/config/tools/rtems-gcc-4.9-newlib-git-epiphany.cfg b/rtems/config/tools/rtems-gcc-4.9-newlib-git-epiphany.cfg
new file mode 100644
index 0000000..31ed707
--- /dev/null
+++ b/rtems/config/tools/rtems-gcc-4.9-newlib-git-epiphany.cfg
@@ -0,0 +1,43 @@
+#
+# GCC 4.9.x., Newlib GIT.
+#
+
+%include %{_configdir}/checks.cfg
+%include %{_configdir}/base.cfg
+%include %{_configdir}/versions.cfg
+
+%define gcc_version    4.9.2
+%define newlib_version ef23a12ff8f840cc571e47870cd5f4ad6bca4553
+
+%define mpfr_version   3.0.1
+%define mpc_version    0.8.2
+%define gmp_version    5.0.5
+
+%define with_threads 1
+%define with_plugin  0
+
+%ifn %{defined with_iconv}
+ %define with_iconv 1
+%endif
+
+#
+# Hash checksums of the libraries used in GCC.
+#
+%hash md5 mpfr-%{mpfr_version}.tar.bz2 bfbecb2eacb6d48432ead5cfc3f7390a
+%hash md5 mpc-%{mpc_version}.tar.gz    e98267ebd5648a39f881d66797122fb6
+%hash md5 gmp-%{gmp_version}.tar.bz2   041487d25e9c230b0c42b106361055fe
+
+#
+# GCC from Hesham's repository (until merged with Adapteva) 
+#
+%source set gcc https://github.com/heshamelmatary/epiphany-gcc/archive/epiphany-gcc-4.9.zip 
+
+#
+# Newlib is in git
+#
+%source set newlib git://sourceware.org/git/newlib-cygwin.git?fetch?reset=hard?branch=master?checkout=%{newlib_version}
+
+#
+# The gcc/newlib build instructions. We use 4.9 Release 1.
+#
+%include %{_configdir}/gcc-4.9-epiphany
diff --git a/rtems/config/tools/rtems-gdb-7.8-epiphany.cfg b/rtems/config/tools/rtems-gdb-7.8-epiphany.cfg
new file mode 100644
index 0000000..f8081ba
--- /dev/null
+++ b/rtems/config/tools/rtems-gdb-7.8-epiphany.cfg
@@ -0,0 +1,28 @@
+#
+# GDB 7.8.1
+#
+
+%include %{_configdir}/checks.cfg
+%include %{_configdir}/base.cfg
+
+%define gdb_version 7.8.1
+
+#%hash md5 gdb-%{gdb_version}.tar.bz2 997492cc3475c96f35ecc8775248c9b1
+
+#
+# Clean up the sim-arange inline code so it builds.
+#
+%patch add gdb %{rtems_gdb_patches}/gdb-sim-arange-inline.diff
+%hash  md5 gdb-sim-arange-inline.diff 11bb2936ea29afeaa023077191fd4705
+%patch add gdb %{rtems_gdb_patches}/gdb-sim-cgen-inline.diff
+%hash  md5 gdb-sim-cgen-inline.diff e6f7d6d7295cdba99f51aab514ea9778
+
+%if %{_build_os} == freebsd
+ %patch add gdb -p0 %{rtems_gdb_patches}/patch-gdb-python-python-config.py
+ %hash  md5 patch-gdb-python-python-config.py c0260fcca4c1a5509635049c0094eee3
+%endif
+
+#
+# The gdb build instructions. We use 7.xx Release 1.
+#
+%include %{_configdir}/gdb-7-8-epiphany
diff --git a/source-builder/config/binutils-2-23-1-epiphany-software-cache.cfg b/source-builder/config/binutils-2-23-1-epiphany-software-cache.cfg
new file mode 100644
index 0000000..ce22a15
--- /dev/null
+++ b/source-builder/config/binutils-2-23-1-epiphany-software-cache.cfg
@@ -0,0 +1,107 @@
+#
+# Binutils 2.xx Version 1.
+#
+# This configuration file configure's, make's and install's binutils.
+#
+
+%include %{_configdir}/checks.cfg
+
+#
+# Select Snapshot Macro Maps
+#
+%select binutils-snapshot
+
+#
+# The description.
+#
+Name:      %{_target}-binutils-%{binutils_version}-%{_host}-%{release}
+Summary:   Binutils v%{binutils_version} for target %{_target} on host %{_host}
+Version:   %{binutils_version}
+Release:   %{release}
+URL: 	   http://sources.redhat.com/binutils
+BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
+
+#
+# Supports Candian Cross (Cxc).
+#
+%define allow_cxc
+
+#
+# Source
+#
+%source set binutils https://github.com/adapteva/epiphany-binutils-gdb/archive/epiphany-binutils-2.23-software-cache.zip 
+
+#
+# Prepare the source code.
+#
+%prep
+  build_top=$(pwd)
+
+  source_dir_binutils="epiphany-binutils-gdb-epiphany-binutils-2.23-software-cache"
+  %source setup binutils -q -n epiphany-binutils-gdb-epiphany-binutils-2.23-software-cache 
+  %patch setup binutils -p1
+
+  cd ${build_top}
+
+%build
+  build_top=$(pwd)
+
+  %{build_directory}
+
+  mkdir -p ${build_dir}
+  cd ${build_dir}
+
+  %{host_build_flags}
+
+  ../${source_dir_binutils}/configure \
+    --build=%{_build} --host=%{_host} \
+    --target=%{_target} \
+    --verbose --disable-nls \
+    %{?with_deterministic_archives:--enable-deterministic-archives} \
+    --without-included-gettext \
+    --disable-win32-registry \
+    --disable-werror \
+    --prefix=%{_prefix} --bindir=%{_bindir} \
+    --exec-prefix=%{_exec_prefix} \
+    --includedir=%{_includedir} --libdir=%{_libdir} \
+    --mandir=%{_mandir} --infodir=%{_infodir}
+
+  %{__make} %{?_smp_mflags} all
+
+  cd ${build_top}
+
+%install
+  cd ${build_top}
+
+  %{__rmdir} $SB_BUILD_ROOT
+
+  cd ${build_dir}
+  %{__make} DESTDIR=$SB_BUILD_ROOT install
+
+  # Dropped in FSF-binutils-2.9.5, but Cygwin still ships it.
+  %{__rmdir} $SB_BUILD_ROOT%{_infodir}/configure.info*
+
+  %{__rmfile} $SB_BUILD_ROOT%{_infodir}/dir
+  touch $SB_BUILD_ROOT%{_infodir}/dir
+
+  # binutils does not install share/locale, however it uses it
+  mkdir -p $SB_BUILD_ROOT%{_prefix}/share/locale
+
+  # We don't ship host files
+  %{__rmfile} ${SB_BUILD_ROOT}%{_libdir}/libiberty*
+
+  # manpages without corresponding tools
+  if test ! -f ${SB_BUILD_ROOT}%{_bindir}/%{_target}-dlltool%{_exeext}; then
+    %{__rmfile} ${SB_BUILD_ROOT}%{_mandir}/man1/%{_target}-dlltool*
+  fi
+  if test ! -f ${SB_BUILD_ROOT}%{_bindir}/%{_target}-nlmconv%{_exeext}; then
+    %{__rmfile} ${SB_BUILD_ROOT}%{_mandir}/man1/%{_target}-nlmconv*
+  fi
+  if test ! -f ${SB_BUILD_ROOT}%{_bindir}/%{_target}-windres%{_exeext}; then
+    %{__rmfile} ${SB_BUILD_ROOT}%{_mandir}/man1/%{_target}-windres*
+  fi
+  if test ! -f ${SB_BUILD_ROOT}%{_bindir}/%{_target}-windmc%{_exeext}; then
+    %{__rmfile} ${SB_BUILD_ROOT}%{_mandir}/man1/%{_target}-windmc*
+  fi
+
+  cd ${build_top}
diff --git a/source-builder/config/gcc-4.9-epiphany.cfg b/source-builder/config/gcc-4.9-epiphany.cfg
new file mode 100644
index 0000000..3c305f2
--- /dev/null
+++ b/source-builder/config/gcc-4.9-epiphany.cfg
@@ -0,0 +1,207 @@
+#
+# GCC Epiphany Support.
+#
+# This configuration file configure's, make's and install's gcc. It uses
+# newlib, MPFR, MPC, and GMP in a one-tree build configuration.
+#
+
+%include %{_configdir}/checks.cfg
+
+%ifn %{defined gcc_version_message}
+%error No GCC Version message defined.
+%endif
+
+#
+# The package description.
+#
+Name:      %{_target}-gcc-%{gcc_version}-newlib-%{newlib_version}-%{_host}-%{release}
+Summary:   GCC v%{gcc_version} and Newlib v%{newlib_version} for target %{_target} on host %{_host}
+Version:   %{gcc_version}
+Release:   %{release}
+URL: 	   http://gcc.gnu.org/
+BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
+
+%source set mpfr http://www.mpfr.org/mpfr-%{mpfr_version}/mpfr-%{mpfr_version}.tar.bz2
+%source set mpc  http://www.multiprecision.org/mpc/download/mpc-%{mpc_version}.tar.gz
+%source set gmp  ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmp_version}.tar.bz2
+
+#
+# Supports Candian Cross (Cxc).
+#
+%define allow_cxc
+
+#
+# The GCC library directory
+#
+%global _gcclibdir %{_prefix}/lib
+
+#
+# Prepare the source code.
+#
ource-builder/config/gdb-7-8-epiphany.cfg%prep
+  # save the build top directory and cd back to it rather than
+  # using 'cd ..' because some shells change $PWD to a symlink's
+  # target location and 'cd ..' fails.
+  build_top=$(pwd)
+
+  # gcc and optional the g++ core if separate packages
+  source_dir_gcc="epiphany-gcc-epiphany-gcc-4.9"
+  %source setup gcc -q -n epiphany-gcc-epiphany-gcc-4.9
+  %patch setup gcc -p1
+  cd ${build_top}
+
+  # newlib
+  #source_dir_newlib="epiphany-newlib-epiphany-newlib-1.20-software-cache"
+  #%source setup newlib -q -D -n epiphany-newlib-epiphany-newlib-1.20-software-cache
+  source_dir_newlib="newlib-%{newlib_version}"
+  %source setup newlib -q -D -n newlib-%{newlib_version}
+  %patch setup newlib -p1
+  cd ${build_top}
+
+  # Link newlib into the gcc source tree
+  %{__rmfile} ${source_dir_gcc}/newlib
+  %{__ln_s} $PWD/${source_dir_newlib}/newlib ${source_dir_gcc}/newlib
+
+  # MPFR
+  source_dir_mpfr="mpfr-%{mpfr_version}"
+  %source setup mpfr -q -D -n mpfr-%{mpfr_version}
+  %patch setup mpfr -p1
+  cd ${build_top}
+  # Build MPFR one-tree style
+  %{__rmfile} ${source_dir_gcc}/mpfr
+  %{__ln_s} $PWD/${source_dir_mpfr} ${source_dir_gcc}/mpfr
+
+  # MPC
+  source_dir_mpc="mpc-%{mpc_version}"
+  %source setup mpc -q -D -n mpc-%{mpc_version}
+  %patch setup mpc -p1
+  cd ${build_top}
+  # Build MPC one-tree style
+  %{__rmfile} ${source_dir_gcc}/mpc
+  %{__ln_s} $PWD/${source_dir_mpc} ${source_dir_gcc}/mpc
+
+  # GMP
+  source_dir_gmp="gmp-%{gmp_version}"
+  %source setup gmp -q -D -n gmp-%{gmp_version}
+  %patch setup gmp -p1
+  cd ${build_top}
+  # Build GMP one-tree style
+  %{__rmfile} ${source_dir_gcc}/gmp
+  %{__ln_s} $PWD/${source_dir_gmp} ${source_dir_gcc}/gmp
+
+  echo "%{gcc_version_message}" > ${source_dir_gcc}/gcc/DEV-PHASE
+
+  # Fix timestamps
+  cd ${source_dir_gcc}
+  contrib/gcc_update --touch
+  cd ${build_top}
+
+%build
+  build_top=$(pwd)
+
+  %{build_directory}
+
+  mkdir -p ${build_dir}
+  cd ${build_dir}
+
+  # Languages.
+  languages="c"
+%if %{enable_cxx}
+  languages="$languages,c++"
+%endif
+%if %{enable_ada}
+  languages="$languages,ada"
+%endif
+%if %{enable_go}
+  languages="$languages,go"
+%endif
+%if %{enable_fortran}
+  languages="$languages,fortran"
+%endif
+%if %{enable_java}
+  languages="$languages,java"
+%endif
+%if %{enable_objc}
+  languages="$languages,objc"
+%endif
+
+%if %{_host_os} == mingw32
+  zlib_option=""
+%else
+  zlib_option="--with-system-zlib"
+%endif
+
+  %{host_build_flags}
+
+  ../${source_dir_gcc}/configure \
+    --prefix=%{_prefix} \
+    --bindir=%{_bindir} \
+    --exec_prefix=%{_exec_prefix} \
+    --includedir=%{_includedir} \
+    --libdir=%{_gcclibdir} \
+    --libexecdir=%{_libexecdir} \
+    --mandir=%{_mandir} \
+    --infodir=%{_infodir} \
+    --datadir=%{_datadir} \
+    --build=%{_build} --host=%{_host} \
+    --target=%{_target} \
+    --disable-libstdcxx-pch \
+    --with-gnu-as --with-gnu-ld --verbose \
+    --with-newlib \
+    "$zlib_option" \
+    --disable-nls --without-included-gettext \
+    --disable-win32-registry \
+    --enable-version-specific-runtime-libs \
+    --disable-lto \
+    --enable-newlib-io-c99-formats \
+    %{?with_iconv:--enable-newlib-iconv} \
+    %{?with_iconv:--enable-newlib-iconv-encodings=%{_newlib_iconv_encodings}} \
+    %{?with_threads:--enable-threads}%{!?with_threads:--disable-threads} \
+    %{?with_plugin:--enable-plugin}%{!?with_plugin:--disable-plugin} \
+    %{?enable_obsolete:--enable-obsolete} \
+    %{?gcc_configure_extra_options:%{gcc_configure_extra_options}} \
+    --enable-languages="$languages"
+
+  if test "%_host" != "%_build" ; then
+    # Bug in gcc-3.2.1:
+    # Somehow, gcc doesn't get syslimits.h right for Cdn-Xs
+    mkdir -p gcc/include
+    cp ../${source_dir_gcc}/gcc/gsyslimits.h gcc/include/syslimits.h
+  fi
+
+  %{__make} %{?_smp_mflags} all
+
+  cd ${build_top}
+
+%install
+  build_top=$(pwd)
+
+  %{__rmdir} $SB_BUILD_ROOT
+
+  cd ${build_dir}
+  %{__make} DESTDIR=$SB_BUILD_ROOT install
+  cd ${build_top}
+
+  # libiberty doesn't honor --libdir, but always installs to a
+  # magically guessed _libdir
+  %{__rmfile} ${SB_BUILD_ROOT}%{_libdir}/libiberty.a
+
+  # We use the version from binutils
+  %{__rmfile} $SB_BUILD_ROOT%{_bindir}/%{_target}-c++filt%{_exeext}
+
+  # We don't ship info/dir
+  %{__rmfile} $SB_BUILD_ROOT%{_infodir}/dir
+
+  # Don't want libffi's man-pages
+  %{__rmfile} $SB_BUILD_ROOT%{_mandir}/man3/*ffi*
+
+  # Clean the symlinks away incase the source is a repo
+  # Note, delete as a directory because of MSYS2 support on Windows.
+  %{__rmdir} ${source_dir_gcc}/newlib
+  %{__rmdir} ${source_dir_gcc}/mpfr
+  %{__rmdir} ${source_dir_gcc}/mpc
+  %{__rmdir} ${source_dir_gcc}/gmp
+
+%testing
+  # Add testing here.
+  export RUNTESTFLAGS=--target_board=%{_target}-run
diff --git a/source-builder/config/gdb-7-8-epiphany.cfg b/source-builder/config/gdb-7-8-epiphany.cfg
new file mode 100644
index 0000000..093aa0a
--- /dev/null
+++ b/source-builder/config/gdb-7-8-epiphany.cfg
@@ -0,0 +1,129 @@
+#
+# GDB 7.xx Version 1.
+#
+# This configuration file configure's, make's and install's gdb.
+#
+
+#
+# See if the simulator has been disabled for Windows.
+#
+%if %{_host_os} == win32
+ %if %{defined win32-gdb-disable-sim}
+  %define gdb-disable-sim 1
+  %endif
+%endif
+
+#
+# Default to building simulators.
+#
+%ifn %{defined gdb-disable-sim}
+ %define gdb-disable-sim 0
+%else
+ %undefine gdb-sim-options
+%endif
+
+%include %{_configdir}/checks.cfg
+
+#
+# Select Snapshot Macro Maps
+#
+%select gdb-snapshot
+%select expat-snapshot
+
+#
+# The description.
+#
+Name:      %{_target}-gdb-%{gdb_version}-%{_host}-%{release}
+Summary:   GDB v%{gdb_version} for target %{_target} on host %{_host}
+Version:   %{gdb_version}
+Release:   %{release}
+URL: 	   http://www.gnu.org/software/gdb/
+BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
+
+#
+# GDB has changed it default extension.
+#
+%ifn %{defined gdb_src_ext}
+  %define gdb_src_ext gz
+%endif
+
+#
+# Source
+#
+%source set gdb https://github.com/heshamelmatary/epiphany-binutils-gdb/archive/epiphany-gdb-7.8.zip 
+
+#
+# Disable Python on Cxc builds for now.
+#
+%if "%{_build}" != "%{_host}"
+  %define without_python
+%endif
+
+#
+#
+# Prepare the source code.
+#
+%prep
+  build_top=$(pwd)
+
+  source_dir_gdb="epiphany-binutils-gdb-epiphany-gdb-7.8"
+  %source setup gdb -q -n epiphany-binutils-gdb-epiphany-gdb-7.8
+  %patch setup gdb -p1
+
+  cd ${build_top}
+
+%build
+  build_top=$(pwd)
+
+  %{build_directory}
+
+  mkdir -p ${build_dir}
+  cd ${build_dir}
+
+  %{host_build_flags}
+
+  if test "%{_build}" != "%{_host}" ; then
+    GDB_LIBS_STATIC="-lexpat"
+  else
+    GDB_LIBS_STATIC="-lexpat"
+    GDB_LIBS="%{_forced_static}"
+  fi
+
+  LIBS_STATIC=${GDB_LIBS_STATIC} \
+  LIBS=${GDB_LIBS} \
+  ../${source_dir_gdb}/configure \
+    --build=%{_build} --host=%{_host} \
+    --target=%{_target} \
+    --verbose --disable-nls \
+    --without-included-gettext \
+    --disable-win32-registry \
+    --disable-werror \
+    %{!?gdb-disable-sim:--enable-sim}%{?gdb-disable-sim:--disable-sim} \
+    %{?gdb-sim-options:%{gdb-sim-options}} \
+    --without-zlib \
+    --with-expat \
+    %{!?without_python:--with-python} \
+    --prefix=%{_prefix} --bindir=%{_bindir} \
+    --exec-prefix=%{_exec_prefix} \
+    --includedir=%{_includedir} --libdir=%{_libdir} \
+    --mandir=%{_mandir} --infodir=%{_infodir}
+
+  %{__make} %{?_smp_mflags} all
+
+  cd ${build_top}
+
+%install
+  build_top=$(pwd)
+
+  %{__rmdir} $SB_BUILD_ROOT
+
+  cd ${build_dir}
+  %{__make} DESTDIR=$SB_BUILD_ROOT install
+
+  # Dropped in FSF-binutils-2.9.5, but Cygwin still ships it.
+  %{__rmdir} $SB_BUILD_ROOT%{_infodir}/configure.info*
+
+  %{__rmfile} $SB_BUILD_ROOT%{_infodir}/dir
+  touch $SB_BUILD_ROOT%{_infodir}/dir
+
+  cd ${build_top}
-- 
2.1.0



More information about the devel mailing list