Allow a user-defined compiler prefix to be specified via the CROSS_COMPILE variable when running switch-arch, e.g.
CROSS_COMPILE=powerpc-linux- ./config/scripts/switch-arch ppc
Based upon an original patch by John Arbuckle programmingkidx@gmail.com.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/config/scripts/switch-arch | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/openbios-devel/config/scripts/switch-arch b/openbios-devel/config/scripts/switch-arch index 868eae6..d5e2f77 100755 --- a/openbios-devel/config/scripts/switch-arch +++ b/openbios-devel/config/scripts/switch-arch @@ -99,7 +99,13 @@ archname()
select_prefix() { - for TARGET in ${1}-unknown-linux-gnu- ${1}-linux-gnu- ${1}-linux- ${1}-elf- ${1}-eabi- + TARGETS="${1}-unknown-linux-gnu- ${1}-linux-gnu- ${1}-linux- ${1}-elf- ${1}-eabi-" + + if [ x"$CROSS_COMPILE" != "x" ]; then + TARGETS=$CROSS_COMPILE + fi + + for TARGET in $TARGETS do if type ${TARGET}gcc > /dev/null 2>&1 then
On May 10, 2015, at 5:23 AM, Mark Cave-Ayland wrote:
Allow a user-defined compiler prefix to be specified via the CROSS_COMPILE variable when running switch-arch, e.g.
CROSS_COMPILE=powerpc-linux- ./config/scripts/switch-arch ppc
Based upon an original patch by John Arbuckle programmingkidx@gmail.com.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
openbios-devel/config/scripts/switch-arch | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/openbios-devel/config/scripts/switch-arch b/openbios-devel/config/scripts/switch-arch index 868eae6..d5e2f77 100755 --- a/openbios-devel/config/scripts/switch-arch +++ b/openbios-devel/config/scripts/switch-arch @@ -99,7 +99,13 @@ archname()
select_prefix() {
- for TARGET in ${1}-unknown-linux-gnu- ${1}-linux-gnu- ${1}-linux- ${1}-elf- ${1}-eabi-
- TARGETS="${1}-unknown-linux-gnu- ${1}-linux-gnu- ${1}-linux- ${1}-elf- ${1}-eabi-"
- if [ x"$CROSS_COMPILE" != "x" ]; then
TARGETS=$CROSS_COMPILE
- fi
- for TARGET in $TARGETS do if type ${TARGET}gcc > /dev/null 2>&1 then
-- 1.7.10.4
I still prefer CROSS_COMPILER to CROSS_COMPILE, but I can live with the change.
What advantage does the code "if [ x"$CROSS_COMPILE" != "x" ];" have over "if [ "$CROSS_COMPILE" ];"?
On 2015-May-10 17:08 , Programmingkid wrote: [...]
What advantage does the code "if [ x"$CROSS_COMPILE" != "x" ];" have over "if [ "$CROSS_COMPILE" ];"?
I don't believe the latter form worked on the early versions of sh/test, there might still be systems where if [""]; produces a syntax error.
Am 10.05.2015 um 23:37 schrieb Tarl Neustaedter:
On 2015-May-10 17:08 , Programmingkid wrote: [...]
What advantage does the code "if [ x"$CROSS_COMPILE" != "x" ];" have over "if [ "$CROSS_COMPILE" ];"?
I don't believe the latter form worked on the early versions of sh/test, there might still be systems where if [""]; produces a syntax error.
Is 'if [ -z "$CROSS_COMPILE" ]' (untested) any more compatible?
Cheers, Andreas
On Mon, May 11, 2015 at 02:57:51PM +0200, Andreas Färber wrote:
Am 10.05.2015 um 23:37 schrieb Tarl Neustaedter:
On 2015-May-10 17:08 , Programmingkid wrote: [...]
What advantage does the code "if [ x"$CROSS_COMPILE" != "x" ];" have over "if [ "$CROSS_COMPILE" ];"?
I don't believe the latter form worked on the early versions of sh/test, there might still be systems where if [""]; produces a syntax error.
Is 'if [ -z "$CROSS_COMPILE" ]' (untested) any more compatible?
Yes, but checks for empty rather than non empty.
On 11/05/15 15:29, Lennart Sorensen wrote:
On Mon, May 11, 2015 at 02:57:51PM +0200, Andreas Färber wrote:
Am 10.05.2015 um 23:37 schrieb Tarl Neustaedter:
On 2015-May-10 17:08 , Programmingkid wrote: [...]
What advantage does the code "if [ x"$CROSS_COMPILE" != "x" ];" have over "if [ "$CROSS_COMPILE" ];"?
I don't believe the latter form worked on the early versions of sh/test, there might still be systems where if [""]; produces a syntax error.
Is 'if [ -z "$CROSS_COMPILE" ]' (untested) any more compatible?
Yes, but checks for empty rather than non empty.
FWIW I used the "if [ x"$CROSS_COMPILE" != "x" ];" version because that's the existing convention used within the file to detect empty variables and I'd like to keep everything consistent.
ATB,
Mark.
On Sun, May 10, 2015 at 05:08:33PM -0400, Programmingkid wrote:
On May 10, 2015, at 5:23 AM, Mark Cave-Ayland wrote:
Allow a user-defined compiler prefix to be specified via the CROSS_COMPILE variable when running switch-arch, e.g.
CROSS_COMPILE=powerpc-linux- ./config/scripts/switch-arch ppc
Based upon an original patch by John Arbuckle programmingkidx@gmail.com.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
openbios-devel/config/scripts/switch-arch | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/openbios-devel/config/scripts/switch-arch b/openbios-devel/config/scripts/switch-arch index 868eae6..d5e2f77 100755 --- a/openbios-devel/config/scripts/switch-arch +++ b/openbios-devel/config/scripts/switch-arch @@ -99,7 +99,13 @@ archname()
select_prefix() {
- for TARGET in ${1}-unknown-linux-gnu- ${1}-linux-gnu- ${1}-linux- ${1}-elf- ${1}-eabi-
- TARGETS="${1}-unknown-linux-gnu- ${1}-linux-gnu- ${1}-linux- ${1}-elf- ${1}-eabi-"
- if [ x"$CROSS_COMPILE" != "x" ]; then
TARGETS=$CROSS_COMPILE
- fi
- for TARGET in $TARGETS do if type ${TARGET}gcc > /dev/null 2>&1 then
-- 1.7.10.4
I still prefer CROSS_COMPILER to CROSS_COMPILE, but I can live with the change.
What advantage does the code "if [ x"$CROSS_COMPILE" != "x" ];" have over "if [ "$CROSS_COMPILE" ];"?
Did you mean:
if [ -n "$CROSS_COMPILE" ];?