Sunday, May 30, 2010

Building Open Office on Windows 7

Ok, this was a long and painful process. I encourage you to be patient when building as there are little things that will go wrong and force you to rebuild or recompile.

The instructions for building Open Office can be found here.

To start you first need to download Cygwin. When installing Cygwin make sure you install all the packages found in the instructions (section entitled "required additional packages")

Next download the source code to your local drive. The instructions can be found here. Go to the section titled :

SCM-Access for the current development line (named DEV300) using Mercurial as SCM

You should perform this in Cygwin. To get to your local drive type cd :
From there find where you downloaded the package to and do the command line instructions.

Next go to the requirements section in the first page. There are a number of files and programs you will need to install. For the things that are files make sure that you copy them in the correct directory. Where it says /external/, the files will reside in the OpenOffice directory structure that you created (the src root). I learned the hard way that having some of these files missing can add significant time to both your configure and compile times.

The next thing that I would recommend that you do is read and follow the section titled:

breaking links to executables

Initially I did not do this but if you skip this step there is a chance you will not be able to run the ./configure found later. I followed the instructions exactly when dealing with the awk.exe/gawk.exe example but was able to get away with simply renaming gunzip.exe to gzip.exe.

Next was the installation of the perl modules. This is another step I skipped initially however it was extremely costly as it won't appear as an error in the ./configure step but at the end of the compilation. Make sure you install all the modules (although some may already be installed and up to date)

After doing the setup it is time to run ./configure in the src_root.
My configure command looked like this:
$ ./configure --disable-build-mozilla --with-midl-path="/cygdrive/c/Program Fil
es/Microsoft SDKs/Windows/v6.1/Bin" --with-jdk-home="/cygdrive/c/Program Files/
Java/jdk1.6.0_20" --with-mozilla-build="/cygdrive/c/mozilla-build" -disable-dir
ectx --with-ant-home=/cygdrive/c/apache-ant-1.8.1 --without-junit --with-frame-
home="/cygdrive/c/Program Files/Microsoft SDKs/Windows/v6.1" --with-psdk-home="
/cygdrive/c/Program Files/Microsoft SDKs/Windows/v6.1"

Make sure that you change your paths accordingly. The "--disable-build-mozilla" and "--with-mozilla-build" seem redundant but only after I put both in would the configure actually complete. I am not sure why that is but I tried all other combinations and none worked.

If your ./configure gives you errors, it will generally tell you what exactly is wrong so it is fairly easy to correct however it may take a while to get it running perfectly on your machine.

The bootstrap section gave me no trouble and at that point I thought it would be smooth sailing until I got to the dmake command.

Dmake ran (initially) without problems and I had some pretty random errors. One of them was saying it could not access c:/temp, and that was because I didn't have a c:/temp. I created the folder and it continued working.

The compilation took a very very long time on my machine (17+hrs) so be very patient and keep an eye on it in case it stops but you don't have to constantly watch it.

Another good thing is if it stops at a certain point you don't have to recompile everything, just the things that haven't already been compiled.

When it was finished and creating the installer I ran into a few errors, it kept looking for a msi_template/codes.txt file. I simply copied the file from another directory into the directory it was looking for it in.

After a long time fixing and recompiling it finally was able to create the installer file. While running the installer file I recommend some sort of treat for yourself because you deserve it if you made it this far.


Sunday, May 23, 2010

Creating a simple Calc Function Extension

The actual process was very simple, the majority of the work came with installing the correct components on my fresh Windows 7 OS.

The first part was getting and installing Netbeans (6.8 IDE) and the Open Office API.

I selected a new project-> and the Chose OpenOffice.org Calc Add-in.

The next screen will set up your Java class name and Package name as well as the directories to store.

The next screen sets up the function definition. You need to set the function name and return type (as well as the display name in the calc app, the description for the auto generated comments and accessibility name for the blind users). Next you can add and edit the parameters of your function and change their type and names.

After clicking finish you should get some auto generated code under your new project in the source package.

Next open up your package and class that you defined and look for the function in the class.
There is a lot of extra code generated but comments will appear in the code to add your functionality, I did something real simple:

public int addFive(int parmValue)
{
return parmValue + 5;
}

I then saved and made sure there were no compile errors and right clicked on the package->Deploy and Run Extension in OpenOffice.org.

It opens OOo and asks to install the extension. After I accept the installation it opens up calc with a new spreadsheet.

I am able to write in the address bar = ADDFIVE(2) and it will display 7.

Friday, May 14, 2010

First Blog

This is where I plan to detail any interesting things I come across when doing my OSD600 Class