aboutsummaryrefslogtreecommitdiff
path: root/projects/crossgcc
diff options
context:
space:
mode:
Diffstat (limited to 'projects/crossgcc')
-rw-r--r--projects/crossgcc/configs/targets1
-rwxr-xr-xprojects/crossgcc/crossgcc24
-rwxr-xr-xprojects/crossgcc/crossgcc-helper25
3 files changed, 39 insertions, 11 deletions
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
diff --git a/projects/crossgcc/crossgcc b/projects/crossgcc/crossgcc
index aa930213..f0d7a5d1 100755
--- a/projects/crossgcc/crossgcc
+++ b/projects/crossgcc/crossgcc
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
#
@@ -52,7 +52,7 @@ extract() {
if [ -f "$tarball_sources_path" ] && ! [ -f "$tarball_install_path" ]
then
- printf "Copying source archive $tarball for $project (with ${arguments:-no argument})\n"
+ printf '%s\n' "Copying source archive $tarball for $project (with ${arguments:-no argument})"
mkdir -p "$tarball_install_directory_path"
@@ -92,7 +92,7 @@ update() {
if [ -f $tarball_sources_path ]
then
- printf "Copying source archive $tarball for $project (with ${arguments:-no argument})\n"
+ printf '%s\n' "Copying source archive $tarball for $project (with ${arguments:-no argument})"
mkdir -p "$tarball_install_directory_path"
@@ -123,7 +123,10 @@ prefix() {
case $arch in
"arm")
- echo "$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
}
@@ -145,7 +148,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() {
@@ -180,7 +192,7 @@ release() {
if [ -f "$tarball_install_path" ] && ! [ -f "$tarball_release_path" ]
then
- printf "Releasing source archive $tarball for $project (with ${arguments:-no argument})\n"
+ printf '%s\n' "Releasing source archive $tarball for $project (with ${arguments:-no argument})"
cp "$tarball_install_path" "$tarball_release_path"
file_verification_create "$tarball_release_path"
diff --git a/projects/crossgcc/crossgcc-helper b/projects/crossgcc/crossgcc-helper
index b4979f89..3891a15c 100755
--- a/projects/crossgcc/crossgcc-helper
+++ b/projects/crossgcc/crossgcc-helper
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
#
@@ -15,12 +15,27 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+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/"
local tarballs=$( ls "$sources_path/util/crossgcc/sum" | sed "s/.cksum$//" )
- echo "$tarballs"
+ printf '%s\n' "$tarballs"
}
crossgcc_tarball_sources_path() {
@@ -28,7 +43,7 @@ crossgcc_tarball_sources_path() {
local tarball_sources_path="$root/$SOURCES/$tarball"
- echo "$tarball_sources_path"
+ printf '%s\n' "$tarball_sources_path"
}
crossgcc_tarball_install_path() {
@@ -39,7 +54,7 @@ crossgcc_tarball_install_path() {
local install_path="$sources_path/util/crossgcc/tarballs/"
local tarball_install_path="$install_path/$tarball"
- echo "$tarball_install_path"
+ printf '%s\n' "$tarball_install_path"
}
crossgcc_tarball_release_path() {
@@ -49,5 +64,5 @@ crossgcc_tarball_release_path() {
local release_path=$( project_release_path "$project" "$SOURCES" "$@" )
local tarball_release_path="$release_path/$tarball"
- echo "$tarball_release_path"
+ printf '%s\n' "$tarball_release_path"
}