summaryrefslogtreecommitdiff
path: root/tools/configure
diff options
context:
space:
mode:
Diffstat (limited to 'tools/configure')
-rwxr-xr-xtools/configure144
1 files changed, 109 insertions, 35 deletions
diff --git a/tools/configure b/tools/configure
index ce23c2a965..7504d562c9 100755
--- a/tools/configure
+++ b/tools/configure
@@ -14,6 +14,7 @@ CCOPTS="-W -Wall -Wundef -O -nostdlib -ffreestanding -Wstrict-prototypes -pipe"
14# global LD options for all platforms 14# global LD options for all platforms
15GLOBAL_LDOPTS="" 15GLOBAL_LDOPTS=""
16 16
17extradefines=""
17use_logf="#undef ROCKBOX_HAS_LOGF" 18use_logf="#undef ROCKBOX_HAS_LOGF"
18use_bootchart="#undef DO_BOOTCHART" 19use_bootchart="#undef DO_BOOTCHART"
19 20
@@ -25,7 +26,10 @@ bindir=
25libdir= 26libdir=
26bindir_full= 27bindir_full=
27libdir_full= 28libdir_full=
28 29
30app_platform=
31app_lcd_width=
32app_lcd_height=
29# 33#
30# Begin Function Definitions 34# Begin Function Definitions
31# 35#
@@ -47,6 +51,59 @@ prefixtools () {
47 OC=${prefix}objcopy 51 OC=${prefix}objcopy
48} 52}
49 53
54app_get_platform() {
55 echo "Select your platform: (S)DL, (A)ndroid (default: Android)"
56 choice=`input`
57 case $choice in
58 s|S*) app_platform="sdl" ;;
59 *|a|A*) app_platform="android" ;;
60 esac
61
62 echo "Selected $app_platform platform"
63 echo "Select the LCD resolution seperated with enter: XxY (default: 320x480)"
64 app_lcd_width=`input`
65 if [ -z "$app_lcd_width" ]; then app_lcd_width="320"; fi
66 app_lcd_height=`input`
67 if [ -z "$app_lcd_height" ]; then app_lcd_height="480"; fi
68 echo "Selected $app_lcd_width x $app_lcd_height resolution"
69
70 app_lcd_width="#define LCD_WIDTH $app_lcd_width"
71 app_lcd_height="#define LCD_HEIGHT $app_lcd_height"
72 # setup files and paths depending on the platform
73 if [ "$app_platform" = "sdl" ]; then
74 if [ -z "$PREFIX" ]; then
75 rbdir="/usr/local/share/rockbox"
76 bindir="/usr/local/bin"
77 bindir_full=$bindir
78 libdir="/usr/local/lib"
79 libdir_full=$libdir
80 else
81 rbdir=`realpath $PREFIX/share/rockbox`
82 bindir="$PREFIX/bin"
83 libdir="$PREFIX/lib"
84 if [ -d bindir ]; then
85 bindir_full=`realpath $bindir`
86 fi
87 if [ -d libdir ]; then
88 libdir_full=`realpath $libdir`
89 fi
90 fi
91 output="rockbox"
92 bootoutput="rockbox"
93 elif [ "$app_platform" = "android" ]; then
94 if [ -n "$PREFIX" ]; then
95 echo "WARNING: PREFIX not supported on Android. You can however use --rbdir"
96 fi
97 rbdir="/data/data/org.rockbox/app_rockbox/rockbox"
98 bindir="/data/data/org.rockbox/lib"
99 bindir_full=$bindir
100 libdir="/data/data/org.rockbox/app_rockbox"
101 libdir_full=$libdir
102 output="librockbox.so"
103 bootoutput="librockbox.so"
104 fi
105}
106
50findarmgcc() { 107findarmgcc() {
51 if [ "$ARG_ARM_EABI" != "0" ]; then 108 if [ "$ARG_ARM_EABI" != "0" ]; then
52 prefixtools arm-elf-eabi- 109 prefixtools arm-elf-eabi-
@@ -102,6 +159,15 @@ findsdl(){
102 done 159 done
103} 160}
104 161
162appcc () {
163 if [ "$1" = "sdl" ]; then
164 simcc "sdl-app"
165 elif [ "$1" = "android" ]; then
166 app_type=$1
167 androidcc
168 fi
169}
170
105simcc () { 171simcc () {
106 172
107 # default tool setup for native building 173 # default tool setup for native building
@@ -114,15 +180,17 @@ simcc () {
114 GCCOPTIMIZE='' 180 GCCOPTIMIZE=''
115 LDOPTS='-lm' # button-sdl.c uses sqrt() 181 LDOPTS='-lm' # button-sdl.c uses sqrt()
116 182
117 # default output binary name 183 # default output binary name, don't override app_get_platform()
118 output="rockboxui" 184 if [ "$app_type" != "sdl-app" ]; then
185 output="rockboxui"
186 fi
119 187
120 # default share option, override below if needed 188 # default share option, override below if needed
121 SHARED_FLAG="-shared" 189 SHARED_FLAG="-shared"
122 190
123 if [ "$win32crosscompile" = "yes" ]; then 191 if [ "$win32crosscompile" = "yes" ]; then
124 LDOPTS="$LDOPTS -mconsole" 192 LDOPTS="$LDOPTS -mconsole"
125 output="rockboxui.exe" 193 output="$output.exe"
126 winbuild="yes" 194 winbuild="yes"
127 else 195 else
128 case $uname in 196 case $uname in
@@ -130,7 +198,7 @@ simcc () {
130 echo "Cygwin host detected" 198 echo "Cygwin host detected"
131 199
132 LDOPTS="$LDOPTS -mconsole" 200 LDOPTS="$LDOPTS -mconsole"
133 output="rockboxui.exe" 201 output="$output.exe"
134 winbuild="yes" 202 winbuild="yes"
135 ;; 203 ;;
136 204
@@ -138,7 +206,7 @@ simcc () {
138 echo "MinGW host detected" 206 echo "MinGW host detected"
139 207
140 LDOPTS="$LDOPTS -mconsole" 208 LDOPTS="$LDOPTS -mconsole"
141 output="rockboxui.exe" 209 output="$output.exe"
142 winbuild="yes" 210 winbuild="yes"
143 ;; 211 ;;
144 212
@@ -188,6 +256,7 @@ simcc () {
188 LDOPTS="$LDOPTS `$sdl --libs`" 256 LDOPTS="$LDOPTS `$sdl --libs`"
189 fi 257 fi
190 fi 258 fi
259
191 260
192 GCCOPTS="$GCCOPTS -I\$(SIMDIR)" 261 GCCOPTS="$GCCOPTS -I\$(SIMDIR)"
193 262
@@ -379,6 +448,18 @@ mipselcc () {
379 gccchoice="4.1.2" 448 gccchoice="4.1.2"
380} 449}
381 450
451androidcc () {
452 gccchoice="4.4.0"
453 prefixtools $ANDROID_NDK_PATH/build/prebuilt/linux-x86/arm-eabi-$gccchoice/bin/arm-eabi-
454 GCCOPTS=`echo $CCOPTS | sed -e s/-ffreestanding// -e s/-nostdlib// -e s/-Wundef//`
455 GCCOPTS="$GCCOPTS -std=gnu99 -ffunction-sections -fno-short-enums -march=armv5te -mtune=xscale -msoft-float -fomit-frame-pointer"
456 GLOBAL_LDOPTS="$GLOBAL_LDOPTS -nostdlib -lc -Wl,--no-undefined -Wl,--gc-sections -Wl,-z,noexecstack -L$ANDROID_NDK_PATH/build/platforms/android-4/arch-arm/usr/lib/ -Wl,-rpath-link=$ANDROID_NKD_PATH/build/platforms/android-4/arch-arm/usr/lib"
457 LDOPTS="$LDOPTS -shared -nostdlib -lm -ldl -llog"
458 extradefines="$extradefines -DANDROID"
459 endian="little"
460 SHARED_FLAG="-shared"
461}
462
382whichadvanced () { 463whichadvanced () {
383 atype=`echo "$1" | cut -c 2-` 464 atype=`echo "$1" | cut -c 2-`
384 ################################################################## 465 ##################################################################
@@ -975,7 +1056,7 @@ cat <<EOF
975 143) YP-S3 160) Vibe 500 131) Mini2440 1056 143) YP-S3 160) Vibe 500 131) Mini2440
976 1057
977 ==MPIO== == Application == 1058 ==MPIO== == Application ==
978 170) HD200 200) SDL 320x240 1059 170) HD200 200) Application
979 1060
980EOF 1061EOF
981 1062
@@ -2609,40 +2690,23 @@ fi
2609 modelname="application" 2690 modelname="application"
2610 target="-DAPPLICATION" 2691 target="-DAPPLICATION"
2611 2692
2612 if [ -z "$PREFIX" ]; then
2613 rbdir="/usr/local/share/rockbox"
2614 bindir="/usr/local/bin"
2615 bindir_full=$bindir
2616 libdir="/usr/local/lib"
2617 libdir_full=$libdir
2618 else
2619 rbdir=`realpath $PREFIX/share/rockbox`
2620 bindir="$PREFIX/bin"
2621 libdir="$PREFIX/lib"
2622 if [ -d bindir ]; then
2623 bindir_full=`realpath $bindir`
2624 fi
2625 if [ -d libdir ]; then
2626 libdir_full=`realpath $libdir`
2627 fi
2628 fi
2629 need_full_path="yes" 2693 need_full_path="yes"
2694 app_get_platform
2630 2695
2631 memory=8 2696 memory=8
2632 uname=`uname` 2697 uname=`uname`
2633 simcc "sdl-app" 2698
2699 appcc "$app_platform"
2634 tool="cp " 2700 tool="cp "
2635 boottool="cp " 2701 boottool="cp "
2636 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" 2702 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
2637 bmp2rb_native="$rootdir/tools/bmp2rb -f 4" 2703 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
2638 output="rockbox"
2639 bootoutput="bootloader-cowond2.bin"
2640 appextra="recorder:gui:radio" 2704 appextra="recorder:gui:radio"
2641 plugins="" 2705 plugins=""
2642 swcodec="yes" 2706 swcodec="yes"
2643 # architecture, manufacturer and model for the target-tree build 2707 # architecture, manufacturer and model for the target-tree build
2644 t_cpu="hosted" 2708 t_cpu="hosted"
2645 t_manufacturer="sdl" 2709 t_manufacturer="$app_platform"
2646 t_model="app" 2710 t_model="app"
2647 ;; 2711 ;;
2648 2712
@@ -2732,7 +2796,7 @@ fi
2732 [Ii]) 2796 [Ii])
2733 appsdir='\$(ROOTDIR)/bootloader' 2797 appsdir='\$(ROOTDIR)/bootloader'
2734 apps="bootloader" 2798 apps="bootloader"
2735 extradefines="-DBOOTLOADER -DE200R_INSTALLER -ffunction-sections -fdata-sections" 2799 extradefines="$extradefines -DBOOTLOADER -DE200R_INSTALLER -ffunction-sections -fdata-sections"
2736 bootloader="1" 2800 bootloader="1"
2737 echo "e200R-installer build selected" 2801 echo "e200R-installer build selected"
2738 ;; 2802 ;;
@@ -2743,11 +2807,11 @@ fi
2743 variant=`input` 2807 variant=`input`
2744 case $variant in 2808 case $variant in
2745 4) 2809 4)
2746 extradefines="-DBOOTLOADER -DC200_ERASE -DC240_ERASE -ffunction-sections -fdata-sections" 2810 extradefines="$extradefines -DBOOTLOADER -DC200_ERASE -DC240_ERASE -ffunction-sections -fdata-sections"
2747 echo "c240 eraser build selected" 2811 echo "c240 eraser build selected"
2748 ;; 2812 ;;
2749 5) 2813 5)
2750 extradefines="-DBOOTLOADER -DC200_ERASE -DC250_ERASE -ffunction-sections -fdata-sections" 2814 extradefines="$extradefines -DBOOTLOADER -DC200_ERASE -DC250_ERASE -ffunction-sections -fdata-sections"
2751 echo "c240 eraser build selected" 2815 echo "c240 eraser build selected"
2752 ;; 2816 ;;
2753 esac 2817 esac
@@ -2771,7 +2835,7 @@ fi
2771 output=$bootoutput 2835 output=$bootoutput
2772 fi 2836 fi
2773 fi 2837 fi
2774 extradefines="-DBOOTLOADER -ffunction-sections -fdata-sections" 2838 extradefines="$extradefines -DBOOTLOADER -ffunction-sections -fdata-sections"
2775 bootloader="1" 2839 bootloader="1"
2776 echo "Bootloader build selected" 2840 echo "Bootloader build selected"
2777 ;; 2841 ;;
@@ -2782,7 +2846,7 @@ fi
2782 fi 2846 fi
2783 debug="-DDEBUG" 2847 debug="-DDEBUG"
2784 simulator="yes" 2848 simulator="yes"
2785 extradefines="-DSIMULATOR" 2849 extradefines="$extradefines -DSIMULATOR"
2786 archosrom="" 2850 archosrom=""
2787 flash="" 2851 flash=""
2788 echo "Simulator build selected" 2852 echo "Simulator build selected"
@@ -2792,7 +2856,7 @@ fi
2792 whichadvanced $btype 2856 whichadvanced $btype
2793 ;; 2857 ;;
2794 [Gg]) 2858 [Gg])
2795 extradefines="-DSTUB" # for target makefile symbol EXTRA_DEFINES 2859 extradefines="$extradefines -DSTUB" # for target makefile symbol EXTRA_DEFINES
2796 appsdir='\$(ROOTDIR)/gdb' 2860 appsdir='\$(ROOTDIR)/gdb'
2797 apps="stub" 2861 apps="stub"
2798 case $modelname in 2862 case $modelname in
@@ -2815,7 +2879,7 @@ fi
2815 toolset=''; 2879 toolset='';
2816 t_cpu=''; 2880 t_cpu='';
2817 GCCOPTS=''; 2881 GCCOPTS='';
2818 extradefines="-DDEBUG" 2882 extradefines="$extradefines -DDEBUG"
2819 appsdir='\$(ROOTDIR)/tools/checkwps'; 2883 appsdir='\$(ROOTDIR)/tools/checkwps';
2820 output='checkwps.'${modelname}; 2884 output='checkwps.'${modelname};
2821 archosrom=''; 2885 archosrom='';
@@ -3048,6 +3112,8 @@ sed > autoconf.h \
3048 -e "s<@have_backlight@<$have_backlight<g" \ 3112 -e "s<@have_backlight@<$have_backlight<g" \
3049 -e "s<@have_fmradio_in@<$have_fmradio_in<g" \ 3113 -e "s<@have_fmradio_in@<$have_fmradio_in<g" \
3050 -e "s<@have_ata_poweroff@<$have_ata_poweroff<g" \ 3114 -e "s<@have_ata_poweroff@<$have_ata_poweroff<g" \
3115 -e "s<@lcd_width@<$app_lcd_width<g" \
3116 -e "s<@lcd_height@<$app_lcd_height<g" \
3051<<EOF 3117<<EOF
3052/* This header was made by configure */ 3118/* This header was made by configure */
3053#ifndef __BUILD_AUTOCONF_H 3119#ifndef __BUILD_AUTOCONF_H
@@ -3075,6 +3141,10 @@ sed > autoconf.h \
3075@config_rtc@ 3141@config_rtc@
3076@have_rtc_alarm@ 3142@have_rtc_alarm@
3077 3143
3144/* lcd dimensions for application builds from configure */
3145@lcd_width@
3146@lcd_height@
3147
3078/* root of Rockbox */ 3148/* root of Rockbox */
3079#define ROCKBOX_DIR "@RBDIR@" 3149#define ROCKBOX_DIR "@RBDIR@"
3080#define ROCKBOX_BINARY_PATH "@binpath@" 3150#define ROCKBOX_BINARY_PATH "@binpath@"
@@ -3089,6 +3159,10 @@ if test -n "$t_cpu"; then
3089 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/hosted/sdl/" 3159 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/hosted/sdl/"
3090 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/hosted/" 3160 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/hosted/"
3091 fi 3161 fi
3162 if [ -n "$app_platform" -a "$app_platform" = "android" ]; then
3163 # android's gcc doesn't add this :/
3164 TARGET_INC="$TARGET_INC -I$ANDROID_NDK_PATH/build/platforms/android-4/arch-arm/usr/include"
3165 fi
3092 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu/$t_manufacturer" 3166 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu/$t_manufacturer"
3093 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu" 3167 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu"
3094 GCCOPTS="$GCCOPTS" 3168 GCCOPTS="$GCCOPTS"