From 5fc47ddf41460248965514a8d8092021298ee2e7 Mon Sep 17 00:00:00 2001 From: Domenico Iezzi Date: Mon, 25 Nov 2024 13:20:48 +0100 Subject: [PATCH] Cleanup build scripting --- .github/workflows/build.yml | 5 +- README.md | 4 +- scripts/build-toolchain | 508 --------------------------- scripts/build-toolchain-msys2 | 296 ---------------- install-deps => scripts/install-deps | 4 +- 5 files changed, 5 insertions(+), 812 deletions(-) delete mode 100755 scripts/build-toolchain delete mode 100755 scripts/build-toolchain-msys2 rename install-deps => scripts/install-deps (63%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a602ad9..f41a842 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,10 +21,7 @@ jobs: - name: Install dependencies run: | - sudo apt-get update - sudo apt-get -y install build-essential build-essential texinfo \ - flex bison libmpfr-dev libgmp-dev libmpc-dev zip libdebuginfod-dev \ - gcc-mingw-w64 g++-mingw-w64 + sudo ./scripts/install-deps - name: Build Linux run: | diff --git a/README.md b/README.md index c91875a..510954e 100644 --- a/README.md +++ b/README.md @@ -20,9 +20,7 @@ git clone --recursive git@github.com:EEESlab/tricore-gcc-toolchain-11.3.0.git Install build dependencies: ```sh -sudo apt-get update -sudo apt-get -y install build-essential texinfo \ - flex bison libmpfr-dev libgmp-dev libmpc-dev zip libdebuginfod-dev +sudo ./scripts/install-deps ``` Create a temporary build directory and call the `configure` script diff --git a/scripts/build-toolchain b/scripts/build-toolchain deleted file mode 100755 index 783e83b..0000000 --- a/scripts/build-toolchain +++ /dev/null @@ -1,508 +0,0 @@ -#!/usr/bin/env bash - -set -eu - -TOOLCHAIN_ROOT="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" -INSTALL_FOLDER=$TOOLCHAIN_ROOT/INSTALL -INSTALL_FOLDER_WIN=$TOOLCHAIN_ROOT/INSTALL-WIN -BUILD_FOLDER=$TOOLCHAIN_ROOT/BUILD -LOG_FOLDER=$TOOLCHAIN_ROOT/LOG -PARALLEL_JOBS=$(nproc) - -export PATH="$INSTALL_FOLDER/bin:$PATH" - -# set default build flags if not available in env -CFLAGS="${CFLAGS:--O2}" -CXXFLAGS="${CXXFLAGS:--O2}" -LDFLAGS="${LDFLAGS:--static -s}" - -print_usage() { - cat <&1 | tee "$LOG_FOLDER/binutils_mcs.log" - if test ${PIPESTATUS[0]} -ne 0; then - echo "The build has failed during make of binutils-mcs" - exit 1 - fi - make install 2>&1 | tee -a "$LOG_FOLDER/binutils_mcs.log" - if test ${PIPESTATUS[0]} -ne 0; then - echo "The build has failed during install of binutils-mcs" - exit 1 - fi -fi - - -### Binutils - -if [[ "$task_string" == "clean-binutils-tc" || "$task_string" == "clean-all" || "$task_string" == "clean-linux" ]]; then - echo "Deleting $BUILD_FOLDER/binutils-tc..." - rm -fr "$BUILD_FOLDER/binutils-tc" -fi - -if [[ "$task_string" == "build-binutils-tc" || "$task_string" == "build-all" || "$task_string" == "build-linux" ]]; then - BINUTILS_SRC_FOLDER="$TOOLCHAIN_ROOT/tricore-binutils-gdb" - mkdir -p "$BUILD_FOLDER/binutils-tc" - mkdir -p "$LOG_FOLDER" - cd "$BUILD_FOLDER/binutils-tc" - if ! $BINUTILS_SRC_FOLDER/configure \ - LDFLAGS="$LDFLAGS" \ - CFLAGS="$CFLAGS" \ - CXXFLAGS="$CXXFLAGS" \ - --target=tricore-elf \ - --enable-targets=mcs-elf \ - --program-prefix=tricore-elf- \ - --disable-threads \ - --enable-nls \ - --disable-itcl \ - --disable-tk \ - --disable-tcl \ - --disable-winsup \ - --disable-gdbtk \ - --disable-libgui \ - --disable-rda \ - --disable-sid \ - --disable-sim \ - --disable-gdb \ - --disable-newlib \ - --disable-libgloss \ - --disable-test-suite \ - --enable-checking=release \ - --with-gnu-ld \ - --with-gnu-as \ - --prefix="$INSTALL_FOLDER" \ - --disable-werror; then - echo "The build has failed during configure of binutils" - exit 1 - fi - make --output-sync -j${PARALLEL_JOBS} LDFLAGS="$LDFLAGS" 2>&1 | tee "$LOG_FOLDER/binutils.log" - if test ${PIPESTATUS[0]} -ne 0; then - echo "The build has failed during make of binutils" - exit 1 - fi - make install 2>&1 | tee -a "$LOG_FOLDER/binutils.log" - if test ${PIPESTATUS[0]} -ne 0; then - echo "The build has failed during install of binutils" - exit 1 - fi -fi - - -### GCC stage1 - -if [[ "$task_string" == "clean-gcc-stage1" || "$task_string" == "clean-all" || "$task_string" == "clean-linux" ]]; then - echo "Deleting $BUILD_FOLDER/gcc-stage1..." - rm -fr "$BUILD_FOLDER/gcc-stage1" -fi - -if [[ "$task_string" == "build-gcc-stage1" || "$task_string" == "build-all" || "$task_string" == "build-linux" ]]; then - GCC_SRC_FOLDER=$TOOLCHAIN_ROOT/tricore-gcc - # Download necessary dependencies if they don't exist - if [[ ! -d $GCC_SRC_FOLDER/gmp ]]; then - cd -- "$GCC_SRC_FOLDER" - ./contrib/download_prerequisites - fi - mkdir -p "$BUILD_FOLDER/gcc-stage1" - mkdir -p "$LOG_FOLDER" - cd "$BUILD_FOLDER/gcc-stage1" - if ! $GCC_SRC_FOLDER/configure \ - LDFLAGS="$LDFLAGS" \ - CFLAGS="$CFLAGS" \ - CXXFLAGS="$CXXFLAGS" \ - CFLAGS_FOR_TARGET='-g -O2 -gdwarf-3' \ - CXXFLAGS_FOR_TARGET='-g -O2 -gdwarf-3' \ - --target=tricore-elf \ - --enable-lib32 \ - --disable-lib64 \ - --prefix="$INSTALL_FOLDER" \ - --enable-languages=c,c++ \ - --enable-libstdcxx-debug-flags='-gdwarf-3 -g -O0 -D_GLIBCXX_ASSERTIONS' \ - --enable-c99 \ - --enable-long-long \ - --enable-checking \ - --enable-nls \ - --enable-static \ - --disable-threads \ - --disable-shared \ - --with-headers=yes \ - --with-newlib=yes \ - --enable-mingw-wildcard \ - --disable-libstdcxx-pch \ - --enable-newlib-elix-level=3 \ - --enable-newlib-io-long-long \ - --disable-newlib-supplied-syscalls \ - --disable-libssp \ - --disable-test-suite; then - echo "The build has failed during configure of gcc (stage 1)" - exit 1 - fi - make -j${PARALLEL_JOBS} all-gcc 2>&1 | tee "$LOG_FOLDER/gcc_stage1.log" - if test ${PIPESTATUS[0]} -ne 0; then - echo "The build has failed during make of gcc (stage 1)" - exit 1 - fi - make install-gcc 2>&1 | tee -a "$LOG_FOLDER/gcc_stage1.log" - if test ${PIPESTATUS[0]} -ne 0; then - echo "The build has failed during install of gcc (stage 1)" - exit 1 - fi -fi - - -### Newlib - -if [[ "$task_string" == "clean-newlib" || "$task_string" == "clean-all" || "$task_string" == "clean-linux" ]]; then - echo "Deleting $BUILD_FOLDER/newlib..." - rm -fr "$BUILD_FOLDER/newlib" -fi - -if [[ "$task_string" == "build-newlib" || "$task_string" == "build-all" || "$task_string" == "build-linux" ]]; then - NEWLIB_SRC_FOLDER="$TOOLCHAIN_ROOT/tricore-newlib-cygwin" - mkdir -p "$BUILD_FOLDER/newlib" - mkdir -p "$LOG_FOLDER" - cd "$BUILD_FOLDER/newlib" - export CC_FOR_TARGET=$INSTALL_FOLDER/bin/tricore-elf-gcc - export CXX_FOR_TARGET=$INSTALL_FOLDER/bin/tricore-elf-c++ - export GCC_FOR_TARGET=$INSTALL_FOLDER/bin/tricore-elf-gcc - export AR_FOR_TARGET=$INSTALL_FOLDER/bin/tricore-elf-ar - export AS_FOR_TARGET=$INSTALL_FOLDER/bin/tricore-elf-as - export LD_FOR_TARGET=$INSTALL_FOLDER/bin/tricore-elf-ld - export NM_FOR_TARGET=$INSTALL_FOLDER/bin/tricore-elf-nm - export OBJDUMP_FOR_TARGET=$INSTALL_FOLDER/bin/tricore-elf-objdump - export RANLIB_FOR_TARGET=$INSTALL_FOLDER/bin/tricore-elf-ranlib - export STRIP_FOR_TARGET=$INSTALL_FOLDER/bin/tricore-elf-strip - export READELF_FOR_TARGET=$INSTALL_FOLDER/bin/tricore-elf-readelf - if ! CFLAGS_FOR_TARGET='-g -gdwarf-3 -O2 -ffunction-sections -mfast-div -fno-common' \ - CXXFLAGS_FOR_TARGET='-g -gdwarf-3 -O2 -ffunction-sections -mfast-div -fno-common' \ - $NEWLIB_SRC_FOLDER/configure \ - --target=tricore-elf \ - --host=i686-w64-mingw32 \ - --build=i686-pc-mingw32 \ - --prefix="$INSTALL_FOLDER"; then - echo "The build has failed during configure of newlib" - exit 1 - fi - make -j${PARALLEL_JOBS} LDFLAGS="$LDFLAGS" all 2>&1 | tee "$LOG_FOLDER/newlib.log" - if test ${PIPESTATUS[0]} -ne 0; then - echo "The build has failed during make of newlib" - fi - make install 2>&1 | tee -a "$LOG_FOLDER/newlib.log" - make install prefix=$INSTALL_FOLDER_WIN 2>&1 | tee -a "$LOG_FOLDER/newlib-win.log" - if test ${PIPESTATUS[0]} -ne 0; then - echo "The build has failed during install of newlib" - exit 1 - fi -fi - -### GCC stage2 - -if [[ "$task_string" == "clean-gcc-stage2" || "$task_string" == "clean-all" || "$task_string" == "clean-linux" ]]; then - echo "Deleting $BUILD_FOLDER/gcc-stage2..." - rm -fr "$BUILD_FOLDER/gcc-stage2" -fi - -if [[ "$task_string" == "build-gcc-stage2" || "$task_string" == "build-all" || "$task_string" == "build-linux" ]]; then - export GCC_SRC_FOLDER=$TOOLCHAIN_ROOT/tricore-gcc - mkdir -p "$BUILD_FOLDER/gcc-stage2" - mkdir -p "$LOG_FOLDER" - cd "$BUILD_FOLDER/gcc-stage2" - if ! $GCC_SRC_FOLDER/configure \ - LDFLAGS="$LDFLAGS" \ - CFLAGS="$CFLAGS" \ - CXXFLAGS="$CXXFLAGS" \ - CFLAGS_FOR_TARGET='-g -gdwarf-3 -O2 -ffast-math -ffunction-sections -mfast-div -fno-common -mno-eabi-bitfield-limit' \ - CPPFLAGS_FOR_TARGET='-g -gdwarf-3 -O2 -ffast-math -ffunction-sections -mfast-div -fno-common -mno-eabi-bitfield-limit' \ - --target=tricore-elf \ - --enable-lib32 \ - --disable-lib64 \ - --prefix="$INSTALL_FOLDER" \ - --enable-languages=c,c++ \ - --enable-libstdcxx-debug-flags='-gdwarf-3 -g -O0 -D_GLIBCXX_ASSERTIONS' \ - --enable-c99 \ - --enable-long-long \ - --enable-checking \ - --enable-nls \ - --enable-static \ - --disable-threads \ - --disable-shared \ - --with-headers=yes \ - --with-gnu-ld \ - --with-gnu-as \ - --with-newlib=yes \ - --enable-mingw-wildcard \ - --disable-libstdcxx-pch \ - --enable-newlib-elix-level=3 \ - --enable-newlib-io-long-long \ - --disable-newlib-supplied-syscalls \ - --disable-libssp \ - --disable-test-suite; then - echo "The build has failed during configure of gcc (stage 2)" - exit 1 - fi - make -j${PARALLEL_JOBS} all 2>&1 | tee "$LOG_FOLDER/gcc_stage2.log" - if test ${PIPESTATUS[0]} -ne 0; then - echo "The build has failed during make of gcc (stage 2)" - exit 1 - fi - make install-strip 2>&1 | tee -a "$LOG_FOLDER/gcc_stage2.log" - if test ${PIPESTATUS[0]} -ne 0; then - echo "The build has failed during install of gcc (stage 2)" - exit 1 - fi -fi - -if [[ "$task_string" == "clean-binutils-mcs-win" || "$task_string" == "clean-all" ]]; then - echo "Deleting $BUILD_FOLDER/binutils-mcs-win..." - rm -fr "$BUILD_FOLDER/binutils-mcs-win" -fi - -if [[ "$task_string" == "build-binutils-mcs-win" || "$task_string" == "build-all" ]]; then - export BINUTILS_SRC_FOLDER=$TOOLCHAIN_ROOT/tricore-binutils-gdb - mkdir -p "$BUILD_FOLDER/binutils-mcs-win" - mkdir -p "$LOG_FOLDER" - cd "$BUILD_FOLDER/binutils-mcs-win" - if ! $BINUTILS_SRC_FOLDER/configure \ - LDFLAGS="$LDFLAGS" \ - CFLAGS="$CFLAGS" \ - CXXFLAGS="$CXXFLAGS" \ - --target=mcs-elf \ - --host=x86_64-w64-mingw32 \ - --program-prefix=mcs-elf- \ - --disable-threads \ - --enable-nls \ - --disable-itcl \ - --disable-tk \ - --disable-tcl \ - --disable-winsup \ - --disable-gdbtk \ - --disable-libgui \ - --disable-rda \ - --disable-sid \ - --disable-sim \ - --disable-gdb \ - --disable-newlib \ - --disable-libgloss \ - --disable-test-suite \ - --enable-checking=release \ - --with-gnu-ld \ - --with-gnu-as \ - --prefix="$INSTALL_FOLDER_WIN" \ - --disable-werror; then - echo "The build has failed during configure of binutils-mcs for Windows" - exit 1 - fi - make --output-sync -j${PARALLEL_JOBS} 2>&1 | tee "$LOG_FOLDER/binutils_mcs-win.log" - if test ${PIPESTATUS[0]} -ne 0; then - echo "The build has failed during make of binutils-mcs for Windows" - exit 1 - fi - make install 2>&1 | tee -a "$LOG_FOLDER/binutils_mcs-win.log" - if test ${PIPESTATUS[0]} -ne 0; then - echo "The build has failed during install of binutils-mcs for Windows" - exit 1 - fi -fi - - -if [[ "$task_string" == "clean-binutils-tc-win" || "$task_string" == "clean-all" ]]; then - echo "Deleting $BUILD_FOLDER/binutils-tc-win..." - rm -fr "$BUILD_FOLDER/binutils-tc-win" -fi - -if [[ "$task_string" == "build-binutils-tc-win" || "$task_string" == "build-all" ]]; then - BINUTILS_SRC_FOLDER=$TOOLCHAIN_ROOT/tricore-binutils-gdb - mkdir -p "$BUILD_FOLDER/binutils-tc-win" - mkdir -p "$LOG_FOLDER" - cd "$BUILD_FOLDER/binutils-tc-win" - if ! $BINUTILS_SRC_FOLDER/configure \ - LDFLAGS="$LDFLAGS" \ - CFLAGS="$CFLAGS" \ - CXXFLAGS="$CXXFLAGS" \ - --target=tricore-elf \ - --host=x86_64-w64-mingw32 \ - --enable-targets=mcs-elf \ - --program-prefix=tricore-elf- \ - --disable-threads \ - --enable-nls \ - --disable-itcl \ - --disable-tk \ - --disable-tcl \ - --disable-winsup \ - --disable-gdbtk \ - --disable-libgui \ - --disable-rda \ - --disable-sid \ - --disable-sim \ - --disable-gdb \ - --disable-newlib \ - --disable-libgloss \ - --disable-test-suite \ - --enable-checking=release \ - --with-gnu-ld \ - --with-gnu-as \ - --prefix="$INSTALL_FOLDER_WIN" \ - --disable-werror; then - echo "The build has failed during configure of binutils fow Windows" - exit 1 - fi - make --output-sync -j${PARALLEL_JOBS} 2>&1 | tee "$LOG_FOLDER/binutils-tc-win.log" - if test ${PIPESTATUS[0]} -ne 0; then - echo "The build has failed during make of binutils for Windows" - exit 1 - fi - make install 2>&1 | tee -a "$LOG_FOLDER/binutils-tc-win.log" - if test ${PIPESTATUS[0]} -ne 0; then - echo "The build has failed during install of binutils for Windows" - exit 1 - fi -fi - - - -if [[ "$task_string" == "clean-gcc-stage2-win" || "$task_string" == "clean-all" ]]; then - echo "Deleting $BUILD_FOLDER/gcc-stage2-win..." - rm -fr "$BUILD_FOLDER/gcc-stage2-win" -fi - -if [[ "$task_string" == "build-gcc-stage2-win" || "$task_string" == "build-all" ]]; then - GCC_SRC_FOLDER=$TOOLCHAIN_ROOT/tricore-gcc - mkdir -p "$BUILD_FOLDER/gcc-stage2-win" - mkdir -p "$LOG_FOLDER" - cd "$BUILD_FOLDER/gcc-stage2-win" - if ! $GCC_SRC_FOLDER/configure \ - LDFLAGS="$LDFLAGS" \ - CFLAGS="$CFLAGS" \ - CXXFLAGS="$CXXFLAGS" \ - CFLAGS_FOR_TARGET='-g -gdwarf-3 -O2 -ffast-math -ffunction-sections -mfast-div -fno-common -mno-eabi-bitfield-limit' \ - CPPFLAGS_FOR_TARGET='-g -gdwarf-3 -O2 -ffast-math -ffunction-sections -mfast-div -fno-common -mno-eabi-bitfield-limit' \ - --target=tricore-elf \ - --host=x86_64-w64-mingw32 \ - --enable-lib32 \ - --disable-lib64 \ - --prefix="$INSTALL_FOLDER_WIN" \ - --enable-languages=c,c++ \ - --enable-libstdcxx-debug-flags='-gdwarf-3 -g -O0 -D_GLIBCXX_ASSERTIONS' \ - --enable-c99 \ - --enable-long-long \ - --enable-checking \ - --enable-nls \ - --enable-static \ - --disable-threads \ - --disable-shared \ - --with-headers=yes \ - --with-gnu-ld \ - --with-gnu-as \ - --with-newlib=yes \ - --enable-mingw-wildcard \ - --disable-libstdcxx-pch \ - --enable-newlib-elix-level=3 \ - --enable-newlib-io-long-long \ - --disable-newlib-supplied-syscalls \ - --disable-libssp \ - --disable-test-suite; then - echo "The build has failed during configure of gcc (stage 2) for Windows" - exit 1 - fi - make -j${PARALLEL_JOBS} all 2>&1 | tee "$LOG_FOLDER/gcc_stage2-win.log" - if test ${PIPESTATUS[0]} -ne 0; then - echo "The build has failed during make of gcc (stage 2) for Windows" - exit 1 - fi - make install-strip 2>&1 | tee -a "$LOG_FOLDER/gcc_stage2-win.log" - if test ${PIPESTATUS[0]} -ne 0; then - echo "The build has failed during install of gcc (stage 2) for Windows" - exit 1 - fi -fi diff --git a/scripts/build-toolchain-msys2 b/scripts/build-toolchain-msys2 deleted file mode 100755 index c8c7fb4..0000000 --- a/scripts/build-toolchain-msys2 +++ /dev/null @@ -1,296 +0,0 @@ -#!/bin/bash - -export TOOLCHAIN_ROOT="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" -export INSTALL_FOLDER=$TOOLCHAIN_ROOT/INSTALL -export BUILD_FOLDER=$TOOLCHAIN_ROOT/BUILD -export LOG_FOLDER=$TOOLCHAIN_ROOT/LOG -export PATH=/mingw64/bin:/opt/bin:$INSTALL_FOLDER/bin:$PATH -PARALLEL_JOBS=$(nproc) -#PARALLEL_JOBS=1 - - - -if [[ $* == *--help* || $* == *-h* ]]; then - echo "Usage: build-toolchain [--all] [--binutils-mcs] [--binutils] [--gcc-stage1] [--newlib] [--gcc-stage2] [--clean-all] [--clean-binutils-mcs] [--clean-binutils] [--clean-gcc-stage1] [--clean-newlib] [--clean-gcc-stage2] [--help | -h]" - exit 0 -fi - - - -if [[ $* == *--clean-all* ]]; then - rm -fr $BUILD_FOLDER - rm -fr $LOG_FOLDER -fi - - -### Binutils MCS - -if [[ $* == *--clean-binutils-mcs* ]]; then - rm -fr $BUILD_FOLDER/binutils-mcs -fi - -if [[ $* == *--binutils-mcs* || $* == *--all* ]]; then - export BINUTILS_SRC_FOLDER=$TOOLCHAIN_ROOT/tricore-binutils-gdb - mkdir -p $BUILD_FOLDER/binutils-mcs - mkdir -p $LOG_FOLDER - cd $BUILD_FOLDER/binutils-mcs - if ! $BINUTILS_SRC_FOLDER/configure \ - LDFLAGS='-static' \ - --target=mcs-elf \ - --build=x86_64-linux-gnu \ - --host=i686-w64-mingw32 \ - --program-prefix=mcs-elf- \ - --disable-threads \ - --enable-nls \ - --disable-itcl \ - --disable-tk \ - --disable-tcl \ - --disable-winsup \ - --disable-gdbtk \ - --disable-libgui \ - --disable-rda \ - --disable-sid \ - --disable-sim \ - --disable-gdb \ - --disable-newlib \ - --disable-libgloss \ - --disable-test-suite \ - --enable-checking=release \ - --with-gnu-ld \ - --with-gnu-as \ - --with-gmp=/mingw32 \ - --prefix=$INSTALL_FOLDER \ - target_alias=mcs-elf \ - --disable-werror; then - echo "The build has failed during configure of binutils-mcs" - exit 1 - fi - make --output-sync -j${PARALLEL_JOBS} LDFLAGS="-static" 2>&1 | tee $LOG_FOLDER/binutilsi-mcs.log - if test ${PIPESTATUS[0]} -ne 0; then - echo "The build has failed during make of binutils-mcs" - exit 1 - fi - make install 2>&1 | tee -a $LOG_FOLDER/binutilsi-mcs.log - if test ${PIPESTATUS[0]} -ne 0; then - echo "The build has failed during install of binutils-mcs" - exit 1 - fi -fi - - -### Binutils - -if [[ $* == *--clean-binutils* ]]; then - rm -fr $BUILD_FOLDER/binutils -fi - -if [[ $* == *--binutils* || $* == *--all* ]]; then - export BINUTILS_SRC_FOLDER=$TOOLCHAIN_ROOT/tricore-binutils-gdb - mkdir -p $BUILD_FOLDER/binutils - mkdir -p $LOG_FOLDER - cd $BUILD_FOLDER/binutils - if ! $BINUTILS_SRC_FOLDER/configure \ - LDFLAGS='-static' \ - --target=tricore-elf \ - --enable-targets=mcs-elf \ - --build=x86_64-linux-gnu \ - --host=i686-w64-mingw32 \ - --program-prefix=tricore-elf- \ - --disable-threads \ - --enable-nls \ - --disable-itcl \ - --disable-tk \ - --disable-tcl \ - --disable-winsup \ - --disable-gdbtk \ - --disable-libgui \ - --disable-rda \ - --disable-sid \ - --disable-sim \ - --disable-gdb \ - --disable-newlib \ - --disable-libgloss \ - --disable-test-suite \ - --enable-checking=release \ - --with-gnu-ld \ - --with-gnu-as \ - --with-gmp=/mingw32 \ - --prefix=$INSTALL_FOLDER \ - target_alias=tricore-elf \ - --disable-werror; then - echo "The build has failed during configure of binutils" - exit 1 - fi - make --output-sync -j${PARALLEL_JOBS} LDFLAGS="-static" 2>&1 | tee $LOG_FOLDER/binutils.log - if test ${PIPESTATUS[0]} -ne 0; then - echo "The build has failed during make of binutils" - exit 1 - fi - make install 2>&1 | tee -a $LOG_FOLDER/binutils.log - if test ${PIPESTATUS[0]} -ne 0; then - echo "The build has failed during install of binutils" - exit 1 - fi -fi - - -### GCC stage1 - -if [[ $* == *--clean-gcc-stage1* ]]; then - rm -fr $BUILD_FOLDER/gcc-stage1 -fi - -if [[ $* == *--gcc-stage1* || $* == *--all* ]]; then - export GCC_SRC_FOLDER=$TOOLCHAIN_ROOT/tricore-gcc - mkdir -p $BUILD_FOLDER/gcc-stage1 - mkdir -p $LOG_FOLDER - cd $BUILD_FOLDER/gcc-stage1 - if ! $GCC_SRC_FOLDER/configure \ - CFLAGS='-I/mingw32/include' \ - CXXFLAGS='-I/mingw32/include' \ - LDFLAGS='-static -L/mingw32/lib' \ - CFLAGS_FOR_TARGET='-g -O2 -gdwarf-3' \ - CXXFLAGS_FOR_TARGET='-g -O2 -gdwarf-3' \ - --target=tricore-elf \ - --build=i686-w64-mingw32 \ - --host=i686-w64-mingw32 \ - --src=../../tricore-gcc \ - --enable-lib32 \ - --disable-lib64 \ - --prefix=$INSTALL_FOLDER \ - --enable-languages=c,c++ \ - --enable-libstdcxx-debug-flags='-gdwarf-3 -g -O0 -D_GLIBCXX_ASSERTIONS' \ - --enable-c99 \ - --enable-long-long \ - --enable-checking \ - --enable-nls \ - --enable-static \ - --disable-threads \ - --disable-shared \ - --with-headers=yes \ - --with-newlib=yes \ - --enable-mingw-wildcard \ - --disable-libstdcxx-pch \ - --enable-newlib-elix-level=3 \ - --enable-newlib-io-long-long \ - --disable-newlib-supplied-syscalls \ - --disable-libssp \ - --disable-test-suite; then - echo "The build has failed during configure of gcc (stage 1)" - exit 1 - fi - make -j${PARALLEL_JOBS} all-gcc 2>&1 | tee $LOG_FOLDER/gcc_stage1.log - if test ${PIPESTATUS[0]} -ne 0; then - echo "The build has failed during make of gcc (stage 1)" - exit 1 - fi - make install-gcc 2>&1 | tee -a $LOG_FOLDER/gcc_stage1.log - if test ${PIPESTATUS[0]} -ne 0; then - echo "The build has failed during install of gcc (stage 1)" - exit 1 - fi -fi - - -### Newlib - -if [[ $* == *--clean-newlib* ]]; then - rm -fr $BUILD_FOLDER/newlib -fi - -if [[ $* == *--newlib* || $* == *--all* ]]; then - export NEWLIB_SRC_FOLDER=$TOOLCHAIN_ROOT/tricore-newlib-cygwin - mkdir -p $BUILD_FOLDER/newlib - mkdir -p $LOG_FOLDER - cd $BUILD_FOLDER/newlib - export CC_FOR_TARGET=$INSTALL_FOLDER/bin/tricore-elf-gcc - export CXX_FOR_TARGET=$INSTALL_FOLDER/bin/tricore-elf-c++ - export GCC_FOR_TARGET=$INSTALL_FOLDER/bin/tricore-elf-gcc - export AR_FOR_TARGET=$INSTALL_FOLDER/bin/tricore-elf-ar - export AS_FOR_TARGET=$INSTALL_FOLDER/bin/tricore-elf-as - export LD_FOR_TARGET=$INSTALL_FOLDER/bin/tricore-elf-ld - export NM_FOR_TARGET=$INSTALL_FOLDER/bin/tricore-elf-nm - export OBJDUMP_FOR_TARGET=$INSTALL_FOLDER/bin/tricore-elf-objdump - export RANLIB_FOR_TARGET=$INSTALL_FOLDER/bin/tricore-elf-ranlib - export STRIP_FOR_TARGET=$INSTALL_FOLDER/bin/tricore-elf-strip - export READELF_FOR_TARGET=$INSTALL_FOLDER/bin/tricore-elf-readelf - if ! CFLAGS_FOR_TARGET='-g -gdwarf-3 -O2 -ffunction-sections -mfast-div -fno-common' \ - CXXFLAGS_FOR_TARGET='-g -gdwarf-3 -O2 -ffunction-sections -mfast-div -fno-common' \ - $NEWLIB_SRC_FOLDER/configure \ - --target=tricore-elf \ - --host=x86_64-linux-gnu \ - --build=i686-pc-mingw32 \ - --prefix=$INSTALL_FOLDER; then - echo "The build has failed during configure of newlib" - exit 1 - fi - make -j${PARALLEL_JOBS} LDFLAGS="-static " all 2>&1 | tee $LOG_FOLDER/newlib.log - if test ${PIPESTATUS[0]} -ne 0; then - echo "The build has failed during make of newlib" - fi - make install 2>&1 | tee -a $LOG_FOLDER/newlib.log - if test ${PIPESTATUS[0]} -ne 0; then - echo "The build has failed during install of newlib" - exit 1 - fi -fi - - -### GCC stage2 - -if [[ $* == *--clean-gcc-stage2* ]]; then - rm -fr $BUILD_FOLDER/gcc-stage2 -fi - -if [[ $* == *--gcc-stage2* || $* == *--all* ]]; then - export GCC_SRC_FOLDER=$TOOLCHAIN_ROOT/tricore-gcc - mkdir -p $BUILD_FOLDER/gcc-stage2 - mkdir -p $LOG_FOLDER - cd $BUILD_FOLDER/gcc-stage2 - if ! $GCC_SRC_FOLDER/configure \ - CFLAGS='-I/mingw32/include' \ - CXXFLAGS='-I/mingw32/include' \ - LDFLAGS='-static -L/mingw32/lib' \ - CFLAGS_FOR_TARGET='-g -O2 -gdwarf-3' \ - CXXFLAGS_FOR_TARGET='-g -O2 -gdwarf-3' \ - --target=tricore-elf \ - --build=i686-w64-mingw32 \ - --host=i686-w64-mingw32 \ - --src=../../tricore-gcc \ - --enable-lib32 \ - --disable-lib64 \ - --prefix=$INSTALL_FOLDER \ - --enable-languages=c,c++ \ - --enable-libstdcxx-debug-flags='-gdwarf-3 -g -O0 -D_GLIBCXX_ASSERTIONS' \ - --enable-c99 \ - --enable-long-long \ - --enable-checking \ - --enable-nls \ - --enable-static \ - --disable-threads \ - --disable-shared \ - --with-headers=yes \ - --with-gnu-ld \ - --with-gnu-as \ - --with-newlib=yes \ - --enable-mingw-wildcard \ - --disable-libstdcxx-pch \ - --enable-newlib-elix-level=3 \ - --enable-newlib-io-long-long \ - --disable-newlib-supplied-syscalls \ - --disable-libssp \ - --disable-test-suite; then - echo "The build has failed during configure of gcc (stage 2)" - exit 1 - fi - make -j${PARALLEL_JOBS} all 2>&1 | tee $LOG_FOLDER/gcc_stage2.log - if test ${PIPESTATUS[0]} -ne 0; then - echo "The build has failed during make of gcc (stage 2)" - exit 1 - fi - make install 2>&1 | tee -a $LOG_FOLDER/gcc_stage2.log - if test ${PIPESTATUS[0]} -ne 0; then - echo "The build has failed during install of gcc (stage 2)" - exit 1 - fi -fi diff --git a/install-deps b/scripts/install-deps similarity index 63% rename from install-deps rename to scripts/install-deps index b8deb6a..0599628 100755 --- a/install-deps +++ b/scripts/install-deps @@ -10,4 +10,6 @@ then fi apt-get update -apt-get -y install build-essential build-essential gcc-mingw-w64 g++-mingw-w64 texinfo flex bison libmpfr-dev libgmp-dev libmpc-dev zip libdebuginfod-dev +apt-get -y install build-essential texinfo \ + flex bison libmpfr-dev libgmp-dev libmpc-dev zip libdebuginfod-dev \ + gcc-mingw-w64 g++-mingw-w64