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/crossgcc52
-rwxr-xr-xprojects/crossgcc/crossgcc-helper23
3 files changed, 52 insertions, 24 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 3ad3b7ae..46b9e3f3 100755
--- a/projects/crossgcc/crossgcc
+++ b/projects/crossgcc/crossgcc
@@ -46,11 +46,11 @@ extract() {
crossgcc_tarballs "$@" | while read tarball
do
- local tarball_sources_path=$( crossgcc_tarball_sources_path "$tarball" )
- local tarball_install_path=$( crossgcc_tarball_install_path "$tarball" "$@" )
- local tarball_install_directory_path=$( dirname "$tarball_install_path" )
+ local tarball_sources_path=$(crossgcc_tarball_sources_path "$tarball")
+ local tarball_install_path=$(crossgcc_tarball_install_path "$tarball" "$@")
+ local tarball_install_directory_path=$(dirname "$tarball_install_path")
- if [ -f "$tarball_sources_path" ] && ! [ -f "$tarball_install_path" ]
+ if [[ -f "$tarball_sources_path" ]] && ! [[ -f "$tarball_install_path" ]]
then
printf '%s\n' "Copying source archive $tarball for $project (with ${arguments:-no argument})"
@@ -70,7 +70,7 @@ extract_check() {
crossgcc_tarballs "$@" | while read tarball
do
- local tarball_install_path=$( crossgcc_tarball_install_path "$tarball" "$@" )
+ local tarball_install_path=$(crossgcc_tarball_install_path "$tarball" "$@")
test ! -f "$tarball_install_path"
done
@@ -86,11 +86,11 @@ update() {
crossgcc_tarballs "$@" | while read tarball
do
- local tarball_sources_path=$( crossgcc_tarball_sources_path "$tarball" )
- local tarball_install_path=$( crossgcc_tarball_install_path "$tarball" "$@" )
- local tarball_install_directory_path=$( dirname "$tarball_install_path" )
+ local tarball_sources_path=$(crossgcc_tarball_sources_path "$tarball")
+ local tarball_install_path=$(crossgcc_tarball_install_path "$tarball" "$@")
+ local tarball_install_directory_path=$(dirname "$tarball_install_path")
- if [ -f $tarball_sources_path ]
+ if [[ -f $tarball_sources_path ]]
then
printf '%s\n' "Copying source archive $tarball for $project (with ${arguments:-no argument})"
@@ -110,7 +110,7 @@ update_check() {
crossgcc_tarballs "$@" | while read tarball
do
- local tarball_sources_path=$( crossgcc_tarball_sources_path "$tarball" "$@" )
+ local tarball_sources_path=$(crossgcc_tarball_sources_path "$tarball" "$@")
test ! -f "$tarball_sources_path"
done
@@ -119,11 +119,14 @@ update_check() {
prefix() {
local arch=$1
- local build_path=$( project_build_path "$project" "$@" )
+ local build_path=$(project_build_path "$project" "$@")
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
}
@@ -135,8 +138,8 @@ build() {
project_sources_directory_missing_empty_error "$project" "$repository" "$@"
- local sources_path=$( project_sources_path "$project" "$repository" "$@" )
- local build_path=$( project_build_path "$project" "$@" )
+ local sources_path=$(project_sources_path "$project" "$repository" "$@")
+ local build_path=$(project_build_path "$project" "$@")
if git_project_check "$repository"
then
@@ -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() {
@@ -172,13 +184,13 @@ release() {
crossgcc_tarballs "$@" | while read tarball
do
- local tarball_install_path=$( crossgcc_tarball_install_path "$tarball" "$@" )
- local tarball_release_path=$( crossgcc_tarball_release_path "$tarball" "$@" )
- local release_path=$( project_release_path "$project" "$SOURCES" "$@" )
+ local tarball_install_path=$(crossgcc_tarball_install_path "$tarball" "$@")
+ local tarball_release_path=$(crossgcc_tarball_release_path "$tarball" "$@")
+ local release_path=$(project_release_path "$project" "$SOURCES" "$@")
mkdir -p "$release_path"
- if [ -f "$tarball_install_path" ] && ! [ -f "$tarball_release_path" ]
+ if [[ -f "$tarball_install_path" ]] && ! [[ -f "$tarball_release_path" ]]
then
printf '%s\n' "Releasing source archive $tarball for $project (with ${arguments:-no argument})"
@@ -198,7 +210,7 @@ release_check() {
crossgcc_tarballs "$@" | while read tarball
do
- local tarball_release_path=$( crossgcc_tarball_release_path "$tarball" "$@" )
+ local tarball_release_path=$(crossgcc_tarball_release_path "$tarball" "$@")
test -f "$tarball_release_path"
done
diff --git a/projects/crossgcc/crossgcc-helper b/projects/crossgcc/crossgcc-helper
index 5c4072d2..94e445bf 100755
--- a/projects/crossgcc/crossgcc-helper
+++ b/projects/crossgcc/crossgcc-helper
@@ -15,10 +15,25 @@
# 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 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$//" )
+ local tarballs=$(ls "$sources_path/util/crossgcc/sum" | sed "s/.cksum$//")
printf '%s\n' "$tarballs"
}
@@ -35,7 +50,7 @@ crossgcc_tarball_install_path() {
local tarball=$1
shift
- local sources_path=$( project_sources_path "$project" "$repository" "$@" )
+ local sources_path=$(project_sources_path "$project" "$repository" "$@")
local install_path="$sources_path/util/crossgcc/tarballs/"
local tarball_install_path="$install_path/$tarball"
@@ -46,7 +61,7 @@ crossgcc_tarball_release_path() {
local tarball=$1
shift
- local release_path=$( project_release_path "$project" "$SOURCES" "$@" )
+ local release_path=$(project_release_path "$project" "$SOURCES" "$@")
local tarball_release_path="$release_path/$tarball"
printf '%s\n' "$tarball_release_path"