SDL is a cross platform multimedia library provide access to low level system hardware and many applications use to operate on MPEG playback.
Since it is a low level software it is usually require as a dependency library to build on other multimedia applications on our device, such as webcam and etc.
Download a copy from SDL and unzip file.
Configure the package and then compile it.
./configure --host=arm-linux --prefix=/usr --sysconfdir=/etc --libdir=/lib --datadir=/usr/share --disable-video-x11 --disable-alsatest --disable-esdtest --disable-arts LDFLAGS="-L/rootfs/lib" CPPFLAGS="-I/rootfs/usr/include"
make
Install into a temporary directory.
make install DESTDIR=/install/SDL-1.2.14
There are 2 directories lib and usr created.
Copy the libraries and header files to our root filesystem.
cp /install/SDL-1.2.14/lib/libSDL* .
cp /install/SDL-1.2.14/lib/pkgconfig/sdl.pc ./pkgconfig
cp /install/SDL-1.2.14/usr/bin/sdl-config /usr/local/arm/4.4.1/bin
cd ../usr/include
cp -r /install/SDL-1.2.14/usr/include/* .
Note, the sdl-config is a shell script which move to our cross-compiler bin directory because it is related to our target-compiled environment.
Modify the /rootfs/lib/libSDL.la libtool library file to point to our root directory.
libdir='/rootfs/lib'
Modify the library reference of sdl.pc in /rootfs/lib/pkgconfig directory as shown below.
prefix=/rootfs
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/usr/include
Modify the sdl-config script as below.
- change /usr to /rootfs
- change ${prefix}/include to ${prefix}/usr/include
- change /lib to ${prefix}/lib
Now, compile the testing program.
Go to test directory in /opt/SDK-1.2.14/test and configure the package.
./configure --host=arm-linux --prefix=/usr --sysconfdir=/etc --libdir=/lib --datadir=/usr/share LDFLAGS="-L/rootfs/lib" CPPFLAGS="-I/rootfs/usr/include"
Modify the Makefile.
- change the include path to start with our root directory eg. /rootfs
- change the lib path to start with -L/rootfs/lib and append -L/rootfs/lib -Wl,-rpath-link,/rootfs/lib
Compile it.
make
Finally, copy the test program to the board for testing (refer to the test/README for a list of the test program description)
I will test the testalpha program.
cd /opt/SDL-1.2.14/test
cp testalpha /rootfs/usr/local/bin
cp icon.bmp /rootfs/usr/local/bin
Restart the board to test the program.
cd /usr/local/bin
testalpha -width 240 -height 320
The above will show a smiley face and you can move it with the pen around the screen.
沒有留言:
張貼留言