OSX 10.4.10 Tiger Compiling Guide ==¶
Okay so I had a hell of a time wrapping my head around compiling etc because I had no idea what was going on in this kind of environment. I had to document as I went as best I could because of all the new concepts etc and I figured wth I'll tweek all that info and post it here for others.
*Notes:*This doc is based around a /usr/local/drqueue install
Okay if you're totally new to all this like I was/am, you'll find that most people assume some basic understanding of compiling / shell etc. It was ALL new to me so I figure I should cover some concepts first for someone like me to help you get the big picture first (we're not all shell geeks hehe)
The Shell (bash, terminal):¶
The shell is a command line environment, you can access this via your finder window applications / terminal.
Once this window is open you'll see
Welcome to Darwin! [computer name]:[login]$
The *$* is always your input prompt for typing in commands.
It is important to note here that this window when you OPEN IT looks for the file /etc/profile and from that sets environment variables and path information etc. So sometimes a command might not work directly from the shell when setting up all the dev tools etc, this is because it's expected YOU the user are going to edit your /etc/profile file to include this information into the PATH= line ! Good and Bad I supposed but def frustrating if you're not aware of this!
Since we are setting some of these things up manually in the profile file, and since this file isn't read again for the changes till you open a new shell window, you will be required to close and reopen your shell window to update any PATH issues etc.
The shell can sometimes be referred to as the bash as well.
The Sudo command (in shell):¶
This command is used at the beginning of a shell command to tell the machine you're trying to run the command using ROOT (Administrator) privileges.
Some things will not let you install or write to the harddisk if you do not have these access rights so it's important to use sudo before a command.
Editing a text file under shell:¶
The simple way to edit a text file in shell is to use pico
pico is a text edit command and can be used as an executable to open your text files. Its not the only one but it works and it's pretty straight forward to use.
the /etc/profile file is your main environment file and can be accessed like so..
$cd /etc $sudo pico profile
This will open up the pico text editing window for the profile file. You can then use this window to add lines etc etc. Also note sometimes its a good idea to scale your shell window up before running this command because you may find it frustrating be stuck in a small window that pico will not resize to if scaled.
Preparing for the compile:¶
When you download Drqueue you'll notice it's in a tar file. Upon extracting it (using stuffit) if you're new to compiling you'll almost certainly get confused.
What you just extracted (to your desktop) is the source code. This information needs to be processed before you can install it. How?!
Okay to compile open source code for tiger osx we're going to need the OSX install CD and a net connection to download / update several essential tools.
Insert the OSX Install CD and go to the XCode Tools Folder ..
and install the XCode developer tools.
Once this package has finished installing go to the cd's Optional Installs package and install X11
Note: You should download the most recent Xcode developer tools as well just to be sure you're up to date.
Go to the mighty blue apple in the top left of your screen, and select SystemPreferences/Software Updates.
Check for updates for applications. It SHOULD find an update for X11, go ahead and download this update.
NOTE: If you go and download the most recent XCode from the net as above, you can be assured if you put an update X11 on your Tiger install you'll run into problems. Just install XCode updates not the X11, use the software updates for this so you get the right one. Don't ask me as Apple.
PKG-CONFIG / GTK2 / SWIG / SCONS / MACPORTS / PYTHON¶
These are the additional applications we'll be installing before we compile drqueue for use. Sounds like a lot but it's fairly straight forward... honest.
To make this process quick and easy the developers out there decided to make two applications that I'm aware of called FINK and DarwinPorts (now called MacPorts).
Essentially these are in my mind ftp programs with a twist. You can call upon MacPorts to download and install your dependancies for you very easily if everything is installed correctly.
So go to www.macports.com and download the most recent release of MacPorts.
Go ahead and install this.
Once this is installed you should be able to use the port command from the shell window
if this returns the following you will know it's working
[[MacPorts]] 1.5 Entering interactive mode... ("help" for help, "quit" to quit_) [Users/gfxsb] >
Just type quit to leave this prompt.
If you get the Error Message:
-bash: port: command not found
Generally one of 3 things could account for this..
1. It's not installed
2. The operating system hasn't had any environment settings changed on install to know where to call macports commands from
3. You need to close and reopen the shell window to reload the environment changes
Fixing Environment Pathing:¶
Assuming you have installed it lets quickly cover how to rectify commands that should work that need some help to work.
-Open the shell
$ cd /etc $ sudo pico profile
-enter the administrator password for your computer and the following window should open.
See the PATH= Line. Use this very basic text editor to edit this line to include the above directories.
The /etc is a directory. The profile file is the file every new shell window looks at when it opens for user defined system variables. Simply put, you can tell OS X where things are in here and a whole lot more I know nothing about :)
Okay the important directory you have added to let OS X Tiger know $ port is a command is the /opt/local/bin directory.
Go ahead and save out this file using CTRL+O and CTRL+X to close it.
and now you should get
[[MacPorts]] 1.5 Entering interactive mode... ("help" for help, "quit" to quit) [Users/gfxsb] >
Just type exit to leave this prompt.
Essentially what we've now done is prepare the operating system for fast downloading of scons, pkg-config, gtk2, swig
Installing dependancies for using scons to compile and install:
Since we installed MacPorts earlier we can use that to get the next block of applications required for this compile to work.¶
First up we'll double check the MacPorts is working and up to date by typing ...
$ sudo port -d selfupdate
Explaination: I wish to as an administrator use macports to selfupdate. Any sudo command will require the adminstrator password to run so be sure to type that in, and from now on I'll assume you know what to do with sudo.
Typing the above tells Macports to go ahead and connect to the net, download and install it's most recent update for itself.
If this errors out with an X11 issue you need to make sure X11 is up to date (check your SystemPreferences/SoftwareUpdates again or make sure you're manually installed it from the options section of your XCode package etc)
If MacPorts does this install successfully you're in really good shape for installing drqueue!
$ sudo port install pkgconfig
$ sudo port install swig
$ sudo port install gtk2
NOTE: If you INCORRECTLY installed X11, macports will more than likely download XFREE first (it usually gets the above expat dependancy first).
It may not install this over the top of your X11 but dang man it can take a while to download regardless, and it's annoying. And the GTK2 install takes long enough as it is anyway.
Basically Xfree is another type of X11, but we don't want to use that for drqueue we want to use X11 and through all this it's best to keep this as clean as possible. So close the terminal window if you get this @error 'and make sure you followed the X11 install properly.
$ sudo port install scons
This will tell MacPorts to connect to the net and download and install scons for you.
This may take sometime again but it is quicker than gtk2.
Once scons is downloaded and installed lets close all shells and reopen them.
This is to ensure any profile / environment changes are refreshed by reloading the shell.
Scons works like this.... the basic scons command is to compile the .c information for you into a working set of files, but this DOESN'T install drqueue, it just gets it ready to install.
So scons is a 2 part process.
Preparation, and installation.
$ cd desktop/(your unpacked drqueue directory) $ sudo scons
Scons will now compile together drqueue. Yes you read right, you're now compiling Drqueue
If you error out here, check the top of the error, if it's saying you're missing pkgconfig or any of the other dependancies above, you may not have finished the port install of these correctly.
Once this is done you need to then tell scons to install drqueue to your preferred location, to set a different location than the default install we can use the PREFIX command like so...
$ sudo scons PREFIX=/usr/local install
This installs all the necessary compiled files for running drqueue and drqman into /usr/local for example. I'm sticking to the default directories for this doc.
Basically that's the compile finished, you're ready to setup your config files etc for DrQueue and then get rendering.
Optional install is a MacPython update as well.
I hope this helped someone
Jorge's notes on Versions
This should help you understand what versions you're downloading a little better too.
BTW the version ....c1 means "candidate 1", so it should be that way you mention, bugs are trying to get squashed on every commit so hourly should work better.
The official release would then follow without any suffix just like "0.64.3".
In the same line, versions ....p1 mean "patch 1" so they should work even better than the release itself. But as we all know there are no perfect laws for bugs. They'll always be there in some way or another, >just trying to keep them hidden :)
The order could be:
- a1,a2,... : alpha1, alpha2...
- b1,b2,... : beta1, beta2...
- c1,c2,... : candidate1, candidate2,...
- <nothing> : release
- p1,p2,... : patch1, patch2,...
Should be simpler for the people around, and so I try to avoid as many as possible but once it's out it helps a lot when they just write the version number.