def build(ctx): c = guess_static(ctx) c.compile('include-main.c', 'main.o') # Fbuild puts object files in ctx.buildroot, # which is good...except that Main.hs wants them in the current directory. # This symlinks it as a workaround try: os.symlink(ctx.buildroot / 'main.o', 'main.o') except: pass
def configure(ctx): flags = ['-Wall', '-Werror'] + ctx.options.cflag testflags = [] defs = [] kw = {} if ctx.options.use_color: flags.append('-fdiagnostics-color') if ctx.options.release: kw['optimize'] = True kw['macros'] = ['NDEBUG'] else: kw['debug'] = True kw['macros'] = ['DEBUG'] c = guess_static(ctx, exe=ctx.options.cc, flags=flags, includes=['utf'], platform_options=[ ({'posix'}, { 'external_libs+': ['rt'] }), ({'gcc'}, { 'flags+': ['-Wno-maybe-uninitialized'] }), ({'clang'}, { 'flags+': ['-Wno-unknown-warning-option'] }), ], **kw) arch = get_target_arch(ctx, c) if arch == 'x86_64': defs.append('X64') elif re.match('i\d86', arch): # X86 is implemented in the x86_64.dasc file. arch = 'x86_64' else: assert 0, "get_target_arch returned invalid architecture '%s'" % arch dasm = DynAsmBuilder(ctx, exe=ctx.options.lua, defs=defs) if Libcut_h(c).libcut_h: ctx.logger.passed('found libcut.h; will build tests') tests = True testflags.append('-std=gnu11') else: ctx.logger.failed('cannot find libcut.h; will not build tests') tests = False headerdoc = find_headerdoc(ctx) return Record(dasm=dasm, c=c, arch=arch, tests=tests, testflags=testflags, headerdoc=headerdoc)
def configure(ctx): kw = dict( debug=ctx.options.buildtype == 'debug', optimize=ctx.options.buildtype == 'release', flags=['-fdiagnostics-color'] if ctx.options.use_color else [], platform_options=[ ({'posix'}, {'external_libs': ['m']}), ] ) kw['flags'].extend(ctx.options.cflag) static = guess_static(ctx, **kw) shared = guess_shared(ctx, **kw) return Record(static=static, shared=shared)
def configure(ctx): kw = dict(debug=ctx.options.buildtype == 'debug', optimize=ctx.options.buildtype == 'release', flags=['-fdiagnostics-color'] if ctx.options.use_color else [], platform_options=[ ({'posix'}, { 'external_libs': ['m'] }), ]) kw['flags'].extend(ctx.options.cflag) static = guess_static(ctx, **kw) shared = guess_shared(ctx, **kw) return Record(static=static, shared=shared)
def configure(ctx): flex = Flex(ctx, debug=ctx.options.debug_lexer) bison = Bison(ctx, flags=['-Wno-other', '-v', '--report-file', ctx.buildroot / 'report']) opts = {'macros': []} flags = ctx.options.cflag if ctx.options.release: opts['optimize'] = True else: opts['debug'] = True if not ctx.options.threads: opts['macros'].append('NO_THREADS') if ctx.options.no_builtins: opts['macros'].append('NO_BUILTINS') if ctx.options.use_color: flags.append('-fdiagnostics-color') if ctx.options.address_sanitizer: flags.extend(('-fsanitize=address', '-fno-omit-frame-pointer')) c = guess_static(ctx, external_libs=['ds'], exe=ctx.options.cc, flags=flags, platform_options=[ ({'posix'}, {'flags+': ['-Wall', '-Werror']}), ({'clang'}, {'flags+': ['-Wno-unneeded-internal-declaration']}), ({'gcc'}, {'flags+': ['-Wno-return-type', '-Wno-unused-function']}), ], **opts) pthread = posix.pthread_h(c) pthread.header # Force the check. if not (openssl.ssl_h(c).header and openssl.sha_h(c).header): raise fbuild.ConfigFailed('OpenSSL is required.') openssl_pkg = PkgConfig(ctx, 'openssl') ldlibs = openssl_pkg.libs().split(' ') ctx.logger.check('checking for pkg-config package lua5.2') try: lua_pkg = PkgConfig(ctx, 'lua5.2') except fbuild.ConfigFailed: ctx.logger.failed() cflags = [] else: ctx.logger.passed() cflags = lua_pkg.cflags() ldlibs.extend(lua_pkg.libs().split(' ')) return Record(flex=flex, bison=bison, c=c, pthread=pthread, cflags=cflags, ldlibs=ldlibs)
def configure(ctx): if ctx.options.platform: platform = ast.literal_eval(ctx.options.platform) else: platform = guess_platform(ctx) flags = ctx.options.cflag posix_flags = ['-Wall', '-Werror'] clang_flags = [] if ctx.options.use_color: posix_flags.append('-fdiagnostics-color') if ctx.options.release: debug = False optimize = True else: debug = True optimize = False clang_flags.append('-fno-limit-debug-info') c = guess_static(ctx, platform=platform, exe=ctx.options.cc, flags=flags, debug=debug, optimize=optimize, platform_options=[ ({'clang'}, { 'flags+': clang_flags }), ({'posix'}, { 'flags+': posix_flags, 'external_libs+': ['m'], 'cross_compiler': True }), ]) external_libs = [] if platform & {'posix'} and not platform & {'mingw'}: libelf_test = libelf(c) if not libelf_test.libelf_h or not libelf_test.gelf_h: raise fbuild.ConfigFailed('libelf is required') external_libs.append('elf') return Record(c=c, external_libs=external_libs)
def configure(ctx): flags = ['-Wall', '-Werror']+ctx.options.cflag testflags = [] defs = [] kw = {} if ctx.options.use_color: flags.append('-fdiagnostics-color') if ctx.options.release: kw['optimize'] = True kw['macros'] = ['NDEBUG'] else: kw['debug'] = True kw['macros'] = ['DEBUG'] c = guess_static(ctx, exe=ctx.options.cc, flags=flags, includes=['utf'], platform_options=[ ({'posix'}, {'external_libs+': ['rt']}), ({'gcc'}, {'flags+': ['-Wno-maybe-uninitialized']}), ({'clang'}, {'flags+': ['-Wno-unknown-warning-option']}), ], **kw) arch = get_target_arch(ctx, c) if arch == 'x86_64': defs.append('X64') elif re.match('i\d86', arch): # X86 is implemented in the x86_64.dasc file. arch = 'x86_64' else: assert 0, "get_target_arch returned invalid architecture '%s'" % arch dasm = DynAsmBuilder(ctx, exe=ctx.options.lua, defs=defs) if Libcut_h(c).libcut_h: ctx.logger.passed('found libcut.h; will build tests') tests = True testflags.append('-std=gnu11') else: ctx.logger.failed('cannot find libcut.h; will not build tests') tests = False headerdoc = find_headerdoc(ctx) return Record(dasm=dasm, c=c, arch=arch, tests=tests, testflags=testflags, headerdoc=headerdoc)
def configure(ctx): flags = ['-Wall', '-Werror']+ctx.options.cflag testflags = [] defs = [] kw = {} if ctx.options.use_color: flags.append('-fdiagnostics-color') if ctx.options.release: kw['optimize'] = True kw['macros'] = ['NDEBUG'] else: kw['debug'] = True kw['macros'] = ['DEBUG'] c = guess_static(ctx, exe=ctx.options.cc, flags=flags, includes=['utf'], platform_options=[ ({'posix'}, {'external_libs+': ['rt']}) ], **kw) arch = get_target_arch(ctx, c) if arch == 'x86_64': defs.append('X64') elif re.match('i\d86', arch): # X86 is implemented in the x86_64.dasc file. arch = 'x86_64' else: raise fbuild.ConfigFailed('unsupported target architecture ' + arch) dasm = DynAsmBuilder(ctx, exe=ctx.options.lua, defs=defs) if Libcut_h(c).libcut_h: ctx.logger.passed('found libcut.h; will build tests') tests = True testflags.append('-std=gnu11') else: ctx.logger.failed('cannot find libcut.h; will not build tests') tests = False return Record(dasm=dasm, c=c, arch=arch, tests=tests, testflags=testflags)
def build(ctx): c = guess_static(ctx) exe = c.build_exe('x', ['x.c']) ctx.install(exe, 'bin') ctx.install('doc.txt', 'share', 'some_subdir_of_usr_share')
def configure(ctx): flex = Flex(ctx, debug=ctx.options.debug_lexer) bison = Bison( ctx, flags=['-Wno-other', '-v', '--report-file', ctx.buildroot / 'report']) opts = {'macros': []} flags = ctx.options.cflag if ctx.options.release: opts['optimize'] = True else: opts['debug'] = True if not ctx.options.threads: opts['macros'].append('NO_THREADS') if ctx.options.no_builtins: opts['macros'].append('NO_BUILTINS') if ctx.options.use_color: flags.append('-fdiagnostics-color') if ctx.options.address_sanitizer: flags.extend(('-fsanitize=address', '-fno-omit-frame-pointer')) c = guess_static(ctx, external_libs=['ds'], exe=ctx.options.cc, flags=flags, platform_options=[ ({'posix'}, { 'flags+': ['-Wall', '-Werror'] }), ({'clang'}, { 'flags+': ['-Wno-unneeded-internal-declaration'] }), ({'gcc'}, { 'flags+': ['-Wno-return-type', '-Wno-unused-function'] }), ], **opts) pthread = posix.pthread_h(c) pthread.header # Force the check. if not (openssl.ssl_h(c).header and openssl.sha_h(c).header): raise fbuild.ConfigFailed('OpenSSL is required.') openssl_pkg = PkgConfig(ctx, 'openssl') ldlibs = openssl_pkg.libs().split(' ') ctx.logger.check('checking for pkg-config package lua5.2') try: lua_pkg = PkgConfig(ctx, 'lua5.2') except fbuild.ConfigFailed: ctx.logger.failed() cflags = [] else: ctx.logger.passed() cflags = lua_pkg.cflags() ldlibs.extend(lua_pkg.libs().split(' ')) return Record(flex=flex, bison=bison, c=c, pthread=pthread, cflags=cflags, ldlibs=ldlibs)