Using Scratchbox for GP2X development

From wiki.gp2x.org

Scratchbox should be good for porting applications to GP2X. A nice feature of the scratchbox environment is that you can set it to emulate arm code - so that if the application to be ported needs to run some code while compiling, it is able to do so. For example, this is extremely useful when cross-compiling software which uses autoconf, automake and so on.

1. Installing scratchbox

Get & install scratchbox

2. Installing the SDK

Follow instructions in sections A,B, or C


GP2XDev

Start scratchbox. Download and extract GP2XDev, go to the `libs` directory, and then apply the following patch ( with the `patch` command) on the makefile:

2,4c2,4
<  PREFIX  = /usr
<  CC      = gcc
<  CXX     = g++
---
>  PREFIX  = $(GP2XDEV)
>  CC      = gp2x-gcc
>  CXX     = gp2x-g++
18c18
< # TARGETS += $(PREFIX)/lib/libtiff.a          ## libtiff-3.8.2
---
>  TARGETS += $(PREFIX)/lib/libtiff.a           ## libtiff-3.8.2
30c30
< # TARGETS += $(PREFIX)/lib/libsmpeg.a         ## smpeg-0.4.4
---
>  TARGETS += $(PREFIX)/lib/libsmpeg.a          ## smpeg-0.4.4
48c48
<  $(PREFIX)/lib/libImlib2.a: $(PREFIX)/lib/libbz2.a $(PREFIX)/lib/libfreetype.a $(PREFIX)/lib/libid3tag.a $(PREFIX)/lib/libjpeg.a $(PREFIX)/lib/libpng.a $(PREFIX)/lib/libungif.a $(PREFIX)/lib/libz.a
---
>  $(PREFIX)/lib/libImlib2.a: $(PREFIX)/lib/libbz2.a $(PREFIX)/lib/libfreetype.a $(PREFIX)/lib/libid3tag.a $(PREFIX)/lib/libjpeg.a $(PREFIX)/lib/libpng.a $(PREFIX)/lib/libtiff.a $(PREFIX)/lib/libungif.a $(PREFIX)/lib/libz.a
75,77c75,77
<  #libtiff-3.8.2: $(PREFIX)/lib/libtiff.a
<  #$(PREFIX)/lib/libtiff.a:
< #     cd libtiff-3.8.2 && $(FLAGS) ./configure --prefix='$(PREFIX)' --build=`uname -m` --host=gp2x --enable-shared --enable-static && $(FLAGS) make && $(FLAGS) make install && $(FLAGS) make clean
---
>  libtiff-3.8.2: $(PREFIX)/lib/libtiff.a
>  $(PREFIX)/lib/libtiff.a:
>       cd libtiff-3.8.2 && $(FLAGS) ./configure --prefix='$(PREFIX)' --build=`uname -m` --host=gp2x --enable-shared --enable-static && $(FLAGS) make && $(FLAGS) make install && $(FLAGS) make clean
112c112
<  $(PREFIX)/lib/libSDL_mixer.a: $(PREFIX)/lib/libSDL.a $(PREFIX)/lib/libvorbisidec.a
---
>  $(PREFIX)/lib/libSDL_mixer.a: $(PREFIX)/lib/libSDL.a $(PREFIX)/lib/libsmpeg.a $(PREFIX)/lib/libvorbisidec.a
123,125c123,125
< # smpeg-0.4.4: $(PREFIX)/lib/libsmpeg.a
< # $(PREFIX)/lib/libsmpeg.a:
< #     cd smpeg-0.4.4 && ./autogen.sh && $(FLAGS) ./configure --prefix='$(PREFIX)' --build=`uname -m` --host=gp2x --disable-gtk-player --disable-opengl-player --enable-shared --enable-static --with-sdl-prefix='$(PREFIX)' --without-x && $(FLAGS) make && $(FLAGS) make install && $(FLAGS) make clean
---
>  smpeg-0.4.4: $(PREFIX)/lib/libsmpeg.a
>  $(PREFIX)/lib/libsmpeg.a:
>       cd smpeg-0.4.4 && ./autogen.sh && $(FLAGS) ./configure --prefix='$(PREFIX)' --build=`uname -m` --host=gp2x --disable-gtk-player --disable-opengl-player --enable-shared --enable-static --with-sdl-prefix='$(PREFIX)' --without-x && $(FLAGS) make && $(FLAGS) make install && $(FLAGS) make clean

A "make" should compile and install the libraries.

Personal tools