CoreFoundation Gone?

One of the major impediments to using WebKit on Windows (assuming you are not writing software for Apple) is that the implementation relies on a suite of proprietary support libraries, such as CoreGraphics, CoreFoundation, and CFNetwork.

Readers of this blog will be familiar with some of the steps I have taken to attempt to mitigate this by using Cairo (rather than CoreGraphics) and Curl (rather than CFNetwork).  However, there still remained large bits of logic written to use various useful data types and operating system support logic found in CoreFoundation.  While performing the tedious task of replacing these routines with equivalent code held limited appeal, the vision of maintaining these mirror routines in perpetuity while the Apple WebKit team marched ever forward with new features and functionality left me curled in the fetal position calling for my mother.

So, rather than attempt to replicate the FontDatabase routines and other logic in WebKit proper, I decided to start a new project to bring the Open Source Core Foundation (CF Lite) into closer compliance with the 'real' CoreFoundation.

It took about a week of on-and-off hacking to take the raw tarball provided by Apple on their Open Source site and get it building and running on Windows.  Since I mostly hack on my Mac, I also created an Xcode project so I could confirm function on both platforms.  I intend to also port it to Linux once I have some spare time.

The sources are mostly complete, and easy to build on OS X using darwinbuild.  However, the instructions on Apple's website are out of date, and the posted example program doesn't even work in the version of CF-Lite (299) referenced on the page.  There are no working instructions or Makefiles for building the current Leopard-based sources on Windows (bug filed.) Furthermore, a lot of the Windows-specific code that appeared in earlier releases seems to have been stripped out in later releases. 

Thankfully, by reviewing every one of the released CF-Lite tarballs, I was able to piece together much of what was missing.  It is unfortunate that the Open Source source omits (or in some cases excludes via "#if 0" stanzas) the Windows versions of these routines.  I took the opportunity to file some radar bugs about this as well.  To add insult to injury, after getting the project building I discovered that someone else had gotten parts of it working (though with some bugs), which would have saved some time if I had been more proficient in my Googling.

The upshot of this long post is that I have successfully launched WinLauncher and browsed to the cf-lite project using WebKit built with the redistributable CFLite.dll (see image above!).

Now, I'm starting to glance meaningfully towards the original CFNetwork source releases ...

Update:  I have had to move the project to SourceForge, as Google Code does not support the use of the Apple Public Source License for its projects.

Comments

Jean-Daniel said…
Nice job. A lots of people dreams about this Windows compatible CF-Lite frameworks.

That said, I don't think porting CFNetwork to windows i a good idea (as it is no longer open source). You will have to maintain it, and to solve bug that Apple already correct in his internal version.
Kreios said…
Don't know if you heard of this project but you might be able to use some of its code.

http://www.cocotron.org/
bfulgham said…
The Cocotron is very interesting. I agree that it may have some useful implementations. Most of it is in Objective C, which limits its direct use in CF-Lite, but converting to C should certainly be possible.

Popular Posts