Hi

These changes let cross-compiling work for my case (x86 > x64 and vice
versa).

- Lauri

-- 
http://www.fastmail.fm - A no graphics, no pop-ups email service

From cf8e581748d18d9831a82ef4641c25e91fd43a8e Mon Sep 17 00:00:00 2001
From: Lauri Kasanen <cur...@operamail.com>
Date: Fri, 9 Sep 2011 14:34:29 +0300
Subject: [PATCH] Linux scripts: Use CC and LD variables

This fixes cross-compiling.

Signed-off-by: Lauri Kasanen <cur...@operamail.com>
---
 setup/Linux/build.sh             |   10 ++++++----
 setup/Linux/oss/build/install.sh |    6 ++++--
 setup/setupdir.sh                |    8 +++++---
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/setup/Linux/build.sh b/setup/Linux/build.sh
index 4b7838c..e889bfe 100644
--- a/setup/Linux/build.sh
+++ b/setup/Linux/build.sh
@@ -11,6 +11,8 @@ else
    TXT2MAN=./txt2man
 fi
 
+[ -z "$LD" ] && LD=ld
+
 rm -rf prototype
 
 mkdir prototype
@@ -105,7 +107,7 @@ cp -a $SRCDIR/setup/Linux/oss/* prototype/$OSSLIBDIR/
 cp -a $SRCDIR/setup/Linux/sbin prototype/usr/
 chmod +x prototype/$OSSLIBDIR/scripts/*
 
-if ! ld -r -o prototype/$OSSLIBDIR/$OBJECTS/osscore.o target/objects/*.o
+if ! $LD -r -o prototype/$OSSLIBDIR/$OBJECTS/osscore.o target/objects/*.o
 then
   echo Linking osscore failed!
   exit 1
@@ -121,7 +123,7 @@ done
 for n in target/modules/*.o
 do
        N=`basename $n .o`
-       ld -r -o prototype/$OSSLIBDIR/$MODULES/$N.o $n
+       $LD -r -o prototype/$OSSLIBDIR/$MODULES/$N.o $n
        echo Check devices for $N
        grep "^$N[      ]" ./devices.list >> devlist.txt
 
@@ -147,12 +149,12 @@ rm -f /tmp/ossman.txt
 # Link the optional NOREGPARM modules
 if test -d noregparm
 then
-   ld -r -o prototype/$OSSLIBDIR/objects.noregparm/osscore.o 
noregparm/target/objects/*.o
+   $LD -r -o prototype/$OSSLIBDIR/objects.noregparm/osscore.o 
noregparm/target/objects/*.o
 
    for n in noregparm/target/modules/*.o
    do
        N=`basename $n .o`
-       ld -r -o prototype/$OSSLIBDIR/modules.noregparm/$N.o $n
+       $LD -r -o prototype/$OSSLIBDIR/modules.noregparm/$N.o $n
    done
 fi
 
diff --git a/setup/Linux/oss/build/install.sh b/setup/Linux/oss/build/install.sh
index e42a3e5..13fdbc2 100644
--- a/setup/Linux/oss/build/install.sh
+++ b/setup/Linux/oss/build/install.sh
@@ -7,6 +7,8 @@ else
   echo "OSSLIBDIR=/usr/lib/oss" > /etc/oss.conf
 fi
 
+[ -z "$LD" ] && LD=ld
+
 cd $OSSLIBDIR/build
 
 rm -f $OSSLIBDIR/.cuckoo_installed
@@ -201,7 +203,7 @@ then
        exit 3
 fi
 
-if ! ld -r osscore.ko osscore_mainline.o -o 
/lib/modules/$UNAME/kernel/oss/osscore.ko
+if ! $LD -r osscore.ko osscore_mainline.o -o 
/lib/modules/$UNAME/kernel/oss/osscore.ko
 then
        echo Linking the osscore module failed
        exit 5
@@ -238,7 +240,7 @@ do
                exit 4
        fi
 
-       if ! ld -r $N.ko $N_mainline.o -o /lib/modules/$UNAME/kernel/oss/$N.ko
+       if ! $LD -r $N.ko $N_mainline.o -o /lib/modules/$UNAME/kernel/oss/$N.ko
        then
                echo Linking $N module failed
                exit 6
diff --git a/setup/setupdir.sh b/setup/setupdir.sh
index f9470d0..9bb9f37 100644
--- a/setup/setupdir.sh
+++ b/setup/setupdir.sh
@@ -9,6 +9,8 @@ then
        exit 1
 fi
 
+[ -z "$CC" ] && CC=cc
+
 echo srcdir=$SRCDIR
 
 BLDDIR=`pwd`
@@ -84,7 +86,7 @@ echo BLDDIR=$BLDDIR > .directories
 echo SRCDIR=$SRCDIR >> .directories
 echo OSSLIBDIR=$OSSLIBDIR >> .directories
 
-cc -o dirsetup $SRCDIR/setup/dirsetup.c
+$CC $LDFLAGS -o dirsetup $SRCDIR/setup/dirsetup.c
 
 # Make sure the latest soundcard.h version is installed in the system
 #rm /usr/include/sys/soundcard.h
@@ -142,7 +144,7 @@ then
   DTARGETOS="-D$TARGETOS"
 fi
 
-cc -D`uname -s` $DTARGETOS -o srcconf $SRCDIR/setup/srcconf.c
+$CC $LDFLAGS -D`uname -s` $DTARGETOS -o srcconf $SRCDIR/setup/srcconf.c
 
 if ./srcconf $*
 then
@@ -245,7 +247,7 @@ fi
 # Setup the link to the right os.h file for this operating system.
 (cd kernel/framework/include;ln -s ../../../kernel/OS/$OS/os_*.h os.h)
 
-cc -o ossvers -I./kernel/framework/include  setup/ossvers.c
+$CC $LDFLAGS -o ossvers -I./kernel/framework/include  setup/ossvers.c
 ./ossvers > .version
 rm ./ossvers
 
-- 
1.7.2.1

_______________________________________________
oss-devel mailing list
oss-devel@mailman.opensound.com
http://mailman.opensound.com/mailman/listinfo/oss-devel

Reply via email to