SCsub 1.5 KB

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