JSDL for Sparc Solaris
Using Binary
- About Sparc Binary
- Installing Developer Binary Distribution
- Installing Dependency Binary Distribution
- Configuring your Development Enviornment
Using Source
- Rebuilding JNI
- Compiling Dependencies
- Building libSDL
- Building SDL_Image
- Building SMpeg
- Bring over CVS
- Edit compilejni.sh
Using the Binary
About
To demonstrate the portability of JSDL, I took 3 hours and built a version
for Sparc Solaris. The current developer distribution was based on
a custom SDL build that installs in /usr/local2.
Video: ENABLED I have only built it to run on X11, and have not tried to
get it to work with the framebuffer at console. However, Sun was the
the first to come up with the early fb device, so hopefully we should be
able to get it to work.
Audio: DISABLED I didn't build SDL to support audio.
Extension - SDLImage : ENABLED Works, but need other dependencies
Extension - SMpeg : DISABLED not compiled in.
Extension - SFont : ENABLED
Installing Developer Binary Distribution
To allow users to test JSDL on Solaris, I have posted a zip file containing
a binary version of JSDL.
- Download http://jsdl.sourceforge.net/dist/jsdl_usr_dist_${DATE}_SunOS_sparc.zip
- unzip jsdl_usr_dist_${DATE}_SunOS_sparc.zip
Installing Dependency Binary Distribution.
JSDL was built against a fresh install of libSDL and SDL extensions. It
includes lib
Remember, audio and SMpeg and not built into this distribution.
- Download http://jsdl.sourceforge.net/dist/SMSsdl-0.4.beta-sparc-local2.bz2
- bzip2 -d SMSsdl-0.4.beta-sparc-local2
- pkgadd -d SMSsdl-0.4.beta-sparc-local2
The package libraries were compiled to run from /usr/local2. If you
change this path, the binary distribution will not work. Below is an output
of /usr/local2/lib
libSDL-1.2.so.0 libjpeg.a
libSDL-1.2.so.0.0.4 libpng.a
libSDL.a libpng.so
libSDL.la libpng.so.3
libSDL.so libpng.so.3.1.2.4
libSDL_image-1.2.so.0 libpng12.a
libSDL_image-1.2.so.0.1.2 libpng12.so
libSDL_image.a libpng12.so.0
libSDL_image.la libpng12.so.0.1.2.4
libSDL_image.so
libSDLmain.a
Configuring Development Environment
JSDL on Solaris requires the following LD_LIBRARY_PATH values
SOLARIS_LIB=/usr/ucblib:/usr/local2/lib
LD_LIBRARY_PATH=$SOLARIS_LIB:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
When testing SDL, you must specify the proper "java.library.path" and it
is always helpful to dump the "jni" debug information.
java -verbose:jni -Djava.library.path=${JSDL_BASE}:/usr/local2/lib:${SOLARIS_LIB}:/usr/lib
-classpath .:$JSDL_BASE sdl.test.TestAnim
Don't be surprised when you see SMpeg related errors. The SMpeg stuff
is not built into this libary.
Using the Source
Rebuilding JNI
The key part of bulding JSDL for Solaris is ensuring the dependencies are
in place so you can build the JNI parts against them. If you want to
go through the trouble of reinstalling everything yourself, here's what I
did.
Compiling Dependencies
Several dependencies must be installed before you can build JSDL
- libSDL - http://www.libsdl.org
- SDL_Image - http://www.libsdl.org
- SMpeg - http://www.libsdl.org (had problem with gcc running out of
memory)
- jpeg - libraries neede by SDL_Image - http://www.sunfreeware.com
- libpng - library needed by SDL_Image - http://www.sunfreeware.com
- gcc http://www.sunfreeware.com
- automake, autoconf, m4, perl are needed for SMpeg ONLY - http://www.sunfreeware.com
(must install in /usr/local/bin/perl )
- Jakarta ant - http://www.apache.org
- Javac - http://www.sun.com
Building libSDL
Before you build libSDL, you must run configure with the following option
./configure --enable-video-x11
I had problems with x11 not being linked into the final libJava4SDL.so library.
If you get "no display device available", this is probably it.
Building SDL_Image
SDL_Image requires jpeg and png libraries to work. You may either install
the binary distributions from www.sunfreeware.com or build the packages yourself.
Either way, they must be in your LD_LIBRARY_PATH prior to building
SDL_Image.
Building SMpeg
Can't say much about this. I brought over the sources and the build
went fine without any errors or warnings. However, near the very end, gcc
stopped, complaining it ran out of memory. If someone gets this to
work on their compiler let me know. In order to get set up for building
SMpeg, you need the following
automake, autoconf, m4, perl
If you get these from http://www.sunfreeware.com, be sure to use their version
of perl. They built the autoconf packages to refer to /usr/local/perl.
SMPeg support will not work until this is fixed.
Bring over CVS
Bring over the CVS source as described in the CVS section of the JSDL homepage.
Modify compileJNI.sh script
Currently, the native build parts of JSDL is limited to one shell script
jsdl/sdl/jni/compilejni.sh. You must modify this script to reflect
the location of Java, libSDL, and other dependencies.
When you invoke compilejni.sh, you will see errors when you get to SMpeg,
but the library will still be built and copied to jsdl/dist/lib.
Run ant
Now we are ready to recompile the java parts against our JSDL native library.
Ensure Jakarta "Ant" is in your path, navigate to the CVS root where
"build.xml" is located and type ant.
The end result should be the following jar: "jsdl/dist/lib/jsdl.jar".
- Make sure this is in your classpath when compiling and running your
tests.
- Make sure your LD_LIBRARY_PATH is set properly as shown in the Binary
discussion.
Good luck!
Scott