From 86ee7170368b2234cbd993da2504c38837ef1b45 Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Mon, 2 Oct 2017 02:08:48 -0400 Subject: Conditionally bootstrap CrossGCC build It's possible that a compilation failure will occur if there's a difference in major versions between the host GCC compiler and the one being built. To avoid this, bootstrapping can be used. The method for bootstrapping is simply passing the '-b' flag to Make; the Makefile takes care of the rest. --- projects/crossgcc/crossgcc | 11 ++++++++++- projects/crossgcc/crossgcc-helper | 15 +++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/projects/crossgcc/crossgcc b/projects/crossgcc/crossgcc index 3ad3b7ae..cdd3f513 100755 --- a/projects/crossgcc/crossgcc +++ b/projects/crossgcc/crossgcc @@ -145,7 +145,16 @@ build() { mkdir -p "$build_path" - make -C "$sources_path" CPUS="$TASKS" DEST="$build_path" "crossgcc-$arch" + local bootstrap_flag + + if ! crossgcc_same_major_version_test; then + printf '\n%s' 'GCC major versions differ. Bootstrapping' 1>&2 + printf '%s\n\n' ' to avoid potential build failure' 1>&2 + + bootstrap_flag='-b' + fi + + make -C "$sources_path" "$bootstrap_flag" CPUS="$TASKS" DEST="$build_path" "crossgcc-$arch" } build_check() { diff --git a/projects/crossgcc/crossgcc-helper b/projects/crossgcc/crossgcc-helper index 5c4072d2..3891a15c 100755 --- a/projects/crossgcc/crossgcc-helper +++ b/projects/crossgcc/crossgcc-helper @@ -15,6 +15,21 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +crossgcc_same_major_version_test() { + local buildgcc_path="$sources_path/util/crossgcc/buildgcc" + local sources_path="$(project_sources_path "$project" "$repository" "$@")" + + local crossgcc_version="$(sed -rne 's/^GCC_VERSION=(.*)$/\1/p' "$buildgcc_path")" + local host_gcc_version="$(gcc -dumpversion)" + + if [[ "${host_gcc_version%%.*}" -eq "${crossgcc_version%%.*}" ]]; then + + return 0 + else + return 1 + fi +} + crossgcc_tarballs() { local sources_path=$( project_sources_path "$project" "$repository" "$@" ) local install_path="$sources_path/util/crossgcc/tarballs/" -- cgit v1.2.3-70-g09d2 From e480b578c9bd1e8791ddc759b7f0baf24d7b8e37 Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Mon, 2 Oct 2017 07:21:49 -0400 Subject: Add i386 to CrossGCC targets file --- projects/crossgcc/configs/targets | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/crossgcc/configs/targets b/projects/crossgcc/configs/targets index fb05f39d..8c9fb8ba 100644 --- a/projects/crossgcc/configs/targets +++ b/projects/crossgcc/configs/targets @@ -1 +1,2 @@ arm +i386 -- cgit v1.2.3-70-g09d2 From ff4ee014ce526a16631ac0913053cade161e7b0a Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Mon, 2 Oct 2017 07:22:52 -0400 Subject: Add i386 to CrossGCC prefix action The prefix action is a quality-of-life addition which helps a user locate the relevant compiler binaries for a given target once built. This change simply extends it for the i386 target. --- projects/crossgcc/crossgcc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/crossgcc/crossgcc b/projects/crossgcc/crossgcc index cdd3f513..f0d7a5d1 100755 --- a/projects/crossgcc/crossgcc +++ b/projects/crossgcc/crossgcc @@ -123,7 +123,10 @@ prefix() { case $arch in "arm") - printf '%s\n' "$build_path/bin/arm-eabi-" + printf '\n%s\n' "$build_path/bin/arm-eabi-" + ;; + "i386") + printf '\n%s\n' "$build_path/bin/i386-elf-" ;; esac } -- cgit v1.2.3-70-g09d2