From 55a85e434286476feeff68f0c22251015a67131f Mon Sep 17 00:00:00 2001 From: "Ralf S. Engelschall" Date: Thu, 8 Aug 2002 15:57:00 +0000 Subject: [PATCH] add dynamic binutils requirement (especially for too old Linux) --- gcc/gcc.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++++ gcc/gcc.spec | 9 +++++---- 2 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 gcc/gcc.sh diff --git a/gcc/gcc.sh b/gcc/gcc.sh new file mode 100644 index 0000000000..7eaa248ba4 --- /dev/null +++ b/gcc/gcc.sh @@ -0,0 +1,47 @@ +#!/bin/sh +## +## gcc.sh -- GCC Package Build Utility +## Copyright (c) 2002 Ralf S. Engelschall +## + +check="$1" +shift +case $check in + require-binutils ) + # determine whether GNU gcc requires GNU binutils on this platform + require="no" + target="$1" + shift + case $target in + *-linux* ) + v=unknown + if [ -f /etc/debian_version ]; then + v=`/usr/bin/dpkg -l binutils | grep binutils | awk '{ print $3; }'` + elif [ -f /etc/redhat-release ]; then + v=`/bin/rpm -q --qf '%{VERSION}' binutils` + elif [ -f /etc/SuSE-release ]; then + v=`/bin/rpm -q --qf '%{VERSION}' binutils` + else + v=`(ld --version | grep 'GNU ld' | sed -e 's;^[^0-9]*\([0-9].[0-9.]*\).*;\1;') 2>/dev/null` + fi + # require GNU binutils >= 2.12 + case "$v" in + 2.1[2-9] | 2.1[2-9].* ) ;; + * ) require="yes" ;; + esac + ;; + * ) + if [ ".`(ld --version) 2>/dev/null | grep 'GNU ld'`" != . ]; then + v=`(ld --version | grep 'GNU ld' | sed -e 's;^[^0-9]*\([0-9].[0-9.]*\).*;\1;') 2>/dev/null` + # require GNU binutils >= 2.12 + case "$v" in + 2.1[2-9] | 2.1[2-9].* ) ;; + * ) require="yes" ;; + esac + fi + ;; + esac + echo "$require" | awk '{ printf("%s", $1); }' + ;; +esac + diff --git a/gcc/gcc.spec b/gcc/gcc.spec index 291aaacac7..13098928b5 100644 --- a/gcc/gcc.spec +++ b/gcc/gcc.spec @@ -24,9 +24,9 @@ ## # package versions -%define V_major 3.1.1 -%define V_short 3.1.1 -%define V_long 3.1.1 +%define V_major 3.1.1 +%define V_short 3.1.1 +%define V_long 3.1.1 # package options %ifndef with_cxx @@ -36,7 +36,7 @@ %define with_optimize yes %endif %ifndef with_binutils -%define with_binutils yes +%define with_binutils %(sh %{SOURCE gcc.sh} require-binutils %{l_target}) %endif # package information @@ -53,6 +53,7 @@ Release: 20020808 # list of sources Source0: ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{V_long}/gcc-%{V_long}.tar.bz2 +Source1: gcc.sh Patch0: gcc.patch # build information