def doc(ctx): """Build the Felix documentation.""" phases, iscr, felix = build(ctx) # copy documentation into target ctx.logger.log('building documentation', color='cyan') # copy website index buildsystem.copy_to(ctx, ctx.buildroot, Path('src/*.html').glob()) # copy website buildsystem.copy_dir_to(ctx, ctx.buildroot, Path('src')/'web') # copy the entire src directory so the user can browse it not actually used # in the build process buildsystem.copy_dir_to(ctx, ctx.buildroot, 'src', pattern='*.{ml,mli,c,cc,cpp,h,hpp,flx,flxh}') # copy the entire test directory so the user can browse it buildsystem.copy_dir_to(ctx, ctx.buildroot, 'test', pattern='*.{flx,expect}') # copy the entire tut examples directory so the user can browse it buildsystem.copy_dir_to(ctx, ctx.buildroot, 'tut', pattern='*.{flx,expect}') # copy docs buildsystem.copy_to(ctx, ctx.buildroot / 'doc', Path('src/doc/*.fdoc').glob())
def build_flx(phase): dsts = [] dsts.extend(buildsystem.copy_to(phase.ctx,Path (phase.ctx.buildroot)/"lib/gnu/gmp", Path('src/lib/gnu/gmp/*.flx').glob())) dsts.extend(buildsystem.copy_to(phase.ctx, phase.ctx.buildroot / 'lib/GL', Path('src/opengl/*.flx').glob())) dsts.extend(buildsystem.copy_to(phase.ctx, phase.ctx.buildroot / 'lib/GL', Path('src/glut/*.flx').glob())) if phase.sdl_config: sdl_fpc = fbuild.builders.text.autoconf_config_file(phase.ctx, 'src/sdl/sdl.fpc', 'src/sdl/sdl.fpc.in', { 'VERSION': phase.sdl_config.version(), 'CFLAGS': phase.sdl_config.cflags(), 'SHARED_LIBS': phase.sdl_config.libs(), 'STATIC_LIBS': phase.sdl_config.static_libs(), }) dsts.extend(buildsystem.copy_fpc_to_config(phase.ctx, [sdl_fpc])) dsts.extend(buildsystem.copy_to(phase.ctx, phase.ctx.buildroot / 'lib/SDL', Path('src/sdl/*.flx').glob())) return dsts
def build_runtime(host_phase, target_phase): """ Builds the judy runtime library, and returns the static and shared library versions. """ path = Path('src/judy/src') # Copy the header into the runtime library. buildsystem.copy_to(target_phase.ctx, target_phase.ctx.buildroot / 'lib/rtl', [path / 'Judy.h', path / 'Judy1/Judy1.h', path / 'JudyL/JudyL.h']) types = config_call('fbuild.config.c.c99.types', target_phase.platform, target_phase.c.static) if types.voidp.size == 8: macros = ['JU_64BIT'] else: macros = ['JU_32BIT'] if 'windows' in target_phase.platform: macros.append('BUILD_JUDY') #Apply this to all source files. srcs = [copy(target_phase.ctx, p, target_phase.ctx.buildroot / p) for p in [ path / 'JudyCommon/JudyMalloc.c', path / 'JudySL/JudySL.c', path / 'JudyHS/JudyHS.c'] + (path / 'Judy1' / '*.c').glob() + (path / 'JudyL' / '*.c').glob()] # Copy all the common judy sources we need so people can rebuild the RTL without a source distro for p in ((path / 'JudyCommon' / '*.c').glob() + (path / 'Judy*' / '*.h').glob()): if p not in ('JudyMalloc.c', 'JudyPrintJP.c'): copy(target_phase.ctx, p, target_phase.ctx.buildroot / p) includes = [path, path / 'JudyCommon', path / 'JudyL', path / 'Judy1'] static = buildsystem.build_c_static_lib(target_phase, 'lib/rtl/judy', srcs=srcs, macros=macros, includes=includes) shared = buildsystem.build_c_shared_lib(target_phase, 'lib/rtl/judy', srcs=srcs, macros=macros, includes=includes) return Record(static=static, shared=shared)
def build_runtime(host_phase, target_phase): """ Builds the judy runtime library, and returns the static and shared library versions. """ path = Path('src/judy/src') # Copy the header into the runtime library. buildsystem.copy_to(target_phase.ctx, target_phase.ctx.buildroot / 'share/lib/rtl', [path / 'Judy.h']) types = config_call('fbuild.config.c.c99.types', target_phase.platform, target_phase.c.static) if types.voidp.size == 8: macros = ['JU_64BIT'] else: macros = ['JU_32BIT'] if 'windows' in target_phase.platform: macros.append('BUILD_JUDY') #Apply this to all source files. srcs = [ copy(target_phase.ctx, p, target_phase.ctx.buildroot / 'share' / p) for p in [ path / 'JudyCommon/JudyMalloc.c', path / 'JudySL/JudySL.c', path / 'JudyHS/JudyHS.c' ] + (path / 'Judy1' / '*.c').glob() + (path / 'JudyL' / '*.c').glob() ] # Copy all the common judy sources we need so people can rebuild the RTL without a source distro for p in ((path / 'JudyCommon' / '*.c').glob() + (path / 'Judy*' / '*.h').glob()): if p not in ('JudyMalloc.c', 'JudyPrintJP.c'): copy(target_phase.ctx, p, target_phase.ctx.buildroot / 'share' / p) includes = [path, path / 'JudyCommon', path / 'JudyL', path / 'Judy1'] static = buildsystem.build_c_static_lib(target_phase, 'host/lib/rtl/judy', srcs=srcs, macros=macros, includes=includes) shared = buildsystem.build_c_shared_lib(target_phase, 'host/lib/rtl/judy', srcs=srcs, macros=macros, includes=includes) return Record(static=static, shared=shared)
def doc(ctx): """Build the Felix documentation.""" phases, iscr, felix = build(ctx) # copy documentation into target ctx.logger.log('building documentation', color='cyan') # copy website index buildsystem.copy_to(ctx, ctx.buildroot, Path('src/*.html').glob()) # copy website buildsystem.copy_dir_to(ctx, ctx.buildroot, Path('src')/'web')
def build_flx(phase): dsts = [] dsts.extend(buildsystem.copy_to(phase.ctx,Path (phase.ctx.buildroot)/"lib/gnu/gmp", Path('src/lib/gnu/gmp/*.flx').glob())) dsts.extend(buildsystem.copy_to(phase.ctx, phase.ctx.buildroot / 'lib/GL', Path('src/opengl/*.flx').glob())) dsts.extend(buildsystem.copy_to(phase.ctx, phase.ctx.buildroot / 'lib/GL', Path('src/glut/*.flx').glob())) return dsts
def build_runtime(host_phase, target_phase): """ Builds the judy runtime library, and returns the static and shared library versions. """ path = Path("src/judy/src") # Copy the header into the runtime library. buildsystem.copy_to(target_phase.ctx, target_phase.ctx.buildroot / "lib/rtl", [path / "Judy.h"]) types = config_call("fbuild.config.c.c99.types", target_phase.platform, target_phase.c.static) if types.voidp.size == 8: macros = ["JU_64BIT"] else: macros = ["JU_32BIT"] srcs = [path / "JudyCommon/JudyMalloc.c", path / "JudySL/JudySL.c", path / "JudyHS/JudyHS.c"] static = buildsystem.build_c_static_lib( target_phase, "lib/rtl/judy", srcs=srcs, objs=_build_objs(host_phase, target_phase, target_phase.c.static, "Judy1") + _build_objs(host_phase, target_phase, target_phase.c.static, "JudyL"), macros=macros, includes=[path, path / "JudyCommon"], ) shared = buildsystem.build_c_shared_lib( target_phase, "lib/rtl/judy", srcs=srcs, objs=_build_objs(host_phase, target_phase, target_phase.c.shared, "Judy1") + _build_objs(host_phase, target_phase, target_phase.c.shared, "JudyL"), macros=macros, includes=[path, path / "JudyCommon"], ) return Record(static=static, shared=shared)
def build_runtime(host_phase, target_phase): path = Path('src/sqlite3') buildsystem.copy_hpps_to_rtl(target_phase.ctx, path / 'flx_sqlite3.hpp', ) buildsystem.copy_to(target_phase.ctx, target_phase.ctx.buildroot / "lib/rtl", [ path / 'sqlite3.h', path / 'sqlite3ext.h', ] ) dst = 'lib/rtl/flx_sqlite3' srcs = [ path / 'sqlite3.c', ] includes = [ target_phase.ctx.buildroot / 'config/target', ] macros = ['BUILD_SQLITE3'] cflags = ([], ['-Wno-sign-compare'])[not 'win32' in target_phase.platform] lflags = [] libs = [] external_libs = [] return Record( static=buildsystem.build_c_static_lib(target_phase, dst, srcs, includes=includes, macros=macros, cflags=cflags, libs=libs, external_libs=external_libs, lflags=lflags), shared=buildsystem.build_c_shared_lib(target_phase, dst, srcs, includes=includes, macros=macros, cflags=cflags, libs=libs, external_libs=external_libs, lflags=lflags))
def build_runtime(phase): path = Path('src/tre/tre') alloca_h = config_call('fbuild.config.c.malloc.alloca_h', phase.platform, phase.c.static) dlfcn_h = config_call('fbuild.config.c.posix.dlfcn_h', phase.platform, phase.c.static, phase.c.shared) getopt_h = config_call('fbuild.config.c.gnu.getopt_h', phase.platform, phase.c.static) inttypes_h = config_call('fbuild.config.c.posix.inttypes_h', phase.platform, phase.c.static) libutf8_h = config_call('fbuild.config.c.libutf8.libutf8_h', phase.platform, phase.c.static) memory_h = config_call('fbuild.config.c.bsd.memory_h', phase.platform, phase.c.static) regex_h = config_call('fbuild.config.c.posix.regex_h', phase.platform, phase.c.static) stdint_h = config_call('fbuild.config.c.c99.stdint_h', phase.platform, phase.c.static) stdlib_h = config_call('fbuild.config.c.posix.stdlib_h', phase.platform, phase.c.static) string_h = config_call('fbuild.config.c.c99.string_h', phase.platform, phase.c.static) strings_h = config_call('fbuild.config.c.posix.strings_h', phase.platform, phase.c.static) sys_stat_h = config_call('fbuild.config.c.posix.sys_stat_h', phase.platform, phase.c.static) sys_types_h = config_call('fbuild.config.c.posix.sys_types_h', phase.platform, phase.c.static) unistd_h = config_call('fbuild.config.c.posix.unistd_h', phase.platform, phase.c.static) wchar_h = config_call('fbuild.config.c.posix.wchar_h', phase.platform, phase.c.static) wctype_h = config_call('fbuild.config.c.posix.wctype_h', phase.platform, phase.c.static) if 'win32' in phase.platform: inline = '__inline' else: inline = None patterns = { 'CRAY_STACKSEG_END': None, 'C_ALLOCA': None, 'ENABLE_NLS': 0, 'HAVE_ALLOCA': alloca_h.alloca is not None, 'HAVE_WCSLEN': wchar_h.wcslen is not None, 'NDEBUG': 1, 'HAVE_ALLOCA_H': alloca_h.header is not None, 'HAVE_CFLOCALECOPYCURRENT': None, 'HAVE_CFPREFERENCESCOPYAPPVALUE': None, 'HAVE_DCGETTEXT': None, 'HAVE_DLFCN_H': dlfcn_h.header is not None, 'HAVE_GETOPT_H': getopt_h.header is not None , 'HAVE_GETOPT_LONG': getopt_h.getopt_long is not None, 'HAVE_GETTEXT': None, 'HAVE_ICONV': None, 'HAVE_INTTYPES_H': inttypes_h.header is not None, 'HAVE_ISASCII': 1, 'HAVE_ISBLANK': 1, 'HAVE_ISWASCII': wctype_h.iswascii is not None, 'HAVE_ISWBLANK': wctype_h.iswblank is not None, 'HAVE_ISWCTYPE': wctype_h.iswctype is not None, 'HAVE_ISWLOWER': wctype_h.iswlower is not None, 'HAVE_ISWUPPER': wctype_h.iswupper is not None, 'HAVE_LIBUTF8_H': libutf8_h.header is not None, 'HAVE_MBRTOWC': wchar_h.mbrtowc is not None, 'HAVE_MBSTATE_T': wchar_h.mbstate_t is not None, 'HAVE_MBTOWC': stdlib_h.mbtowc is not None, 'HAVE_MEMORY_H': memory_h.header is not None, 'HAVE_REGEX_H': regex_h.header is not None, 'HAVE_REG_ERRCODE_T': regex_h.reg_errcode_t is not None, 'HAVE_STDINT_H': stdint_h.header is not None, 'HAVE_STDLIB_H': stdlib_h.header is not None, 'HAVE_STRINGS_H': strings_h.header is not None, 'HAVE_STRING_H': string_h.header is not None, 'HAVE_SYS_STAT_H': sys_stat_h.header is not None, 'HAVE_SYS_TYPES_H': sys_types_h.header is not None, 'HAVE_TOWLOWER': wctype_h.towlower is not None, 'HAVE_TOWUPPER': wctype_h.towupper is not None, 'HAVE_UNISTD_H': unistd_h.header is not None, 'HAVE_WCHAR_H': wchar_h.header is not None, 'HAVE_WCHAR_T': wchar_h.wchar_t is not None, 'HAVE_WCSCHR': wchar_h.wcschr is not None, 'HAVE_WCSCPY': wchar_h.wcscpy is not None, 'HAVE_WCSNCPY': wchar_h.wcsncpy is not None, 'HAVE_WCSRTOMBS': wchar_h.wcsrtombs is not None, 'HAVE_WCSTOMBS': stdlib_h.wcstombs is not None, 'HAVE_WCTYPE': wctype_h.wctype is not None, 'HAVE_WCTYPE_H': wctype_h.header is not None, 'HAVE_WINT_T': wctype_h.wint_t is not None, 'NO_MINUS_C_MINUS_O': None, 'PACKAGE': '"tre"', 'PACKAGE_TARNAME': '"tre"', 'PACKAGE_VERSION': '"0.8.0"', 'STACK_DIRECTION': None, 'VERSION': '"0.8.0"', 'PACKAGE_BUGREPORT': '"*****@*****.**"', 'PACKAGE_NAME': '"TRE"', 'PACKAGE_STRING': '"TRE 0.8.0"', 'PACKAGE_TARFILE': 'tre', 'STDC_HEADERS': 1, 'TRE_APPROX': 1, 'TRE_DEBUG': None, 'TRE_MULTIBYTE': wchar_h.header is not None, 'TRE_REGEX_T_FIELD': 'value', 'TRE_SYSTEM_REGEX_H_PATH': None, 'TRE_USE_ALLOCA': alloca_h.alloca is not None, 'TRE_USE_SYSTEM_REGEX_H': None, 'TRE_VERSION': '"0.8.0"', 'TRE_VERSION_1': '0', 'TRE_VERSION_2': '8', 'TRE_VERSION_3': '0', 'TRE_WCHAR': wchar_h.header is not None, 'WCHAR_MAX': None, 'WCHAR_T_SIGNED': None, 'WCHAR_T_UNSIGNED': None, '_FILE_OFFSET_BITS': None, '_GNU_SOURCE': 1, '_LARGE_FILES': None, '_REGCOMP_INTERNAL': None, 'const': None, 'inline': inline, } fbuild.builders.text.autoconf_config_header(phase.ctx, path / 'config.h', path / 'config.h.in', patterns) fbuild.builders.text.autoconf_config_header(phase.ctx, path / 'lib/tre-config.h', path / 'lib/tre-config.h.in', patterns) buildsystem.copy_to(phase.ctx, phase.ctx.buildroot / 'lib/rtl/tre', [ path / 'lib/tre.h', phase.ctx.buildroot / path / 'lib/tre-config.h']) dst = 'lib/rtl/tre' srcs = Path.glob('src/tre/tre/lib/*.c') includes = [ phase.ctx.buildroot / 'config/target', phase.ctx.buildroot / path, phase.ctx.buildroot / path / 'lib', path / 'gnulib/lib', ] macros = ['HAVE_CONFIG_H', 'BUILD_TRE'] #Workaround link error : unresolved external symbol _snprintf #referenced in function _tre_version. if 'win32' in phase.platform: macros.append('snprintf=_snprintf') return Record( static=buildsystem.build_c_static_lib(phase, dst, srcs, includes=includes, macros=macros), shared=buildsystem.build_c_shared_lib(phase, dst, srcs, includes=includes, macros=macros))
def build(host_phase, target_phase): path = Path('src/flx_drivers') buildsystem.copy_to(target_phase.ctx, target_phase.ctx.buildroot / "share/lib/rtl/", [ path / 'flx_run.hpp', ]) run_includes = [ target_phase.ctx.buildroot / 'host/lib/rtl', 'src/exceptions', 'src/gc', 'src/judy/src', 'src/pthread', 'src/flx_async', 'src/rtl', ] arun_includes = run_includes + [ target_phase.ctx.buildroot / 'host/lib/rtl', 'src/demux', 'src/faio', ] + ([], ['src/demux/win'])['win32' in target_phase.platform] flx_run_static_obj = target_phase.cxx.static.compile( dst='host/lib/rtl/flx_run_lib', src=path / 'flx_run_lib_static.cpp', includes=run_includes, ) flx_run_static_main = target_phase.cxx.static.compile( dst='host/lib/rtl/flx_run_main', src=path / 'flx_run_main.cxx', includes=run_includes, ) flx_run_exe = target_phase.cxx.shared.build_exe( dst='host/bin/flx_run', srcs=[path / 'flx_run_main.cxx', path / 'flx_run_lib_dynamic.cpp'], includes=run_includes, libs=[ call('buildsystem.flx_rtl.build_runtime', host_phase, target_phase).shared ], ) flx_arun_static_obj = target_phase.cxx.static.compile( dst='host/lib/rtl/flx_arun_lib', src=path / 'flx_arun_lib_static.cpp', includes=arun_includes, ) flx_arun_static_main = target_phase.cxx.static.compile( dst='host/lib/rtl/flx_arun_main', src=path / 'flx_arun_main.cxx', includes=arun_includes, ) flx_arun_exe = target_phase.cxx.shared.build_exe( dst='host/bin/flx_arun', srcs=[path / 'flx_arun_main.cxx', path / 'flx_arun_lib_dynamic.cpp'], includes=arun_includes, libs=[ call('buildsystem.flx_rtl.build_runtime', host_phase, target_phase).shared, call('buildsystem.flx_pthread.build_runtime', target_phase).shared, call('buildsystem.flx_async.build_runtime', host_phase, target_phase).shared, call('buildsystem.demux.build_runtime', target_phase).shared, call('buildsystem.faio.build_runtime', host_phase, target_phase).shared ], ) return Record( flx_run_lib=flx_run_static_obj, flx_run_main=flx_run_static_main, flx_run_exe=flx_run_exe, flx_arun_lib=flx_arun_static_obj, flx_arun_main=flx_arun_static_main, flx_arun_exe=flx_arun_exe, )
def configure(ctx): """Configure Felix.""" build = config_build(ctx) host = config_host(ctx, build) target = config_target(ctx, host) # Make sure the config directories exist. #(ctx.buildroot / 'host/config').makedirs() # copy the config directory for initial config # this will be overwritten by subsequent steps if # necessary # buildsystem.copy_to(ctx, ctx.buildroot / 'host/config', Path('src/config/*.fpc').glob()) # most of these ones are actually platform independent # just do the windows EXTERN to dllexport mapping # which is controlled by compile time switches anyhow # should probably move these out of config directory # they're put in config in case there really are any # platform mods. buildsystem.copy_to(ctx, ctx.buildroot / 'host/lib/rtl', Path('src/config/target/*.hpp').glob()) buildsystem.copy_to(ctx, ctx.buildroot / 'host/lib/rtl', Path('src/config/target/*.h').glob()) types = config_call('fbuild.config.c.c99.types', target.platform, target.c.static) # this is a hack: assume we're running on Unix. # later when Erick figures out how to fix this # we'd copy the win32 subdirectory entries instead if "posix" in target.platform: print("COPYING POSIX RESOURCE DATABASE") buildsystem.copy_to(ctx, ctx.buildroot / 'host/config', Path('src/config/unix/*.fpc').glob()) if types.voidp.size == 4: print("32 bit Unix") buildsystem.copy_to(ctx, ctx.buildroot / 'host/config', Path('src/config/unix/unix32/*.fpc').glob()) else: print("64 bit Unix") buildsystem.copy_to(ctx, ctx.buildroot / 'host/config', Path('src/config/unix/unix64/*.fpc').glob()) if "linux" in target.platform: print("COPYING LINUX RESOURCE DATABASE") buildsystem.copy_to(ctx, ctx.buildroot / 'host/config', Path('src/config/linux/*.fpc').glob()) # enable this on win32 **instead** of the above to copy fpc files if "windows" in target.platform: print("COPYING WIN32 RESOURCE DATABASE") buildsystem.copy_to(ctx, ctx.buildroot / 'host/config', Path('src/config/win32/*.fpc').glob()) # enable this on solaris to clobber any fpc files # where the generic unix ones are inadequate #buildsystem.copy_to(ctx, # ctx.buildroot / 'config', Path('src/config/solaris/*.fpc').glob()) # enable this on osx to clobber any fpc files # where the generic unix ones are inadequate if 'macosx' in target.platform: print("COPYING MACOSX RESOURCE DATABASE") buildsystem.copy_to(ctx, ctx.buildroot / 'host/config', Path('src/config/macosx/*.fpc').glob()) if 'cygwin' in target.platform: print("COPYING CYWGIN (POSIX) RESOURCE DATABASE") buildsystem.copy_to(ctx, ctx.buildroot / 'host/config', Path('src/config/cygwin/*.fpc').glob()) if 'msys' in target.platform: print("COPYING MSYS RESOURCE DATABASE") buildsystem.copy_to(ctx, ctx.buildroot / 'host/config', Path('src/config/msys/*.fpc').glob()) if 'solaris' in target.platform: print("COPYING SOLARIS RESOURCE DATABASE") buildsystem.copy_to(ctx, ctx.buildroot / 'host/config', Path('src/config/solaris/*.fpc').glob()) # extract the configuration iscr = call('buildsystem.iscr.Iscr', ctx) # convert the config into something iscr can use call('buildsystem.iscr.config_iscr_config', ctx, build, host, target) # re-extract packages if any of them changed ctx.scheduler.map(iscr, (src_dir(ctx) / 'lpsrc/*.pak').glob()) # overwrite or add *.fpc files to the config directory call('buildsystem.post_config.copy_user_fpcs', ctx) # set the toolchain dst = ctx.buildroot / 'host/config/toolchain.fpc' if 'macosx' in target.platform: toolchain = "toolchain_" + hack_toolchain_name(str( target.c.static)) + "_osx" elif "windows" in target.platform: toolchain = "toolchain_msvc_win32" else: toolchain = "toolchain_" + hack_toolchain_name(str( target.c.static)) + "_linux" print("**********************************************") print("SETTING TOOLCHAIN " + toolchain) print("**********************************************") f = open(dst, "w") f.write("toolchain: " + toolchain + "\n") f.close() # make Felix representation of whole build config call('buildsystem.show_build_config.build', ctx) return Record(build=build, host=host, target=target), iscr
def build_runtime(phase): path = Path('src/re2/re2') buildsystem.copy_to(phase.ctx, phase.ctx.buildroot / "lib/rtl/re2", [ path / 're2/re2.h', path / 're2/set.h', path / 're2/stringpiece.h', path / 're2/variadic_function.h', ] ) dst = 'lib/rtl/flx_re2' srcs = [ path / 're2/bitstate.cc', path / 're2/compile.cc', path / 're2/dfa.cc', path / 're2/filtered_re2.cc', path / 're2/mimics_pcre.cc', path / 're2/nfa.cc', path / 're2/onepass.cc', path / 're2/parse.cc', path / 're2/perl_groups.cc', path / 're2/prefilter.cc', path / 're2/prefilter_tree.cc', path / 're2/prog.cc', path / 're2/re2.cc', path / 're2/regexp.cc', path / 're2/set.cc', path / 're2/simplify.cc', path / 're2/tostring.cc', path / 're2/unicode_casefold.cc', path / 're2/unicode_groups.cc', path / 'util/arena.cc', #path / 'util/benchmark.cc', path / 'util/hash.cc', #path / 'util/pcre.cc', #path / 'util/random.cc', path / 'util/rune.cc', path / 'util/stringpiece.cc', path / 'util/stringprintf.cc', path / 'util/strutil.cc', #path / 'util/thread.cc', path / 'util/valgrind.cc', ] includes = [ phase.ctx.buildroot / 'config/target', path ] macros = ['BUILD_RE2'] + (['WIN32', 'NOMINMAX'],[])[not 'win32' in phase.platform] cflags = ([], ['-Wno-sign-compare'])[not 'win32' in phase.platform] lflags = [] libs = [] external_libs = [] return Record( static=buildsystem.build_cxx_static_lib(phase, dst, srcs, includes=includes, macros=macros, cflags=cflags, libs=libs, external_libs=external_libs, lflags=lflags), shared=buildsystem.build_cxx_shared_lib(phase, dst, srcs, includes=includes, macros=macros, cflags=cflags, libs=libs, external_libs=external_libs, lflags=lflags))
def build(host_phase, target_phase): path = Path('src/flx_drivers') buildsystem.copy_to(target_phase.ctx, target_phase.ctx.buildroot / "lib/rtl/", [ path / 'flx_run.hpp', ] ) run_includes = [ target_phase.ctx.buildroot / 'config/target', 'src/exceptions', 'src/gc', 'src/judy/src', 'src/pthread', 'src/flx_async', 'src/rtl', ] arun_includes = run_includes + [ target_phase.ctx.buildroot / 'lib/rtl', 'src/demux', 'src/faio', ] + ([], ['src/demux/win'])['win32' in target_phase.platform] flx_run_static_obj = target_phase.cxx.static.compile( dst='lib/rtl/flx_run_lib', src=path / 'flx_run_lib.cpp', includes=run_includes, macros=['FLX_STATIC_LINK'], ) flx_run_static_main= target_phase.cxx.static.compile( dst='lib/rtl/flx_run_main', src=path / 'flx_run_main.cxx', includes=run_includes, macros=['FLX_STATIC_LINK'], ) flx_run_exe = target_phase.cxx.shared.build_exe( dst='bin/flx_run', srcs=[path / 'flx_run_main.cxx', path / 'flx_run_lib.cpp'], includes=run_includes, libs=[call('buildsystem.flx_rtl.build_runtime', host_phase, target_phase).shared], ) flx_arun_static_obj = target_phase.cxx.static.compile( dst='lib/rtl/flx_arun_lib', src=path / 'flx_arun_lib.cpp', includes=arun_includes, macros=['FLX_STATIC_LINK'], ) flx_arun_static_main= target_phase.cxx.static.compile( dst='lib/rtl/flx_arun_main', src=path / 'flx_arun_main.cxx', includes=arun_includes, macros=['FLX_STATIC_LINK'], ) flx_arun_exe = target_phase.cxx.shared.build_exe( dst='bin/flx_arun', srcs=[path / 'flx_arun_main.cxx', path/ 'flx_arun_lib.cpp'], includes=arun_includes, libs=[ call('buildsystem.flx_rtl.build_runtime', host_phase, target_phase).shared, call('buildsystem.flx_pthread.build_runtime', target_phase).shared, call('buildsystem.flx_async.build_runtime', host_phase,target_phase).shared, call('buildsystem.demux.build_runtime', target_phase).shared, call('buildsystem.faio.build_runtime', host_phase,target_phase).shared], ) return Record( flx_run_lib=flx_run_static_obj, flx_run_main=flx_run_static_main, flx_run_exe=flx_run_exe, flx_arun_lib=flx_arun_static_obj, flx_arun_main=flx_arun_static_main, flx_arun_exe=flx_arun_exe, )
def build_flx(phase): buildsystem.copy_to(phase.ctx, phase.ctx.buildroot / "lib/sqlite3", Path("src/sqlite3/*.flx").glob())
def configure(ctx): """Configure Felix.""" build = config_build(ctx) host = config_host(ctx, build) target = config_target(ctx, host) # Make sure the config directories exist. (ctx.buildroot / 'config/build').makedirs() (ctx.buildroot / 'config/host').makedirs() (ctx.buildroot / 'config/target').makedirs() # copy the config directory for initial config # this will be overwritten by subsequent steps if # necessary # buildsystem.copy_dir_to(ctx, ctx.buildroot, 'src/config', pattern='*.fpc') # most of these ones are actually platform independent # just do the windows EXTERN to dllexport mapping # which is controlled by compile time switches anyhow # should probably move these out of config directory # they're put in config in case there really are any # platform mods. buildsystem.copy_to(ctx, ctx.buildroot/'config/target', Path('src/config/target/*.hpp').glob()) # this is a hack: assume we're running on Unix. # later when Erick figures out how to fix this # we'd copy the win32 subdirectory entries instead buildsystem.copy_to(ctx, ctx.buildroot / 'config', Path('src/config/unix/*.fpc').glob()) # enable this on win32 **instead** of the above to copy fpc files #buildsystem.copy_to(ctx, # ctx.buildroot / 'config', Path('src/config/win32/*.fpc').glob()) # enable this on solaris to clobber any fpc files # where the generic unix ones are inadequate #buildsystem.copy_to(ctx, # ctx.buildroot / 'config', Path('src/config/solaris/*.fpc').glob()) # enable this on osx to clobber any fpc files # where the generic unix ones are inadequate if 'macosx' in target.platform: buildsystem.copy_to(ctx, ctx.buildroot / 'config', Path('src/config/macosx/*.fpc').glob()) # extract the configuration iscr = call('buildsystem.iscr.Iscr', ctx) # convert the config into something iscr can use call('buildsystem.iscr.config_iscr_config', ctx, build, host, target) # re-extract packages if any of them changed ctx.scheduler.map(iscr, (src_dir(ctx)/'lpsrc/*.pak').glob()) # overwrite or add *.fpc files to the config directory call('buildsystem.post_config.copy_user_fpcs', ctx) # make Felix representation of whole build config call('buildsystem.show_build_config.build',ctx) return Record(build=build, host=host, target=target), iscr
def configure(ctx): """Configure Felix.""" build = config_build(ctx) host = config_host(ctx, build) target = config_target(ctx, host) # Make sure the config directories exist. #(ctx.buildroot / 'host/config').makedirs() # copy the config directory for initial config # this will be overwritten by subsequent steps if # necessary # buildsystem.copy_to(ctx, ctx.buildroot/'host/config', Path('src/config/*.fpc').glob()) # most of these ones are actually platform independent # just do the windows EXTERN to dllexport mapping # which is controlled by compile time switches anyhow # should probably move these out of config directory # they're put in config in case there really are any # platform mods. buildsystem.copy_to(ctx, ctx.buildroot/'host/lib/rtl', Path('src/config/target/*.hpp').glob()) buildsystem.copy_to(ctx, ctx.buildroot/'host/lib/rtl', Path('src/config/target/*.h').glob()) types = config_call('fbuild.config.c.c99.types', target.platform, target.c.static) # this is a hack: assume we're running on Unix. # later when Erick figures out how to fix this # we'd copy the win32 subdirectory entries instead if "posix" in target.platform: print("COPYING POSIX RESOURCE DATABASE") buildsystem.copy_to(ctx, ctx.buildroot / 'host/config', Path('src/config/unix/*.fpc').glob()) if types.voidp.size == 4: print("32 bit Unix") buildsystem.copy_to(ctx, ctx.buildroot / 'host/config', Path('src/config/unix/unix32/*.fpc').glob()) else: print("64 bit Unix") buildsystem.copy_to(ctx, ctx.buildroot / 'host/config', Path('src/config/unix/unix64/*.fpc').glob()) if "linux" in target.platform: print("COPYING LINUX RESOURCE DATABASE") buildsystem.copy_to(ctx, ctx.buildroot / 'host/config', Path('src/config/linux/*.fpc').glob()) # enable this on win32 **instead** of the above to copy fpc files if "windows" in target.platform: print("COPYING WIN32 RESOURCE DATABASE") buildsystem.copy_to(ctx, ctx.buildroot / 'host/config', Path('src/config/win32/*.fpc').glob()) # enable this on solaris to clobber any fpc files # where the generic unix ones are inadequate #buildsystem.copy_to(ctx, # ctx.buildroot / 'config', Path('src/config/solaris/*.fpc').glob()) # enable this on osx to clobber any fpc files # where the generic unix ones are inadequate if 'macosx' in target.platform: print("COPYING MACOSX RESOURCE DATABASE") buildsystem.copy_to(ctx, ctx.buildroot / 'host/config', Path('src/config/macosx/*.fpc').glob()) if 'cygwin' in target.platform: print("COPYING CYWGIN (POSIX) RESOURCE DATABASE") buildsystem.copy_to(ctx, ctx.buildroot / 'host/config', Path('src/config/cygwin/*.fpc').glob()) if 'msys' in target.platform: print("COPYING MSYS RESOURCE DATABASE") buildsystem.copy_to(ctx, ctx.buildroot / 'host/config', Path('src/config/msys/*.fpc').glob()) if 'solaris' in target.platform: print("COPYING SOLARIS RESOURCE DATABASE") buildsystem.copy_to(ctx, ctx.buildroot / 'host/config', Path('src/config/solaris/*.fpc').glob()) # extract the configuration iscr = call('buildsystem.iscr.Iscr', ctx) # convert the config into something iscr can use call('buildsystem.iscr.config_iscr_config', ctx, build, host, target) # re-extract packages if any of them changed ctx.scheduler.map(iscr, (src_dir(ctx)/'lpsrc/*.pak').glob()) # overwrite or add *.fpc files to the config directory call('buildsystem.post_config.copy_user_fpcs', ctx) # set the toolchain dst = ctx.buildroot / 'host/config/toolchain.fpc' if 'macosx' in target.platform: toolchain = "toolchain_"+hack_toolchain_name(str(target.c.static))+"_osx" elif "windows" in target.platform: toolchain= "toolchain_msvc_win32" else: toolchain = "toolchain_"+hack_toolchain_name(str(target.c.static))+"_linux" print("**********************************************") print("SETTING TOOLCHAIN " + toolchain) print("**********************************************") f = open(dst,"w") f.write ("toolchain: "+toolchain+"\n") f.close() # make Felix representation of whole build config call('buildsystem.show_build_config.build',ctx) return Record(build=build, host=host, target=target), iscr
def build_runtime(phase): path = Path('src/re2/re2') buildsystem.copy_to(phase.ctx, phase.ctx.buildroot / "share/lib/rtl/re2", [ path / 're2/re2.h', path / 're2/set.h', path / 're2/stringpiece.h', path / 're2/variadic_function.h', ]) dst = 'host/lib/rtl/flx_re2' srcs = [ path / 're2/bitstate.cc', path / 're2/compile.cc', path / 're2/dfa.cc', path / 're2/filtered_re2.cc', path / 're2/mimics_pcre.cc', path / 're2/nfa.cc', path / 're2/onepass.cc', path / 're2/parse.cc', path / 're2/perl_groups.cc', path / 're2/prefilter.cc', path / 're2/prefilter_tree.cc', path / 're2/prog.cc', path / 're2/re2.cc', path / 're2/regexp.cc', path / 're2/set.cc', path / 're2/simplify.cc', path / 're2/tostring.cc', path / 're2/unicode_casefold.cc', path / 're2/unicode_groups.cc', path / 'util/arena.cc', #path / 'util/benchmark.cc', path / 'util/hash.cc', #path / 'util/pcre.cc', #path / 'util/random.cc', path / 'util/rune.cc', path / 'util/stringpiece.cc', path / 'util/stringprintf.cc', path / 'util/strutil.cc', #path / 'util/thread.cc', path / 'util/valgrind.cc', ] includes = [phase.ctx.buildroot / 'host/lib/rtl', path] macros = ['BUILD_RE2'] + (['WIN32', 'NOMINMAX' ], [])[not 'win32' in phase.platform] cflags = ([], ['-Wno-sign-compare'])[not 'win32' in phase.platform] lflags = [] libs = [] external_libs = [] return Record( static=buildsystem.build_cxx_static_lib(phase, dst, srcs, includes=includes, macros=macros, cflags=cflags, libs=libs, external_libs=external_libs, lflags=lflags), shared=buildsystem.build_cxx_shared_lib(phase, dst, srcs, includes=includes, macros=macros, cflags=cflags, libs=libs, external_libs=external_libs, lflags=lflags))