Exemple #1
0
def write_setting_header (conf, **kwargs):
	conf.setenv ("setting")
	conf.write_config_header (**kwargs)
	bak = conf.env.cfg_files
	conf.setenv("")
	conf.env.append_unique ("cfg_files", bak)
	conf.all_envs.pop("setting", None)
Exemple #2
0
def write_setting_header(conf, **kwargs):
    conf.setenv("setting")
    conf.write_config_header(**kwargs)
    bak = conf.env.cfg_files
    conf.setenv("")
    conf.env.append_unique("cfg_files", bak)
    conf.all_envs.pop("setting", None)
def SAMBA_CONFIG_H(conf, path=None):
    '''write out config.h in the right directory'''
    # we don't want to produce a config.h in places like lib/replace
    # when we are building projects that depend on lib/replace
    if not IN_LAUNCH_DIR(conf):
        return

    # we need to build real code that can't be optimized away to test
    stack_protect_list = ['-fstack-protector-strong', '-fstack-protector']
    for stack_protect_flag in stack_protect_list:
        flag_supported = conf.check(
            fragment='''
                                    #include <stdio.h>

                                    int main(void)
                                    {
                                        char t[100000];
                                        while (fgets(t, sizeof(t), stdin));
                                        return 0;
                                    }
                                    ''',
            execute=0,
            cflags=['-Werror', '-Wp,-D_FORTIFY_SOURCE=2', stack_protect_flag],
            mandatory=False,
            msg='Checking if compiler accepts %s' % (stack_protect_flag))
        if flag_supported:
            conf.ADD_CFLAGS('%s' % (stack_protect_flag))
            break

    flag_supported = conf.check(
        fragment='''
                                #include <stdio.h>

                                int main(void)
                                {
                                    char t[100000];
                                    while (fgets(t, sizeof(t), stdin));
                                    return 0;
                                }
                                ''',
        execute=0,
        cflags=['-Werror', '-fstack-clash-protection'],
        mandatory=False,
        msg='Checking if compiler accepts -fstack-clash-protection')
    if flag_supported:
        conf.ADD_CFLAGS('-fstack-clash-protection')

    if Options.options.debug:
        conf.ADD_CFLAGS('-g', testflags=True)

    if Options.options.pidl_developer:
        conf.env.PIDL_DEVELOPER_MODE = True

    if Options.options.developer:
        conf.env.DEVELOPER_MODE = True

        conf.ADD_CFLAGS('-g', testflags=True)
        conf.ADD_CFLAGS('-Wall', testflags=True)
        conf.ADD_CFLAGS('-Wshadow', testflags=True)
        conf.ADD_CFLAGS('-Wmissing-prototypes', testflags=True)
        if CHECK_CODE(
                conf,
                'struct a { int b; }; struct c { struct a d; } e = { };',
                'CHECK_C99_INIT',
                link=False,
                cflags=
                '-Wmissing-field-initializers -Werror=missing-field-initializers',
                msg="Checking C99 init of nested structs."):
            conf.ADD_CFLAGS('-Wmissing-field-initializers', testflags=True)
        conf.ADD_CFLAGS('-Wformat-overflow=2', testflags=True)
        conf.ADD_CFLAGS('-Wformat-zero-length', testflags=True)
        conf.ADD_CFLAGS('-Wcast-align -Wcast-qual', testflags=True)
        conf.ADD_CFLAGS('-fno-common', testflags=True)

        conf.ADD_CFLAGS('-Werror=address', testflags=True)
        # we add these here to ensure that -Wstrict-prototypes is not set during configure
        conf.ADD_CFLAGS('-Werror=strict-prototypes -Wstrict-prototypes',
                        testflags=True)
        conf.ADD_CFLAGS('-Werror=write-strings -Wwrite-strings',
                        testflags=True)
        conf.ADD_CFLAGS('-Werror-implicit-function-declaration',
                        testflags=True)
        conf.ADD_CFLAGS('-Werror=pointer-arith -Wpointer-arith',
                        testflags=True)
        conf.ADD_CFLAGS(
            '-Werror=declaration-after-statement -Wdeclaration-after-statement',
            testflags=True)
        conf.ADD_CFLAGS('-Werror=return-type -Wreturn-type', testflags=True)
        conf.ADD_CFLAGS('-Werror=uninitialized -Wuninitialized',
                        testflags=True)
        conf.ADD_CFLAGS('-Wimplicit-fallthrough', testflags=True)
        conf.ADD_CFLAGS('-Werror=strict-overflow -Wstrict-overflow=2',
                        testflags=True)

        conf.ADD_CFLAGS('-Wformat=2 -Wno-format-y2k', testflags=True)
        conf.ADD_CFLAGS('-Wno-format-zero-length', testflags=True)
        conf.ADD_CFLAGS('-Werror=format-security -Wformat-security',
                        testflags=True,
                        prereq_flags='-Wformat')
        # This check is because for ldb_search(), a NULL format string
        # is not an error, but some compilers complain about that.
        if CHECK_CFLAGS(
                conf, ["-Werror=format", "-Wformat=2"], '''
int testformat(char *format, ...) __attribute__ ((format (__printf__, 1, 2)));

int main(void) {
        testformat(0);
        return 0;
}

'''):
            if not 'EXTRA_CFLAGS' in conf.env:
                conf.env['EXTRA_CFLAGS'] = []
            conf.env['EXTRA_CFLAGS'].extend(TO_LIST("-Werror=format"))

        if not Options.options.disable_warnings_as_errors:
            conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS',
                                  '-Werror -Wno-error=deprecated-declarations',
                                  testflags=True)
            conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS',
                                  '-Wno-error=tautological-compare',
                                  testflags=True)
            conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS',
                                  '-Wno-error=cast-align',
                                  testflags=True)

    if Options.options.fatal_errors:
        conf.ADD_CFLAGS('-Wfatal-errors', testflags=True)

    if Options.options.pedantic:
        conf.ADD_CFLAGS('-W', testflags=True)

    if (Options.options.address_sanitizer
            or Options.options.undefined_sanitizer):
        conf.ADD_CFLAGS('-g -O1', testflags=True)
    if Options.options.address_sanitizer:
        conf.ADD_CFLAGS('-fno-omit-frame-pointer', testflags=True)
        conf.ADD_CFLAGS('-fsanitize=address', testflags=True)
        conf.ADD_LDFLAGS('-fsanitize=address', testflags=True)
        conf.env['ADDRESS_SANITIZER'] = True
    if Options.options.undefined_sanitizer:
        conf.ADD_CFLAGS('-fsanitize=undefined', testflags=True)
        conf.ADD_CFLAGS('-fsanitize=null', testflags=True)
        conf.ADD_CFLAGS('-fsanitize=alignment', testflags=True)
        conf.ADD_LDFLAGS('-fsanitize=undefined', testflags=True)
        conf.env['UNDEFINED_SANITIZER'] = True

    # Let people pass an additional ADDITIONAL_{CFLAGS,LDFLAGS}
    # environment variables which are only used the for final build.
    #
    # The CFLAGS and LDFLAGS environment variables are also
    # used for the configure checks which might impact their results.
    #
    # If these variables don't pass a smoke test, fail the configure

    conf.add_os_flags('ADDITIONAL_CFLAGS')
    if conf.env.ADDITIONAL_CFLAGS:
        conf.CHECK_CFLAGS(conf.env['ADDITIONAL_CFLAGS'], mandatory=True)
        conf.env['EXTRA_CFLAGS'].extend(conf.env['ADDITIONAL_CFLAGS'])

    conf.add_os_flags('ADDITIONAL_LDFLAGS')
    if conf.env.ADDITIONAL_LDFLAGS:
        conf.CHECK_LDFLAGS(conf.env['ADDITIONAL_LDFLAGS'], mandatory=True)
        conf.env['EXTRA_LDFLAGS'].extend(conf.env['ADDITIONAL_LDFLAGS'])

    if path is None:
        conf.write_config_header('default/config.h', top=True, remove=False)
    else:
        conf.write_config_header(os.path.join(conf.variant, path),
                                 remove=False)
    for key in conf.env.define_key:
        conf.undefine(key, from_env=False)
    conf.env.define_key = []
    conf.SAMBA_CROSS_CHECK_COMPLETE()
Exemple #4
0
def configure(conf):
    conf.load('compiler_c intltool')

    path, version = get_pkg_path_and_version("pidgin")
    conf.env.PIDGIN_PATH = path
    conf.env.PURPLE_PATH = join(path, "libpurple")
    conf.env.PURPLE_VERSION = version

    if conf.env.PURPLE_SSL:
        # Order matters: It seems like ssl-gnutls has to be loaded before
        # core-ssl to be found (see ssl.c:probe_ssl_plugins)
        conf.env.PURPLE_PLUGINS += ["ssl-" + conf.env.PURPLE_SSL, "ssl"]

        conf.env.append_value("LIB_PURPLE_BUILD", ["gnutls"])

    plugins = conf.env.PURPLE_PLUGINS

    conf.check_cfg(atleast_pkgconfig_version='0.1')
    conf.check_cfg(package='libxml-2.0',
                   uselib_store='XML',
                   args=['--cflags', '--libs'])

    conf.env.append_value("DEFINES_PURPLE_BUILD", ["HAVE_CONFIG_H"])
    conf.env.append_value("INCLUDES_PURPLE_BUILD",
                          ["libpurple_config", conf.env.PURPLE_PATH])
    conf.env.append_value("LIB_PURPLE_BUILD", ["resolv"])

    # We are going to build a shared library
    conf.env.append_value("CFLAGS_PURPLE_BUILD", ["-fPIC"])

    headers = [
        "arpa/nameser_compat", "fcntl", "sys/time", "unistd", "locale",
        "libintl", "signal", "stdint", "regex"
    ]

    for i in headers:
        conf.check_cc(header_name=i + ".h",
                      mandatory=False,
                      auto_add_header_name=True)

    conf.define("PURPLE_PLUGINS", 1)
    conf.define("HAVE_GETIFADDRS", 1)
    conf.define("HAVE_INET_NTOP", 1)
    conf.define("HAVE_INET_ATON", 1)
    conf.define("HAVE_GETADDRINFO", 1)
    conf.define("HAVE_STRUCT_TM_TM_ZONE", 1)
    conf.define("HAVE_TM_GMTOFF", 1)
    conf.define("HAVE_TIMEZONE", 1)
    conf.define("HAVE_TIMGM", 1)
    conf.define("HAVE_STRFTIME_Z_FORMAT", 1)
    conf.define("HAVE_FILENO", 1)
    conf.define("HAVE_STRUCT_SOCKADDR_SA_LEN", 1)
    conf.define("VERSION", conf.env.PURPLE_VERSION)
    conf.define("DISPLAY_VERSION", conf.env.PURPLE_VERSION)
    conf.define("DATADIR", ".")
    conf.define("SYSCONFDIR", ".")
    conf.define("PACKAGE_NAME", "libpurple")
    conf.define("HAVE_SSL", 1)
    conf.define("HAVE_ICONV", 1)
    conf.define("SIZEOF_TIME_T", 4, quote=False)
    conf.define("HAVE_CONFIG_H", 1, quote=False)
    conf.define("HAVE_GNUTLS_PRIORITY_FUNCS", 1)
    conf.define("_GNU_SOURCE", 1, quote=False)

    conf.define("SSL_CERTIFICATES_DIR",
                join(conf.env.APP_PATH, "share", "ca-certs"))
    conf.define("LIBDIR", conf.env.PLUGIN_PATH)

    conf.define("ENABLE_NLS", 1, quote=False)
    conf.define("PACKAGE", "libpurple")
    conf.define("LOCALEDIR", join(conf.env.APP_PATH, "share", "locale"))

    conf.define("STATIC_PROTO_INIT",
                "void static_proto_init() {}",
                quote=False)
    conf.write_config_header('libpurple_config/config.h')

    conf.load('protocols', tooldir=conf.env.TOOLDIR)
Exemple #5
0
def configure(conf):
    conf.load('compiler_c intltool')

    path, version = get_pkg_path_and_version("pidgin")
    conf.env.PIDGIN_PATH = path
    conf.env.PURPLE_PATH = join(path, "libpurple")
    conf.env.PURPLE_VERSION = version

    if conf.env.PURPLE_SSL:
        # Order matters: It seems like ssl-gnutls has to be loaded before
        # core-ssl to be found (see ssl.c:probe_ssl_plugins)
        conf.env.PURPLE_PLUGINS += ["ssl-" + conf.env.PURPLE_SSL, "ssl"]

        conf.env.append_value("LIB_PURPLE_BUILD", ["gnutls"])

    plugins = conf.env.PURPLE_PLUGINS

    conf.check_cfg(atleast_pkgconfig_version='0.1')
    conf.check_cfg(package='libxml-2.0', uselib_store='XML',
                   args=['--cflags', '--libs'])

    conf.env.append_value("DEFINES_PURPLE_BUILD", ["HAVE_CONFIG_H"])
    conf.env.append_value("INCLUDES_PURPLE_BUILD", ["libpurple_config",
                                                    conf.env.PURPLE_PATH])
    conf.env.append_value("LIB_PURPLE_BUILD", ["resolv"])

    # We are going to build a shared library
    conf.env.append_value("CFLAGS_PURPLE_BUILD", ["-fPIC"])

    headers = ["arpa/nameser_compat", "fcntl", "sys/time",
               "unistd", "locale", "libintl", "signal", "stdint", "regex"]

    for i in headers:
        conf.check_cc(header_name=i + ".h", mandatory=False,
                      auto_add_header_name=True)

    conf.define("PURPLE_PLUGINS", 1)
    conf.define("HAVE_GETIFADDRS", 1)
    conf.define("HAVE_INET_NTOP", 1)
    conf.define("HAVE_INET_ATON", 1)
    conf.define("HAVE_GETADDRINFO", 1)
    conf.define("HAVE_STRUCT_TM_TM_ZONE", 1)
    conf.define("HAVE_TM_GMTOFF", 1)
    conf.define("HAVE_TIMEZONE", 1)
    conf.define("HAVE_TIMGM", 1)
    conf.define("HAVE_STRFTIME_Z_FORMAT", 1)
    conf.define("HAVE_FILENO", 1)
    conf.define("HAVE_STRUCT_SOCKADDR_SA_LEN", 1)
    conf.define("VERSION", conf.env.PURPLE_VERSION)
    conf.define("DISPLAY_VERSION", conf.env.PURPLE_VERSION)
    conf.define("DATADIR", ".")
    conf.define("SYSCONFDIR", ".")
    conf.define("PACKAGE_NAME", "libpurple")
    conf.define("HAVE_SSL", 1)
    conf.define("HAVE_ICONV", 1)
    conf.define("SIZEOF_TIME_T", 4, quote=False)
    conf.define("HAVE_CONFIG_H", 1, quote=False)
    conf.define("HAVE_GNUTLS_PRIORITY_FUNCS", 1)
    conf.define("_GNU_SOURCE", 1, quote=False)

    conf.define("SSL_CERTIFICATES_DIR",
            join(conf.env.APP_PATH, "share", "ca-certs")
    )
    conf.define("LIBDIR", conf.env.PLUGIN_PATH)

    conf.define("ENABLE_NLS", 1, quote=False)
    conf.define("PACKAGE", "libpurple")
    conf.define("LOCALEDIR",
                join(conf.env.APP_PATH, "share", "locale")
    )

    conf.define("STATIC_PROTO_INIT", "void static_proto_init() {}", quote=False)
    conf.write_config_header('libpurple_config/config.h')

    conf.load('protocols', tooldir=conf.env.TOOLDIR)
def configure(conf):
    conf.load('compiler_c')

    path, version = get_path_and_version()
    conf.env.PURPLE_PATH = path
    conf.env.PURPLE_VERSION = version

    if conf.env.PURPLE_SSL:
        # Order matters: It seems like ssl-gnutls has to be loaded before
        # core-ssl to be found (see ssl.c:probe_ssl_plugins)
        conf.env.PURPLE_PLUGINS += ["ssl-" + conf.env.PURPLE_SSL, "ssl"]

        # TODO: conf.define("SSL_CERTIFICATE_DIR")
        conf.env.append_value("LIB_PURPLE_BUILD", ["gnutls"])

    plugins = conf.env.PURPLE_PLUGINS
    protocols = conf.env.PURPLE_PROTOCOLS

    if "jabber" in protocols:
        conf.env.PURPLE_SASL = True
        conf.load('sasl', tooldir='build_lib')
    else:
        conf.env.PURPLE_SASL = False

    conf.check_cfg(atleast_pkgconfig_version='0.1')
    conf.check_cfg(package='libxml-2.0', uselib_store='XML',
                   args=['--cflags', '--libs'])

    conf.env.append_value("DEFINES_PURPLE_BUILD", ["HAVE_CONFIG_H"])
    conf.env.append_value("INCLUDES_PURPLE_BUILD", ["libpurple_config", path])
    conf.env.append_value("LIB_PURPLE_BUILD", ["resolv"])

    # We are going to build a shared library
    conf.env.append_value("CFLAGS_PURPLE_BUILD", ["-fPIC"])

    headers = ["arpa/nameser_compat", "fcntl", "sys/time",
               "unistd", "locale", "signal", "stdint", "regex"]

    for i in headers:
        conf.check_cc(header_name=i + ".h", mandatory=False,
                      auto_add_header_name=True)

    conf.define("PURPLE_STATIC_PRPL", 1)
    conf.define("PURPLE_PLUGINS", 1)
    conf.define("HAVE_GETIFADDRS", 1)
    conf.define("HAVE_INET_NTOP", 1)
    conf.define("HAVE_INET_ATON", 1)
    conf.define("HAVE_GETADDRINFO", 1)
    conf.define("HAVE_STRUCT_TM_TM_ZONE", 1)
    conf.define("HAVE_TM_GMTOFF", 1)
    conf.define("HAVE_TIMEZONE", 1)
    conf.define("HAVE_TIMGM", 1)
    conf.define("HAVE_STRFTIME_Z_FORMAT", 1)
    conf.define("HAVE_FILENO", 1)
    conf.define("HAVE_STRUCT_SOCKADDR_SA_LEN", 1)
    conf.define("VERSION", conf.env.PURPLE_VERSION)
    conf.define("DISPLAY_VERSION", conf.env.PURPLE_VERSION)
    conf.define("DATADIR", ".")
    conf.define("SYSCONFDIR", ".")
    conf.define("PACKAGE_NAME", "libpurple")
    conf.define("HAVE_SSL", 1)
    conf.define("HAVE_ICONV", 1)
    conf.define("LIBDIR", ".")
    conf.define("SIZEOF_TIME_T", 4, quote=False)
    conf.define("HAVE_CONFIG_H", 1, quote=False)
    conf.define("HAVE_CYRUS_SASL", 1, quote=False)
    conf.define("HAVE_GNUTLS_PRIORITY_FUNCS", 1)
    conf.define("_GNU_SOURCE", 1, quote=False)

    proto_extern = "\\\n".join(
                        "extern gboolean purple_init_%s_plugin();" %
                            name.replace('-', '_')
                        for name in chain(plugins, protocols)
                        )

    proto_func = "\\\n".join(
                        "   purple_init_%s_plugin();" % name.replace('-', '_')
                        for name in chain(plugins, protocols)
                        )

    proto_init = """%s\\
void static_proto_init()\\
{\\
%s\\
}""" % (proto_extern, proto_func)

    conf.define("STATIC_PROTO_INIT", proto_init, quote=False)

    conf.write_config_header('libpurple_config/config.h')