def addBuildDirOptions(parser):
    """
    Add build directory specific options to the parser.
    """
    from optparse import OptionGroup
    group = OptionGroup(parser, 'Build Dir Options')
    group.add_option('--clean', action='store_true', help=
        'purge the build directory before building')
    group.add_option('--no-clean', action='store_false', dest='clean', help
        ='do not purge the build directory before building')
    group.add_option('--no-unpack', action='store_true', help=
        'assume that the sources are already present')
    parser.add_option_group(group)
    parser.set_defaults(clean=False, no_unpack=False)
    return parser
