diff options
Diffstat (limited to 'core/SCsub')
-rw-r--r-- | core/SCsub | 111 |
1 files changed, 62 insertions, 49 deletions
diff --git a/core/SCsub b/core/SCsub index ca003ce931..0ab4f11d87 100644 --- a/core/SCsub +++ b/core/SCsub @@ -1,6 +1,6 @@ #!/usr/bin/env python -Import('env') +Import("env") import core_builders import make_binders @@ -11,31 +11,32 @@ env.core_sources = [] # Generate AES256 script encryption key import os + txt = "0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0" -if ("SCRIPT_AES256_ENCRYPTION_KEY" in os.environ): +if "SCRIPT_AES256_ENCRYPTION_KEY" in os.environ: e = os.environ["SCRIPT_AES256_ENCRYPTION_KEY"] txt = "" ec_valid = True - if (len(e) != 64): + if len(e) != 64: ec_valid = False else: for i in range(len(e) >> 1): - if (i > 0): + if i > 0: txt += "," - txts = "0x" + e[i * 2:i * 2 + 2] + txts = "0x" + e[i * 2 : i * 2 + 2] try: int(txts, 16) except: ec_valid = False txt += txts - if (not ec_valid): + if not ec_valid: txt = "0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0" print("Invalid AES256 encryption key, not 64 bits hex: " + e) # NOTE: It is safe to generate this file here, since this is still executed serially with open("script_encryption_key.gen.cpp", "w") as f: - f.write("#include \"core/project_settings.h\"\nuint8_t script_encryption_key[32]={" + txt + "};\n") + f.write('#include "core/project_settings.h"\nuint8_t script_encryption_key[32]={' + txt + "};\n") # Add required thirdparty code. @@ -49,7 +50,6 @@ thirdparty_misc_sources = [ # C sources "fastlz.c", "smaz.c", - # C++ sources "hq2x.cpp", "pcg.cpp", @@ -60,30 +60,30 @@ thirdparty_misc_sources = [thirdparty_misc_dir + file for file in thirdparty_mis env_thirdparty.add_source_files(env.core_sources, thirdparty_misc_sources) # Zlib library, can be unbundled -if env['builtin_zlib']: - thirdparty_zlib_dir = "#thirdparty/zlib/" - thirdparty_zlib_sources = [ - "adler32.c", - "compress.c", - "crc32.c", - "deflate.c", - "infback.c", - "inffast.c", - "inflate.c", - "inftrees.c", - "trees.c", - "uncompr.c", - "zutil.c", - ] - thirdparty_zlib_sources = [thirdparty_zlib_dir + file for file in thirdparty_zlib_sources] - - env_thirdparty.Prepend(CPPPATH=[thirdparty_zlib_dir]) - # Needs to be available in main env too - env.Prepend(CPPPATH=[thirdparty_zlib_dir]) - if (env['target'] == 'debug'): - env_thirdparty.Append(CPPDEFINES=['ZLIB_DEBUG']) - - env_thirdparty.add_source_files(env.core_sources, thirdparty_zlib_sources) +if env["builtin_zlib"]: + thirdparty_zlib_dir = "#thirdparty/zlib/" + thirdparty_zlib_sources = [ + "adler32.c", + "compress.c", + "crc32.c", + "deflate.c", + "infback.c", + "inffast.c", + "inflate.c", + "inftrees.c", + "trees.c", + "uncompr.c", + "zutil.c", + ] + thirdparty_zlib_sources = [thirdparty_zlib_dir + file for file in thirdparty_zlib_sources] + + env_thirdparty.Prepend(CPPPATH=[thirdparty_zlib_dir]) + # Needs to be available in main env too + env.Prepend(CPPPATH=[thirdparty_zlib_dir]) + if env["target"] == "debug": + env_thirdparty.Append(CPPDEFINES=["ZLIB_DEBUG"]) + + env_thirdparty.add_source_files(env.core_sources, thirdparty_zlib_sources) # Minizip library, could be unbundled in theory # However, our version has some custom modifications, so it won't compile with the system one @@ -99,7 +99,7 @@ env_thirdparty.add_source_files(env.core_sources, thirdparty_minizip_sources) # Zstd library, can be unbundled in theory # though we currently use some private symbols # https://github.com/godotengine/godot/issues/17374 -if env['builtin_zstd']: +if env["builtin_zstd"]: thirdparty_zstd_dir = "#thirdparty/zstd/" thirdparty_zstd_sources = [ "common/debug.c", @@ -142,32 +142,45 @@ if env['builtin_zstd']: env.add_source_files(env.core_sources, "*.cpp") # Certificates -env.Depends("#core/io/certs_compressed.gen.h", ["#thirdparty/certs/ca-certificates.crt", env.Value(env['builtin_certs']), env.Value(env['system_certs_path'])]) -env.CommandNoCache("#core/io/certs_compressed.gen.h", "#thirdparty/certs/ca-certificates.crt", run_in_subprocess(core_builders.make_certs_header)) +env.Depends( + "#core/io/certs_compressed.gen.h", + ["#thirdparty/certs/ca-certificates.crt", env.Value(env["builtin_certs"]), env.Value(env["system_certs_path"])], +) +env.CommandNoCache( + "#core/io/certs_compressed.gen.h", + "#thirdparty/certs/ca-certificates.crt", + run_in_subprocess(core_builders.make_certs_header), +) # Make binders -env.CommandNoCache(['method_bind.gen.inc', 'method_bind_ext.gen.inc', 'method_bind_free_func.gen.inc'], 'make_binders.py', run_in_subprocess(make_binders.run)) +env.CommandNoCache( + ["method_bind.gen.inc", "method_bind_ext.gen.inc", "method_bind_free_func.gen.inc"], + "make_binders.py", + run_in_subprocess(make_binders.run), +) # Authors -env.Depends('#core/authors.gen.h', "../AUTHORS.md") -env.CommandNoCache('#core/authors.gen.h', "../AUTHORS.md", run_in_subprocess(core_builders.make_authors_header)) +env.Depends("#core/authors.gen.h", "../AUTHORS.md") +env.CommandNoCache("#core/authors.gen.h", "../AUTHORS.md", run_in_subprocess(core_builders.make_authors_header)) # Donors -env.Depends('#core/donors.gen.h', "../DONORS.md") -env.CommandNoCache('#core/donors.gen.h', "../DONORS.md", run_in_subprocess(core_builders.make_donors_header)) +env.Depends("#core/donors.gen.h", "../DONORS.md") +env.CommandNoCache("#core/donors.gen.h", "../DONORS.md", run_in_subprocess(core_builders.make_donors_header)) # License -env.Depends('#core/license.gen.h', ["../COPYRIGHT.txt", "../LICENSE.txt"]) -env.CommandNoCache('#core/license.gen.h', ["../COPYRIGHT.txt", "../LICENSE.txt"], run_in_subprocess(core_builders.make_license_header)) +env.Depends("#core/license.gen.h", ["../COPYRIGHT.txt", "../LICENSE.txt"]) +env.CommandNoCache( + "#core/license.gen.h", ["../COPYRIGHT.txt", "../LICENSE.txt"], run_in_subprocess(core_builders.make_license_header) +) # Chain load SCsubs -SConscript('os/SCsub') -SConscript('math/SCsub') -SConscript('crypto/SCsub') -SConscript('io/SCsub') -SConscript('debugger/SCsub') -SConscript('input/SCsub') -SConscript('bind/SCsub') +SConscript("os/SCsub") +SConscript("math/SCsub") +SConscript("crypto/SCsub") +SConscript("io/SCsub") +SConscript("debugger/SCsub") +SConscript("input/SCsub") +SConscript("bind/SCsub") # Build it all as a library |