RHEL 6 for the Clueless: Generic Software Build

By Ed Hurst | Posted at 6:23 AM

For our last desktop oriented article, I promised we would build one item using the generic Open Source scripted building process. For this project, I chose something only slightly complicated, and likely to be favored by most users: PySolFC, the Python Solitaire Fan Club Edition. It's not just a collection of card games, but more card games than you've ever seen, along with a wide array of Mahjongg based games. It also comes with background music.

Written in the Python scripting language, PySol had been around for a long time, then almost died. It was revived by a few fans, but they haven't gotten around to putting the background music into the Linux/Unix version by default. The Windows and Mac versions do have the music, but for Linux you'll have to work a bit.

On RHEL 6 (and clones) you'll need to add a few packages, so open your Terminal and login as root, then:

yum install tkinter pysol-devel SDL

First, we need to build the sound player. The package is called smpeg, and it's an SRPM from Fedora 11. Realize this part is still messing with RPM and we've covered that in previous lessons. You'll need to install it manually and build it with RPMbuild. Once you've done that, install everything except the debug package.

Now we get PySolFC. Click on the link for PySolFC on that page. On the next page select the latest version 2.0; on the page after that, click PySolFC-2.0.tar.bz2. I've just shown you the basic layout of most Sourceforge projects, where a lot of generic build source packages are found. That next link will open a page with some advertising, then an auto-download process.

This time root will build the package in another location. First, let's navigate in the file system to the generic source building place:

cd /usr/local/src

Then move the package there:

mv /home/username/Downloads/PySolFC-2.0.tar.bz2 ./

That's the move command (mv) pulling the package from where it downloaded to the current working directory (./). Now let's open it:

tar -xvfj PySol [hit TAB]

This is a one step process for handling the standard Unix tar bundles, with switches to make it exract (x) with some visual feedback (v) on the file we name (f) and using the bzip2 compression (j) because that's the package format (ending in bz2). You should now have in front of you a folder labeled PySolFC-2.0. Move inside that:

cd PysolFC-2.0

Go ahead and run ls to see what's there. One of the first things you want to look for in building from source is README and INSTALL. In this case, we have at least the README, which is simply plain text. We use less to read that, and the SPACE bar to scroll down, along with the arrow keys, PGUP, PGDN all working as you might expect. The instructions are pretty sparse, and assume a level of experience our series assumes you don't have.

Aside from the PySol-Sound-Server, which we get later, you already have all the basic requirements for this, so skip down to the installation section. This one is really quite simple, since it's Python. I want you to notice farther down, where the last section lists places where you can get extra features. It includes the location for default music files. We'll be getting those before we are finished.

Close the reader using the "q" command. Now, let's build it:

python pysol.py

This is very well done, because it installs everything where it should be, and even creates a link in your GNOME menu system. That was the easy part. Let's back out of this folder:

cd ../

We still need the sound server, which is still kept at the old PySol website. It's another bz2 file, and you'll need to move it and open it the same way as we did above. Now move down into the folder created. This time I will warn you the README is out of date. That is, it's still valid for building, but the links are likely to have changed since it was written in 2004. Open Source projects come and go, and their websites, too. This is why I took the time to chase down the smpeg file above.

Let's build this. Below are a stack of commands you need to execute one at a time, and wait for the prompt to return before you execute the next. It's a common notation in Open Source instructions. If you read the README, you'll notice I've trimmed off the standard prompt symbol ($) for the standard user account, or (#) for the root prompt. By the way, at the point of "make test" you can stop the music test by hitting CTRL-c. This kills most running processes which grab the commandline prompt.

cd src
./configure
make
make strip [optional]
make test
make install

We are almost done. Let's get the music files. We don't need root to do this, since the music goes in your user account files. Log out the root account (exit) and you'll find yourself as the user in your Home directory. Move down into the Downloads folder -- cd Downloads -- and let's open that package. Since it's in the gzip format, we change the tar command just a bit, replacing the "j" switch with "z":

tar -xvfz pysol-music-4.40.tar.gz

You'll need to create your own user account music cache. PySol will be looking in your Home directory for a hidden folder -- .PySolFC -- and a music folder inside that. We get both with this single command:

mkdir ~/.PySolFC/music

Now we move the music files where they belong. These files are several layers deep in the subdirectory you just created from the gzip package.

cd pysol-music-4.40/data/music

Run the ls command and you'll see a license file with each music file, and, while they are all various types of "mod" files, they have different format tags, either .mod or .it. Don't get too confused about that; if you want to know about this offbeat music format, you can find thousands of of them all over the web, an art form in itself. Just search for "mod music." We will move them one at a time so you get used to how it works:

mv Astral_Dreams.it ~/PySolFC/music/
mv Past_and_Future.it ~/PySolFC/music/
mv Subsequential.mod ~/PySolFC/music/

You can close your Terminal window. Check the Applications menu, and under Games you should now find PySol Fan Club Edition. If we got everything right, you should hear background music every time you play the games. The fellow who wrote this music, Carl Larsson (aka Nightbeat), is regarded among mod music fans as a master of the ambiance style. While you can chase down his work and others, you'll find not all of them will play properly using the PySol music server. You'll have to experiment and see what works and what you like.

Ed Hurst is Associate Editor of Open for Business.