Sunday, April 17, 2011

Release is closer than ever... again

Well, since my last post, I actually didn't thought about Mac. Then, I decided to make sure the API was working on Mac and it was a hell of work to get it even compiling.

The first problem was how to start testing. I don't own a mac and I sure wouldn't buy one just to code a few lines. I found a virtualbox image on torrent and tried to start it. The first problem, it wouldn't kick in, because the image requires VT-x and I was not pleased to find out that my Vaio didn't have the option to enable it in the BIOs. In the end, I found out that my model had a BIOs update at Sony's site that enables the hardware virtualization option.

Ok, image up and running, I tried to run skype2gmail... and it obviously didn't work. It complained on the native library, that it was not build for my OS archtecture (64bit).

Ok, next problem, how to compile the native code? I never programmed for Mac, so I had some trouble finding out that I needed XCode to build it. Ok, I got it (XCode 3.x) and the next problem: it required another Leopard version. Actually, I just had to download 4Gb of updates or so to get it to accept XCode.

After so long, I got it working and tried to build the project, just to find out that it wouldn't because of deprecated jam targets (then I found the project was originally made for Project Builder, the XCode predecessor).

Well, I was so pissed that XCode completely refused to upgrade the jam targets and did not provided any clue on how to redo it, that I almost gave up on mac support. But I finally cooled off, and tried to understand the project's text file to find out what it was trying to do. I figured it out eventually and remade the build files, to use ANT, MAKE and NO xcode at all. HA! Take that damn xcode! :P

The next problem was to the Skype.framork shared library. It required to install the damn thing in a fixed relative place. I didn't want to force the user to install anything in his OS to run skype2gmail. So I decided that the framework should be inside the jar somehow, but this left some problems: first, I would have to extract it at runtime and I would have change its install name. I tried to change the install name using install_name_tool, but it didn't work at all. I ended opening the binary with a hex tool and changed the path inside the binary by hand. It worked like a charm and know I have the library working without any external dependency,

The last problem was that the library wasn't working at all. I found out that mac's Skype did not replied the GET CHATMESSAGE appropriately, starting the reply with CHATMESSAGE. It insisted in replying with "MESSAGE" instead. Obviously, the API was not prepared for that and didn't recognize the reply. I fixed in the native library to prepend the "CHAT" part if the reply started with "MESSAGE".

In the end, I got it working. Still, the mac api version, like the first linux api version, is not very consistent. Sometimes, skype just doesn't reply the CHATMESSAGE reply. I noticed that sometimes, Mac's Skype was very slow to reply. I may improve stability just by increasing the timeouts.

Anyway, I now have that nice feeling of overcoming a hard challenge, since it works ;)

No comments:

Post a Comment