David Baron's weblog: May 2005

Friends & Colleagues

Wednesday 2005-05-25

Make way for ducklings (11:58 +0200)

I'm in Amsterdam, attending XTech 2005. It's not as warm as it was in California.

Yesterday morning at Schiphol Airport, while our Boeing 777-200 flight (the KLM flight from San Francisco to Amsterdam) was taxiing after landing, we stopped on the taxiway, and the pilot made an announcement. There was a family of ducks (a mother leading small ducklings) in the runway, and we were waiting for them to move, or be moved by the airport staff. The plane even inched forward a few times and backed up again, as if to try to scare the ducks off the taxiway. After a few minutes, they walked off the right side of the taxiway (where I could see them) and into the vegetation along one of the canals near the airport, and our plane (and the two behind us) continued on.

The right of way rules in Amsterdam are pretty interesting. Watching the interaction of pedestrians, bikes, cars, and trams run smoothly is pretty interesting. It takes a bit of thinking for those not used to them. But most people here probably don't consider the rule that Boeing 777 aircraft yield to ducklings!

Thursday 2005-05-12

Some bash functions for Mozilla development (00:29 -0700)

I figured I'd share a few bash functions that I find useful for Mozilla development. There are only a handful of people in the world who care about this stuff, and this entry is for them. The rest of you can feel free to ignore it.

For a start, there's this one that's useful when I need to revise the IID of “interfaces” that aren't defined in IDL:

uuidgen-c++()
{
        local UUID=$(uuidgen)
        echo "// $UUID"
        echo "#define NS__IID \\"
        echo "{ 0x${UUID:0:8}, 0x${UUID:9:4}, 0x${UUID:14:4}, \\"
        echo -n "  { 0x${UUID:19:2}, 0x${UUID:21:2}, 0x${UUID:24:2}, "
        echo -n "0x${UUID:26:2}, 0x${UUID:28:2}, 0x${UUID:30:2}, "
        echo "0x${UUID:32:2}, 0x${UUID:34:2} } }"
}

It saves the manual typing involved in splitting up a generated IID.

But the more interesting one is the way I deal with my many mozconfig files. First of all, I have them all in a directory, ~/mozilla/mozconfig/. But then I have the following bash function to switch between them:

moz()
{
        local FILE=~/mozilla/mozconfig/$1
        if [ ! -f $FILE ]
        then
                echo "Error: $FILE does not exist." 1>&2
                return 1
        fi
        export MOZCONFIG=$FILE

        if [ -d ../obj -a ! -d ../obj/$1 ]
        then
                echo "Warning: Will create new objdir" 1>&2
        fi
}

My ~/.bashrc file contains a call to this function too, moz firefox-debugopt, so that my MOZCONFIG environment variable is never unset, so I can't accidentally do a srcdir build (horrors, never mind the damage to that source tree).

Since many of my build options are in common, I have the various files include other files. For example, my ~/mozilla/mozconfig/firefox-debug contains the lines:

. $(dirname $MOZCONFIG)/common
. $(dirname $MOZCONFIG)/common-debug
. $(dirname $MOZCONFIG)/common-gtk2+xft

which allow sharing of common bits of configuration. This part didn't have to depend on the fact that I'm always using mozconfigs via the MOZCONFIG environment variable to allow my MOZCONFIG files. However, the next bit does. The trick I use in ~/mozilla/mozconfig/common to ensure that I never accidentally create a MOZCONFIG file that will build in the wrong object directory is this:

mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../obj/$(basename $MOZCONFIG)/

which ensures that whenever I do a build with one of my mozconfig files, it will always end up in an object directory based on the name of that mozconfig file.

This way of dealing with mozconfig files has made it a lot easier for me to deal with the combination of multiple source trees and multiple build configurations for each tree.

San Francisco (00:05 -0700)

Last Saturday I went up to San Francisco and did a little hiking. Believe it or not, there are some worthwhile places to hike within city limits (I'm a big fan of both Golden Gate Park and Lincoln Park). I took some photographs of the Golden Gate Bridge from Lincoln Park, including this one, which is a view of the bridge from the ocean side:

[Photo of Golden Gate Bridge from Lincoln Park]