SCsub 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/usr/bin/env python
  2. Import('env')
  3. env.core_sources = []
  4. gd_call = ""
  5. gd_inc = ""
  6. for x in env.global_defaults:
  7. env.core_sources.append("#platform/" + x + "/globals/global_defaults.cpp")
  8. gd_inc += '#include "platform/' + x + '/globals/global_defaults.h"\n'
  9. gd_call += "\tregister_" + x + "_global_defaults();\n"
  10. gd_cpp = '#include "globals.h"\n'
  11. gd_cpp += gd_inc
  12. gd_cpp += "void GlobalConfig::register_global_defaults() {\n" + gd_call + "\n}\n"
  13. f = open("global_defaults.cpp", "wb")
  14. f.write(gd_cpp)
  15. f.close()
  16. import os
  17. 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"
  18. if ("SCRIPT_AES256_ENCRYPTION_KEY" in os.environ):
  19. e = os.environ["SCRIPT_AES256_ENCRYPTION_KEY"]
  20. txt = ""
  21. ec_valid = True
  22. if (len(e) != 64):
  23. ec_valid = False
  24. else:
  25. for i in range(len(e) >> 1):
  26. if (i > 0):
  27. txt += ","
  28. txts = "0x" + e[i * 2:i * 2 + 2]
  29. try:
  30. int(txts, 16)
  31. except:
  32. ec_valid = False
  33. txt += txts
  34. if (not ec_valid):
  35. 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"
  36. print("Invalid AES256 encryption key, not 64 bits hex: " + e)
  37. f = open("script_encryption_key.cpp", "wb")
  38. f.write("#include \"globals.h\"\nuint8_t script_encryption_key[32]={" + txt + "};\n")
  39. f.close()
  40. env.add_source_files(env.core_sources, "*.cpp")
  41. Export('env')
  42. import make_binders
  43. env.Command(['method_bind.inc', 'method_bind_ext.inc'], 'make_binders.py', make_binders.run)
  44. SConscript('os/SCsub')
  45. SConscript('math/SCsub')
  46. SConscript('io/SCsub')
  47. SConscript('bind/SCsub')
  48. lib = env.Library("core", env.core_sources)
  49. env.Prepend(LIBS=[lib])