Friday, December 30, 2005

How I Spent My Christmas Vacation

Well, we went to Christmas Eve service, called Mom and lil'bro, opened presents under the tree, had friends over, oh, I see, this is supposed to be how I spent Christmas with my computer.

That's right, Dave. What have we been doing?

Well, since I've been home most of this week I've had plenty of chances to hack around on the computer. Most of this has been looking for new games I can play on a Linux box, like Penguin Planet Racer, né Tux Racer. I've also mined Tech Blogs for scripts, and even set up my own online software repository, which currently has one (count 'em - 1) script.

But mainly, I went looking for games and other add-ons.

So yesterday I did a Google™ search on "Linux Games" and was led to John Murray's Homepage. Not the John Murray from my hometown, this one's Aussie. His page has a collection of Linux links. One was a proprietary pinball game that I couldn't get to work. But another was a link to a bunch of fancy new screen savers, all of which run under xscreensaver.

If you don't know about xscreensaver, you haven't been running Linux very long. It's a screen saver program, as you might expect, which starts up when your keyboard and/or mouse have been idle for a preset amount of time. It then starts up, putting up weird images on your screen. Unlike most screen savers in the Windows world, however, xscreensaver can do different things at different times. Currently, my copy has 250 programs. When I'm off the computer for a bit, one of them, chosen randomly, starts up. I can, of course, edit the list of allowed programs (using what's called xscreensaver-demo for some reason). And, also of course, I can change the time xscreensaver waits before it starts, how long it displays a given screensaver, and when (or if) it locks up my keyboard so that outsiders can't see my account without my password.

But wait, there's more! Other people have added screensavers for xscreensaver. And that's what today's post is about.

Warning!! Long, geeky post follows!! You have been warned!!

As I said, I found a page of neat screensavers. Now this is a SourceForge project, so it's easy to go there and get the source, right? But then you have to download Source, Textures, and Sounds, either separately or all together, and then figure out how to put them together. Complicated. Better to let someone else do the work. So let's follow Murray's suggestion and search RPMfind for rss_glx packages. There aren't any for Fedora Core, but there are several for Mandriva. Let's try that, first downloading the latest binary RPM, rss_glx-0.7.6-1mdk.i586.rpm.

Try a standard install:

$ sudo rpm -ivh rss_glx-0.7.6-1mdk.i586.rpm
Password: xxxxxxxxxx
error: Failed dependencies:
        libMagick-5.5.7.so.0 is needed by rss_glx-0.7.6-1mdk.i586
        libopenal.so.0 is needed by rss_glx-0.7.6-1mdk.i586

Not terribly unexpected, this is a Fedora machine, after all. It's a bit worrisome that my yum repositories don't seem to know about libMagick and libopenal, but maybe in Fedora they're given different package names.

So go back to RPMfind and download the equivalent source RPM, rss_glx-0.7.6-1mdk.src.rpm. Move it into the ~/rpmbuild/SRPMS directory, and try to install it there:

$ sudo rpmbuild --rebuild rss_glx-0.7.6-1mdk.src.rpm 
Password:xxxxxxxxxx
error: Failed build dependencies:
        libMesaGLU1-devel is needed by rss_glx-0.7.6-1mdk.i386
        libopenal-devel is needed by rss_glx-0.7.6-1mdk.i386
        libMesaglut-devel is needed by rss_glx-0.7.6-1mdk.i386
        libMagick-devel >= 5.5.7 is needed by rss_glx-0.7.6-1mdk.i386

OK, lots of stuff missing. And no good idea as to where to find it. The only reference I find to Mesa or GLU under Fedora is as part of the xorg-x11 distribution, which makes sense, actually. But it would appear that Mandriva and Fedora use different package names, and I don't want to deal with that right now.

What to do? I still don't want to go back to the source, if I can avoid it, as I might not get everything installed the right way. But wait! I have the source code right here, in the src.rpm package. Let's yank it out.

The easiest way to do this is to use fedora-extract, a little script which will pull apart any archive file:

$ fedora-extract rss_glx-0.7.6-1mdk.src.rpm 
rss_glx-0.7.6-1mdk/rss-glx_0.7.6.tar.bz2
rss_glx-0.7.6-1mdk/rss_glx.spec
$ cd rss_glx-0.7.6-1mdk
$ ls -l
total 4892
-rw-r--r--  1 local local 4978215 Aug 29  2003 rss-glx_0.7.6.tar.bz2
-rw-r--r--  1 local local    6346 Aug 29  2003 rss_glx.spec

At this point we could, I suppose, look through the spec file and see what we're supposed to be doing. Mostly it just sets up some default directories, though. So let's just yank out the source and do it ourselves.

$ tar xjf rss-glx_0.7.6.tar.bz2
$ ls -l
total 4900
drwxr-xr-x  8 local local    4096 Aug 28  2003 rss-glx_0.7.6
-rw-r--r--  1 local local 4978215 Aug 29  2003 rss-glx_0.7.6.tar.bz2
-rw-r--r--  1 local local    6346 Aug 29  2003 rss_glx.spec
$ cd rss-glx_0.7.6
$ ls
aclocal.m4   configure.in  Makefile.am    other_src            stamp-h.in
AUTHORS      COPYING       Makefile.in    README               utils
autogen.sh   depcomp       missing        README.xscreensaver
ChangeLog    include       mkinstalldirs  reallyslick
config.h.in  INSTALL       NEWS           src
configure    install-sh    oglc_src       stamp-h

Good, there's a configure file. Examining it says that it defaults to /usr/local for storage, and that's good enough.

$ ./configure
[Lots of lines deleted -- no errors on my system]

It does, however, give the messages

checking AL/al.h usability... no
checking AL/al.h presence... no
checking for AL/al.h... no
Hrm, maybe AL/al.h is in /usr/local/include
checking AL/al.h usability... no
checking AL/al.h presence... no
checking for AL/al.h... no

Which I'm guessing have something to do with the missing libopenal library. I see that Murray had the same problem. A quick search shows that OpenAL is a portable library for 3D spatialized audio. OK, I don't really want audio in my screensaver, thank you very much. Let's just leave this out.

OK, now compile the stuff:

$ make
[Takes a while, no error messages I can see.]

Then we use the handy checkinstall program to create an RPM file:

$ sudo /usr/local/sbin/checkinstall
Password:  xyzzyxyzzy2

checkinstall 1.6.0, Copyright 2002 Felipe Eduardo Sanchez Diaz Duran
           This software is released under the GNU GPL.


The package documentation directory ./doc-pak does not exist. 
Should I create a default set of package docs?  [y]: y

Preparing package documentation...OK

Please choose the packaging method you want to use.
Slackware [S], RPM [R] or Debian [D]? R

Please write a description for the package.
End your description with an empty line or EOF.
>> This is a collection of OpenGL screensavers for xscreensaver. They
require a hardware-accellerated GLX implementation.
You need to add them manually to your ~/.xscreensaver file as described
in README.xscreensaver
http://rss-glx.sourceforge.net/

[I then edited to fields so that finally things look like this:]
This package will be built according to these values: 

1 -  Summary: [ This is a collection of OpenGL screensavers for xscreensaver. They ]
2 -  Name:    [ rss ]
3 -  Version: [ glx_0.7.6 ]
4 -  Release: [ 1 ]
5 -  License: [ GPL ]
6 -  Group:   [ Applications/System ]
7 -  Architecture: [ i386 ]
8 -  Source location: [ rss-glx_0.7.6 ]
9 -  Alternate source location: [ http://rss-glx.sourceforge.net/ ]
10 - Requires: [ xscreensaver-base ]
11 - Provides: [ rss ]

Enter a number to change any of them or press ENTER to continue:
[Lots of output]
**********************************************************************

 Done. The new package has been saved to

 /home/local/rpmbuild/RPMS/i386/rss-glx_0.7.6-1.i386.rpm
 You can install it in your system anytime using: 

      rpm -i rss-glx_0.7.6-1.i386.rpm

**********************************************************************

$ cd /home/local/rpmbuild/RPMS/i386
$ sudo rpm -ivh rss-glx_0.7.6-1.i386.rpm
Preparing...                ########################################### [100%]
   1:rss                    ########################################### [100%]

Now, however, we need to look at the file /usr/doc/rss-glx_0.7.6/README.xscreensaver, which tells you to run /usr/local/bin/rss-glx_install.pl, which will update your personal xscreensaver installation. A properly constructed RPM file would do this automatically, but this isn't a properly constructed RPM, so there. Once the script is run, you can play around with xscreensaver-demo to see which of the new programs works on your computer. Like Murray, I couldn't get Skyrocket to work, but I'm not going to worry about that now. I can probably fix it by installing libopenal, but, as I said, I don't really need a noisy screen saver. I just unchecked the box that tells xscreensaver to run Skyrocket. The rest of the new screensavers work.

OK, that's a long, geeky post, but I wanted to document all of the steps in a software install, just this once. Next time I'll just refer you back here, OK?

Note added in proof: While I was posting all this, I'd left xscreensaver-demo running, positioned on the Skyrocket program. After I posted the original message, I remembered demo was still running. When I went to click it off, I saw that Skyrocket was, in fact, working. Without sound, of course. So I've put it back into the rotation for xscreensaver.

0 comments: