"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 runforside_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, "mkaddoptions" is defined as a shell function that does some escaping and echoes whatever is listed after it to a temp file (acaddoptions 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
  • mkaddoptions 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: acaddoptions does some quoting and echoes the result, mkaddoptions is a no-op
  • finally, configure sources the result as a shell script (with some hackery in there)

[end.]