“mozconfig” — a play in two acts

Today while trying to figure out a strange build error with a student (mozconfig doesn’t like CR as much as CRLF), Ted decided to share a bit about the inner life of mozconfig.  I repeat it with permission for your reading pleasure.

Act I

  • You run “make -f client.mk”
  • The run_for_side_effects line runs mozconfig2client-mk
  • This uses mozconfig-find to find the mozconfig to use
  • Your mozconfig is sourced as a shell script
  • In mozconfig2client-mk, “mk_add_options” is defined as a shell function that does some escaping and echoes whatever is listed after it to a temp file (ac_add_options in that file is defined as a no-op)
  • client.mk then includes that temp file, so anything in it is treated as makefile source
  • mk_add_options FOO=bar just winds up as the makefile assignment “FOO=bar”

Act II

  • configure repeats this dance, but uses mozconfig2configure instead
  • this does the reverse: ac_add_options does some quoting and echoes the result, mk_add_options is a no-op
  • finally, configure sources the result as a shell script (with some hackery in there)

[end.]

This entry was posted in CDOT, Mozilla, Seneca. Bookmark the permalink. Both comments and trackbacks are currently closed.

3 Comments

  1. Posted January 28, 2009 at 4:37 pm | Permalink

    Is this play a comedy or a tragedy?

    I can’t tell… ;-)

  2. Posted January 28, 2009 at 4:45 pm | Permalink

    Preed:

    That depends. Does your build succeed, or does it fail and you eventually hang yourself in frustration?

  3. Mike Hoye
    Posted January 28, 2009 at 11:33 pm | Permalink

    I think I’ll have to poke my eyes out either way.