PyGame (http://www.pygame.org/), a gaming library for Python, is required by some example models of SVM, such as the CD Player and the MP3 Player. Hence, the users are highly recommended to install PyGame, though it is not necessary for SVM or SCC.
First, the users must download the PyGame source. It is available at:
The version that is used here is 1.6.
After download the source package (pygame-1.6.tar.gz), the users should extract it, and a directory named pygame-1.6 is created.
Before PyGame can be compiled, the users must manually install the SDL library for Cygwin. To do this, the following steps should be taken:
After downloading the package, extract it and a directory named Numeric-23.1 is created. Go into the directory and execute the following command:
python setup.py install build
Extract the package, and a directory named prebuilt is created.
Extract the package and copy pexports.exe to /usr/local/bin.
#!/bin/sh mkdir -p /usr/local/lib for fn in "$@" do lib=${fn%%.dll}; dest=/usr/local/lib/lib$lib.a if test -f $dest then echo $dest already exists. Skipping ...; else echo "$fn ===> /usr/local/lib/lib$lib.a"; pexports.exe $lib.dll > $lib.def && dlltool --def $lib.def --dllname $lib.dll --output-lib lib$lib.a && rm $lib.def; mv lib$lib.a /usr/local/lib; fi; done
dll2a.sh *.dll
The script generates several SDL libraries in /usr/local/lib.
chmod +x *.dll cp *.dll /usr/local/bin
#This Setup file is used by the setup.py script to configure the #python extensions. You will likely use the "config.py" which will #build a correct Setup file for you based on your system settings. #If not, the format is simple enough to edit by hand. First change #the needed command-line flags for each dependency, then comment out #any unavailable optional modules in the first optional section. SDL = -I/NEED_INC_PATH_FIX -L/NEED_LIB_PATH_FIX -lSDL FONT = -lSDL_ttf IMAGE = -lSDL_image MIXER = -lSDL_mixer SMPEG = -lsmpeg NUMERIC = -I. #the following modules are optional. you will want to compile #everything you can, but you can ignore ones you don't have #dependencies for, just comment them out imageext src/imageext.c $(SDL) $(IMAGE) font src/font.c $(SDL) $(FONT) mixer src/mixer.c $(SDL) $(MIXER) mixer_music src/music.c $(SDL) $(MIXER) movie src/movie.c $(SDL) $(SMPEG) surfarray src/surfarray.c $(SDL) $(NUMERIC) sndarray src/sndarray.c $(SDL) $(NUMERIC) $(MIXER) #these modules are required for pygame to run. they only require #SDL as a dependency. these should not be altered base src/base.c $(SDL) cdrom src/cdrom.c $(SDL) constants src/constants.c $(SDL) display src/display.c $(SDL) event src/event.c $(SDL) key src/key.c $(SDL) mouse src/mouse.c $(SDL) rect src/rect.c $(SDL) rwobject src/rwobject.c $(SDL) surface src/surface.c src/alphablit.c $(SDL) surflock src/surflock.c $(SDL) time src/time.c $(SDL) joystick src/joystick.c $(SDL) draw src/draw.c $(SDL) image src/image.c $(SDL) transform src/transform.c src/rotozoom.c src/scale2x.c $(SDL) #the following are placeholders. setup.py can use them to help #auto-copy needed DLLs into the pygame installation folder. #you can simply ignore these lines under non-windows, no need to #comment out. COPYLIB_smpeg $(SDL) $(SMPEG)
Execute the following commands to build and install PyGame (assuming that the current shell is bash):
export LIBRARY_PATH=/usr/local/lib:$LIBRARY_PATH export CPATH=/usr/local/include/SDL:$CPATH python setup.py install build
After all these steps, PyGame should have been built for the Python that was used in the build. Try the following command to see if everything goes right:
python -c "import pygame; print pygame.__version__"