summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Häggqvist <rasher@rasher.dk>2009-10-12 18:49:29 +0000
committerJonas Häggqvist <rasher@rasher.dk>2009-10-12 18:49:29 +0000
commitb285a77be5145e6e4214fec54b78e29285b3c091 (patch)
tree5f801d183c435a33c837fc3db88d3c8d09aefdcd
parente1439fa010c3e5d42d08978b8864e0407ae573dc (diff)
downloadrockbox-b285a77be5145e6e4214fec54b78e29285b3c091.tar.gz
rockbox-b285a77be5145e6e4214fec54b78e29285b3c091.zip
Change the Windows crosscompiling logic:
- It is now an option under (A)dvanced. - Configure will look through PATH for a sdl-config of a crosscompiled SDL. - It should now in theory work on other platforms besides Linux. Untested. - Should be easy to adapt to also work for the database and checkwps tools. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23136 a1c6a512-1295-4272-9138-f99709370657
-rwxr-xr-xtools/configure71
1 files changed, 38 insertions, 33 deletions
diff --git a/tools/configure b/tools/configure
index 790be27cc5..3e54f818e5 100755
--- a/tools/configure
+++ b/tools/configure
@@ -38,27 +38,6 @@ prefixtools () {
38 OC=${prefix}objcopy 38 OC=${prefix}objcopy
39} 39}
40 40
41crosswincc () {
42 # naive approach to selecting a mingw cross-compiler on linux/*nix
43 echo "Enabling win32 crosscompiling"
44
45 sdl=`findtool sdl-config`
46 sdl_cflags=""
47 sdl_libs=""
48 prefixtools i586-mingw32msvc-
49 if [ $1 = "sdl" -a -n "$sdl" ]; then
50 sdl_cflags="`sdl-config --cflags`"
51 sdl_libs="`sdl-config --libs`"
52 fi
53 # add cross-compiler option(s)
54 GCCOPTS="$GCCOPTS $sdl_cflags"
55 LDOPTS="-mconsole $sdl_libs"
56
57 output="rockboxui.exe" # use this as output binary name
58 crosscompile="yes"
59 endian="little" # windows is little endian
60}
61
62# scan the $PATH for the given command 41# scan the $PATH for the given command
63findtool(){ 42findtool(){
64 file="$1" 43 file="$1"
@@ -78,6 +57,29 @@ findtool(){
78 fi 57 fi
79} 58}
80 59
60# scan the $PATH for sdl-config - if crosscompiling, require that it is
61# a mingw32 sdl-config
62findsdl(){
63 file="sdl-config"
64
65 IFS=":"
66 for path in $PATH
67 do
68 #echo "checks for $file in $path" >&2
69 if test -f "$path/$file"; then
70 if [ "yes" = "${crosscompile}" ]; then
71 if [ "0" != `$path/$file --libs |grep -c mwindows` ]; then
72 echo "$path/$file"
73 return
74 fi
75 else
76 echo "$path/$file"
77 return
78 fi
79 fi
80 done
81}
82
81simcc () { 83simcc () {
82 84
83 # default tool setup for native building 85 # default tool setup for native building
@@ -88,7 +90,7 @@ simcc () {
88 GCCOPTIMIZE='' 90 GCCOPTIMIZE=''
89 91
90 output="rockboxui" # use this as default output binary name 92 output="rockboxui" # use this as default output binary name
91 sdl=`findtool sdl-config` 93 sdl=`findsdl`
92 sdl_cflags="" 94 sdl_cflags=""
93 sdl_libs="" 95 sdl_libs=""
94 96
@@ -100,8 +102,8 @@ simcc () {
100 exit 1 102 exit 1
101 else 103 else
102 # generic sdl-config checker 104 # generic sdl-config checker
103 sdl_cflags=`sdl-config --cflags` 105 sdl_cflags=`$sdl --cflags`
104 sdl_libs=`sdl-config --libs` 106 sdl_libs=`$sdl --libs`
105 fi 107 fi
106 fi 108 fi
107 109
@@ -133,14 +135,6 @@ simcc () {
133 echo "Linux host detected" 135 echo "Linux host detected"
134 GCCOPTS="$GCCOPTS $sdl_cflags" 136 GCCOPTS="$GCCOPTS $sdl_cflags"
135 LDOPTS="$sdl_libs" 137 LDOPTS="$sdl_libs"
136 # cannot crosscompile without SDL installed
137 if [ -n "$sdl" ]; then
138 if [ "0" != `sdl-config --libs |grep -c mwindows` ]; then
139 # Enable crosscompiling if sdl-config is from Windows SDL
140 # overrides GCCOPTS and LDOPTS
141 crosswincc $1
142 fi
143 fi
144 ;; 138 ;;
145 139
146 FreeBSD) 140 FreeBSD)
@@ -207,6 +201,13 @@ EOF
207 # use wildcard here to make it work even if it was named *.exe like 201 # use wildcard here to make it work even if it was named *.exe like
208 # on cygwin 202 # on cygwin
209 rm -f $tmpdir/conftest-$id* 203 rm -f $tmpdir/conftest-$id*
204 else
205 # We are crosscompiling
206 # add cross-compiler option(s)
207 prefixtools i586-mingw32msvc-
208 LDOPTS="-mconsole $sdl_libs"
209 output="rockboxui.exe" # use this as output binary name
210 endian="little" # windows is little endian
210 fi 211 fi
211} 212}
212 213
@@ -332,7 +333,7 @@ whichadvanced () {
332 interact=1 333 interact=1
333 echo "" 334 echo ""
334 echo "Enter your developer options (press enter when done)" 335 echo "Enter your developer options (press enter when done)"
335 printf "(D)EBUG, (L)ogf, (S)imulator, (P)rofiling, (V)oice" 336 printf "(D)EBUG, (L)ogf, (S)imulator, (P)rofiling, (V)oice, (W)in32 crosscompile"
336 if [ "$memory" = "2" ]; then 337 if [ "$memory" = "2" ]; then
337 printf ", (8)MB MOD" 338 printf ", (8)MB MOD"
338 fi 339 fi
@@ -420,6 +421,10 @@ whichadvanced () {
420 echo "RTC functions enabled (DS1339/DS3231)" 421 echo "RTC functions enabled (DS1339/DS3231)"
421 fi 422 fi
422 ;; 423 ;;
424 [Ww])
425 echo "Enabling Windows 32 cross-compiling"
426 crosscompile="yes"
427 ;;
423 *) 428 *)
424 if [ "$interact" ]; then 429 if [ "$interact" ]; then
425 cont=0 430 cont=0