随笔-6  评论-1  文章-0  trackbacks-0
How to install SDL on the PSPSDK.
1.  The absolute first thing that you need to do is install Cygwin and the PSPtoolchain.  There are already really
good tutorials on how to do both of those things on psp-programming.com.  If you've already got both of those
installed, make sure you have the latest versions.
2.  The next step is to download and install the SDL library.  To do this you need to open Cygwin, navigate to
your home directory (or where ever you want to download the source to) and type the line below at the Cygwin bash
prompt.  Be sure that you capitalize SDL, otherwise it may not download due to the case sensitive nature of URLs.
svn co svn://svn.ps2dev.org/psp/trunk/SDL
3.  Now we'll start the installation process.  The first step is to run the autogen.sh file, however just running
the script may or may not work.  In all my tries, just running the script has never fully configured without
errors.  Apparently there is a problem with the auto make function built into Cygwin.  To circumvent this problem
use the line below exactly as you see it.
WANT_AUTOMAKE=1.9 ./autogen.sh
If everything goes well the script will run without errors.  If it does present errors, try deleting the SDL folder
and downloading the files again using setp #2, then try again.
4.  Now it is time to run the configure command.  This one is a little confusing if you're new to Cygwin so I'll
explain exactly how to key in the command you see below.  In order for this command to run without errors, it must be typed in exactly as you see if.  This command
along with the others in this tutorial are taken directly from the readme.psp file in the root of the source
directory.  My advice to you is to copy and paste this into the Cygwin shell.  To paste text into Cygwin, right
click on the title bar of the Cygwin window.  In the context menu that comes up, you'll see an option called
"Edit".  Choose the paste option under the Edit menu to paste the text.  About now, you've probably already
looked at the command and are wanting to know what the h311 the back slash is in there for.....well, I'll tell
you.  It is there to allow users to break up long bash prompt commands into easier to read slices.  If you
were to type the command in manually you'd hit enter after the back slash character and you'd get a new line
to finish typing the command on without running any of what you've already typed.  Now go run the command below,
and I'll see you in step 5.  (NOTE: If the command below won't run without errors you've probably either forgotten
the WANT_AUTOMAKE=1.9 part of step 3 or there's a problem with your Cygwin installation)
LDFLAGS="-L$(psp-config --pspsdk-path)/lib -lc -lpspuser" \
./configure --host psp --prefix=$(psp-config --psp-prefix)
5.  Now its time to actually install the SDL files, and it couldn't be any easier.  At the command prompt, type
the following and hit enter.
make
If you did everything right in the previous steps, make should run without errors.  Now for the last command to
install the SDL library.
make install
Congratulations, you've done it.  SDL is now installed.  However, there are a few other things that you need
before you can start bangin' out code.  You're probably going to want the ability to play sounds and to be able
to load picture files.  SDL by default only knows how to handle BMP files, but we can fix that by installing
the SDL_image library.  So, on to step 6.
6.  Before we can install the SDL_image library there's a few things we need.  We need zlib and libpng.
These allow us to work with compressed image files and PNG files respectively.  If you've worked through
Yeldarb's tutorials, you should already have those two libraries and you can skip down to step 8.  So,
go to your home directory in Cygwin and type the following commands.  (NOTE: where you see <ENTER> means
to press the enter key)
svn co svn://svn.ps2dev.org/psp/trunk/zlib  <ENTER>
cd zlib <ENTER>
make <ENTER>
make install <ENTER>
cd .. <ENTER>
7.  Now that zlib is installed you can install libpng.
svn co svn://svn.ps2dev.org/psp/trunk/libpng <ENTER>
cd libpng <ENTER>
make <ENTER>
make install <ENTER>
cd .. <ENTER>
8.  Now to load the library that will allow us to use JPG images.
svn co svn://svn.ps2dev.org/psp/trunk/jpeg <ENTER>
cd jpeg <ENTER>
make <ENTER>
make install <ENTER>
cd .. <ENTER>
9.  Alright, now that all the pre-requisites are installed we can install the SDL_image library.  This library
is what we'll use to load our image files in upcoming tutorials.  It makes it so that we can load BMP, JPG, and
PNG files all using the same command IMG_load(); but like I said, there'll be more on that later.  This library
installation is a little more difficult than the last three, but using the copy/paste method you should be fine.
In this step, like in step #1, it will be important to capitalize certain letters, so copy what I've put below
exactly.
svn co svn://svn.ps2dev.org/psp/trunk/SDL_image <ENTER>
cd SDL_image <ENTER>
WANT_AUTOMAKE=1.9 ./autogen.sh <ENTER>
LDFLAGS="-L$(psp-config --pspsdk-path)/lib -lc -lpspuser" \
./configure --host psp --with-sdl-prefix=$(psp-config --psp-prefix) \
--prefix=$(psp-config --psp-prefix)  <ENTER>
make <ENTER>
make install <ENTER>
cd .. <ENTER>
10.  Alright, now with the image libraries out of the way we'll load our libraries for playing sound files.  The
first one that we'll load is called libTremor.  There are three different sound libraries that work with SDL_mixer,
but if libTremor is present it takes prescedence over the other two.  If you want to use one of the other ones,
then you're probably an advanced enough programmer to know what to do to allow their use and I will leave that
part out.  When you look at the commands below, you're probably going to think, "Hey, where's the autogen.sh
command?"  Well, trust me when I say that its there and the commands below are all you need this time around.
(NOTE: See the capital T in libTremor?  Be sure that you capitalize it in the svn statement.)
svn co svn://svn.ps2dev.org/psp/trunk/libTremor <ENTER>
LDFLAGS="-L$(psp-config --pspsdk-path)/lib -lc -lpspuser" ./autogen.sh \
--host psp --prefix=$(psp-config --psp-prefix) <ENTER>
make <ENTER>
make install <ENTER>
cd .. <ENTER>
11.  Now to install the SDL_mixer.
WANT_AUTOMAKE=1.9 ./autogen.sh <ENTER>
LDFLAGS="-L$(psp-config --pspsdk-path)/lib -lc -lpspuser" \
./configure --host psp --with-sdl-prefix=$(psp-config --psp-prefix) \
--disable-music-mp3 --prefix=$(psp-config --psp-prefix) \
--disable-music-libmikmod --enable-music-mod <ENTER>
make <ENTER>
make install <ENTER>
12.  Wow, you're still reading my guide!  I can't believe it.  Anyway, you're almost done...only one more
library to install.  This one is called SDL_gfx and it contains some primitive rotation and scaling of images.
The documentation in the README file say that it isn't assembly quality yet, but that it should work fine if
the CPU is fast enough or the images are small enough.  I haven't worked with it any yet so I don't know if it
is truly a worth while library for the PSP.  All that being said, you can choose whether or now you want to
install it.  I'm going to play around with it, and make a tutorial or two sometime in the future but it'll be
toward the end of my SDL tutorial series.  By then it could be optimized enough to really shine on our beloved
little handhelds.  It also contains a framerate controller along with some MMX image filters...whatever those
are.  Alrighty then, enough talking, on to the installation.
svn co svn://svn.ps2dev.org/psp/trunk/SDL_gfx <ENTER>
cd SDL_gfx <ENTER>
WANT_AUTOMAKE=1.9 ./autogen.sh
AR=psp-ar \
LDFLAGS="-L$(psp-config --pspsdk-path)/lib -lc -lpspuser" \
./configure --host psp --with-sdl-prefix=$(psp-config --psp-prefix) \
--prefix=$(psp-config --psp-prefix) --disable-mmx --disable-shared <ENTER>
make <ENTER>
make install <ENTER>
Well, if you did everything right you should have a fully installed SDL library linked to the PSPtoolchain that
will allow you to write programs in SDL for the PSP.  Stay tuned for another SDL tutorial.  I'm going to try to
release one a week for the next few weeks, then a few a month depending on how ambitious I'm feeling.  If you
have any questions feel free to ask, but know ahead of time that I'm no expert on this stuff yet and I'll do my
best to help where I can.
This tutorial was written by b1G~n1ck.
posted on 2007-06-01 16:15 悠然小调 阅读(1867) 评论(1)  编辑 收藏 引用 所属分类: psp c&c++ 编程

评论:
# re: How to install SDL on the PSPSDK 2009-03-07 03:54 | zeus
Dude this is an awesome tutorial. I am on step 6, and so far everything is going well. Thanks alot for this! I recommend everyone who is programming for psp to read through this.  回复  更多评论
  

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理