GNUstep bleeding edge
For a client project I'm looking into Mac/Linux GUI cross platform options. Naturally GNUstep is high on my list. It's been a while (maybe 10 years) since I even played with GNUstep and I've struggled a bit getting all the latest things to compile together. So, like everyone else, I'm putting together a guide for how I did it since none of the other guides seem to be up to date (and I'm sure mine will be out of date shortly too!)
I'm installing on Ubuntu 12.04, but other Linux platforms will be very similar - just the dependencies might be different.
So firstly about those package dependencies. I've done so many apt-get installs that I've lost track exactly what I needed. Something a bit like this:
sudo aptitude install build-essential git subversion ninja cmake libffi-dev libxml2-dev libgnutls-dev libicu-dev libblocksruntime-dev libkqueue-dev libpthread-workqueue-dev autoconf libtool
Make sure you've uninstalled any older clang or libobjc libraries (otherwise you'll need to be very careful with configure args etc. to specify our compiled versions) and also any older version of libdispatch
Firstly we want the trunk version of llvm/clang. Grit your teeth, because we're going to have to use subversion:
Now add the following to your .bashrc etc:
Now reload your bashrc:
Check you can find clang:
Now we want the latest gnustep libobjc2 with all the latest modern runtime goodies:
Now add the following to your .bashrc:
export OBJCFLAGS="-fblocks -fobjc-runtime=gnustep"
Now add the following to your .bashrc:
Now we can start installing gnustep itself:
If you get warnings about blocks during make, check that you don't have old libobjc libraries on your system. You can specify a particular libobjc library version when you build the gnustep-make package, but easier to just uninstall them.
Now lets run some tests.
The gnustep-base check tests are very handy for making sure you have all the latest things. Warnings you should look out for are things like you haven't enabled blocks or subscripting. If you get warnings like that you should check your OBJCFLAGS etc. At this point I get no failures or skips:
Now we want the latest lib dispatch for all our GCD goodness:
Now we can compile some test code from this post (http://lists.gnu.org/archive/html/discuss-gnustep/2012-12/msg00036.html) which I have pasted into a gist: https://gist.github.com/aufflick/5674798
And there we are! Ready to install the other gnustep-* modules from github.
AQXMLParser + OAuth
I've been enjoying using Jim Dovey's excellent AQXMLParser lately, and in fact am giving a talk on it tonight at Sydney CocoaHeads. To use it in a new project, I need to be able to authorise the outbound REST request with some OAuth 1 tokens etc.
OAuth can be a right pain, and the Cocoa implementations aren't awesome. gtm-oauth (the OAuth 1 library from the Google Toolbox for Mac) is a little odd in its implementation, but doing your own OAuth implementation would be so tedious it's one of the better options out there.
It's all pretty easy. Firstly, use gtm-oauth like normal to have your user authorise your app and receive a token.
Next, to make a request, gtm-oauth provides a way to authorise an NSMutableURLRequest, but AQXMLParser uses it's own HTTPMessage class (which wraps the lower level CFHTTPMessage from Core Foundation).
What I have done is extend HTTPMessage to provide a copy of itself as an NSURLRequest, and then write a category that auths that with gtm-oauth and then cribs the headers from that and applies them to the HTTPMessage. It's a little roundabout, but because of the need to sign the whole request and the way that gtm-oauth internals work, anything else would be very complicated. So in use, it looks like this:
For now the changes and category are only in my fork, but I have a pending pull request with Jim that I will work out the best way to incorporate them into his master repository. My fork also contains tweaks to work with the latest llvm and ARC (although note neither gtm-oauth nor HTTPMessage or AQXMLParser use ARC, so you'll have to add the -fno-objc-arc compiler flag where appropriate).
My fork of aqtoolkit: https://github.com/aufflick/aqtoolkit
supervisord supervisorctl cheat sheet
On my new server I made the switch from daemontools to supervisor. As if to make daemontools users feel at home the documentation for supervisorctl use is a bit thin :)
Unfortunately supervisor doesn't offer a way to provide a custom restart command, so doing an uninterrupted haproxy restart via supervisor isn't possible. Instead make sure you have autorestart set to unexpected (the default) rather than true (which is what I usually do) - that way if you want a clean haproxy restart you can just do it yourself at the commandline using the -sf option as normal.