20050217
M(i|a)croscopic
This blog's been neglected, so I think I'll post some musings from the past few weeks.
Having recently returned to the city from a small country town, the difference amazes me. I've never lived in the country before in my life and it was a totally new experience.
Everyone's friendly, people get to know you quickly, yet for some reason that tends to make me uncomfortable and vaguely paranoid. There is a sense of security in the anonymity of the city that I was hitherto unaware of. And yet, out there, the atmosphere is more relaxed. World events push at the same rate, but somehow the country absorbs them more slowly. The days do not rush, they meander.
But the biggest difference is the people. In the city, a business suit and a laptop bag are marks of status, of acceptibility, There, I felt self-conscious walking down the street with my mp3 player and mobile phone. Here, people hurry, honed in on their targets, dodging and ducking through the obstacle course that is the city pavements. There, they stroll along, pausing to have a chat or see what takes their eye, and amicably give way to each other. Here, a university degree is how you get a decent career. There, leaving school at Year 10 and helping your father work the farm is the sign of a good future.
In this day and age, what makes the difference? A country town is no less connected than the city, news reaches there as quickly as it does here, so wherein lies the vastly separated mindset? I think it's because it's always been like that, and now it's self-perpetuating. People go to the city to be connected, to be on the cutting edge, at the centre of things. People go to the country to slow down, to get back to the land, to enjoy a sense of community.
Out there, the world is at once very big and very small - and sometimes it's hard to tell the difference.
M.
20050201
Creating OS X application bundles step by step
Introduction
This guide is the result of attempting to package a network visualiser (tcprose) I wrote so that it can be distributed as an application bundle. I gathered information from many places, and while I try to be accurate as possible should you notice any bugs feel free to contact me.
Step 1 - The folder hierachy
Each application bundle is on disk a file that ends in .app and contains a strict folder hierachy. The folder hierarchy is the form:
- application.app
- Contents
- Info.plist
- Frameworks
- dependent non-standard libraries
- MacOS
- executable binary
- Resources
- icons and other support files
- Figure out what libraries your application depends on, and figure out what libraries need to be distributed with the program. In order to see the dynamic libraries your binaries depend on, use the otool thus:
otool -L binary
In my case:solaris:~/code/tcprose steve$ otool -L tcprose tcprose: /sw/lib/libSDL-1.2.0.dylib (compatibility version 8.0.0, current version 8.1.0) /System/Library/Frameworks/Cocoa.framework/Versions /A/Cocoa (compatibility version 1.0.0, current version 9.0.0) /System/Library/Frameworks/OpenGL.framework/Versions /A/OpenGL (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 71.1.1) /sw/lib/libpcap.0.dylib (compatibility version 0.8.3, current version 0.8.3) solaris:~/code/tcprose steve$
- Anything in /System or /usr can be safely assumed to be present on all default systems. Notice then the 2 libraries in /sw/lib. For those unfamiliar with fink, its where it installs all its packages. Those 2 libraries need to be copied into the Frameworks folder. Do be careful however that you copy the actual file, not the symbolic links. For example:
solaris:/sw/lib steve$ ls -l libpcap.0.dylib lrwxr-xr-x 1 root admin 19 20 Aug 03:35 libpcap.0.dylib -> libpcap.0.8.3.dylib solaris:/sw/lib steve$
Notice that libpcap.0.dylib is in fact a symlink to libpcap.0.8.3.dylib, thus you need to copy /sw/lib/libpcap.0.8.3.dylib, not /sw/lib/libpcap.0.dylib. - Once the required libraries have been copied into Frameworks folder, its time to do some linking manipulation. Use the install_name_tool to remapped the dynamically linked libraries so your binary links against the libraries in Frameworks folder. To do this you issue the command:
install_name_tool -change old_library_path new_library_path binary
In tcprose's case:solaris:/sw/lib steve$ install_name_tool -change /sw/lib/libpcap.0.dylib @executable_path/../Frameworks/libpcap.0.8.3.dylib ./tcprose
Notice the use of @executable_path: this is what makes it "tick". @executable_path will automatically map to the path where the executable is located. Now if you move the binary into the MacOS directory, it will link against the libraries you have copied into the Frameworks folder