Thursday, October 22, 2009

compiling flexlib

Flexlib is an excellent component library which I have used extensively , especially the MDI framework. Recently we encountered an issue in flexlib swc which was actually a bug. Hoping that it could have been fixed in the latest builds, i set about to compile it. Although the site itself has almost all the requisite stuff but somehow all the steps are not there at a particular place so maybe this helps somebody out. But please note they are windows specific.
you would need
  1. an anonymous checkout of the code first using svn as described here.
  2. apache ant(mine was 1.7.1) as the build tool. (it helps if you add the bin folder in your installation to the path variable on your machine)
Go to the build folder under flexlib on a command prompt. You will notice a file called build.xml and another build.win.properties. They need to modified a bit according to your settings -
For flex 3 -
In build.win.properties add these new variables(make sure to change the values to your flex install directory). I added it at line number 15, but its up to you.

flexsdk.bin.dir = C:/Program Files/Adobe/Flex Builder 3/sdks/3.2.0/bin
flexsdk.lib.dir = C:/Program Files/Adobe/Flex Builder 3/sdks/3.2.0/frameworks/libs
flexsdk.locale = en_US
flexsdk.locale.dir = C:/Program Files/Adobe/Flex Builder 3/sdks/3.2.0/frameworks/locale/{locale}

change these variables to use the new variables

asdoc.exe = ${flexsdk.bin.dir}/asdoc.exe
compc.exe = ${flexsdk.bin.dir}/compc.exe
mxmlc.exe = ${flexsdk.bin.dir}/mxmlc.exe

In build.xml
uncomment this line (32)
<property file="./build/build.win.properties" />
and comment this one(33)
<property file="./build/build.mac.properties" />

on line (24) update the basedir attribute to your flexlib directory(an absolute path is good enough)
<project name="flexlib" basedir="C:\Project\GoogleCode\flexlib" default="lib" >
Going to line 118,you would need to uncomment this line
<arg line="-el '${flexsdk.lib.dir}/player'" />
and change it, so that I could compile flexlib for flash player 10.
<arg line="-el '${flexsdk.lib.dir}/player/10'" />

Thats it, now on command prompt go the flexlib/build directory and run ant(which is as simple as ant + enter key,if you followed the first part of the post correctly)

if all goes good you should see a flexlib.swc in the bin flexlib/bin folder.