3 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
11 # global CC options for all platforms
12 CCOPTS
="-W -Wall -O -nostdlib -ffreestanding -Wstrict-prototypes"
14 use_logf
="#undef ROCKBOX_HAS_LOGF"
17 # Begin Function Definitions
27 WINDRES
=${prefix}windres
28 DLLTOOL
=${prefix}dlltool
29 DLLWRAP
=${prefix}dllwrap
30 RANLIB
=${prefix}ranlib
38 # naive approach to selecting a mingw cross-compiler on linux/*nix
39 echo "Enabling win32 crosscompiling"
41 prefixtools i586-mingw32msvc-
43 LDOPTS
="-lgdi32 -luser32 -mwindows"
44 # add cross-compiler option(s)
45 GCCOPTS
="$GCCOPTS -mno-cygwin"
47 output
="rockboxui.exe" # use this as output binary name
49 endian
="little" # windows is little endian
54 # default tool setup for native building
57 GCCOPTS
='-W -Wall -g -fno-builtin'
59 output
="rockboxui" # use this as default output binary name
63 echo "Cygwin host detected"
65 if [ "$simver" = "win32" ]; then
67 GCCOPTS
="$GCCOPTS -mno-cygwin -DNOCYGWIN"
68 LDOPTS
="-lgdi32 -luser32 -mno-cygwin"
72 LDOPTS
='-L/usr/X11R6/lib -lSM -lICE -lXt -lX11 -lXmu -lSM -lICE -lX11 -lpthread'
74 output
="rockboxui.exe" # use this as output binary name
78 echo "Linux host detected"
80 LDOPTS
='-L/usr/X11R6/lib -lX11 -lm -lXt -lXmu -lnsl -ldl -lpthread'
81 if [ "$simver" = "win32" ]; then
82 crosswincc
# setup cross-compiler
87 echo "FreeBSD host detected"
88 LDOPTS
='-L/usr/X11R6/lib -lX11 -lm -lXt -lXmu -dl -lpthread'
89 if [ "$simver" = "win32" ]; then
90 crosswincc
# setup cross-compiler
95 echo "Unsupported system: $uname, fix configure and retry"
101 if test "X$crosscompile" != "Xyes"; then
103 cat >/tmp
/conftest-
$id.c
<<EOF
105 int main(int argc, char **argv)
108 char *varp = (char *)&var;
116 $CC -o /tmp
/conftest-
$id /tmp
/conftest-
$id.c
2>/dev
/null
118 if test `/tmp/conftest-$id 2>/dev/null` -gt "1"; then
125 echo "Simulator environment deemed $endian endian"
127 # use wildcard here to make it work even if it was named *.exe like
129 rm -f /tmp
/conftest-
$id*
135 GCCOPTS
="$CCOPTS -m1"
136 GCCOPTIMIZE
="-fomit-frame-pointer -fschedule-insns"
141 prefixtools calmrisc16-unknown-elf-
142 GCCOPTS
="-Wl\,--no-check-sections $CCOPTS"
143 GCCOPTIMIZE
="-fomit-frame-pointer"
148 prefixtools m68k-elf-
149 GCCOPTS
="$CCOPTS -g -m5200 -Wa\,-m5249 -malign-int -mstrict-align"
150 GCCOPTIMIZE
="-fomit-frame-pointer"
158 echo "Where do you want the firmware to be flashed?"
159 echo "WARNING: Do not answer this question lightly,"
160 echo "unless you don't plan to flash your gmini."
161 echo "In this case, reply '0x10000' (no quotes) and "
162 echo "re-configure when you know better."
165 if [ "0$loadaddress" = "0" ]; then
167 loadaddress
="0x10000";
169 echo "You selected $loadaddress"
177 ##################################################################
178 # Prompt for specific developer options
181 echo "Enter your developer options (press enter when done)"
182 echo "(D)EBUG, (L)ogf, (S)imulator"
185 while [ $cont = "1" ]; do
193 GCCOPTS
="$GCCOPTS -g -DDEBUG"
197 echo "logf() support enabled"
198 use_logf
="#define ROCKBOX_HAS_LOGF 1"
201 echo "Simulator build enabled"
211 if [ "yes" = "$simulator" ]; then
213 extradefines
="-DSIMULATOR"
220 if [ -z "$simver" ]; then
222 ##################################################################
223 # Figure out win32/x11 GUI
226 echo "Build (W)in32 or (X)11 GUI version? (X)"
238 # make sure the code knows this is for win32
239 extradefines
="$extradefines -DWIN32"
245 echo "Selected $simver simulator"
250 # figure out which languages that are around
251 for file in $rootdir/apps
/lang
/*.lang
; do
252 clean
=`echo $file | sed -e 's:.*/::g' | cut "-d." -f1`
253 langs
="$langs $clean"
257 for one
in $langs; do
268 for one
in $langs; do
269 if [ "$num" = "$pick" ]; then
277 if test "$1" = "--help"; then
278 echo "Rockbox configure script."
279 echo "Invoke this in a directory to generate a Makefile to build Rockbox"
280 echo "Do *NOT* run this within the tools directory!"
282 echo "Usage: configure [--ccache]"
286 if test "$1" = "--ccache"; then
287 echo "Enable ccache for building"
291 if test -r "configure"; then
292 # this is a check for a configure script in the current directory, it there
293 # is one, try to figure out if it is this one!
295 if { grep "^# Jukebox" configure
>/dev
/null
2>&1 ; } then
296 echo "WEEEEEEEEP. Don't run this configure script within the tools directory."
297 echo "It will only cause you pain and grief. Instead do this:"
300 echo " mkdir build-dir"
302 echo " ../tools/configure"
304 echo "Much happiness will arise from this. Enjoy"
309 if [ "$target" = "--help" -o \
310 "$target" = "-h" ]; then
311 echo "Just invoke the script and answer the questions."
312 echo "This script will write a Makefile for you"
316 # get our current directory
319 if [ "$target" = "update" ]; then
320 echo "configure update is unfortunately no longer supported"
324 echo "This script will setup your Rockbox build environment."
325 echo "Further docs here: http://www.rockbox.org/"
330 if [ -z "$rootdir" ]; then
331 ##################################################################
332 # Figure out where the source code root is!
335 firmfile
="crt0.S" # a file to check for in the firmware root dir
337 for dir
in . .. ..
/.. ..
/rockbox
*; do
338 if [ -f $dir/firmware
/$firmfile ]; then
344 if [ -z "$rootdir" ]; then
345 echo "This script couldn't find your source code root directory. Please enter the"
346 echo "full path to the source code directory here:"
351 #####################################################################
352 # Convert the possibly relative directory name to an absolute version
358 echo "Using this source code root directory:"
362 # cd back to the build dir
367 appsdir
='\$(ROOTDIR)/apps'
369 ##################################################################
370 # Figure out target platform
373 echo "Enter target platform:"
375 echo "1 - Archos Player/Studio"
376 echo "2 - Archos Recorder"
377 echo "3 - Archos FM Recorder"
378 echo "4 - Archos Recorder v2"
379 echo "5 - Archos Gmini 120"
380 echo "6 - Archos Gmini SP"
381 echo "7 - Archos Ondio SP"
382 echo "8 - Archos Ondio FM"
383 echo "9 - iRiver H120/H140"
384 echo "10 - iRiver H320/H340"
392 target
="-DARCHOS_PLAYER"
394 tool
="$rootdir/tools/scramble"
397 archosrom
="$pwd/rombox.ucl"
398 flash
="$pwd/rockbox.ucl"
405 target
="-DARCHOS_RECORDER"
407 tool
="$rootdir/tools/scramble"
410 archosrom
="$pwd/rombox.ucl"
411 flash
="$pwd/rockbox.ucl"
418 target
="-DARCHOS_FMRECORDER"
420 tool
="$rootdir/tools/scramble -fm"
424 flash
="$pwd/rockbox.ucl"
431 target
="-DARCHOS_RECORDERV2"
433 tool
="$rootdir/tools/scramble -v2"
436 archosrom
="$pwd/rombox.ucl"
437 flash
="$pwd/rockbox.ucl"
444 target
="-DARCHOS_GMINI120"
445 memory
=16 # fixed size (16 is a guess, remove comment when checked)
447 tool
="cp" # might work for now!
448 output
="rockbox.gmini"
452 plugins
="" # disabled for now, enable later on
458 target
="-DARCHOS_GMINISP"
459 memory
=16 # fixed size (16 is a guess, remove comment when checked)
461 tool
="cp" # might work for now!
462 output
="rockbox.gmini"
466 plugins
="" # disabled for now, enable later on
472 target
="-DARCHOS_ONDIOSP"
474 tool
="$rootdir/tools/scramble -osp"
477 archosrom
="$pwd/rombox.ucl"
478 flash
="$pwd/rockbox.ucl"
485 target
="-DARCHOS_ONDIOFM"
487 tool
="$rootdir/tools/scramble -ofm"
490 archosrom
="$pwd/rombox.ucl"
491 flash
="$pwd/rockbox.ucl"
498 target
="-DIRIVER_H100"
501 tool
="$rootdir/tools/scramble -add=h120"
502 output
="rockbox.iriver"
507 codecs
="libmad liba52 libFLAC libTremor libwavpack dumb libmusepack"
512 target
="-DIRIVER_H300"
515 tool
="$rootdir/tools/scramble -add=h120"
516 output
="rockbox.iriver"
521 codecs
="libmad liba52 libFLAC libTremor libwavpack dumb libmusepack"
525 echo "Please select an actual target platform!"
531 echo "Platform set to $archos"
534 ############################################################################
535 # Amount of memory, for those that can differ.
538 if [ -z "$memory" ]; then
540 if [ -z "$update" ]; then
541 echo "Enter size of your RAM (in MB): (defaults to 2)"
554 echo "Memory size selected: $memory MB"
557 ##################################################################
558 # Figure out build "type"
561 echo "Build (N)ormal, (D)evel, (S)imulator, (B)ootloader? (N)"
567 if [ "$archos" = "h100" ]; then
568 extradefines
="-DBOOTLOADER" # for target makefile symbol EXTRA_DEFINES
569 appsdir
='\$(ROOTDIR)/bootloader'
572 extradefines
="-DBOOTLOADER -ffunction-sections -fdata-sections"
573 appsdir
='\$(ROOTDIR)/flash/bootbox'
577 echo "Bootloader build selected"
582 extradefines
="-DSIMULATOR"
583 echo "Simulator build selected"
587 echo "Devel build selected"
592 echo "Normal build selected"
593 GCCOPTS
="$GCCOPTS $GCCOPTIMIZE"
601 ############################################################################
604 echo "Select a number for the language to use (default is english)"
609 if [ -z "$language" ]; then
613 echo "Language set to $language"
617 if [ "yes" = "$simulator" ]; then
618 # setup compiler and things for simulator
621 if [ -d "archos" ]; then
622 echo "sub directory archos already present"
625 echo "created an archos subdirectory for simulating the hard disk"
629 # Now, figure out version number of the (gcc) compiler we are about to use
630 gccver
=`$CC -dumpversion`;
632 if [ -z "$gccver" ]; then
633 echo "WARNING: The compiler you must use ($CC) is not in your path!"
634 echo "WARNING: this may cause your build to fail since we cannot do the"
635 echo "WARNING: checks we want now."
638 # gccver should now be "3.3.5", "3.4.3", "2.95.3-6" and similar, but don't
641 num1
=`echo $gccver | cut -d . -f1`
642 num2
=`echo $gccver | cut -d . -f2`
643 gccnum
=`(expr $num1 "*" 100 + $num2) 2>/dev/null`
650 echo "Using $CC $gccver ($gccnum)"
654 if test "X$ccache" = "Xyes"; then
658 if test "X$endian" = "Xbig"; then
659 defendian
="ROCKBOX_BIG_ENDIAN"
661 defendian
="ROCKBOX_LITTLE_ENDIAN"
665 -e "s,@ENDIAN@,${defendian},g" \
666 -e "s,^#undef ROCKBOX_HAS_LOGF,$use_logf,g" \
668 /* This header was made by configure */
669 #ifndef __BUILD_AUTOCONF_H
670 #define __BUILD_AUTOCONF_H
672 /* Define endianess for the target or simulator platform */
675 /* Define this if you build rockbox to support the logf logging and display */
676 #undef ROCKBOX_HAS_LOGF
678 #endif /* __BUILD_AUTOCONF_H */
681 if test "$simulator" = "yes"; then
682 # add simul make stuff on the #SIMUL# line
683 simmagic
='/#SIMUL#/c\ @$(MAKE) -C $(SIMDIR) OBJDIR=$(BUILDDIR)/sim\n @$(MAKE) -C $(ROOTDIR)/uisimulator/common OBJDIR=$(BUILDDIR)/comsim'
685 # delete the line that matches
686 simmagic
='/#SIMUL#/D'
690 -e "s,@ROOTDIR@,${rootdir},g" \
691 -e "s,@DEBUG@,${debug},g" \
692 -e "s,@MEMORY@,${memory},g" \
693 -e "s,@TARGET@,${target},g" \
694 -e "s,@ARCHOS@,${archos},g" \
695 -e "s,@LANGUAGE@,${language},g" \
696 -e "s,@PWD@,${pwd},g" \
697 -e "s,@CC@,${CC},g" \
698 -e "s,@LD@,${LD},g" \
699 -e "s,@AR@,${AR},g" \
700 -e "s,@AS@,${AS},g" \
701 -e "s,@OC@,${OC},g" \
702 -e "s,@WINDRES@,${WINDRES},g" \
703 -e "s,@DLLTOOL@,${DLLTOOL},g" \
704 -e "s,@DLLWRAP@,${DLLWRAP},g" \
705 -e "s,@RANLIB@,${RANLIB},g" \
706 -e "s,@TOOL@,${tool},g" \
707 -e "s,@OUTPUT@,${output},g" \
708 -e "s,@APPEXTRA@,${appextra},g" \
709 -e "s,@ARCHOSROM@,${archosrom},g" \
710 -e "s,@FLASHFILE@,${flash},g" \
711 -e "s,@PLUGINS@,${plugins},g" \
712 -e "s,@CODECS@,${codecs},g" \
713 -e "s,@GCCOPTS@,${GCCOPTS},g" \
714 -e "s,@LDOPTS@,${LDOPTS},g" \
715 -e "s,@LOADADDRESS@,${loadaddress},g" \
716 -e "s,@EXTRADEF@,${extradefines},g" \
717 -e "s,@APPSDIR@,${appsdir},g" \
718 -e "s,@APPS@,${apps},g" \
719 -e "s,@SIMVER@,${simver},g" \
720 -e "s,@GCCVER@,${gccver},g" \
721 -e "s,@GCCNUM@,${gccnum},g" \
722 -e "s,@UNAME@,${uname},g" \
723 -e "s,@ENDIAN@,${defendian},g" \
726 ## Automaticly generated. http://www.rockbox.org/
728 export ROOTDIR=@ROOTDIR@
729 export FIRMDIR=\$(ROOTDIR)/firmware
730 export APPSDIR=@APPSDIR@
731 export TOOLSDIR=\$(ROOTDIR)/tools
732 export DOCSDIR=\$(ROOTDIR)/docs
734 export ARCHOS=@ARCHOS@
735 export ARCHOSROM=@ARCHOSROM@
736 export FLASHFILE=@FLASHFILE@
737 export TARGET=@TARGET@
739 export BUILDDIR=@PWD@
740 export LANGUAGE=@LANGUAGE@
741 export MEMORYSIZE=@MEMORY@
742 export VERSION=\$(shell date +%y%m%d-%H%M)
743 export MKFIRMWARE=@TOOL@
744 export BINARY=@OUTPUT@
745 export APPEXTRA=@APPEXTRA@
746 export ENABLEDPLUGINS=@PLUGINS@
747 export SOFTWARECODECS=@CODECS@
748 export EXTRA_DEFINES=@EXTRADEF@
754 export WINDRES=@WINDRES@
755 export DLLTOOL=@DLLTOOL@
756 export DLLWRAP=@DLLWRAP@
757 export RANLIB=@RANLIB@
758 export GCCOPTS=@GCCOPTS@
759 export LOADADDRESS=@LOADADDRESS@
760 export SIMVER=@SIMVER@
761 export SIMDIR=\$(ROOTDIR)/uisimulator/\$(SIMVER)
762 export LDOPTS=@LDOPTS@
763 export GCCVER=@GCCVER@
764 export GCCNUM=@GCCNUM@
767 # Do not print "Entering directory ..."
768 MAKEFLAGS += --no-print-directory
770 .PHONY: all clean tags zip
774 @\$(MAKE) -C \$(FIRMDIR) OBJDIR=\$(BUILDDIR)/firmware
775 @\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@
778 @\$(MAKE) -C \$(FIRMDIR) clean OBJDIR=\$(BUILDDIR)/firmware
779 @\$(MAKE) -C \$(APPSDIR) clean OBJDIR=\$(BUILDDIR)/@APPS@
780 @rm -rf rockbox.zip TAGS @APPS@ firmware comsim sim lang.h
784 \$(MAKE) -C \$(FIRMDIR) tags
785 \$(MAKE) -C \$(APPSDIR) tags
786 \$(MAKE) -C \$(APPSDIR)/plugins tags
787 \$(MAKE) -C \$(APPSDIR)/plugins/lib tags
790 \$(TOOLSDIR)/buildzip.pl -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
793 if [ "yes" = "$simulator" ]; then
795 cat >> Makefile
<<EOF
798 @echo "installing a full setup in your archos dir"
799 @(make zip && cd archos && unzip -oq ../rockbox.zip)
804 echo "Created Makefile"