Browse Source

Merge pull request #6985 from akien-mga/python-pep8

Apply PEP8 to all python files using autopep8
Rémi Verschelde 8 years ago
parent
commit
7e3aa4bd5e
100 changed files with 6348 additions and 6407 deletions
  1. 308 313
      SConstruct
  2. 1 1
      bin/SCsub
  3. 4 4
      bin/tests/SCsub
  4. 36 36
      core/SCsub
  5. 1 1
      core/bind/SCsub
  6. 3 3
      core/io/SCsub
  7. 90 91
      core/make_binders.py
  8. 1 1
      core/math/SCsub
  9. 1 1
      core/os/SCsub
  10. 160 156
      doc/tools/doc_merge.py
  11. 270 273
      doc/tools/doc_status.py
  12. 264 279
      doc/tools/makedoku.py
  13. 554 583
      doc/tools/makehtml.py
  14. 290 291
      doc/tools/makemd.py
  15. 457 459
      doc/tools/makerst.py
  16. 19 19
      drivers/SCsub
  17. 12 12
      drivers/gl_context/SCsub
  18. 5 5
      drivers/gles2/shaders/SCsub
  19. 35 35
      drivers/png/SCsub
  20. 2 2
      drivers/rtaudio/SCsub
  21. 7 7
      drivers/unix/SCsub
  22. 12 12
      drivers/zlib/SCsub
  23. 3 3
      main/SCsub
  24. 723 745
      methods.py
  25. 8 8
      modules/SCsub
  26. 3 2
      modules/chibi/config.py
  27. 2 5
      modules/cscript/config.py
  28. 3 2
      modules/dds/config.py
  29. 16 16
      modules/enet/SCsub
  30. 3 2
      modules/enet/config.py
  31. 2 2
      modules/etc1/SCsub
  32. 3 2
      modules/etc1/config.py
  33. 59 59
      modules/freetype/SCsub
  34. 3 2
      modules/freetype/config.py
  35. 2 5
      modules/gdscript/config.py
  36. 2 5
      modules/gridmap/config.py
  37. 4 7
      modules/ik/config.py
  38. 2 2
      modules/jpg/SCsub
  39. 3 2
      modules/jpg/config.py
  40. 15 15
      modules/mpc/SCsub
  41. 3 2
      modules/mpc/config.py
  42. 9 9
      modules/ogg/SCsub
  43. 3 2
      modules/ogg/config.py
  44. 660 660
      modules/openssl/SCsub
  45. 3 2
      modules/openssl/config.py
  46. 197 197
      modules/opus/SCsub
  47. 3 2
      modules/opus/config.py
  48. 3 2
      modules/pbm/config.py
  49. 6 6
      modules/pvr/SCsub
  50. 3 2
      modules/pvr/config.py
  51. 2 1
      modules/regex/config.py
  52. 16 16
      modules/squish/SCsub
  53. 7 6
      modules/squish/config.py
  54. 64 64
      modules/theora/SCsub
  55. 3 2
      modules/theora/config.py
  56. 2 5
      modules/visual_script/config.py
  57. 35 35
      modules/vorbis/SCsub
  58. 3 2
      modules/vorbis/config.py
  59. 14 14
      modules/webm/SCsub
  60. 3 2
      modules/webm/config.py
  61. 297 297
      modules/webm/libvpx/SCsub
  62. 18 18
      modules/webm/libvpx/yasm_osx_fat.py
  63. 109 109
      modules/webp/SCsub
  64. 3 2
      modules/webp/config.py
  65. 66 66
      platform/android/SCsub
  66. 215 212
      platform/android/detect.py
  67. 7 7
      platform/bb10/SCsub
  68. 61 57
      platform/bb10/detect.py
  69. 13 12
      platform/haiku/SCsub
  70. 51 45
      platform/haiku/detect.py
  71. 18 18
      platform/iphone/SCsub
  72. 171 168
      platform/iphone/detect.py
  73. 20 20
      platform/javascript/SCsub
  74. 73 69
      platform/javascript/detect.py
  75. 9 9
      platform/osx/SCsub
  76. 62 64
      platform/osx/detect.py
  77. 3 3
      platform/server/SCsub
  78. 41 42
      platform/server/detect.py
  79. 16 16
      platform/windows/SCsub
  80. 270 273
      platform/windows/detect.py
  81. 11 11
      platform/winrt/SCsub
  82. 112 110
      platform/winrt/detect.py
  83. 6 6
      platform/x11/SCsub
  84. 190 194
      platform/x11/detect.py
  85. 1 1
      scene/2d/SCsub
  86. 4 4
      scene/3d/SCsub
  87. 11 11
      scene/SCsub
  88. 1 1
      scene/animation/SCsub
  89. 1 1
      scene/audio/SCsub
  90. 1 1
      scene/gui/SCsub
  91. 1 1
      scene/io/SCsub
  92. 1 1
      scene/main/SCsub
  93. 3 3
      scene/resources/SCsub
  94. 1 1
      scene/resources/default_theme/SCsub
  95. 41 42
      scene/resources/default_theme/make_header.py
  96. 9 9
      servers/SCsub
  97. 1 1
      servers/audio/SCsub
  98. 1 1
      servers/physics/SCsub
  99. 1 1
      servers/physics/joints/SCsub
  100. 1 1
      servers/physics_2d/SCsub

+ 308 - 313
SConstruct

@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #!/usr/bin/env python
 
 
-EnsureSConsVersion(0,14);
+EnsureSConsVersion(0, 14)
 
 
 
 
 import string
 import string
@@ -14,85 +14,84 @@ methods.update_version()
 
 
 # scan possible build platforms
 # scan possible build platforms
 
 
-platform_list = [] # list of platforms
-platform_opts = {} # options for each platform
-platform_flags = {} # flags for each platform
+platform_list = []  # list of platforms
+platform_opts = {}  # options for each platform
+platform_flags = {}  # flags for each platform
 
 
-active_platforms=[]
-active_platform_ids=[]
-platform_exporters=[]
-global_defaults=[]
+active_platforms = []
+active_platform_ids = []
+platform_exporters = []
+global_defaults = []
 
 
 for x in glob.glob("platform/*"):
 for x in glob.glob("platform/*"):
-	if (not os.path.isdir(x) or not os.path.exists(x+"/detect.py")):
-		continue
-	tmppath="./"+x
+    if (not os.path.isdir(x) or not os.path.exists(x + "/detect.py")):
+        continue
+    tmppath = "./" + x
 
 
-	sys.path.append(tmppath)
-	import detect
+    sys.path.append(tmppath)
+    import detect
 
 
-	if (os.path.exists(x+"/export/export.cpp")):
-		platform_exporters.append(x[9:])
-	if (os.path.exists(x+"/globals/global_defaults.cpp")):
-		global_defaults.append(x[9:])
-	if (detect.is_active()):
-		active_platforms.append( detect.get_name() )
-		active_platform_ids.append(x);
-	if (detect.can_build()):
-		x=x.replace("platform/","") # rest of world
-		x=x.replace("platform\\","") # win32
-		platform_list+=[x]
-		platform_opts[x]=detect.get_opts()
-		platform_flags[x]=detect.get_flags()
-	sys.path.remove(tmppath)
-	sys.modules.pop('detect')
+    if (os.path.exists(x + "/export/export.cpp")):
+        platform_exporters.append(x[9:])
+    if (os.path.exists(x + "/globals/global_defaults.cpp")):
+        global_defaults.append(x[9:])
+    if (detect.is_active()):
+        active_platforms.append(detect.get_name())
+        active_platform_ids.append(x)
+    if (detect.can_build()):
+        x = x.replace("platform/", "")  # rest of world
+        x = x.replace("platform\\", "")  # win32
+        platform_list += [x]
+        platform_opts[x] = detect.get_opts()
+        platform_flags[x] = detect.get_flags()
+    sys.path.remove(tmppath)
+    sys.modules.pop('detect')
 
 
-module_list=methods.detect_modules()
+module_list = methods.detect_modules()
 
 
 
 
-#print "Detected Platforms: "+str(platform_list)
+# print "Detected Platforms: "+str(platform_list)
 
 
-methods.save_active_platforms(active_platforms,active_platform_ids)
+methods.save_active_platforms(active_platforms, active_platform_ids)
 
 
-custom_tools=['default']
+custom_tools = ['default']
 
 
 platform_arg = ARGUMENTS.get("platform", ARGUMENTS.get("p", False))
 platform_arg = ARGUMENTS.get("platform", ARGUMENTS.get("p", False))
 
 
-if (os.name=="posix"):
-	pass
-elif (os.name=="nt"):
-	if ( os.getenv("VCINSTALLDIR")==None or platform_arg=="android"):
-		custom_tools=['mingw']
+if (os.name == "posix"):
+    pass
+elif (os.name == "nt"):
+    if (os.getenv("VCINSTALLDIR") == None or platform_arg == "android"):
+        custom_tools = ['mingw']
 
 
-env_base=Environment(tools=custom_tools);
+env_base = Environment(tools=custom_tools)
 if 'TERM' in os.environ:
 if 'TERM' in os.environ:
-	env_base['ENV']['TERM'] = os.environ['TERM']
+    env_base['ENV']['TERM'] = os.environ['TERM']
 env_base.AppendENVPath('PATH', os.getenv('PATH'))
 env_base.AppendENVPath('PATH', os.getenv('PATH'))
 env_base.AppendENVPath('PKG_CONFIG_PATH', os.getenv('PKG_CONFIG_PATH'))
 env_base.AppendENVPath('PKG_CONFIG_PATH', os.getenv('PKG_CONFIG_PATH'))
-env_base.global_defaults=global_defaults
-env_base.android_maven_repos=[]
-env_base.android_dependencies=[]
-env_base.android_java_dirs=[]
-env_base.android_res_dirs=[]
-env_base.android_aidl_dirs=[]
-env_base.android_jni_dirs=[]
-env_base.android_default_config=[]
-env_base.android_manifest_chunk=""
-env_base.android_permission_chunk=""
-env_base.android_appattributes_chunk=""
-env_base.disabled_modules=[]
-env_base.use_ptrcall=False
-env_base.split_drivers=False
-
-
-
-env_base.__class__.android_add_maven_repository=methods.android_add_maven_repository
-env_base.__class__.android_add_dependency=methods.android_add_dependency
-env_base.__class__.android_add_java_dir=methods.android_add_java_dir
-env_base.__class__.android_add_res_dir=methods.android_add_res_dir
-env_base.__class__.android_add_aidl_dir=methods.android_add_aidl_dir
-env_base.__class__.android_add_jni_dir=methods.android_add_jni_dir
-env_base.__class__.android_add_default_config=methods.android_add_default_config
+env_base.global_defaults = global_defaults
+env_base.android_maven_repos = []
+env_base.android_dependencies = []
+env_base.android_java_dirs = []
+env_base.android_res_dirs = []
+env_base.android_aidl_dirs = []
+env_base.android_jni_dirs = []
+env_base.android_default_config = []
+env_base.android_manifest_chunk = ""
+env_base.android_permission_chunk = ""
+env_base.android_appattributes_chunk = ""
+env_base.disabled_modules = []
+env_base.use_ptrcall = False
+env_base.split_drivers = False
+
+
+env_base.__class__.android_add_maven_repository = methods.android_add_maven_repository
+env_base.__class__.android_add_dependency = methods.android_add_dependency
+env_base.__class__.android_add_java_dir = methods.android_add_java_dir
+env_base.__class__.android_add_res_dir = methods.android_add_res_dir
+env_base.__class__.android_add_aidl_dir = methods.android_add_aidl_dir
+env_base.__class__.android_add_jni_dir = methods.android_add_jni_dir
+env_base.__class__.android_add_default_config = methods.android_add_default_config
 env_base.__class__.android_add_to_manifest = methods.android_add_to_manifest
 env_base.__class__.android_add_to_manifest = methods.android_add_to_manifest
 env_base.__class__.android_add_to_permissions = methods.android_add_to_permissions
 env_base.__class__.android_add_to_permissions = methods.android_add_to_permissions
 env_base.__class__.android_add_to_attributes = methods.android_add_to_attributes
 env_base.__class__.android_add_to_attributes = methods.android_add_to_attributes
@@ -102,75 +101,75 @@ env_base.__class__.add_source_files = methods.add_source_files
 env_base.__class__.use_windows_spawn_fix = methods.use_windows_spawn_fix
 env_base.__class__.use_windows_spawn_fix = methods.use_windows_spawn_fix
 env_base.__class__.split_lib = methods.split_lib
 env_base.__class__.split_lib = methods.split_lib
 
 
-env_base["x86_libtheora_opt_gcc"]=False
-env_base["x86_libtheora_opt_vc"]=False
+env_base["x86_libtheora_opt_gcc"] = False
+env_base["x86_libtheora_opt_vc"] = False
 
 
 customs = ['custom.py']
 customs = ['custom.py']
 
 
 profile = ARGUMENTS.get("profile", False)
 profile = ARGUMENTS.get("profile", False)
 if profile:
 if profile:
-	import os.path
-	if os.path.isfile(profile):
-		customs.append(profile)
-	elif os.path.isfile(profile+".py"):
-		customs.append(profile+".py")
+    import os.path
+    if os.path.isfile(profile):
+        customs.append(profile)
+    elif os.path.isfile(profile + ".py"):
+        customs.append(profile + ".py")
 
 
-opts=Variables(customs, ARGUMENTS)
+opts = Variables(customs, ARGUMENTS)
 opts.Add('target', 'Compile Target (debug/release_debug/release).', "debug")
 opts.Add('target', 'Compile Target (debug/release_debug/release).', "debug")
 opts.Add('arch', 'Platform dependent architecture (arm/arm64/x86/x64/mips/etc)', "")
 opts.Add('arch', 'Platform dependent architecture (arm/arm64/x86/x64/mips/etc)', "")
 opts.Add('bits', 'Compile Target Bits (default/32/64/fat).', "default")
 opts.Add('bits', 'Compile Target Bits (default/32/64/fat).', "default")
-opts.Add('platform','Platform: '+str(platform_list)+'.',"")
-opts.Add('p','Platform (same as platform=).',"")
-opts.Add('tools','Build Tools (Including Editor): (yes/no)','yes')
-opts.Add('gdscript','Build GDSCript support: (yes/no)','yes')
-opts.Add('libogg','Ogg library for ogg container support (system/builtin)','builtin')
-opts.Add('libvorbis','Ogg Vorbis library for vorbis support (system/builtin)','builtin')
-opts.Add('libtheora','Theora library for theora module (system/builtin)','builtin')
-opts.Add('libvpx','VPX library for webm module (system/builtin)','builtin')
-opts.Add('opus','Opus and opusfile library for Opus format support: (system/builtin)','builtin')
-opts.Add('minizip','Build Minizip Archive Support: (yes/no)','yes')
-opts.Add('squish','Squish library for BC Texture Compression in editor (system/builtin)','builtin')
-opts.Add('freetype','Freetype library for TTF support via freetype module (system/builtin)','builtin')
-opts.Add('xml','XML Save/Load support (yes/no)','yes')
-opts.Add('libpng','libpng library for image loader support (system/builtin)','builtin')
-opts.Add('libwebp','libwebp library for webp module (system/builtin)','builtin')
-opts.Add('openssl','OpenSSL library for openssl module (system/builtin)','builtin')
-opts.Add('libmpcdec','libmpcdec library for mpc module (system/builtin)','builtin')
-opts.Add('enet','ENet library (system/builtin)','builtin')
-opts.Add('glew','GLEW library for the gl_context (system/builtin)','builtin')
-opts.Add('xaudio2','XAudio2 audio driver (yes/no)','no')
+opts.Add('platform', 'Platform: ' + str(platform_list) + '.', "")
+opts.Add('p', 'Platform (same as platform=).', "")
+opts.Add('tools', 'Build Tools (Including Editor): (yes/no)', 'yes')
+opts.Add('gdscript', 'Build GDSCript support: (yes/no)', 'yes')
+opts.Add('libogg', 'Ogg library for ogg container support (system/builtin)', 'builtin')
+opts.Add('libvorbis', 'Ogg Vorbis library for vorbis support (system/builtin)', 'builtin')
+opts.Add('libtheora', 'Theora library for theora module (system/builtin)', 'builtin')
+opts.Add('libvpx', 'VPX library for webm module (system/builtin)', 'builtin')
+opts.Add('opus', 'Opus and opusfile library for Opus format support: (system/builtin)', 'builtin')
+opts.Add('minizip', 'Build Minizip Archive Support: (yes/no)', 'yes')
+opts.Add('squish', 'Squish library for BC Texture Compression in editor (system/builtin)', 'builtin')
+opts.Add('freetype', 'Freetype library for TTF support via freetype module (system/builtin)', 'builtin')
+opts.Add('xml', 'XML Save/Load support (yes/no)', 'yes')
+opts.Add('libpng', 'libpng library for image loader support (system/builtin)', 'builtin')
+opts.Add('libwebp', 'libwebp library for webp module (system/builtin)', 'builtin')
+opts.Add('openssl', 'OpenSSL library for openssl module (system/builtin)', 'builtin')
+opts.Add('libmpcdec', 'libmpcdec library for mpc module (system/builtin)', 'builtin')
+opts.Add('enet', 'ENet library (system/builtin)', 'builtin')
+opts.Add('glew', 'GLEW library for the gl_context (system/builtin)', 'builtin')
+opts.Add('xaudio2', 'XAudio2 audio driver (yes/no)', 'no')
 opts.Add("CXX", "C++ Compiler")
 opts.Add("CXX", "C++ Compiler")
 opts.Add("CC", "C Compiler")
 opts.Add("CC", "C Compiler")
-opts.Add("CCFLAGS", "Custom flags for the C/C++ compiler");
-opts.Add("CFLAGS", "Custom flags for the C compiler");
-opts.Add("LINKFLAGS", "Custom flags for the linker");
-opts.Add('unix_global_settings_path', 'unix-specific path to system-wide settings. Currently only used by templates.','')
+opts.Add("CCFLAGS", "Custom flags for the C/C++ compiler")
+opts.Add("CFLAGS", "Custom flags for the C compiler")
+opts.Add("LINKFLAGS", "Custom flags for the linker")
+opts.Add('unix_global_settings_path', 'unix-specific path to system-wide settings. Currently only used by templates.', '')
 opts.Add('disable_3d', 'Disable 3D nodes for smaller executable (yes/no)', "no")
 opts.Add('disable_3d', 'Disable 3D nodes for smaller executable (yes/no)', "no")
 opts.Add('disable_advanced_gui', 'Disable advance 3D gui nodes and behaviors (yes/no)', "no")
 opts.Add('disable_advanced_gui', 'Disable advance 3D gui nodes and behaviors (yes/no)', "no")
 opts.Add('verbose', 'Enable verbose output for the compilation (yes/no)', 'yes')
 opts.Add('verbose', 'Enable verbose output for the compilation (yes/no)', 'yes')
-opts.Add('deprecated','Enable deprecated features (yes/no)','yes')
+opts.Add('deprecated', 'Enable deprecated features (yes/no)', 'yes')
 opts.Add('extra_suffix', 'Custom extra suffix added to the base filename of all generated binary files.', '')
 opts.Add('extra_suffix', 'Custom extra suffix added to the base filename of all generated binary files.', '')
 opts.Add('vsproj', 'Generate Visual Studio Project. (yes/no)', 'no')
 opts.Add('vsproj', 'Generate Visual Studio Project. (yes/no)', 'no')
 
 
 # add platform specific options
 # add platform specific options
 
 
 for k in platform_opts.keys():
 for k in platform_opts.keys():
-	opt_list = platform_opts[k]
-	for o in opt_list:
-		opts.Add(o[0],o[1],o[2])
+    opt_list = platform_opts[k]
+    for o in opt_list:
+        opts.Add(o[0], o[1], o[2])
 
 
 for x in module_list:
 for x in module_list:
-	opts.Add('module_'+x+'_enabled', "Enable module '"+x+"' (yes/no)", "yes")
+    opts.Add('module_' + x + '_enabled', "Enable module '" + x + "' (yes/no)", "yes")
 
 
-opts.Update(env_base) # update environment
-Help(opts.GenerateHelpText(env_base)) # generate help
+opts.Update(env_base)  # update environment
+Help(opts.GenerateHelpText(env_base))  # generate help
 
 
 # add default include paths
 # add default include paths
 
 
-env_base.Append(CPPPATH=['#core','#core/math','#tools','#drivers','#'])
+env_base.Append(CPPPATH=['#core', '#core/math', '#tools', '#drivers', '#'])
 
 
 # configure ENV for platform
 # configure ENV for platform
-env_base.platform_exporters=platform_exporters
+env_base.platform_exporters = platform_exporters
 
 
 """
 """
 sys.path.append("./platform/"+env_base["platform"])
 sys.path.append("./platform/"+env_base["platform"])
@@ -180,227 +179,223 @@ sys.path.remove("./platform/"+env_base["platform"])
 sys.modules.pop('detect')
 sys.modules.pop('detect')
 """
 """
 
 
-if (env_base['target']=='debug'):
-	env_base.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC']);
-	env_base.Append(CPPFLAGS=['-DSCI_NAMESPACE'])
+if (env_base['target'] == 'debug'):
+    env_base.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC'])
+    env_base.Append(CPPFLAGS=['-DSCI_NAMESPACE'])
 
 
-if (env_base['deprecated']!='no'):
-	env_base.Append(CPPFLAGS=['-DENABLE_DEPRECATED']);
+if (env_base['deprecated'] != 'no'):
+    env_base.Append(CPPFLAGS=['-DENABLE_DEPRECATED'])
 
 
 env_base.platforms = {}
 env_base.platforms = {}
 
 
 
 
-selected_platform =""
+selected_platform = ""
 
 
 if env_base['platform'] != "":
 if env_base['platform'] != "":
-	selected_platform=env_base['platform']
+    selected_platform = env_base['platform']
 elif env_base['p'] != "":
 elif env_base['p'] != "":
-	selected_platform=env_base['p']
-	env_base["platform"]=selected_platform
-
+    selected_platform = env_base['p']
+    env_base["platform"] = selected_platform
 
 
 
 
 if selected_platform in platform_list:
 if selected_platform in platform_list:
 
 
-	sys.path.append("./platform/"+selected_platform)
-	import detect
-	if "create" in dir(detect):
-		env = detect.create(env_base)
-	else:
-		env = env_base.Clone()
-
-	if env['vsproj']=="yes":
-		env.vs_incs = []
-		env.vs_srcs = []
-
-		def AddToVSProject( sources ):
-			for x in sources:
-				if type(x) == type(""):
-					fname = env.File(x).path
-				else:
-					fname = env.File(x)[0].path
-				pieces =  fname.split(".")
-				if len(pieces)>0:
-					basename = pieces[0]
-					basename = basename.replace('\\\\','/')
-					env.vs_srcs = env.vs_srcs + [basename + ".cpp"]
-					env.vs_incs = env.vs_incs + [basename + ".h"]
-					#print basename
-		env.AddToVSProject = AddToVSProject
-
-	env.extra_suffix=""
-
-	if env["extra_suffix"] != '' :
-		env.extra_suffix += '.'+env["extra_suffix"]
-
-	CCFLAGS = env.get('CCFLAGS', '')
-	env['CCFLAGS'] = ''
-
-	env.Append(CCFLAGS=string.split(str(CCFLAGS)))
-
-	CFLAGS = env.get('CFLAGS', '')
-	env['CFLAGS'] = ''
-
-	env.Append(CFLAGS=string.split(str(CFLAGS)))
-
-	LINKFLAGS = env.get('LINKFLAGS', '')
-	env['LINKFLAGS'] = ''
-
-	env.Append(LINKFLAGS=string.split(str(LINKFLAGS)))
-
-	flag_list = platform_flags[selected_platform]
-	for f in flag_list:
-		if not (f[0] in ARGUMENTS): # allow command line to override platform flags
-			env[f[0]] = f[1]
-
-	#must happen after the flags, so when flags are used by configure, stuff happens (ie, ssl on x11)
-	detect.configure(env)
-
-	#env['platform_libsuffix'] = env['LIBSUFFIX']
-
-	suffix="."+selected_platform
-
-	if (env["target"]=="release"):
-		if (env["tools"]=="yes"):
-			print("Tools can only be built with targets 'debug' and 'release_debug'.")
-			sys.exit(255)
-		suffix+=".opt"
-
-		env.Append(CCFLAGS=['-DNDEBUG']);
-
-	elif (env["target"]=="release_debug"):
-		if (env["tools"]=="yes"):
-			suffix+=".opt.tools"
-		else:
-			suffix+=".opt.debug"
-	else:
-		if (env["tools"]=="yes"):
-			suffix+=".tools"
-		else:
-			suffix+=".debug"
-
-	if env["arch"] != "":
-		suffix += "."+env["arch"]
-	elif (env["bits"]=="32"):
-		suffix+=".32"
-	elif (env["bits"]=="64"):
-		suffix+=".64"
-	elif (env["bits"]=="fat"):
-		suffix+=".fat"
-
-	suffix+=env.extra_suffix
-
-	env["PROGSUFFIX"]=suffix+env["PROGSUFFIX"]
-	env["OBJSUFFIX"]=suffix+env["OBJSUFFIX"]
-	env["LIBSUFFIX"]=suffix+env["LIBSUFFIX"]
-	env["SHLIBSUFFIX"]=suffix+env["SHLIBSUFFIX"]
-
-	sys.path.remove("./platform/"+selected_platform)
-	sys.modules.pop('detect')
-
-
-	env.module_list=[]
-
-	for x in module_list:
-		if env['module_'+x+'_enabled'] != "yes":
-			continue
-		tmppath="./modules/"+x
-		sys.path.append(tmppath)
-		env.current_module=x
-		import config
-		if (config.can_build(selected_platform)):
-			config.configure(env)
-			env.module_list.append(x)
-		sys.path.remove(tmppath)
-		sys.modules.pop('config')
-
-
-	if (env.use_ptrcall):
-		env.Append(CPPFLAGS=['-DPTRCALL_ENABLED']);
-
-	# to test 64 bits compiltion
-	# env.Append(CPPFLAGS=['-m64'])
-
-	if (env['tools']=='yes'):
-		env.Append(CPPFLAGS=['-DTOOLS_ENABLED'])
-	if (env['disable_3d']=='yes'):
-		env.Append(CPPFLAGS=['-D_3D_DISABLED'])
-	if (env['gdscript']=='yes'):
-		env.Append(CPPFLAGS=['-DGDSCRIPT_ENABLED'])
-	if (env['disable_advanced_gui']=='yes'):
-		env.Append(CPPFLAGS=['-DADVANCED_GUI_DISABLED'])
-
-	if (env['minizip'] == 'yes'):
-		env.Append(CPPFLAGS=['-DMINIZIP_ENABLED'])
-
-	if (env['xml']=='yes'):
-		env.Append(CPPFLAGS=['-DXML_ENABLED'])
-
-	if (env['verbose']=='no'):
-		methods.no_verbose(sys,env)
-
-	Export('env')
-
-	#build subdirs, the build order is dependent on link order.
-
-	SConscript("core/SCsub")
-	SConscript("servers/SCsub")
-	SConscript("scene/SCsub")
-	SConscript("tools/SCsub")
-	SConscript("drivers/SCsub")
-	SConscript("bin/SCsub")
-
-	SConscript("modules/SCsub")
-	SConscript("main/SCsub")
-
-	SConscript("platform/"+selected_platform+"/SCsub"); # build selected platform
-
-	# Microsoft Visual Studio Project Generation
-	if (env['vsproj'])=="yes":
-
-		AddToVSProject(env.core_sources)
-		AddToVSProject(env.main_sources)
-		AddToVSProject(env.modules_sources)
-		AddToVSProject(env.scene_sources)
-		AddToVSProject(env.servers_sources)
-		AddToVSProject(env.tool_sources)
-
-		# this env flag won't work, it needs to be set in env_base=Environment(MSVC_VERSION='9.0')
-		# Even then, SCons still seems to ignore it and builds with the latest MSVC...
-		# That said, it's not needed to be set so far but I'm leaving it here so that this comment
-		# has a purpose.
-		#env['MSVS_VERSION']='9.0'
-		
-		
-		# Calls a CMD with /C(lose) and /V(delayed environment variable expansion) options.
-		# And runs vcvarsall bat for the propper arhitecture and scons for propper configuration
-		env['MSVSBUILDCOM'] = 'cmd /V /C set "plat=$(PlatformTarget)" ^& (if "$(PlatformTarget)"=="x64" (set "plat=x86_amd64")) ^& set "tools=yes" ^& (if "$(Configuration)"=="release" (set "tools=no")) ^& call "$(VCInstallDir)vcvarsall.bat" !plat! ^& scons platform=windows target=$(Configuration) tools=!tools! -j2'
-		env['MSVSREBUILDCOM'] = 'cmd /V /C set "plat=$(PlatformTarget)" ^& (if "$(PlatformTarget)"=="x64" (set "plat=x86_amd64")) ^& set "tools=yes" ^& (if "$(Configuration)"=="release" (set "tools=no")) & call "$(VCInstallDir)vcvarsall.bat" !plat! ^& scons platform=windows target=$(Configuration) tools=!tools! vsproj=yes -j2'
-		env['MSVSCLEANCOM'] = 'cmd /V /C set "plat=$(PlatformTarget)" ^& (if "$(PlatformTarget)"=="x64" (set "plat=x86_amd64")) ^& set "tools=yes" ^& (if "$(Configuration)"=="release" (set "tools=no")) ^& call "$(VCInstallDir)vcvarsall.bat" !plat! ^& scons --clean platform=windows target=$(Configuration) tools=!tools! -j2'
-		
-		# This version information (Win32, x64, Debug, Release, Release_Debug seems to be
-		# required for Visual Studio to understand that it needs to generate an NMAKE
-		# project. Do not modify without knowing what you are doing.
-		debug_variants = ['debug|Win32']+['debug|x64']
-		release_variants = ['release|Win32']+['release|x64']
-		release_debug_variants = ['release_debug|Win32']+['release_debug|x64']
-		variants = debug_variants + release_variants + release_debug_variants
-		debug_targets = ['bin\\godot.windows.tools.32.exe']+['bin\\godot.windows.tools.64.exe']
-		release_targets = ['bin\\godot.windows.opt.32.exe']+['bin\\godot.windows.opt.64.exe']
-		release_debug_targets = ['bin\\godot.windows.opt.tools.32.exe']+['bin\\godot.windows.opt.tools.64.exe']
-		targets = debug_targets + release_targets + release_debug_targets
-		msvproj = env.MSVSProject(target = ['#godot' + env['MSVSPROJECTSUFFIX'] ],
-								incs = env.vs_incs,
-								srcs = env.vs_srcs,
-								runfile = targets,
-								buildtarget = targets,
-								auto_build_solution=1,
-								variant = variants)
+    sys.path.append("./platform/" + selected_platform)
+    import detect
+    if "create" in dir(detect):
+        env = detect.create(env_base)
+    else:
+        env = env_base.Clone()
+
+    if env['vsproj'] == "yes":
+        env.vs_incs = []
+        env.vs_srcs = []
+
+        def AddToVSProject(sources):
+            for x in sources:
+                if type(x) == type(""):
+                    fname = env.File(x).path
+                else:
+                    fname = env.File(x)[0].path
+                pieces = fname.split(".")
+                if len(pieces) > 0:
+                    basename = pieces[0]
+                    basename = basename.replace('\\\\', '/')
+                    env.vs_srcs = env.vs_srcs + [basename + ".cpp"]
+                    env.vs_incs = env.vs_incs + [basename + ".h"]
+                    # print basename
+        env.AddToVSProject = AddToVSProject
+
+    env.extra_suffix = ""
+
+    if env["extra_suffix"] != '':
+        env.extra_suffix += '.' + env["extra_suffix"]
+
+    CCFLAGS = env.get('CCFLAGS', '')
+    env['CCFLAGS'] = ''
+
+    env.Append(CCFLAGS=string.split(str(CCFLAGS)))
+
+    CFLAGS = env.get('CFLAGS', '')
+    env['CFLAGS'] = ''
+
+    env.Append(CFLAGS=string.split(str(CFLAGS)))
+
+    LINKFLAGS = env.get('LINKFLAGS', '')
+    env['LINKFLAGS'] = ''
+
+    env.Append(LINKFLAGS=string.split(str(LINKFLAGS)))
+
+    flag_list = platform_flags[selected_platform]
+    for f in flag_list:
+        if not (f[0] in ARGUMENTS):  # allow command line to override platform flags
+            env[f[0]] = f[1]
+
+    # must happen after the flags, so when flags are used by configure, stuff happens (ie, ssl on x11)
+    detect.configure(env)
+
+    #env['platform_libsuffix'] = env['LIBSUFFIX']
+
+    suffix = "." + selected_platform
+
+    if (env["target"] == "release"):
+        if (env["tools"] == "yes"):
+            print("Tools can only be built with targets 'debug' and 'release_debug'.")
+            sys.exit(255)
+        suffix += ".opt"
+
+        env.Append(CCFLAGS=['-DNDEBUG'])
+
+    elif (env["target"] == "release_debug"):
+        if (env["tools"] == "yes"):
+            suffix += ".opt.tools"
+        else:
+            suffix += ".opt.debug"
+    else:
+        if (env["tools"] == "yes"):
+            suffix += ".tools"
+        else:
+            suffix += ".debug"
+
+    if env["arch"] != "":
+        suffix += "." + env["arch"]
+    elif (env["bits"] == "32"):
+        suffix += ".32"
+    elif (env["bits"] == "64"):
+        suffix += ".64"
+    elif (env["bits"] == "fat"):
+        suffix += ".fat"
+
+    suffix += env.extra_suffix
+
+    env["PROGSUFFIX"] = suffix + env["PROGSUFFIX"]
+    env["OBJSUFFIX"] = suffix + env["OBJSUFFIX"]
+    env["LIBSUFFIX"] = suffix + env["LIBSUFFIX"]
+    env["SHLIBSUFFIX"] = suffix + env["SHLIBSUFFIX"]
+
+    sys.path.remove("./platform/" + selected_platform)
+    sys.modules.pop('detect')
+
+    env.module_list = []
+
+    for x in module_list:
+        if env['module_' + x + '_enabled'] != "yes":
+            continue
+        tmppath = "./modules/" + x
+        sys.path.append(tmppath)
+        env.current_module = x
+        import config
+        if (config.can_build(selected_platform)):
+            config.configure(env)
+            env.module_list.append(x)
+        sys.path.remove(tmppath)
+        sys.modules.pop('config')
+
+    if (env.use_ptrcall):
+        env.Append(CPPFLAGS=['-DPTRCALL_ENABLED'])
+
+    # to test 64 bits compiltion
+    # env.Append(CPPFLAGS=['-m64'])
+
+    if (env['tools'] == 'yes'):
+        env.Append(CPPFLAGS=['-DTOOLS_ENABLED'])
+    if (env['disable_3d'] == 'yes'):
+        env.Append(CPPFLAGS=['-D_3D_DISABLED'])
+    if (env['gdscript'] == 'yes'):
+        env.Append(CPPFLAGS=['-DGDSCRIPT_ENABLED'])
+    if (env['disable_advanced_gui'] == 'yes'):
+        env.Append(CPPFLAGS=['-DADVANCED_GUI_DISABLED'])
+
+    if (env['minizip'] == 'yes'):
+        env.Append(CPPFLAGS=['-DMINIZIP_ENABLED'])
+
+    if (env['xml'] == 'yes'):
+        env.Append(CPPFLAGS=['-DXML_ENABLED'])
+
+    if (env['verbose'] == 'no'):
+        methods.no_verbose(sys, env)
+
+    Export('env')
+
+    # build subdirs, the build order is dependent on link order.
+
+    SConscript("core/SCsub")
+    SConscript("servers/SCsub")
+    SConscript("scene/SCsub")
+    SConscript("tools/SCsub")
+    SConscript("drivers/SCsub")
+    SConscript("bin/SCsub")
+
+    SConscript("modules/SCsub")
+    SConscript("main/SCsub")
+
+    SConscript("platform/" + selected_platform + "/SCsub")  # build selected platform
+
+    # Microsoft Visual Studio Project Generation
+    if (env['vsproj']) == "yes":
+
+        AddToVSProject(env.core_sources)
+        AddToVSProject(env.main_sources)
+        AddToVSProject(env.modules_sources)
+        AddToVSProject(env.scene_sources)
+        AddToVSProject(env.servers_sources)
+        AddToVSProject(env.tool_sources)
+
+        # this env flag won't work, it needs to be set in env_base=Environment(MSVC_VERSION='9.0')
+        # Even then, SCons still seems to ignore it and builds with the latest MSVC...
+        # That said, it's not needed to be set so far but I'm leaving it here so that this comment
+        # has a purpose.
+        # env['MSVS_VERSION']='9.0'
+
+        # Calls a CMD with /C(lose) and /V(delayed environment variable expansion) options.
+        # And runs vcvarsall bat for the propper arhitecture and scons for propper configuration
+        env['MSVSBUILDCOM'] = 'cmd /V /C set "plat=$(PlatformTarget)" ^& (if "$(PlatformTarget)"=="x64" (set "plat=x86_amd64")) ^& set "tools=yes" ^& (if "$(Configuration)"=="release" (set "tools=no")) ^& call "$(VCInstallDir)vcvarsall.bat" !plat! ^& scons platform=windows target=$(Configuration) tools=!tools! -j2'
+        env['MSVSREBUILDCOM'] = 'cmd /V /C set "plat=$(PlatformTarget)" ^& (if "$(PlatformTarget)"=="x64" (set "plat=x86_amd64")) ^& set "tools=yes" ^& (if "$(Configuration)"=="release" (set "tools=no")) & call "$(VCInstallDir)vcvarsall.bat" !plat! ^& scons platform=windows target=$(Configuration) tools=!tools! vsproj=yes -j2'
+        env['MSVSCLEANCOM'] = 'cmd /V /C set "plat=$(PlatformTarget)" ^& (if "$(PlatformTarget)"=="x64" (set "plat=x86_amd64")) ^& set "tools=yes" ^& (if "$(Configuration)"=="release" (set "tools=no")) ^& call "$(VCInstallDir)vcvarsall.bat" !plat! ^& scons --clean platform=windows target=$(Configuration) tools=!tools! -j2'
+
+        # This version information (Win32, x64, Debug, Release, Release_Debug seems to be
+        # required for Visual Studio to understand that it needs to generate an NMAKE
+        # project. Do not modify without knowing what you are doing.
+        debug_variants = ['debug|Win32'] + ['debug|x64']
+        release_variants = ['release|Win32'] + ['release|x64']
+        release_debug_variants = ['release_debug|Win32'] + ['release_debug|x64']
+        variants = debug_variants + release_variants + release_debug_variants
+        debug_targets = ['bin\\godot.windows.tools.32.exe'] + ['bin\\godot.windows.tools.64.exe']
+        release_targets = ['bin\\godot.windows.opt.32.exe'] + ['bin\\godot.windows.opt.64.exe']
+        release_debug_targets = ['bin\\godot.windows.opt.tools.32.exe'] + ['bin\\godot.windows.opt.tools.64.exe']
+        targets = debug_targets + release_targets + release_debug_targets
+        msvproj = env.MSVSProject(target=['#godot' + env['MSVSPROJECTSUFFIX']],
+                                  incs=env.vs_incs,
+                                  srcs=env.vs_srcs,
+                                  runfile=targets,
+                                  buildtarget=targets,
+                                  auto_build_solution=1,
+                                  variant=variants)
 
 
 else:
 else:
 
 
-	print("No valid target platform selected.")
-	print("The following were detected:")
-	for x in platform_list:
-		print("\t"+x)
-	print("\nPlease run scons again with argument: platform=<string>")
+    print("No valid target platform selected.")
+    print("The following were detected:")
+    for x in platform_list:
+        print("\t" + x)
+    print("\nPlease run scons again with argument: platform=<string>")

+ 1 - 1
bin/SCsub

@@ -3,4 +3,4 @@
 Import('env')
 Import('env')
 Export('env')
 Export('env')
 
 
-SConscript('tests/SCsub');
+SConscript('tests/SCsub')

+ 4 - 4
bin/tests/SCsub

@@ -2,13 +2,13 @@
 
 
 Import('env')
 Import('env')
 
 
-env.tests_sources=[]
-env.add_source_files(env.tests_sources,"*.cpp")
+env.tests_sources = []
+env.add_source_files(env.tests_sources, "*.cpp")
 
 
 Export('env')
 Export('env')
 
 
-#SConscript('math/SCsub');
+# SConscript('math/SCsub');
 
 
-lib = env.Library("tests",env.tests_sources)
+lib = env.Library("tests", env.tests_sources)
 
 
 env.Prepend(LIBS=[lib])
 env.Prepend(LIBS=[lib])

+ 36 - 36
core/SCsub

@@ -2,66 +2,66 @@
 
 
 Import('env')
 Import('env')
 
 
-env.core_sources=[]
+env.core_sources = []
 
 
 
 
-gd_call=""
-gd_inc=""
+gd_call = ""
+gd_inc = ""
 
 
 for x in env.global_defaults:
 for x in env.global_defaults:
-	env.core_sources.append("#platform/"+x+"/globals/global_defaults.cpp")
-	gd_inc+='#include "platform/'+x+'/globals/global_defaults.h"\n'
-	gd_call+="\tregister_"+x+"_global_defaults();\n"
+    env.core_sources.append("#platform/" + x + "/globals/global_defaults.cpp")
+    gd_inc += '#include "platform/' + x + '/globals/global_defaults.h"\n'
+    gd_call += "\tregister_" + x + "_global_defaults();\n"
 
 
-gd_cpp='#include "globals.h"\n'
-gd_cpp+=gd_inc
-gd_cpp+="void Globals::register_global_defaults() {\n"+gd_call+"\n}\n"
+gd_cpp = '#include "globals.h"\n'
+gd_cpp += gd_inc
+gd_cpp += "void Globals::register_global_defaults() {\n" + gd_call + "\n}\n"
 
 
-f = open("global_defaults.cpp","wb")
+f = open("global_defaults.cpp", "wb")
 f.write(gd_cpp)
 f.write(gd_cpp)
 f.close()
 f.close()
 
 
 import os
 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"
 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):
-		ec_valid=False
-	else:
-
-		for i in range(len(e)>>1):
-			if (i>0):
-				txt+=","
-			txts="0x"+e[i*2:i*2+2]
-			try:
-				int(txts,16)
-			except:
-				ec_valid=False
-			txt+=txts
-	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)
+    e = os.environ["SCRIPT_AES256_ENCRYPTION_KEY"]
+    txt = ""
+    ec_valid = True
+    if (len(e) != 64):
+        ec_valid = False
+    else:
+
+        for i in range(len(e) >> 1):
+            if (i > 0):
+                txt += ","
+            txts = "0x" + e[i * 2:i * 2 + 2]
+            try:
+                int(txts, 16)
+            except:
+                ec_valid = False
+            txt += txts
+    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)
 
 
 f = open("script_encryption_key.cpp", "wb")
 f = open("script_encryption_key.cpp", "wb")
 f.write("#include \"globals.h\"\nuint8_t script_encryption_key[32]={" + txt + "};\n")
 f.write("#include \"globals.h\"\nuint8_t script_encryption_key[32]={" + txt + "};\n")
 f.close()
 f.close()
 
 
 
 
-env.add_source_files(env.core_sources,"*.cpp")
+env.add_source_files(env.core_sources, "*.cpp")
 
 
 
 
 Export('env')
 Export('env')
 
 
 import make_binders
 import make_binders
-env.Command(['method_bind.inc','method_bind_ext.inc'], 'make_binders.py', make_binders.run)
+env.Command(['method_bind.inc', 'method_bind_ext.inc'], 'make_binders.py', make_binders.run)
 
 
-SConscript('os/SCsub');
-SConscript('math/SCsub');
-SConscript('io/SCsub');
-SConscript('bind/SCsub');
+SConscript('os/SCsub')
+SConscript('math/SCsub')
+SConscript('io/SCsub')
+SConscript('bind/SCsub')
 
 
-lib = env.Library("core",env.core_sources)
+lib = env.Library("core", env.core_sources)
 
 
 env.Prepend(LIBS=[lib])
 env.Prepend(LIBS=[lib])

+ 1 - 1
core/bind/SCsub

@@ -2,6 +2,6 @@
 
 
 Import('env')
 Import('env')
 
 
-env.add_source_files(env.core_sources,"*.cpp")
+env.add_source_files(env.core_sources, "*.cpp")
 
 
 Export('env')
 Export('env')

+ 3 - 3
core/io/SCsub

@@ -2,8 +2,8 @@
 
 
 Import('env')
 Import('env')
 
 
-env.add_source_files(env.core_sources,"*.cpp")
-env.add_source_files(env.core_sources,"*.c")
-#env.core_sources.append("io/fastlz.c")
+env.add_source_files(env.core_sources, "*.cpp")
+env.add_source_files(env.core_sources, "*.c")
+# env.core_sources.append("io/fastlz.c")
 
 
 Export('env')
 Export('env')

+ 90 - 91
core/make_binders.py

@@ -1,7 +1,7 @@
 # -*- coding: ibm850 -*-
 # -*- coding: ibm850 -*-
 
 
 
 
-template_typed="""
+template_typed = """
 #ifdef TYPED_METHOD_BIND
 #ifdef TYPED_METHOD_BIND
 template<class T $ifret ,class R$ $ifargs ,$ $arg, class P@$>
 template<class T $ifret ,class R$ $ifargs ,$ $arg, class P@$>
 class MethodBind$argc$$ifret R$$ifconst C$ : public MethodBind {
 class MethodBind$argc$$ifret R$$ifconst C$ : public MethodBind {
@@ -77,7 +77,7 @@ MethodBind* create_method_bind($ifret R$ $ifnoret void$ (T::*p_method)($arg, P@$
 #endif
 #endif
 """
 """
 
 
-template="""
+template = """
 #ifndef TYPED_METHOD_BIND
 #ifndef TYPED_METHOD_BIND
 $iftempl template<$ $ifret class R$ $ifretargs ,$ $arg, class P@$ $iftempl >$
 $iftempl template<$ $ifret class R$ $ifretargs ,$ $arg, class P@$ $iftempl >$
 class MethodBind$argc$$ifret R$$ifconst C$ : public MethodBind {
 class MethodBind$argc$$ifret R$$ifconst C$ : public MethodBind {
@@ -166,96 +166,95 @@ MethodBind* create_method_bind($ifret R$ $ifnoret void$ (T::*p_method)($arg, P@$
 """
 """
 
 
 
 
-def make_version(template,nargs,argmax,const,ret):
-
-	intext=template
-	from_pos=0
-	outtext=""
-
-	while(True):
-		to_pos=intext.find("$",from_pos)
-		if (to_pos==-1):
-			outtext+=intext[from_pos:]
-			break
-		else:
-			outtext+=intext[from_pos:to_pos]
-		end=intext.find("$",to_pos+1)
-		if (end==-1):
-			break # ignore
-		macro=intext[to_pos+1:end]
-		cmd=""
-		data=""
-
-		if (macro.find(" ")!=-1):
-			cmd=macro[0:macro.find(" ")]
-			data=macro[macro.find(" ")+1:]
-		else:
-			cmd=macro
-
-		if (cmd=="argc"):
-			outtext+=str(nargs)
-		if (cmd=="ifret" and ret):
-			outtext+=data
-		if (cmd=="ifargs" and nargs):
-			outtext+=data
-		if (cmd=="ifretargs" and nargs and ret):
-			outtext+=data
-		if (cmd=="ifconst" and const):
-			outtext+=data
-		elif (cmd=="ifnoconst" and not const):
-			outtext+=data
-		elif (cmd=="ifnoret" and not ret):
-			outtext+=data
-		elif (cmd=="iftempl" and (nargs>0 or ret)):
-			outtext+=data
-		elif (cmd=="arg,"):
-			for i in range(1,nargs+1):
-				if (i>1):
-					outtext+=", "
-				outtext+=data.replace("@",str(i))
-		elif (cmd=="arg"):
-			for i in range(1,nargs+1):
-				outtext+=data.replace("@",str(i))
-		elif (cmd=="noarg"):
-			for i in range(nargs+1,argmax+1):
-				outtext+=data.replace("@",str(i))
-		elif (cmd=="noarg"):
-			for i in range(nargs+1,argmax+1):
-				outtext+=data.replace("@",str(i))
-
-		from_pos=end+1
-
-	return outtext
+def make_version(template, nargs, argmax, const, ret):
+
+    intext = template
+    from_pos = 0
+    outtext = ""
+
+    while(True):
+        to_pos = intext.find("$", from_pos)
+        if (to_pos == -1):
+            outtext += intext[from_pos:]
+            break
+        else:
+            outtext += intext[from_pos:to_pos]
+        end = intext.find("$", to_pos + 1)
+        if (end == -1):
+            break  # ignore
+        macro = intext[to_pos + 1:end]
+        cmd = ""
+        data = ""
+
+        if (macro.find(" ") != -1):
+            cmd = macro[0:macro.find(" ")]
+            data = macro[macro.find(" ") + 1:]
+        else:
+            cmd = macro
+
+        if (cmd == "argc"):
+            outtext += str(nargs)
+        if (cmd == "ifret" and ret):
+            outtext += data
+        if (cmd == "ifargs" and nargs):
+            outtext += data
+        if (cmd == "ifretargs" and nargs and ret):
+            outtext += data
+        if (cmd == "ifconst" and const):
+            outtext += data
+        elif (cmd == "ifnoconst" and not const):
+            outtext += data
+        elif (cmd == "ifnoret" and not ret):
+            outtext += data
+        elif (cmd == "iftempl" and (nargs > 0 or ret)):
+            outtext += data
+        elif (cmd == "arg,"):
+            for i in range(1, nargs + 1):
+                if (i > 1):
+                    outtext += ", "
+                outtext += data.replace("@", str(i))
+        elif (cmd == "arg"):
+            for i in range(1, nargs + 1):
+                outtext += data.replace("@", str(i))
+        elif (cmd == "noarg"):
+            for i in range(nargs + 1, argmax + 1):
+                outtext += data.replace("@", str(i))
+        elif (cmd == "noarg"):
+            for i in range(nargs + 1, argmax + 1):
+                outtext += data.replace("@", str(i))
+
+        from_pos = end + 1
+
+    return outtext
 
 
 
 
 def run(target, source, env):
 def run(target, source, env):
 
 
-	versions=10
-	versions_ext=6
-	text=""
-	text_ext=""
-
-	for i in range(0,versions+1):
-
-		t=""
-		t+=make_version(template,i,versions,False,False)
-		t+=make_version(template_typed,i,versions,False,False)
-		t+=make_version(template,i,versions,False,True)
-		t+=make_version(template_typed,i,versions,False,True)
-		t+=make_version(template,i,versions,True,False)
-		t+=make_version(template_typed,i,versions,True,False)
-		t+=make_version(template,i,versions,True,True)
-		t+=make_version(template_typed,i,versions,True,True)
-		if (i>=versions_ext):
-			text_ext+=t
-		else:
-			text+=t
-
-
-	f=open(target[0].path,"w")
-	f.write(text)
-	f.close()
-
-	f=open(target[1].path,"w")
-	f.write(text_ext)
-	f.close()
+    versions = 10
+    versions_ext = 6
+    text = ""
+    text_ext = ""
+
+    for i in range(0, versions + 1):
+
+        t = ""
+        t += make_version(template, i, versions, False, False)
+        t += make_version(template_typed, i, versions, False, False)
+        t += make_version(template, i, versions, False, True)
+        t += make_version(template_typed, i, versions, False, True)
+        t += make_version(template, i, versions, True, False)
+        t += make_version(template_typed, i, versions, True, False)
+        t += make_version(template, i, versions, True, True)
+        t += make_version(template_typed, i, versions, True, True)
+        if (i >= versions_ext):
+            text_ext += t
+        else:
+            text += t
+
+    f = open(target[0].path, "w")
+    f.write(text)
+    f.close()
+
+    f = open(target[1].path, "w")
+    f.write(text_ext)
+    f.close()

+ 1 - 1
core/math/SCsub

@@ -2,6 +2,6 @@
 
 
 Import('env')
 Import('env')
 
 
-env.add_source_files(env.core_sources,"*.cpp")
+env.add_source_files(env.core_sources, "*.cpp")
 
 
 Export('env')
 Export('env')

+ 1 - 1
core/os/SCsub

@@ -2,6 +2,6 @@
 
 
 Import('env')
 Import('env')
 
 
-env.add_source_files(env.core_sources,"*.cpp")
+env.add_source_files(env.core_sources, "*.cpp")
 
 
 Export('env')
 Export('env')

+ 160 - 156
doc/tools/doc_merge.py

@@ -6,206 +6,210 @@ import xml.etree.ElementTree as ET
 
 
 
 
 tree = ET.parse(sys.argv[1])
 tree = ET.parse(sys.argv[1])
-old_doc=tree.getroot()
+old_doc = tree.getroot()
 
 
 tree = ET.parse(sys.argv[2])
 tree = ET.parse(sys.argv[2])
-new_doc=tree.getroot()
+new_doc = tree.getroot()
 
 
-f = file(sys.argv[3],"wb")
-tab=0
+f = file(sys.argv[3], "wb")
+tab = 0
 
 
-old_classes={}
+old_classes = {}
+
+
+def write_string(_f, text, newline=True):
+    for t in range(tab):
+        _f.write("\t")
+    _f.write(text)
+    if (newline):
+        _f.write("\n")
 
 
-def write_string(_f, text,newline=True):
-	for t in range(tab):
-		_f.write("\t")
-	_f.write(text)
-	if (newline):
-		_f.write("\n")
 
 
 def escape(ret):
 def escape(ret):
-	ret=ret.replace("&","&amp;");
-	ret=ret.replace("<","&gt;");
-	ret=ret.replace(">","&lt;");
-	ret=ret.replace("'","&apos;");
-	ret=ret.replace("\"","&quot;");
-	return ret
+    ret = ret.replace("&", "&amp;")
+    ret = ret.replace("<", "&gt;")
+    ret = ret.replace(">", "&lt;")
+    ret = ret.replace("'", "&apos;")
+    ret = ret.replace("\"", "&quot;")
+    return ret
 
 
 
 
 def inc_tab():
 def inc_tab():
-	global tab
-	tab+=1
+    global tab
+    tab += 1
+
 
 
 def dec_tab():
 def dec_tab():
-	global tab
-	tab-=1
-
-write_string(f,'<?xml version="1.0" encoding="UTF-8" ?>')
-write_string(f,'<doc version="'+new_doc.attrib["version"]+'">')
-
-def get_tag(node,name):
-	tag=""
-	if (name in node.attrib):
-		tag=' '+name+'="'+escape(node.attrib[name])+'" '
-	return tag
-
-def find_method_descr(old_class,name):
-
-	methods = old_class.find("methods")
-	if(methods!=None and len(list(methods))>0):
-		for m in list(methods):
-			if (m.attrib["name"]==name):
-				description=m.find("description")
-				if (description!=None and description.text.strip()!=""):
-					return description.text
-
-	return None
-
-def find_signal_descr(old_class,name):
-
-	signals = old_class.find("signals")
-	if(signals!=None and len(list(signals))>0):
-		for m in list(signals):
-			if (m.attrib["name"]==name):
-				description=m.find("description")
-				if (description!=None and description.text.strip()!=""):
-					return description.text
-
-	return None
-
-def find_constant_descr(old_class,name):
-
-	if (old_class==None):
-		return None
-	constants = old_class.find("constants")
-	if(constants!=None and len(list(constants))>0):
-		for m in list(constants):
-			if (m.attrib["name"]==name):
-				if (m.text.strip()!=""):
-					return m.text
-	return None
+    global tab
+    tab -= 1
+
+write_string(f, '<?xml version="1.0" encoding="UTF-8" ?>')
+write_string(f, '<doc version="' + new_doc.attrib["version"] + '">')
 
 
-def write_class(c):
-	class_name = c.attrib["name"]
-	print("Parsing Class: "+class_name)
-	if (class_name in old_classes):
-		old_class=old_classes[class_name]
-	else:
-		old_class=None
 
 
+def get_tag(node, name):
+    tag = ""
+    if (name in node.attrib):
+        tag = ' ' + name + '="' + escape(node.attrib[name]) + '" '
+    return tag
 
 
-	category=get_tag(c,"category")
-	inherits=get_tag(c,"inherits")
-	write_string(f,'<class name="'+class_name+'" '+category+inherits+'>')
-	inc_tab()
 
 
-	write_string(f,"<brief_description>")
+def find_method_descr(old_class, name):
 
 
-	if (old_class!=None):
-		old_brief_descr=old_class.find("brief_description")
-		if (old_brief_descr!=None):
-			write_string(f,escape(old_brief_descr.text.strip()))
+    methods = old_class.find("methods")
+    if(methods != None and len(list(methods)) > 0):
+        for m in list(methods):
+            if (m.attrib["name"] == name):
+                description = m.find("description")
+                if (description != None and description.text.strip() != ""):
+                    return description.text
 
 
+    return None
 
 
-	write_string(f,"</brief_description>")
 
 
-	write_string(f,"<description>")
-	if (old_class!=None):
-		old_descr=old_class.find("description")
-		if (old_descr!=None):
-			write_string(f,escape(old_descr.text.strip()))
+def find_signal_descr(old_class, name):
 
 
-	write_string(f,"</description>")
+    signals = old_class.find("signals")
+    if(signals != None and len(list(signals)) > 0):
+        for m in list(signals):
+            if (m.attrib["name"] == name):
+                description = m.find("description")
+                if (description != None and description.text.strip() != ""):
+                    return description.text
 
 
-	methods = c.find("methods")
-	if(methods!=None and len(list(methods))>0):
+    return None
 
 
-		write_string(f,"<methods>")
-		inc_tab()
 
 
-		for m in list(methods):
-			qualifiers=get_tag(m,"qualifiers")
+def find_constant_descr(old_class, name):
 
 
-			write_string(f,'<method name="'+escape(m.attrib["name"])+'" ' +qualifiers+'>')
-			inc_tab()
+    if (old_class == None):
+        return None
+    constants = old_class.find("constants")
+    if(constants != None and len(list(constants)) > 0):
+        for m in list(constants):
+            if (m.attrib["name"] == name):
+                if (m.text.strip() != ""):
+                    return m.text
+    return None
 
 
-			for a in list(m):
-				if (a.tag=="return"):
-					typ=get_tag(a,"type")
-					write_string(f,'<return'+typ+'>');
-					write_string(f,'</return>');
-				elif (a.tag=="argument"):
 
 
-					default=get_tag(a,"default")
+def write_class(c):
+    class_name = c.attrib["name"]
+    print("Parsing Class: " + class_name)
+    if (class_name in old_classes):
+        old_class = old_classes[class_name]
+    else:
+        old_class = None
 
 
-					write_string(f,'<argument index="'+a.attrib["index"]+'" name="'+escape(a.attrib["name"])+'" type="'+a.attrib["type"]+'"' +default+'>');
-					write_string(f,'</argument>');
+    category = get_tag(c, "category")
+    inherits = get_tag(c, "inherits")
+    write_string(f, '<class name="' + class_name + '" ' + category + inherits + '>')
+    inc_tab()
 
 
-			write_string(f,'<description>');
-			if (old_class!=None):
-				old_method_descr=find_method_descr(old_class,m.attrib["name"])
-				if (old_method_descr):
-					write_string(f,escape(escape(old_method_descr.strip())))
+    write_string(f, "<brief_description>")
 
 
-			write_string(f,'</description>');
-			dec_tab()
-			write_string(f,"</method>")
-		dec_tab()
-		write_string(f,"</methods>")
+    if (old_class != None):
+        old_brief_descr = old_class.find("brief_description")
+        if (old_brief_descr != None):
+            write_string(f, escape(old_brief_descr.text.strip()))
 
 
-	signals = c.find("signals")
-	if(signals!=None and len(list(signals))>0):
+    write_string(f, "</brief_description>")
 
 
-		write_string(f,"<signals>")
-		inc_tab()
+    write_string(f, "<description>")
+    if (old_class != None):
+        old_descr = old_class.find("description")
+        if (old_descr != None):
+            write_string(f, escape(old_descr.text.strip()))
 
 
-		for m in list(signals):
+    write_string(f, "</description>")
 
 
-			write_string(f,'<signal name="'+escape(m.attrib["name"])+'">')
-			inc_tab()
+    methods = c.find("methods")
+    if(methods != None and len(list(methods)) > 0):
 
 
-			for a in list(m):
-				if (a.tag=="argument"):
+        write_string(f, "<methods>")
+        inc_tab()
 
 
-					write_string(f,'<argument index="'+a.attrib["index"]+'" name="'+escape(a.attrib["name"])+'" type="'+a.attrib["type"]+'">');
-					write_string(f,'</argument>');
+        for m in list(methods):
+            qualifiers = get_tag(m, "qualifiers")
 
 
-			write_string(f,'<description>');
-			if (old_class!=None):
-				old_signal_descr=find_signal_descr(old_class,m.attrib["name"])
-				if (old_signal_descr):
-					write_string(f,escape(old_signal_descr.strip()))
-			write_string(f,'</description>');
-			dec_tab()
-			write_string(f,"</signal>")
-		dec_tab()
-		write_string(f,"</signals>")
+            write_string(f, '<method name="' + escape(m.attrib["name"]) + '" ' + qualifiers + '>')
+            inc_tab()
 
 
-	constants = c.find("constants")
-	if(constants!=None and len(list(constants))>0):
+            for a in list(m):
+                if (a.tag == "return"):
+                    typ = get_tag(a, "type")
+                    write_string(f, '<return' + typ + '>')
+                    write_string(f, '</return>')
+                elif (a.tag == "argument"):
 
 
-		write_string(f,"<constants>")
-		inc_tab()
+                    default = get_tag(a, "default")
 
 
-		for m in list(constants):
+                    write_string(f, '<argument index="' + a.attrib["index"] + '" name="' + escape(a.attrib["name"]) + '" type="' + a.attrib["type"] + '"' + default + '>')
+                    write_string(f, '</argument>')
 
 
-			write_string(f,'<constant name="'+escape(m.attrib["name"])+'" value="'+m.attrib["value"]+'">')
-			old_constant_descr=find_constant_descr(old_class,m.attrib["name"])
-			if (old_constant_descr):
-				write_string(f,escape(old_constant_descr.strip()))
-			write_string(f,"</constant>")
+            write_string(f, '<description>')
+            if (old_class != None):
+                old_method_descr = find_method_descr(old_class, m.attrib["name"])
+                if (old_method_descr):
+                    write_string(f, escape(escape(old_method_descr.strip())))
 
 
-		dec_tab()
-		write_string(f,"</constants>")
+            write_string(f, '</description>')
+            dec_tab()
+            write_string(f, "</method>")
+        dec_tab()
+        write_string(f, "</methods>")
 
 
-	dec_tab()
-	write_string(f,"</class>")
+    signals = c.find("signals")
+    if(signals != None and len(list(signals)) > 0):
 
 
-for c in list(old_doc):
-	old_classes[c.attrib["name"]]=c
+        write_string(f, "<signals>")
+        inc_tab()
 
 
-for c in list(new_doc):
-	write_class(c)
-write_string(f,'</doc>\n')
+        for m in list(signals):
+
+            write_string(f, '<signal name="' + escape(m.attrib["name"]) + '">')
+            inc_tab()
+
+            for a in list(m):
+                if (a.tag == "argument"):
 
 
+                    write_string(f, '<argument index="' + a.attrib["index"] + '" name="' + escape(a.attrib["name"]) + '" type="' + a.attrib["type"] + '">')
+                    write_string(f, '</argument>')
 
 
+            write_string(f, '<description>')
+            if (old_class != None):
+                old_signal_descr = find_signal_descr(old_class, m.attrib["name"])
+                if (old_signal_descr):
+                    write_string(f, escape(old_signal_descr.strip()))
+            write_string(f, '</description>')
+            dec_tab()
+            write_string(f, "</signal>")
+        dec_tab()
+        write_string(f, "</signals>")
+
+    constants = c.find("constants")
+    if(constants != None and len(list(constants)) > 0):
+
+        write_string(f, "<constants>")
+        inc_tab()
+
+        for m in list(constants):
+
+            write_string(f, '<constant name="' + escape(m.attrib["name"]) + '" value="' + m.attrib["value"] + '">')
+            old_constant_descr = find_constant_descr(old_class, m.attrib["name"])
+            if (old_constant_descr):
+                write_string(f, escape(old_constant_descr.strip()))
+            write_string(f, "</constant>")
+
+        dec_tab()
+        write_string(f, "</constants>")
+
+    dec_tab()
+    write_string(f, "</class>")
+
+for c in list(old_doc):
+    old_classes[c.attrib["name"]] = c
+
+for c in list(new_doc):
+    write_class(c)
+write_string(f, '</doc>\n')

+ 270 - 273
doc/tools/doc_status.py

@@ -11,233 +11,235 @@ import xml.etree.ElementTree as ET
 ################################################################################
 ################################################################################
 
 
 flags = {
 flags = {
-	'c': platform.platform() != 'Windows', # Disable by default on windows, since we use ANSI escape codes
-	'b': False,
-	'g': False,
-	's': False,
-	'u': False,
-	'h': False,
-	'p': False,
-	'o': True,
-	'i': False,
+    'c': platform.platform() != 'Windows',  # Disable by default on windows, since we use ANSI escape codes
+    'b': False,
+    'g': False,
+    's': False,
+    'u': False,
+    'h': False,
+    'p': False,
+    'o': True,
+    'i': False,
 }
 }
 flag_descriptions = {
 flag_descriptions = {
-	'c': 'Toggle colors when outputting.',
-	'b': 'Toggle showing only not fully described classes.',
-	'g': 'Toggle showing only completed classes.',
-	's': 'Toggle showing comments about the status.',
-	'u': 'Toggle URLs to docs.',
-	'h': 'Show help and exit.',
-	'p': 'Toggle showing percentage as well as counts.',
-	'o': 'Toggle overall column.',
-	'i': 'Toggle collapse of class items columns.',
+    'c': 'Toggle colors when outputting.',
+    'b': 'Toggle showing only not fully described classes.',
+    'g': 'Toggle showing only completed classes.',
+    's': 'Toggle showing comments about the status.',
+    'u': 'Toggle URLs to docs.',
+    'h': 'Show help and exit.',
+    'p': 'Toggle showing percentage as well as counts.',
+    'o': 'Toggle overall column.',
+    'i': 'Toggle collapse of class items columns.',
 }
 }
 long_flags = {
 long_flags = {
-	'colors': 'c',
-	'use-colors': 'c',
+    'colors': 'c',
+    'use-colors': 'c',
 
 
-	'bad': 'b',
-	'only-bad': 'b',
+    'bad': 'b',
+    'only-bad': 'b',
 
 
-	'good': 'g',
-	'only-good': 'g',
+    'good': 'g',
+    'only-good': 'g',
 
 
-	'comments': 's',
-	'status': 's',
+    'comments': 's',
+    'status': 's',
 
 
-	'urls': 'u',
-	'gen-url': 'u',
+    'urls': 'u',
+    'gen-url': 'u',
 
 
-	'help': 'h',
+    'help': 'h',
 
 
-	'percent': 'p',
-	'use-percentages': 'p',
+    'percent': 'p',
+    'use-percentages': 'p',
 
 
-	'overall': 'o',
-	'use-overall': 'o',
+    'overall': 'o',
+    'use-overall': 'o',
 
 
-	'items': 'i',
-	'collapse': 'i',
+    'items': 'i',
+    'collapse': 'i',
 }
 }
 table_columns = ['name', 'brief_description', 'description', 'methods', 'constants', 'members', 'signals']
 table_columns = ['name', 'brief_description', 'description', 'methods', 'constants', 'members', 'signals']
 table_column_names = ['Name', 'Brief Desc.', 'Desc.', 'Methods', 'Constants', 'Members', 'Signals']
 table_column_names = ['Name', 'Brief Desc.', 'Desc.', 'Methods', 'Constants', 'Members', 'Signals']
 colors = {
 colors = {
-	'name': [36], # cyan
-	'part_big_problem': [4, 31], # underline, red
-	'part_problem': [31], # red
-	'part_mostly_good': [33], # yellow
-	'part_good': [32], # green
-	'url': [4, 34], # underline, blue
-	'section': [1, 4], # bold, underline
-	'state_off': [36], # cyan
-	'state_on': [1, 35], # bold, magenta/plum
+    'name': [36],  # cyan
+    'part_big_problem': [4, 31],  # underline, red
+    'part_problem': [31],  # red
+    'part_mostly_good': [33],  # yellow
+    'part_good': [32],  # green
+    'url': [4, 34],  # underline, blue
+    'section': [1, 4],  # bold, underline
+    'state_off': [36],  # cyan
+    'state_on': [1, 35],  # bold, magenta/plum
 }
 }
 overall_progress_description_weigth = 10
 overall_progress_description_weigth = 10
 
 
 
 
-
 ################################################################################
 ################################################################################
 #                                    Utils                                     #
 #                                    Utils                                     #
 ################################################################################
 ################################################################################
 
 
 def validate_tag(elem, tag):
 def validate_tag(elem, tag):
-	if elem.tag != tag:
-		print('Tag mismatch, expected "' + tag + '", got ' + elem.tag)
-		sys.exit(255)
+    if elem.tag != tag:
+        print('Tag mismatch, expected "' + tag + '", got ' + elem.tag)
+        sys.exit(255)
+
 
 
 def color(color, string):
 def color(color, string):
-	if flags['c']:
-		color_format = ''
-		for code in colors[color]:
-			color_format += '\033[' + str(code) + 'm'
-		return color_format + string + '\033[0m'
-	else:
-		return string
+    if flags['c']:
+        color_format = ''
+        for code in colors[color]:
+            color_format += '\033[' + str(code) + 'm'
+        return color_format + string + '\033[0m'
+    else:
+        return string
 
 
 ansi_escape = re.compile(r'\x1b[^m]*m')
 ansi_escape = re.compile(r'\x1b[^m]*m')
-def nonescape_len(s):
-	return len(ansi_escape.sub('', s))
 
 
 
 
+def nonescape_len(s):
+    return len(ansi_escape.sub('', s))
+
 
 
 ################################################################################
 ################################################################################
 #                                   Classes                                    #
 #                                   Classes                                    #
 ################################################################################
 ################################################################################
 
 
 class ClassStatusProgress:
 class ClassStatusProgress:
-	def __init__(self, described = 0, total = 0):
-		self.described = described
-		self.total = total
-
-	def __add__(self, other):
-		return ClassStatusProgress(self.described + other.described, self.total + other.total)
-
-	def increment(self, described):
-		if described:
-			self.described += 1
-		self.total += 1
-
-	def is_ok(self):
-		return self.described >= self.total
-
-	def to_configured_colored_string(self):
-		if flags['p']:
-			return self.to_colored_string('{percent}% ({has}/{total})', '{pad_percent}{pad_described}{s}{pad_total}')
-		else:
-			return self.to_colored_string()
-
-	def to_colored_string(self, format='{has}/{total}', pad_format='{pad_described}{s}{pad_total}'):
-		ratio = self.described/self.total if self.total != 0 else 1
-		percent = round(100*ratio)
-		s = format.format(has = str(self.described), total = str(self.total), percent = str(percent))
-		if self.described >= self.total:
-			s = color('part_good', s)
-		elif self.described >= self.total/4*3:
-			s = color('part_mostly_good', s)
-		elif self.described > 0:
-			s = color('part_problem', s)
-		else:
-			s = color('part_big_problem', s)
-		pad_size = max(len(str(self.described)), len(str(self.total)))
-		pad_described = ''.ljust(pad_size - len(str(self.described)))
-		pad_percent = ''.ljust(3 - len(str(percent)))
-		pad_total = ''.ljust(pad_size - len(str(self.total)))
-		return pad_format.format(pad_described = pad_described, pad_total = pad_total, pad_percent = pad_percent, s = s)
+
+    def __init__(self, described=0, total=0):
+        self.described = described
+        self.total = total
+
+    def __add__(self, other):
+        return ClassStatusProgress(self.described + other.described, self.total + other.total)
+
+    def increment(self, described):
+        if described:
+            self.described += 1
+        self.total += 1
+
+    def is_ok(self):
+        return self.described >= self.total
+
+    def to_configured_colored_string(self):
+        if flags['p']:
+            return self.to_colored_string('{percent}% ({has}/{total})', '{pad_percent}{pad_described}{s}{pad_total}')
+        else:
+            return self.to_colored_string()
+
+    def to_colored_string(self, format='{has}/{total}', pad_format='{pad_described}{s}{pad_total}'):
+        ratio = self.described / self.total if self.total != 0 else 1
+        percent = round(100 * ratio)
+        s = format.format(has=str(self.described), total=str(self.total), percent=str(percent))
+        if self.described >= self.total:
+            s = color('part_good', s)
+        elif self.described >= self.total / 4 * 3:
+            s = color('part_mostly_good', s)
+        elif self.described > 0:
+            s = color('part_problem', s)
+        else:
+            s = color('part_big_problem', s)
+        pad_size = max(len(str(self.described)), len(str(self.total)))
+        pad_described = ''.ljust(pad_size - len(str(self.described)))
+        pad_percent = ''.ljust(3 - len(str(percent)))
+        pad_total = ''.ljust(pad_size - len(str(self.total)))
+        return pad_format.format(pad_described=pad_described, pad_total=pad_total, pad_percent=pad_percent, s=s)
 
 
 
 
 class ClassStatus:
 class ClassStatus:
-	def __init__(self, name=''):
-		self.name = name
-		self.has_brief_description = True
-		self.has_description = True
-		self.progresses = {
-			'methods': ClassStatusProgress(),
-			'constants': ClassStatusProgress(),
-			'members': ClassStatusProgress(),
-			'signals': ClassStatusProgress()
-		}
 
 
-	def __add__(self, other):
-		new_status = ClassStatus()
-		new_status.name = self.name
-		new_status.has_brief_description = self.has_brief_description and other.has_brief_description
-		new_status.has_description = self.has_description and other.has_description
-		for k in self.progresses:
-			new_status.progresses[k] = self.progresses[k] + other.progresses[k]
-		return new_status
+    def __init__(self, name=''):
+        self.name = name
+        self.has_brief_description = True
+        self.has_description = True
+        self.progresses = {
+            'methods': ClassStatusProgress(),
+            'constants': ClassStatusProgress(),
+            'members': ClassStatusProgress(),
+            'signals': ClassStatusProgress()
+        }
 
 
-	def is_ok(self):
-		ok = True
-		ok = ok and self.has_brief_description
-		ok = ok and self.has_description
-		for k in self.progresses:
-			ok = ok and self.progresses[k].is_ok()
-		return ok
+    def __add__(self, other):
+        new_status = ClassStatus()
+        new_status.name = self.name
+        new_status.has_brief_description = self.has_brief_description and other.has_brief_description
+        new_status.has_description = self.has_description and other.has_description
+        for k in self.progresses:
+            new_status.progresses[k] = self.progresses[k] + other.progresses[k]
+        return new_status
 
 
-	def make_output(self):
-		output = {}
-		output['name'] = color('name', self.name)
+    def is_ok(self):
+        ok = True
+        ok = ok and self.has_brief_description
+        ok = ok and self.has_description
+        for k in self.progresses:
+            ok = ok and self.progresses[k].is_ok()
+        return ok
 
 
-		ok_string = color('part_good', 'OK')
-		missing_string = color('part_big_problem', 'MISSING')
+    def make_output(self):
+        output = {}
+        output['name'] = color('name', self.name)
 
 
-		output['brief_description'] = ok_string if self.has_brief_description else missing_string
-		output['description'] = ok_string if self.has_description else missing_string
+        ok_string = color('part_good', 'OK')
+        missing_string = color('part_big_problem', 'MISSING')
 
 
-		description_progress = ClassStatusProgress(
-			(self.has_brief_description + self.has_description) * overall_progress_description_weigth,
-			2 * overall_progress_description_weigth
-		)
-		items_progress = ClassStatusProgress()
+        output['brief_description'] = ok_string if self.has_brief_description else missing_string
+        output['description'] = ok_string if self.has_description else missing_string
 
 
-		for k in ['methods', 'constants', 'members', 'signals']:
-			items_progress += self.progresses[k]
-			output[k] = self.progresses[k].to_configured_colored_string()
+        description_progress = ClassStatusProgress(
+            (self.has_brief_description + self.has_description) * overall_progress_description_weigth,
+            2 * overall_progress_description_weigth
+        )
+        items_progress = ClassStatusProgress()
 
 
-		output['items'] = items_progress.to_configured_colored_string()
+        for k in ['methods', 'constants', 'members', 'signals']:
+            items_progress += self.progresses[k]
+            output[k] = self.progresses[k].to_configured_colored_string()
 
 
-		output['overall'] = (description_progress + items_progress).to_colored_string('{percent}%', '{pad_percent}{s}')
+        output['items'] = items_progress.to_configured_colored_string()
 
 
-		if self.name.startswith('Total'):
-			output['url'] = color('url', 'http://docs.godotengine.org/en/latest/classes/_classes.html')
-			if flags['s']:
-				output['comment'] = color('part_good', 'ALL OK')
-		else:
-			output['url'] = color('url', 'http://docs.godotengine.org/en/latest/classes/class_{name}.html'.format(name=self.name.lower()))
+        output['overall'] = (description_progress + items_progress).to_colored_string('{percent}%', '{pad_percent}{s}')
 
 
-			if flags['s'] and not flags['g'] and self.is_ok():
-				output['comment'] = color('part_good', 'ALL OK')
+        if self.name.startswith('Total'):
+            output['url'] = color('url', 'http://docs.godotengine.org/en/latest/classes/_classes.html')
+            if flags['s']:
+                output['comment'] = color('part_good', 'ALL OK')
+        else:
+            output['url'] = color('url', 'http://docs.godotengine.org/en/latest/classes/class_{name}.html'.format(name=self.name.lower()))
 
 
-		return output
+            if flags['s'] and not flags['g'] and self.is_ok():
+                output['comment'] = color('part_good', 'ALL OK')
 
 
-	def generate_for_class(c):
-		status = ClassStatus()
-		status.name = c.attrib['name']
-		for tag in list(c):
+        return output
 
 
-			if tag.tag == 'brief_description':
-				status.has_brief_description = len(tag.text.strip()) > 0
+    def generate_for_class(c):
+        status = ClassStatus()
+        status.name = c.attrib['name']
+        for tag in list(c):
 
 
-			elif tag.tag == 'description':
-				status.has_description = len(tag.text.strip()) > 0
+            if tag.tag == 'brief_description':
+                status.has_brief_description = len(tag.text.strip()) > 0
 
 
-			elif tag.tag in ['methods', 'signals']:
-				for sub_tag in list(tag):
-					descr = sub_tag.find('description')
-					status.progresses[tag.tag].increment(len(descr.text.strip()) > 0)
+            elif tag.tag == 'description':
+                status.has_description = len(tag.text.strip()) > 0
 
 
-			elif tag.tag in ['constants', 'members']:
-				for sub_tag in list(tag):
-					status.progresses[tag.tag].increment(len(sub_tag.text.strip()) > 0)
+            elif tag.tag in ['methods', 'signals']:
+                for sub_tag in list(tag):
+                    descr = sub_tag.find('description')
+                    status.progresses[tag.tag].increment(len(descr.text.strip()) > 0)
 
 
-			elif tag.tag in ['theme_items']:
-				pass #Ignore those tags, since they seem to lack description at all
+            elif tag.tag in ['constants', 'members']:
+                for sub_tag in list(tag):
+                    status.progresses[tag.tag].increment(len(sub_tag.text.strip()) > 0)
 
 
-			else:
-				print(tag.tag, tag.attrib)
+            elif tag.tag in ['theme_items']:
+                pass  # Ignore those tags, since they seem to lack description at all
 
 
-		return status
+            else:
+                print(tag.tag, tag.attrib)
 
 
+        return status
 
 
 
 
 ################################################################################
 ################################################################################
@@ -248,31 +250,31 @@ input_file_list = []
 input_class_list = []
 input_class_list = []
 
 
 for arg in sys.argv[1:]:
 for arg in sys.argv[1:]:
-	if arg.startswith('--'):
-		flags[long_flags[arg[2:]]] = not flags[long_flags[arg[2:]]]
-	elif arg.startswith('-'):
-		for f in arg[1:]:
-			flags[f] = not flags[f]
-	elif arg.endswith('.xml'):
-		input_file_list.append(arg)
-	else:
-		input_class_list.append(arg)
+    if arg.startswith('--'):
+        flags[long_flags[arg[2:]]] = not flags[long_flags[arg[2:]]]
+    elif arg.startswith('-'):
+        for f in arg[1:]:
+            flags[f] = not flags[f]
+    elif arg.endswith('.xml'):
+        input_file_list.append(arg)
+    else:
+        input_class_list.append(arg)
 
 
 if flags['i']:
 if flags['i']:
-	for r in ['methods', 'constants', 'members', 'signals']:
-		index = table_columns.index(r)
-		del table_column_names[index]
-		del table_columns[index]
-	table_column_names.append('Items')
-	table_columns.append('items')
+    for r in ['methods', 'constants', 'members', 'signals']:
+        index = table_columns.index(r)
+        del table_column_names[index]
+        del table_columns[index]
+    table_column_names.append('Items')
+    table_columns.append('items')
 
 
 if flags['o'] == (not flags['i']):
 if flags['o'] == (not flags['i']):
-	table_column_names.append('Overall')
-	table_columns.append('overall')
+    table_column_names.append('Overall')
+    table_columns.append('overall')
 
 
 if flags['u']:
 if flags['u']:
-	table_column_names.append('Docs URL')
-	table_columns.append('url')
+    table_column_names.append('Docs URL')
+    table_columns.append('url')
 
 
 
 
 ################################################################################
 ################################################################################
@@ -280,29 +282,28 @@ if flags['u']:
 ################################################################################
 ################################################################################
 
 
 if len(input_file_list) < 1 or flags['h']:
 if len(input_file_list) < 1 or flags['h']:
-	if not flags['h']:
-		print(color('section', 'Invalid usage') + ': At least one classes.xml file is required')
-	print(color('section', 'Usage') + ': doc_status.py [flags] <classes.xml> [class names]')
-	print('\t< and > signify required parameters, while [ and ] signify optional parameters.')
-	print('\tNote that you can give more than one classes file, in which case they will be merged on-the-fly.')
-	print(color('section', 'Available flags') + ':')
-	possible_synonym_list = list(long_flags)
-	possible_synonym_list.sort()
-	flag_list = list(flags)
-	flag_list.sort()
-	for flag in flag_list:
-		synonyms = [color('name', '-' + flag)]
-		for synonym in possible_synonym_list:
-			if long_flags[synonym] == flag:
-				synonyms.append(color('name', '--' + synonym))
-
-		print(('{synonyms} (Currently '+color('state_'+('on' if flags[flag] else 'off'), '{value}')+')\n\t{description}').format(
-			synonyms = ', '.join(synonyms),
-			value = ('on' if flags[flag] else 'off'),
-			description = flag_descriptions[flag]
-		))
-	sys.exit(0)
-
+    if not flags['h']:
+        print(color('section', 'Invalid usage') + ': At least one classes.xml file is required')
+    print(color('section', 'Usage') + ': doc_status.py [flags] <classes.xml> [class names]')
+    print('\t< and > signify required parameters, while [ and ] signify optional parameters.')
+    print('\tNote that you can give more than one classes file, in which case they will be merged on-the-fly.')
+    print(color('section', 'Available flags') + ':')
+    possible_synonym_list = list(long_flags)
+    possible_synonym_list.sort()
+    flag_list = list(flags)
+    flag_list.sort()
+    for flag in flag_list:
+        synonyms = [color('name', '-' + flag)]
+        for synonym in possible_synonym_list:
+            if long_flags[synonym] == flag:
+                synonyms.append(color('name', '--' + synonym))
+
+        print(('{synonyms} (Currently ' + color('state_' + ('on' if flags[flag] else 'off'), '{value}') + ')\n\t{description}').format(
+            synonyms=', '.join(synonyms),
+            value=('on' if flags[flag] else 'off'),
+            description=flag_descriptions[flag]
+        ))
+    sys.exit(0)
 
 
 
 
 ################################################################################
 ################################################################################
@@ -313,26 +314,25 @@ class_names = []
 classes = {}
 classes = {}
 
 
 for file in input_file_list:
 for file in input_file_list:
-	tree = ET.parse(file)
-	doc = tree.getroot()
+    tree = ET.parse(file)
+    doc = tree.getroot()
 
 
-	if 'version' not in doc.attrib:
-		print('Version missing from "doc"')
-		sys.exit(255)
+    if 'version' not in doc.attrib:
+        print('Version missing from "doc"')
+        sys.exit(255)
 
 
-	version = doc.attrib['version']
+    version = doc.attrib['version']
 
 
-	for c in list(doc):
-		if c.attrib['name'] in class_names:
-			continue
-		class_names.append(c.attrib['name'])
-		classes[c.attrib['name']] = c
+    for c in list(doc):
+        if c.attrib['name'] in class_names:
+            continue
+        class_names.append(c.attrib['name'])
+        classes[c.attrib['name']] = c
 
 
 class_names.sort()
 class_names.sort()
 
 
 if len(input_class_list) < 1:
 if len(input_class_list) < 1:
-	input_class_list = class_names
-
+    input_class_list = class_names
 
 
 
 
 ################################################################################
 ################################################################################
@@ -346,34 +346,32 @@ table_column_chars = '|'
 total_status = ClassStatus('Total')
 total_status = ClassStatus('Total')
 
 
 for cn in input_class_list:
 for cn in input_class_list:
-	if not cn in classes:
-		print('Cannot find class ' + cn + '!')
-		sys.exit(255)
-
-	c = classes[cn]
-	validate_tag(c, 'class')
-	status = ClassStatus.generate_for_class(c)
+    if not cn in classes:
+        print('Cannot find class ' + cn + '!')
+        sys.exit(255)
 
 
-	if flags['b'] and status.is_ok():
-		continue
-	if flags['g'] and not status.is_ok():
-		continue
+    c = classes[cn]
+    validate_tag(c, 'class')
+    status = ClassStatus.generate_for_class(c)
 
 
-	total_status = total_status + status
-	out = status.make_output()
-	row = []
-	for column in table_columns:
-		if column in out:
-			row.append(out[column])
-		else:
-			row.append('')
+    if flags['b'] and status.is_ok():
+        continue
+    if flags['g'] and not status.is_ok():
+        continue
 
 
-	if 'comment' in out and out['comment'] != '':
-		row.append(out['comment'])
-
-	table.append(row)
+    total_status = total_status + status
+    out = status.make_output()
+    row = []
+    for column in table_columns:
+        if column in out:
+            row.append(out[column])
+        else:
+            row.append('')
 
 
+    if 'comment' in out and out['comment'] != '':
+        row.append(out['comment'])
 
 
+    table.append(row)
 
 
 
 
 ################################################################################
 ################################################################################
@@ -381,50 +379,49 @@ for cn in input_class_list:
 ################################################################################
 ################################################################################
 
 
 if len(table) == 1:
 if len(table) == 1:
-	print(color('part_big_problem', 'No classes suitable for printing!'))
-	sys.exit(0)
+    print(color('part_big_problem', 'No classes suitable for printing!'))
+    sys.exit(0)
 
 
 if len(table) > 2:
 if len(table) > 2:
-	total_status.name = 'Total = {0}'.format(len(table) - 1)
-	out = total_status.make_output()
-	row = []
-	for column in table_columns:
-		if column in out:
-			row.append(out[column])
-		else:
-			row.append('')
-	table.append(row)
+    total_status.name = 'Total = {0}'.format(len(table) - 1)
+    out = total_status.make_output()
+    row = []
+    for column in table_columns:
+        if column in out:
+            row.append(out[column])
+        else:
+            row.append('')
+    table.append(row)
 
 
 table_column_sizes = []
 table_column_sizes = []
 for row in table:
 for row in table:
-	for cell_i, cell in enumerate(row):
-		if cell_i >= len(table_column_sizes):
-			table_column_sizes.append(0)
+    for cell_i, cell in enumerate(row):
+        if cell_i >= len(table_column_sizes):
+            table_column_sizes.append(0)
 
 
-		table_column_sizes[cell_i] = max(nonescape_len(cell), table_column_sizes[cell_i])
+        table_column_sizes[cell_i] = max(nonescape_len(cell), table_column_sizes[cell_i])
 
 
 divider_string = table_row_chars[0]
 divider_string = table_row_chars[0]
 for cell_i in range(len(table[0])):
 for cell_i in range(len(table[0])):
-	divider_string += table_row_chars[1] * (table_column_sizes[cell_i] + 2) + table_row_chars[0]
+    divider_string += table_row_chars[1] * (table_column_sizes[cell_i] + 2) + table_row_chars[0]
 print(divider_string)
 print(divider_string)
 
 
 for row_i, row in enumerate(table):
 for row_i, row in enumerate(table):
-	row_string = table_column_chars
-	for cell_i, cell in enumerate(row):
-		padding_needed = table_column_sizes[cell_i] - nonescape_len(cell) + 2
-		if cell_i == 0:
-			row_string += table_row_chars[2] + cell + table_row_chars[2]*(padding_needed-1)
-		else:
-			row_string += table_row_chars[2]*math.floor(padding_needed/2) + cell + table_row_chars[2]*math.ceil((padding_needed/2))
-		row_string += table_column_chars
+    row_string = table_column_chars
+    for cell_i, cell in enumerate(row):
+        padding_needed = table_column_sizes[cell_i] - nonescape_len(cell) + 2
+        if cell_i == 0:
+            row_string += table_row_chars[2] + cell + table_row_chars[2] * (padding_needed - 1)
+        else:
+            row_string += table_row_chars[2] * math.floor(padding_needed / 2) + cell + table_row_chars[2] * math.ceil((padding_needed / 2))
+        row_string += table_column_chars
 
 
-	print(row_string)
+    print(row_string)
 
 
-	if row_i == 0 or row_i == len(table) - 2:
-		print(divider_string)
+    if row_i == 0 or row_i == len(table) - 2:
+        print(divider_string)
 
 
 print(divider_string)
 print(divider_string)
 
 
 if total_status.is_ok() and not flags['g']:
 if total_status.is_ok() and not flags['g']:
-	print('All listed classes are ' + color('part_good', 'OK') + '!')
-
+    print('All listed classes are ' + color('part_good', 'OK') + '!')

+ 264 - 279
doc/tools/makedoku.py

@@ -8,308 +8,295 @@ input_list = []
 
 
 
 
 for arg in sys.argv[1:]:
 for arg in sys.argv[1:]:
-  input_list.append(arg)
+    input_list.append(arg)
 
 
 if len(input_list) < 1:
 if len(input_list) < 1:
-  print("usage: makedoku.py <classes.xml>")
-  sys.exit(0)
+    print("usage: makedoku.py <classes.xml>")
+    sys.exit(0)
 
 
 
 
-def validate_tag(elem,tag):
-  if (elem.tag != tag):
-    print("Tag mismatch, expected '"+tag+"', got "+elem.tag);
-    sys.exit(255)
+def validate_tag(elem, tag):
+    if (elem.tag != tag):
+        print("Tag mismatch, expected '" + tag + "', got " + elem.tag)
+        sys.exit(255)
 
 
 
 
-class_names=[]
-classes={}
+class_names = []
+classes = {}
 
 
 
 
-def make_class_list(class_list,columns):
+def make_class_list(class_list, columns):
 
 
-	f=open("class_list.txt","wb")
-	prev=0
-	col_max = len(class_list) / columns + 1
-	print("col max is ", col_max)
-	col_count = 0
-	row_count = 0
-	last_initial = ""
-	fit_columns=[]
+    f = open("class_list.txt", "wb")
+    prev = 0
+    col_max = len(class_list) / columns + 1
+    print("col max is ", col_max)
+    col_count = 0
+    row_count = 0
+    last_initial = ""
+    fit_columns = []
 
 
-	for n in range(0,columns):
-		fit_columns+=[[]]
+    for n in range(0, columns):
+        fit_columns += [[]]
 
 
-	indexers=[]
-	last_initial=""
+    indexers = []
+    last_initial = ""
 
 
-	idx=0
-	for n in class_list:
-		col = idx/col_max
-		if (col>=columns):
-			col=columns-1
-		fit_columns[col]+=[n]
-		idx+=1
-		if (n[:1]!=last_initial):
-			indexers+=[n]
-		last_initial=n[:1]
+    idx = 0
+    for n in class_list:
+        col = idx / col_max
+        if (col >= columns):
+            col = columns - 1
+        fit_columns[col] += [n]
+        idx += 1
+        if (n[:1] != last_initial):
+            indexers += [n]
+        last_initial = n[:1]
 
 
+    row_max = 0
 
 
-	row_max=0
+    for n in range(0, columns):
+        if (len(fit_columns[n]) > row_max):
+            row_max = len(fit_columns[n])
 
 
-	for n in range(0,columns):
-		if (len(fit_columns[n])>row_max):
-			row_max=len(fit_columns[n])
+    for r in range(0, row_max):
+        s = "|"
+        for c in range(0, columns):
+            if (r >= len(fit_columns[c])):
+                continue
 
 
+            classname = fit_columns[c][r]
+            initial = classname[0]
+            if (classname in indexers):
+                s += "**" + initial + "**|"
+            else:
+                s += " |"
 
 
-	for r in range(0,row_max):
-		s="|"
-		for c in range(0,columns):
-			if (r>=len(fit_columns[c])):
-				continue
+            s += "[[" + classname.lower() + "|" + classname + "]]|"
 
 
-			classname = fit_columns[c][r]
-			initial=classname[0]
-			if (classname in indexers):
-				s+="**"+initial+"**|"
-			else:
-				s+=" |"
-
-			s+="[["+classname.lower()+"|"+classname+"]]|"
-
-		s+="\n"
-		f.write(s)
+        s += "\n"
+        f.write(s)
 
 
 
 
 def dokuize_text(txt):
 def dokuize_text(txt):
 
 
-	return txt
+    return txt
 
 
 
 
 def dokuize_text(text):
 def dokuize_text(text):
- pos=0
- while(True):
-  pos = text.find("[",pos)
-  if (pos==-1):
-   break
-
-  endq_pos=text.find("]",pos+1)
-  if (endq_pos==-1):
-   break
-
-  pre_text=text[:pos]
-  post_text=text[endq_pos+1:]
-  tag_text=text[pos+1:endq_pos]
-
-  if (tag_text in class_names):
-    tag_text="[["+tag_text.lower()+"|"+tag_text+"]]"
-  else: #command
-   cmd=tag_text
-   space_pos=tag_text.find(" ")
-   if (cmd.find("html")==0):
-    cmd=tag_text[:space_pos]
-    param=tag_text[space_pos+1:]
-    tag_text="<"+param+">"
-   elif(cmd.find("method")==0):
-    cmd=tag_text[:space_pos]
-    param=tag_text[space_pos+1:]
-
-    if (param.find(".")!=-1):
-     class_param,method_param=param.split(".")
-     tag_text="[["+class_param.lower()+"#"+method_param+"|"+class_param+'.'+method_param+"]]"
-    else:
-     tag_text="[[#"+param+"|"+param+"]]"
-   elif (cmd.find("image=")==0):
-    tag_text="{{"+cmd[6:]+"}}"
-   elif (cmd.find("url=")==0):
-    tag_text="[["+cmd[4:]+"|"
-   elif (cmd=="/url"):
-    tag_text="]]>"
-   elif (cmd=="center"):
-    tag_text=""
-   elif (cmd=="/center"):
-    tag_text=""
-   elif (cmd=="br"):
-    tag_text="\\\\\n"
-   elif (cmd=="i" or cmd=="/i"):
-    tag_text="//"
-   elif (cmd=="b" or cmd=="/b"):
-    tag_text="**"
-   elif (cmd=="u" or cmd=="/u"):
-    tag_text="__"
-   else:
-    tag_text="["+tag_text+"]"
-
-
-  text=pre_text+tag_text+post_text
-  pos=len(pre_text)+len(tag_text)
-
- #tnode = ET.SubElement(parent,"div")
- #tnode.text=text
- return text
+    pos = 0
+    while(True):
+        pos = text.find("[", pos)
+        if (pos == -1):
+            break
+
+        endq_pos = text.find("]", pos + 1)
+        if (endq_pos == -1):
+            break
+
+        pre_text = text[:pos]
+        post_text = text[endq_pos + 1:]
+        tag_text = text[pos + 1:endq_pos]
+
+        if (tag_text in class_names):
+            tag_text = "[[" + tag_text.lower() + "|" + tag_text + "]]"
+        else:  # command
+            cmd = tag_text
+            space_pos = tag_text.find(" ")
+            if (cmd.find("html") == 0):
+                cmd = tag_text[:space_pos]
+                param = tag_text[space_pos + 1:]
+                tag_text = "<" + param + ">"
+            elif(cmd.find("method") == 0):
+                cmd = tag_text[:space_pos]
+                param = tag_text[space_pos + 1:]
+
+                if (param.find(".") != -1):
+                    class_param, method_param = param.split(".")
+                    tag_text = "[[" + class_param.lower() + "#" + method_param + "|" + class_param + '.' + method_param + "]]"
+                else:
+                    tag_text = "[[#" + param + "|" + param + "]]"
+            elif (cmd.find("image=") == 0):
+                tag_text = "{{" + cmd[6:] + "}}"
+            elif (cmd.find("url=") == 0):
+                tag_text = "[[" + cmd[4:] + "|"
+            elif (cmd == "/url"):
+                tag_text = "]]>"
+            elif (cmd == "center"):
+                tag_text = ""
+            elif (cmd == "/center"):
+                tag_text = ""
+            elif (cmd == "br"):
+                tag_text = "\\\\\n"
+            elif (cmd == "i" or cmd == "/i"):
+                tag_text = "//"
+            elif (cmd == "b" or cmd == "/b"):
+                tag_text = "**"
+            elif (cmd == "u" or cmd == "/u"):
+                tag_text = "__"
+            else:
+                tag_text = "[" + tag_text + "]"
+
+        text = pre_text + tag_text + post_text
+        pos = len(pre_text) + len(tag_text)
+
+    #tnode = ET.SubElement(parent,"div")
+    # tnode.text=text
+    return text
 
 
 
 
 def make_type(t):
 def make_type(t):
-	global class_names
-	if (t in class_names):
-		return "[["+t.lower()+"|"+t+"]]"
-	return t
-
-
-def make_method(f,name,m,declare,event=False):
-
-	s="  * "
-	ret_type="void"
-	args=list(m)
-	mdata={}
-	mdata["argidx"]=[]
-	for a in args:
-		if (a.tag=="return"):
-			idx=-1
-		elif (a.tag=="argument"):
-			idx=int(a.attrib["index"])
-		else:
-			continue
-
-		mdata["argidx"].append(idx)
-		mdata[idx]=a
-
-
-
-	if (not event):
-		if (-1 in mdata["argidx"]):
-			s+=make_type(mdata[-1].attrib["type"])
-		else:
-			s+="void"
-		s+=" "
-
-	if (declare):
-
-		#span.attrib["class"]="funcdecl"
-		#a=ET.SubElement(span,"a")
-		#a.attrib["name"]=name+"_"+m.attrib["name"]
-		#a.text=name+"::"+m.attrib["name"]
-		s+="**"+m.attrib["name"]+"**"
-	else:
-		s+="[[#"+m.attrib["name"]+"|"+m.attrib["name"]+"]]"
-
-	s+="**(**"
-	argfound=False
-	for a in mdata["argidx"]:
-		arg=mdata[a]
-		if (a<0):
-			continue
-		if (a>0):
-			s+=", "
-		else:
-			s+=" "
+    global class_names
+    if (t in class_names):
+        return "[[" + t.lower() + "|" + t + "]]"
+    return t
+
+
+def make_method(f, name, m, declare, event=False):
+
+    s = "  * "
+    ret_type = "void"
+    args = list(m)
+    mdata = {}
+    mdata["argidx"] = []
+    for a in args:
+        if (a.tag == "return"):
+            idx = -1
+        elif (a.tag == "argument"):
+            idx = int(a.attrib["index"])
+        else:
+            continue
+
+        mdata["argidx"].append(idx)
+        mdata[idx] = a
+
+    if (not event):
+        if (-1 in mdata["argidx"]):
+            s += make_type(mdata[-1].attrib["type"])
+        else:
+            s += "void"
+        s += " "
+
+    if (declare):
+
+        # span.attrib["class"]="funcdecl"
+        # a=ET.SubElement(span,"a")
+        # a.attrib["name"]=name+"_"+m.attrib["name"]
+        # a.text=name+"::"+m.attrib["name"]
+        s += "**" + m.attrib["name"] + "**"
+    else:
+        s += "[[#" + m.attrib["name"] + "|" + m.attrib["name"] + "]]"
 
 
-		s+=make_type(arg.attrib["type"])
-		if ("name" in arg.attrib):
-			s+=" "+arg.attrib["name"]
-		else:
-			s+=" arg"+str(a)
+    s += "**(**"
+    argfound = False
+    for a in mdata["argidx"]:
+        arg = mdata[a]
+        if (a < 0):
+            continue
+        if (a > 0):
+            s += ", "
+        else:
+            s += " "
 
 
-		if ("default" in arg.attrib):
-			s+="="+arg.attrib["default"]
+        s += make_type(arg.attrib["type"])
+        if ("name" in arg.attrib):
+            s += " " + arg.attrib["name"]
+        else:
+            s += " arg" + str(a)
 
 
+        if ("default" in arg.attrib):
+            s += "=" + arg.attrib["default"]
 
 
-		argfound=True
+        argfound = True
 
 
-	if (argfound):
-		s+=" "
-	s+="**)**"
+    if (argfound):
+        s += " "
+    s += "**)**"
 
 
-	if ("qualifiers" in m.attrib):
-		s+=" "+m.attrib["qualifiers"]
+    if ("qualifiers" in m.attrib):
+        s += " " + m.attrib["qualifiers"]
 
 
-	f.write(s+"\n")
+    f.write(s + "\n")
 
 
 
 
 def make_doku_class(node):
 def make_doku_class(node):
 
 
-	name = node.attrib["name"]
-
-	f=open(name.lower()+".txt","wb")
-
-	f.write("======  "+name+"  ======\n")
-
-	if ("inherits" in node.attrib):
-		inh=node.attrib["inherits"].strip()
-		f.write("**Inherits:** [["+inh.lower()+"|"+inh+"]]\\\\\n")
-	if ("category" in node.attrib):
-		f.write("**Category:** "+node.attrib["category"].strip()+"\\\\\n")
-
-	briefd = node.find("brief_description")
-	if (briefd!=None):
-		f.write("=====  Brief Description  ======\n")
-		f.write( dokuize_text(briefd.text.strip())+"\n" )
-
-	methods = node.find("methods")
-
-	if(methods!=None and len(list(methods))>0):
-		f.write("=====  Member Functions  ======\n")
-		for m in list(methods):
-			make_method(f,node.attrib["name"],m,False)
-
-	events = node.find("signals")
-	if(events!=None and len(list(events))>0):
-		f.write("=====  Signals  ======\n")
-		for m in list(events):
-			make_method(f,node.attrib["name"],m,True,True)
-
-	members = node.find("members")
-
-	if(members!=None and len(list(members))>0):
-		f.write("=====  Member Variables  ======\n")
-
-		for c in list(members):
-			s = "  * "
-			s+=make_type(c.attrib["type"])+" "
-			s+="**"+c.attrib["name"]+"**"
-			if (c.text.strip()!=""):
-				s+=" - "+c.text.strip()
-			f.write(s+"\n")
-
-
-
-	constants = node.find("constants")
-	if(constants!=None and len(list(constants))>0):
-		f.write("=====  Numeric Constants  ======\n")
-		for c in list(constants):
-			s = "  * "
-			s+="**"+c.attrib["name"]+"**"
-			if ("value" in c.attrib):
-				s+=" = **"+c.attrib["value"]+"**"
-			if (c.text.strip()!=""):
-				s+=" - "+c.text.strip()
-			f.write(s+"\n")
-
-
-	descr=node.find("description")
-	if (descr!=None and descr.text.strip()!=""):
-		f.write("=====  Description  ======\n")
-		f.write(dokuize_text(descr.text.strip())+"\n")
-
-	methods = node.find("methods")
-
-	if(methods!=None and len(list(methods))>0):
-		f.write("=====  Member Function Description  ======\n")
-		for m in list(methods):
-
-			d=m.find("description")
-			if (d==None or d.text.strip()==""):
-				continue
-			f.write("==  "+m.attrib["name"]+"  ==\n")
-			make_method(f,node.attrib["name"],m,False)
-			f.write("\\\\\n")
-			f.write(dokuize_text(d.text.strip()))
-			f.write("\n")
-
-
-
-
-
-	"""
+    name = node.attrib["name"]
+
+    f = open(name.lower() + ".txt", "wb")
+
+    f.write("======  " + name + "  ======\n")
+
+    if ("inherits" in node.attrib):
+        inh = node.attrib["inherits"].strip()
+        f.write("**Inherits:** [[" + inh.lower() + "|" + inh + "]]\\\\\n")
+    if ("category" in node.attrib):
+        f.write("**Category:** " + node.attrib["category"].strip() + "\\\\\n")
+
+    briefd = node.find("brief_description")
+    if (briefd != None):
+        f.write("=====  Brief Description  ======\n")
+        f.write(dokuize_text(briefd.text.strip()) + "\n")
+
+    methods = node.find("methods")
+
+    if(methods != None and len(list(methods)) > 0):
+        f.write("=====  Member Functions  ======\n")
+        for m in list(methods):
+            make_method(f, node.attrib["name"], m, False)
+
+    events = node.find("signals")
+    if(events != None and len(list(events)) > 0):
+        f.write("=====  Signals  ======\n")
+        for m in list(events):
+            make_method(f, node.attrib["name"], m, True, True)
+
+    members = node.find("members")
+
+    if(members != None and len(list(members)) > 0):
+        f.write("=====  Member Variables  ======\n")
+
+        for c in list(members):
+            s = "  * "
+            s += make_type(c.attrib["type"]) + " "
+            s += "**" + c.attrib["name"] + "**"
+            if (c.text.strip() != ""):
+                s += " - " + c.text.strip()
+            f.write(s + "\n")
+
+    constants = node.find("constants")
+    if(constants != None and len(list(constants)) > 0):
+        f.write("=====  Numeric Constants  ======\n")
+        for c in list(constants):
+            s = "  * "
+            s += "**" + c.attrib["name"] + "**"
+            if ("value" in c.attrib):
+                s += " = **" + c.attrib["value"] + "**"
+            if (c.text.strip() != ""):
+                s += " - " + c.text.strip()
+            f.write(s + "\n")
+
+    descr = node.find("description")
+    if (descr != None and descr.text.strip() != ""):
+        f.write("=====  Description  ======\n")
+        f.write(dokuize_text(descr.text.strip()) + "\n")
+
+    methods = node.find("methods")
+
+    if(methods != None and len(list(methods)) > 0):
+        f.write("=====  Member Function Description  ======\n")
+        for m in list(methods):
+
+            d = m.find("description")
+            if (d == None or d.text.strip() == ""):
+                continue
+            f.write("==  " + m.attrib["name"] + "  ==\n")
+            make_method(f, node.attrib["name"], m, False)
+            f.write("\\\\\n")
+            f.write(dokuize_text(d.text.strip()))
+            f.write("\n")
+
+    """
   div=ET.Element("div")
   div=ET.Element("div")
   div.attrib["class"]="class";
   div.attrib["class"]="class";
 
 
@@ -487,28 +474,26 @@ def make_doku_class(node):
   return div
   return div
 """
 """
 for file in input_list:
 for file in input_list:
-	tree = ET.parse(file)
-	doc=tree.getroot()
+    tree = ET.parse(file)
+    doc = tree.getroot()
 
 
-	if ("version" not in doc.attrib):
-		print("Version missing from 'doc'")
-		sys.exit(255)
+    if ("version" not in doc.attrib):
+        print("Version missing from 'doc'")
+        sys.exit(255)
 
 
-	version=doc.attrib["version"]
+    version = doc.attrib["version"]
 
 
-	for c in list(doc):
-		if (c.attrib["name"] in class_names):
-			continue
-		class_names.append(c.attrib["name"])
-		classes[c.attrib["name"]]=c
+    for c in list(doc):
+        if (c.attrib["name"] in class_names):
+            continue
+        class_names.append(c.attrib["name"])
+        classes[c.attrib["name"]] = c
 
 
 
 
 class_names.sort()
 class_names.sort()
 
 
-make_class_list(class_names,4)
+make_class_list(class_names, 4)
 
 
 for cn in class_names:
 for cn in class_names:
-	c=classes[cn]
-	make_doku_class(c)
-
-
+    c = classes[cn]
+    make_doku_class(c)

File diff suppressed because it is too large
+ 554 - 583
doc/tools/makehtml.py


+ 290 - 291
doc/tools/makemd.py

@@ -7,17 +7,17 @@ import xml.etree.ElementTree as ET
 input_list = []
 input_list = []
 
 
 for arg in sys.argv[1:]:
 for arg in sys.argv[1:]:
-	input_list.append(arg)
+    input_list.append(arg)
 
 
 if len(input_list) < 1:
 if len(input_list) < 1:
-	print 'usage: makemd.py <classes.xml>'
-	sys.exit(0)
+    print 'usage: makemd.py <classes.xml>'
+    sys.exit(0)
 
 
 
 
 def validate_tag(elem, tag):
 def validate_tag(elem, tag):
-	if elem.tag != tag:
-		print "Tag mismatch, expected '" + tag + "', got " + elem.tag
-		sys.exit(255)
+    if elem.tag != tag:
+        print "Tag mismatch, expected '" + tag + "', got " + elem.tag
+        sys.exit(255)
 
 
 
 
 class_names = []
 class_names = []
@@ -26,321 +26,320 @@ classes = {}
 
 
 def make_class_list(class_list, columns):
 def make_class_list(class_list, columns):
 
 
-	f = open('class_list.md', 'wb')
-	prev = 0
-	col_max = len(class_list) / columns + 1
-	print ('col max is ', col_max)
-	col_count = 0
-	row_count = 0
-	last_initial = ''
-	fit_columns = []
-
-	for n in range(0, columns):
-		fit_columns += [[]]
-
-	indexers = []
-	last_initial = ''
-
-	idx = 0
-	for n in class_list:
-		col = idx / col_max
-		if col >= columns:
-			col = columns - 1
-		fit_columns[col] += [n]
-		idx += 1
-		if n[:1] != last_initial:
-			indexers += [n]
-		last_initial = n[:1]
-
-	row_max = 0
-	f.write("\n")
-
-	for n in range(0, columns):
-		if len(fit_columns[n]) > row_max:
-			row_max = len(fit_columns[n])
-
-	f.write("| ")
-	for n in range(0, columns):
-		f.write(" | |")
-
-	f.write("\n")
-	f.write("| ")
-	for n in range(0, columns):
-		f.write(" --- | ------- |")
-	f.write("\n")
-
-	for r in range(0, row_max):
-		s = '| '
-		for c in range(0, columns):
-			if r >= len(fit_columns[c]):
-				continue
-
-			classname = fit_columns[c][r]
-			initial = classname[0]
-			if classname in indexers:
-				s += '**' + initial + '** | '
-			else:
-				s += ' | '
-
-			s += '[' + classname + '](class_'+ classname.lower()+') | '
-
-		s += '\n'
-		f.write(s)
+    f = open('class_list.md', 'wb')
+    prev = 0
+    col_max = len(class_list) / columns + 1
+    print ('col max is ', col_max)
+    col_count = 0
+    row_count = 0
+    last_initial = ''
+    fit_columns = []
+
+    for n in range(0, columns):
+        fit_columns += [[]]
+
+    indexers = []
+    last_initial = ''
+
+    idx = 0
+    for n in class_list:
+        col = idx / col_max
+        if col >= columns:
+            col = columns - 1
+        fit_columns[col] += [n]
+        idx += 1
+        if n[:1] != last_initial:
+            indexers += [n]
+        last_initial = n[:1]
+
+    row_max = 0
+    f.write("\n")
+
+    for n in range(0, columns):
+        if len(fit_columns[n]) > row_max:
+            row_max = len(fit_columns[n])
+
+    f.write("| ")
+    for n in range(0, columns):
+        f.write(" | |")
+
+    f.write("\n")
+    f.write("| ")
+    for n in range(0, columns):
+        f.write(" --- | ------- |")
+    f.write("\n")
+
+    for r in range(0, row_max):
+        s = '| '
+        for c in range(0, columns):
+            if r >= len(fit_columns[c]):
+                continue
+
+            classname = fit_columns[c][r]
+            initial = classname[0]
+            if classname in indexers:
+                s += '**' + initial + '** | '
+            else:
+                s += ' | '
+
+            s += '[' + classname + '](class_' + classname.lower() + ') | '
+
+        s += '\n'
+        f.write(s)
 
 
 
 
 def dokuize_text(txt):
 def dokuize_text(txt):
 
 
-	return txt
+    return txt
 
 
 
 
 def dokuize_text(text):
 def dokuize_text(text):
-	pos = 0
-	while True:
-		pos = text.find('[', pos)
-		if pos == -1:
-			break
-
-		endq_pos = text.find(']', pos + 1)
-		if endq_pos == -1:
-			break
-
-		pre_text = text[:pos]
-		post_text = text[endq_pos + 1:]
-		tag_text = text[pos + 1:endq_pos]
-
-		if tag_text in class_names:
-			tag_text = make_type(tag_text)
-		else:
-
-		# command
-
-			cmd = tag_text
-			space_pos = tag_text.find(' ')
-			if cmd.find('html') == 0:
-				cmd = tag_text[:space_pos]
-				param = tag_text[space_pos + 1:]
-				tag_text = '<' + param + '>'
-			elif cmd.find('method') == 0:
-				cmd = tag_text[:space_pos]
-				param = tag_text[space_pos + 1:]
-
-				if param.find('.') != -1:
-					(class_param, method_param) = param.split('.')
-					tag_text = '['+class_param+'.'+method_param.replace("_","&#95;")+'](' + class_param.lower() + '#' \
-						+ method_param + ')'
-				else:
-					tag_text = '[' + param.replace("_","&#95;") + '](#' + param + ')'
-			elif cmd.find('image=') == 0:
-				tag_text = '![](' + cmd[6:] + ')'
-			elif cmd.find('url=') == 0:
-				tag_text = '[' + cmd[4:] + ']('+cmd[4:]
-			elif cmd == '/url':
-				tag_text = ')'
-			elif cmd == 'center':
-				tag_text = ''
-			elif cmd == '/center':
-				tag_text = ''
-			elif cmd == 'br':
-				tag_text = '\n'
-			elif cmd == 'i' or cmd == '/i':
-				tag_text = '_'
-			elif cmd == 'b' or cmd == '/b':
-				tag_text = '**'
-			elif cmd == 'u' or cmd == '/u':
-				tag_text = '__'
-			else:
-				tag_text = '[' + tag_text + ']'
-
-		text = pre_text + tag_text + post_text
-		pos = len(pre_text) + len(tag_text)
+    pos = 0
+    while True:
+        pos = text.find('[', pos)
+        if pos == -1:
+            break
+
+        endq_pos = text.find(']', pos + 1)
+        if endq_pos == -1:
+            break
+
+        pre_text = text[:pos]
+        post_text = text[endq_pos + 1:]
+        tag_text = text[pos + 1:endq_pos]
+
+        if tag_text in class_names:
+            tag_text = make_type(tag_text)
+        else:
+
+            # command
+
+            cmd = tag_text
+            space_pos = tag_text.find(' ')
+            if cmd.find('html') == 0:
+                cmd = tag_text[:space_pos]
+                param = tag_text[space_pos + 1:]
+                tag_text = '<' + param + '>'
+            elif cmd.find('method') == 0:
+                cmd = tag_text[:space_pos]
+                param = tag_text[space_pos + 1:]
+
+                if param.find('.') != -1:
+                    (class_param, method_param) = param.split('.')
+                    tag_text = '[' + class_param + '.' + method_param.replace("_", "&#95;") + '](' + class_param.lower() + '#' \
+                        + method_param + ')'
+                else:
+                    tag_text = '[' + param.replace("_", "&#95;") + '](#' + param + ')'
+            elif cmd.find('image=') == 0:
+                tag_text = '![](' + cmd[6:] + ')'
+            elif cmd.find('url=') == 0:
+                tag_text = '[' + cmd[4:] + '](' + cmd[4:]
+            elif cmd == '/url':
+                tag_text = ')'
+            elif cmd == 'center':
+                tag_text = ''
+            elif cmd == '/center':
+                tag_text = ''
+            elif cmd == 'br':
+                tag_text = '\n'
+            elif cmd == 'i' or cmd == '/i':
+                tag_text = '_'
+            elif cmd == 'b' or cmd == '/b':
+                tag_text = '**'
+            elif cmd == 'u' or cmd == '/u':
+                tag_text = '__'
+            else:
+                tag_text = '[' + tag_text + ']'
+
+        text = pre_text + tag_text + post_text
+        pos = len(pre_text) + len(tag_text)
 
 
  # tnode = ET.SubElement(parent,"div")
  # tnode = ET.SubElement(parent,"div")
  # tnode.text=text
  # tnode.text=text
 
 
-	return text
+    return text
 
 
 
 
 def make_type(t):
 def make_type(t):
-	global class_names
-	if t in class_names:
-		return '[' + t + '](class_' + t.lower() + ')'
-	return t
+    global class_names
+    if t in class_names:
+        return '[' + t + '](class_' + t.lower() + ')'
+    return t
 
 
 
 
 def make_method(
 def make_method(
-	f,
-	name,
-	m,
-	declare,
-	event=False,
-	):
-
-	s = '  * '
-	ret_type = 'void'
-	args = list(m)
-	mdata = {}
-	mdata['argidx'] = []
-	for a in args:
-		if a.tag == 'return':
-			idx = -1
-		elif a.tag == 'argument':
-			idx = int(a.attrib['index'])
-		else:
-			continue
-
-		mdata['argidx'].append(idx)
-		mdata[idx] = a
-
-	if not event:
-		if -1 in mdata['argidx']:
-			s += make_type(mdata[-1].attrib['type'])
-		else:
-			s += 'void'
-		s += ' '
-
-	if declare:
-
-		# span.attrib["class"]="funcdecl"
-		# a=ET.SubElement(span,"a")
-		# a.attrib["name"]=name+"_"+m.attrib["name"]
-		# a.text=name+"::"+m.attrib["name"]
-
-		s += ' **'+m.attrib['name'].replace("_","&#95;")+'** '
-	else:
-		s += ' **['+ m.attrib['name'].replace("_","&#95;")+'](#' + m.attrib['name'] + ')** '
-
-	s += ' **(**'
-	argfound = False
-	for a in mdata['argidx']:
-		arg = mdata[a]
-		if a < 0:
-			continue
-		if a > 0:
-			s += ', '
-		else:
-			s += ' '
-
-		s += make_type(arg.attrib['type'])
-		if 'name' in arg.attrib:
-			s += ' ' + arg.attrib['name']
-		else:
-			s += ' arg' + str(a)
-
-		if 'default' in arg.attrib:
-			s += '=' + arg.attrib['default']
-
-		argfound = True
-
-	if argfound:
-		s += ' '
-	s += ' **)**'
-
-	if 'qualifiers' in m.attrib:
-		s += ' ' + m.attrib['qualifiers']
-
-	f.write(s + '\n')
+        f,
+        name,
+        m,
+        declare,
+        event=False,
+):
+
+    s = '  * '
+    ret_type = 'void'
+    args = list(m)
+    mdata = {}
+    mdata['argidx'] = []
+    for a in args:
+        if a.tag == 'return':
+            idx = -1
+        elif a.tag == 'argument':
+            idx = int(a.attrib['index'])
+        else:
+            continue
+
+        mdata['argidx'].append(idx)
+        mdata[idx] = a
+
+    if not event:
+        if -1 in mdata['argidx']:
+            s += make_type(mdata[-1].attrib['type'])
+        else:
+            s += 'void'
+        s += ' '
+
+    if declare:
+
+        # span.attrib["class"]="funcdecl"
+        # a=ET.SubElement(span,"a")
+        # a.attrib["name"]=name+"_"+m.attrib["name"]
+        # a.text=name+"::"+m.attrib["name"]
+
+        s += ' **' + m.attrib['name'].replace("_", "&#95;") + '** '
+    else:
+        s += ' **[' + m.attrib['name'].replace("_", "&#95;") + '](#' + m.attrib['name'] + ')** '
+
+    s += ' **(**'
+    argfound = False
+    for a in mdata['argidx']:
+        arg = mdata[a]
+        if a < 0:
+            continue
+        if a > 0:
+            s += ', '
+        else:
+            s += ' '
+
+        s += make_type(arg.attrib['type'])
+        if 'name' in arg.attrib:
+            s += ' ' + arg.attrib['name']
+        else:
+            s += ' arg' + str(a)
+
+        if 'default' in arg.attrib:
+            s += '=' + arg.attrib['default']
+
+        argfound = True
+
+    if argfound:
+        s += ' '
+    s += ' **)**'
+
+    if 'qualifiers' in m.attrib:
+        s += ' ' + m.attrib['qualifiers']
+
+    f.write(s + '\n')
 
 
 
 
 def make_doku_class(node):
 def make_doku_class(node):
 
 
-	name = node.attrib['name']
-
-	f = open("class_"+name.lower() + '.md', 'wb')
-
-	f.write('#  ' + name + '  \n')
-
-	if 'inherits' in node.attrib:
-		inh = node.attrib['inherits'].strip()
-		f.write('####**Inherits:** '+make_type(inh)+'\n')
-	if 'category' in node.attrib:
-		f.write('####**Category:** ' + node.attrib['category'].strip()
-				+ '\n')
-
-	briefd = node.find('brief_description')
-	if briefd != None:
-		f.write('\n###  Brief Description  \n')
-		f.write(dokuize_text(briefd.text.strip()) + '\n')
-
-	methods = node.find('methods')
-
-	if methods != None and len(list(methods)) > 0:
-		f.write('\n###  Member Functions \n')
-		for m in list(methods):
-			make_method(f, node.attrib['name'], m, False)
-
-	events = node.find('signals')
-	if events != None and len(list(events)) > 0:
-		f.write('\n###  Signals  \n')
-		for m in list(events):
-			make_method(f, node.attrib['name'], m, True, True)
-
-	members = node.find('members')
-
-	if members != None and len(list(members)) > 0:
-		f.write('\n###  Member Variables  \n')
-
-		for c in list(members):
-			s = '  * '
-			s += make_type(c.attrib['type']) + ' '
-			s += '**' + c.attrib['name'] + '**'
-			if c.text.strip() != '':
-				s += ' - ' + c.text.strip()
-			f.write(s + '\n')
-
-	constants = node.find('constants')
-	if constants != None and len(list(constants)) > 0:
-		f.write('\n###  Numeric Constants  \n')
-		for c in list(constants):
-			s = '  * '
-			s += '**' + c.attrib['name'] + '**'
-			if 'value' in c.attrib:
-				s += ' = **' + c.attrib['value'] + '**'
-			if c.text.strip() != '':
-				s += ' - ' + c.text.strip()
-			f.write(s + '\n')
-
-	descr = node.find('description')
-	if descr != None and descr.text.strip() != '':
-		f.write('\n###  Description  \n')
-		f.write(dokuize_text(descr.text.strip()) + '\n')
-
-	methods = node.find('methods')
-
-	if methods != None and len(list(methods)) > 0:
-		f.write('\n###  Member Function Description  \n')
-		for m in list(methods):
-
-			d = m.find('description')
-			if d == None or d.text.strip() == '':
-				continue
-			f.write('\n#### <a name="'+m.attrib['name']+'">' + m.attrib['name'] + '</a>\n')
-			make_method(f, node.attrib['name'], m, True)
-			f.write('\n')
-			f.write(dokuize_text(d.text.strip()))
-			f.write('\n')
+    name = node.attrib['name']
+
+    f = open("class_" + name.lower() + '.md', 'wb')
+
+    f.write('#  ' + name + '  \n')
+
+    if 'inherits' in node.attrib:
+        inh = node.attrib['inherits'].strip()
+        f.write('####**Inherits:** ' + make_type(inh) + '\n')
+    if 'category' in node.attrib:
+        f.write('####**Category:** ' + node.attrib['category'].strip()
+                + '\n')
+
+    briefd = node.find('brief_description')
+    if briefd != None:
+        f.write('\n###  Brief Description  \n')
+        f.write(dokuize_text(briefd.text.strip()) + '\n')
+
+    methods = node.find('methods')
+
+    if methods != None and len(list(methods)) > 0:
+        f.write('\n###  Member Functions \n')
+        for m in list(methods):
+            make_method(f, node.attrib['name'], m, False)
+
+    events = node.find('signals')
+    if events != None and len(list(events)) > 0:
+        f.write('\n###  Signals  \n')
+        for m in list(events):
+            make_method(f, node.attrib['name'], m, True, True)
+
+    members = node.find('members')
+
+    if members != None and len(list(members)) > 0:
+        f.write('\n###  Member Variables  \n')
+
+        for c in list(members):
+            s = '  * '
+            s += make_type(c.attrib['type']) + ' '
+            s += '**' + c.attrib['name'] + '**'
+            if c.text.strip() != '':
+                s += ' - ' + c.text.strip()
+            f.write(s + '\n')
+
+    constants = node.find('constants')
+    if constants != None and len(list(constants)) > 0:
+        f.write('\n###  Numeric Constants  \n')
+        for c in list(constants):
+            s = '  * '
+            s += '**' + c.attrib['name'] + '**'
+            if 'value' in c.attrib:
+                s += ' = **' + c.attrib['value'] + '**'
+            if c.text.strip() != '':
+                s += ' - ' + c.text.strip()
+            f.write(s + '\n')
+
+    descr = node.find('description')
+    if descr != None and descr.text.strip() != '':
+        f.write('\n###  Description  \n')
+        f.write(dokuize_text(descr.text.strip()) + '\n')
+
+    methods = node.find('methods')
+
+    if methods != None and len(list(methods)) > 0:
+        f.write('\n###  Member Function Description  \n')
+        for m in list(methods):
+
+            d = m.find('description')
+            if d == None or d.text.strip() == '':
+                continue
+            f.write('\n#### <a name="' + m.attrib['name'] + '">' + m.attrib['name'] + '</a>\n')
+            make_method(f, node.attrib['name'], m, True)
+            f.write('\n')
+            f.write(dokuize_text(d.text.strip()))
+            f.write('\n')
 
 
 
 
 for file in input_list:
 for file in input_list:
-	tree = ET.parse(file)
-	doc = tree.getroot()
+    tree = ET.parse(file)
+    doc = tree.getroot()
 
 
-	if 'version' not in doc.attrib:
-		print "Version missing from 'doc'"
-		sys.exit(255)
+    if 'version' not in doc.attrib:
+        print "Version missing from 'doc'"
+        sys.exit(255)
 
 
-	version = doc.attrib['version']
+    version = doc.attrib['version']
 
 
-	for c in list(doc):
-		if c.attrib['name'] in class_names:
-			continue
-		class_names.append(c.attrib['name'])
-		classes[c.attrib['name']] = c
+    for c in list(doc):
+        if c.attrib['name'] in class_names:
+            continue
+        class_names.append(c.attrib['name'])
+        classes[c.attrib['name']] = c
 
 
 class_names.sort()
 class_names.sort()
 
 
 make_class_list(class_names, 2)
 make_class_list(class_names, 2)
 
 
 for cn in class_names:
 for cn in class_names:
-	c = classes[cn]
-	make_doku_class(c)
-
+    c = classes[cn]
+    make_doku_class(c)

+ 457 - 459
doc/tools/makerst.py

@@ -8,512 +8,510 @@ import xml.etree.ElementTree as ET
 input_list = []
 input_list = []
 
 
 for arg in sys.argv[1:]:
 for arg in sys.argv[1:]:
-	input_list.append(arg)
+    input_list.append(arg)
 
 
 if len(input_list) < 1:
 if len(input_list) < 1:
-	print 'usage: makerst.py <classes.xml>'
-	sys.exit(0)
+    print 'usage: makerst.py <classes.xml>'
+    sys.exit(0)
 
 
 
 
 def validate_tag(elem, tag):
 def validate_tag(elem, tag):
-	if elem.tag != tag:
-		print "Tag mismatch, expected '" + tag + "', got " + elem.tag
-		sys.exit(255)
+    if elem.tag != tag:
+        print "Tag mismatch, expected '" + tag + "', got " + elem.tag
+        sys.exit(255)
 
 
 
 
 class_names = []
 class_names = []
 classes = {}
 classes = {}
 
 
-def ul_string(str,ul):
-	str+="\n"
-	for i in range(len(str)-1):
-		str+=ul
-	str+="\n"
-	return str
+
+def ul_string(str, ul):
+    str += "\n"
+    for i in range(len(str) - 1):
+        str += ul
+    str += "\n"
+    return str
+
 
 
 def make_class_list(class_list, columns):
 def make_class_list(class_list, columns):
 
 
-	f = codecs.open('class_list.rst', 'wb', 'utf-8')
-	prev = 0
-	col_max = len(class_list) / columns + 1
-	print ('col max is ', col_max)
-	col_count = 0
-	row_count = 0
-	last_initial = ''
-	fit_columns = []
-
-	for n in range(0, columns):
-		fit_columns += [[]]
-
-	indexers = []
-	last_initial = ''
-
-	idx = 0
-	for n in class_list:
-		col = idx / col_max
-		if col >= columns:
-			col = columns - 1
-		fit_columns[col] += [n]
-		idx += 1
-		if n[:1] != last_initial:
-			indexers += [n]
-		last_initial = n[:1]
-
-	row_max = 0
-	f.write("\n")
-
-	for n in range(0, columns):
-		if len(fit_columns[n]) > row_max:
-			row_max = len(fit_columns[n])
-
-	f.write("| ")
-	for n in range(0, columns):
-		f.write(" | |")
-
-	f.write("\n")
-	f.write("+")
-	for n in range(0, columns):
-		f.write("--+-------+")
-	f.write("\n")
-
-	for r in range(0, row_max):
-		s = '+ '
-		for c in range(0, columns):
-			if r >= len(fit_columns[c]):
-				continue
-
-			classname = fit_columns[c][r]
-			initial = classname[0]
-			if classname in indexers:
-				s += '**' + initial + '** | '
-			else:
-				s += ' | '
-
-			s += '[' + classname + '](class_'+ classname.lower()+') | '
-
-		s += '\n'
-		f.write(s)
-
-	for n in range(0, columns):
-		f.write("--+-------+")
-	f.write("\n")
-
-
-def rstize_text(text,cclass):
-
-	# Linebreak + tabs in the XML should become two line breaks unless in a "codeblock"
-	pos = 0
-	while True:
-		pos = text.find('\n', pos)
-		if pos == -1:
-			break
-
-		pre_text = text[:pos]
-		while text[pos+1] == '\t':
-			pos += 1
-		post_text = text[pos+1:]
-
-		# Handle codeblocks
-		if post_text.startswith("[codeblock]"):
-			end_pos = post_text.find("[/codeblock]")
-			if end_pos == -1:
-				sys.exit("ERROR! [codeblock] without a closing tag!")
-
-			code_text = post_text[len("[codeblock]"):end_pos]
-			post_text = post_text[end_pos:]
-
-			# Remove extraneous tabs
-			code_pos = 0
-			while True:
-				code_pos = code_text.find('\n', code_pos)
-				if code_pos == -1:
-					break
-
-				to_skip = 0
-				while code_pos+to_skip+1 < len(code_text) and code_text[code_pos+to_skip+1] == '\t':
-					to_skip += 1
-
-				if len(code_text[code_pos+to_skip+1:])==0:
-					code_text = code_text[:code_pos] + "\n"
-					code_pos += 1
-				else:
-					code_text = code_text[:code_pos] + "\n    " + code_text[code_pos+to_skip+1:]
-					code_pos += 5 - to_skip
-
-			text = pre_text + "\n[codeblock]" + code_text + post_text
-			pos += len("\n[codeblock]" + code_text)
-
-		# Handle normal text
-		else:
-			text = pre_text + "\n\n" + post_text
-			pos += 2
-
-	# Escape * character to avoid interpreting it as emphasis
-	pos = 0
-	while True:
-		pos = text.find('*', pos)
-		if pos == -1:
-			break
-		text = text[:pos] + "\*" + text[pos + 1:]
-		pos += 2
-
-	# Escape _ character at the end of a word to avoid interpreting it as an inline hyperlink
-	pos = 0
-	while True:
-		pos = text.find('_', pos)
-		if pos == -1:
-			break
-		if not text[pos + 1].isalnum(): # don't escape within a snake_case word
-			text = text[:pos] + "\_" + text[pos + 1:]
-			pos += 2
-		else:
-			pos += 1
-
-	# Handle [tags]
-	pos = 0
-	while True:
-		pos = text.find('[', pos)
-		if pos == -1:
-			break
-
-		endq_pos = text.find(']', pos + 1)
-		if endq_pos == -1:
-			break
-
-		pre_text = text[:pos]
-		post_text = text[endq_pos + 1:]
-		tag_text = text[pos + 1:endq_pos]
-
-		if tag_text in class_names:
-			tag_text = make_type(tag_text)
-		else: # command
-			cmd = tag_text
-			space_pos = tag_text.find(' ')
-			if cmd.find('html') == 0:
-				cmd = tag_text[:space_pos]
-				param = tag_text[space_pos + 1:]
-				tag_text = param
-			elif cmd.find('method') == 0:
-				cmd = tag_text[:space_pos]
-				param = tag_text[space_pos + 1:]
-
-				if param.find('.') != -1:
-					(class_param, method_param) = param.split('.')
-					tag_text = ':ref:`'+class_param+'.'+method_param+'<class_' + class_param + '_' + method_param + '>`'
-				else:
-					tag_text = ':ref:`' + param + '<class_' + cclass +"_"+ param + '>`'
-			elif cmd.find('image=') == 0:
-				tag_text = "" #'![](' + cmd[6:] + ')'
-			elif cmd.find('url=') == 0:
-				tag_text = ':ref:`' + cmd[4:] + '<'+cmd[4:]+">`"
-			elif cmd == '/url':
-				tag_text = ')'
-			elif cmd == 'center':
-				tag_text = ''
-			elif cmd == '/center':
-				tag_text = ''
-			elif cmd == 'codeblock':
-				tag_text = '\n::\n'
-			elif cmd == '/codeblock':
-				tag_text = ''
-				# Strip newline if the tag was alone on one
-				if pre_text[-1] == '\n':
-					pre_text = pre_text[:-1]
-			elif cmd == 'br':
-				# Make a new paragraph instead of a linebreak, rst is not so linebreak friendly
-				tag_text = '\n\n'
-				# Strip potential leading spaces
-				while post_text[0] == ' ':
-					post_text = post_text[1:]
-			elif cmd == 'i' or cmd == '/i':
-				tag_text = '*'
-			elif cmd == 'b' or cmd == '/b':
-				tag_text = '**'
-			elif cmd == 'u' or cmd == '/u':
-				tag_text = ''
-			elif cmd == 'code' or cmd == '/code':
-				tag_text = '``'
-			else:
-				tag_text = ':ref:`' + tag_text + '<class_'+tag_text.lower()+'>`'
-
-		text = pre_text + tag_text + post_text
-		pos = len(pre_text) + len(tag_text)
+    f = codecs.open('class_list.rst', 'wb', 'utf-8')
+    prev = 0
+    col_max = len(class_list) / columns + 1
+    print ('col max is ', col_max)
+    col_count = 0
+    row_count = 0
+    last_initial = ''
+    fit_columns = []
+
+    for n in range(0, columns):
+        fit_columns += [[]]
+
+    indexers = []
+    last_initial = ''
+
+    idx = 0
+    for n in class_list:
+        col = idx / col_max
+        if col >= columns:
+            col = columns - 1
+        fit_columns[col] += [n]
+        idx += 1
+        if n[:1] != last_initial:
+            indexers += [n]
+        last_initial = n[:1]
+
+    row_max = 0
+    f.write("\n")
+
+    for n in range(0, columns):
+        if len(fit_columns[n]) > row_max:
+            row_max = len(fit_columns[n])
+
+    f.write("| ")
+    for n in range(0, columns):
+        f.write(" | |")
+
+    f.write("\n")
+    f.write("+")
+    for n in range(0, columns):
+        f.write("--+-------+")
+    f.write("\n")
+
+    for r in range(0, row_max):
+        s = '+ '
+        for c in range(0, columns):
+            if r >= len(fit_columns[c]):
+                continue
+
+            classname = fit_columns[c][r]
+            initial = classname[0]
+            if classname in indexers:
+                s += '**' + initial + '** | '
+            else:
+                s += ' | '
+
+            s += '[' + classname + '](class_' + classname.lower() + ') | '
+
+        s += '\n'
+        f.write(s)
+
+    for n in range(0, columns):
+        f.write("--+-------+")
+    f.write("\n")
+
+
+def rstize_text(text, cclass):
+
+    # Linebreak + tabs in the XML should become two line breaks unless in a "codeblock"
+    pos = 0
+    while True:
+        pos = text.find('\n', pos)
+        if pos == -1:
+            break
+
+        pre_text = text[:pos]
+        while text[pos + 1] == '\t':
+            pos += 1
+        post_text = text[pos + 1:]
+
+        # Handle codeblocks
+        if post_text.startswith("[codeblock]"):
+            end_pos = post_text.find("[/codeblock]")
+            if end_pos == -1:
+                sys.exit("ERROR! [codeblock] without a closing tag!")
+
+            code_text = post_text[len("[codeblock]"):end_pos]
+            post_text = post_text[end_pos:]
+
+            # Remove extraneous tabs
+            code_pos = 0
+            while True:
+                code_pos = code_text.find('\n', code_pos)
+                if code_pos == -1:
+                    break
+
+                to_skip = 0
+                while code_pos + to_skip + 1 < len(code_text) and code_text[code_pos + to_skip + 1] == '\t':
+                    to_skip += 1
+
+                if len(code_text[code_pos + to_skip + 1:]) == 0:
+                    code_text = code_text[:code_pos] + "\n"
+                    code_pos += 1
+                else:
+                    code_text = code_text[:code_pos] + "\n    " + code_text[code_pos + to_skip + 1:]
+                    code_pos += 5 - to_skip
+
+            text = pre_text + "\n[codeblock]" + code_text + post_text
+            pos += len("\n[codeblock]" + code_text)
+
+        # Handle normal text
+        else:
+            text = pre_text + "\n\n" + post_text
+            pos += 2
+
+    # Escape * character to avoid interpreting it as emphasis
+    pos = 0
+    while True:
+        pos = text.find('*', pos)
+        if pos == -1:
+            break
+        text = text[:pos] + "\*" + text[pos + 1:]
+        pos += 2
+
+    # Escape _ character at the end of a word to avoid interpreting it as an inline hyperlink
+    pos = 0
+    while True:
+        pos = text.find('_', pos)
+        if pos == -1:
+            break
+        if not text[pos + 1].isalnum():  # don't escape within a snake_case word
+            text = text[:pos] + "\_" + text[pos + 1:]
+            pos += 2
+        else:
+            pos += 1
+
+    # Handle [tags]
+    pos = 0
+    while True:
+        pos = text.find('[', pos)
+        if pos == -1:
+            break
+
+        endq_pos = text.find(']', pos + 1)
+        if endq_pos == -1:
+            break
+
+        pre_text = text[:pos]
+        post_text = text[endq_pos + 1:]
+        tag_text = text[pos + 1:endq_pos]
+
+        if tag_text in class_names:
+            tag_text = make_type(tag_text)
+        else:  # command
+            cmd = tag_text
+            space_pos = tag_text.find(' ')
+            if cmd.find('html') == 0:
+                cmd = tag_text[:space_pos]
+                param = tag_text[space_pos + 1:]
+                tag_text = param
+            elif cmd.find('method') == 0:
+                cmd = tag_text[:space_pos]
+                param = tag_text[space_pos + 1:]
+
+                if param.find('.') != -1:
+                    (class_param, method_param) = param.split('.')
+                    tag_text = ':ref:`' + class_param + '.' + method_param + '<class_' + class_param + '_' + method_param + '>`'
+                else:
+                    tag_text = ':ref:`' + param + '<class_' + cclass + "_" + param + '>`'
+            elif cmd.find('image=') == 0:
+                tag_text = ""  # '![](' + cmd[6:] + ')'
+            elif cmd.find('url=') == 0:
+                tag_text = ':ref:`' + cmd[4:] + '<' + cmd[4:] + ">`"
+            elif cmd == '/url':
+                tag_text = ')'
+            elif cmd == 'center':
+                tag_text = ''
+            elif cmd == '/center':
+                tag_text = ''
+            elif cmd == 'codeblock':
+                tag_text = '\n::\n'
+            elif cmd == '/codeblock':
+                tag_text = ''
+                # Strip newline if the tag was alone on one
+                if pre_text[-1] == '\n':
+                    pre_text = pre_text[:-1]
+            elif cmd == 'br':
+                # Make a new paragraph instead of a linebreak, rst is not so linebreak friendly
+                tag_text = '\n\n'
+                # Strip potential leading spaces
+                while post_text[0] == ' ':
+                    post_text = post_text[1:]
+            elif cmd == 'i' or cmd == '/i':
+                tag_text = '*'
+            elif cmd == 'b' or cmd == '/b':
+                tag_text = '**'
+            elif cmd == 'u' or cmd == '/u':
+                tag_text = ''
+            elif cmd == 'code' or cmd == '/code':
+                tag_text = '``'
+            else:
+                tag_text = ':ref:`' + tag_text + '<class_' + tag_text.lower() + '>`'
+
+        text = pre_text + tag_text + post_text
+        pos = len(pre_text) + len(tag_text)
 
 
  # tnode = ET.SubElement(parent,"div")
  # tnode = ET.SubElement(parent,"div")
  # tnode.text=text
  # tnode.text=text
 
 
-	return text
+    return text
 
 
 
 
 def make_type(t):
 def make_type(t):
-	global class_names
-	if t in class_names:
-		return ':ref:`'+t+'<class_' + t.lower()+'>`'
-	return t
+    global class_names
+    if t in class_names:
+        return ':ref:`' + t + '<class_' + t.lower() + '>`'
+    return t
 
 
 
 
 def make_method(
 def make_method(
-	f,
-	name,
-	m,
-	declare,
-	cname,
-	event=False,
-	pp=None
-	):
-
-	if (declare or pp==None):
-		t = '- '
-	else:
-		t = ""
-
-	ret_type = 'void'
-	args = list(m)
-	mdata = {}
-	mdata['argidx'] = []
-	for a in args:
-		if a.tag == 'return':
-			idx = -1
-		elif a.tag == 'argument':
-			idx = int(a.attrib['index'])
-		else:
-			continue
-
-		mdata['argidx'].append(idx)
-		mdata[idx] = a
-
-	if not event:
-		if -1 in mdata['argidx']:
-			t += make_type(mdata[-1].attrib['type'])
-		else:
-			t += 'void'
-		t += ' '
-
-	if declare or pp==None:
-
-		# span.attrib["class"]="funcdecl"
-		# a=ET.SubElement(span,"a")
-		# a.attrib["name"]=name+"_"+m.attrib["name"]
-		# a.text=name+"::"+m.attrib["name"]
-
-		s = ' **'+m.attrib['name']+'** '
-	else:
-		s = ':ref:`'+ m.attrib['name']+'<class_' + cname+"_"+m.attrib['name'] + '>` '
-
-	s += ' **(**'
-	argfound = False
-	for a in mdata['argidx']:
-		arg = mdata[a]
-		if a < 0:
-			continue
-		if a > 0:
-			s += ', '
-		else:
-			s += ' '
-
-		s += make_type(arg.attrib['type'])
-		if 'name' in arg.attrib:
-			s += ' ' + arg.attrib['name']
-		else:
-			s += ' arg' + str(a)
-
-		if 'default' in arg.attrib:
-			s += '=' + arg.attrib['default']
-
-		argfound = True
-
-	if argfound:
-		s += ' '
-	s += ' **)**'
-
-	if 'qualifiers' in m.attrib:
-		s += ' ' + m.attrib['qualifiers']
+        f,
+        name,
+        m,
+        declare,
+        cname,
+        event=False,
+        pp=None
+):
+
+    if (declare or pp == None):
+        t = '- '
+    else:
+        t = ""
+
+    ret_type = 'void'
+    args = list(m)
+    mdata = {}
+    mdata['argidx'] = []
+    for a in args:
+        if a.tag == 'return':
+            idx = -1
+        elif a.tag == 'argument':
+            idx = int(a.attrib['index'])
+        else:
+            continue
+
+        mdata['argidx'].append(idx)
+        mdata[idx] = a
+
+    if not event:
+        if -1 in mdata['argidx']:
+            t += make_type(mdata[-1].attrib['type'])
+        else:
+            t += 'void'
+        t += ' '
+
+    if declare or pp == None:
+
+        # span.attrib["class"]="funcdecl"
+        # a=ET.SubElement(span,"a")
+        # a.attrib["name"]=name+"_"+m.attrib["name"]
+        # a.text=name+"::"+m.attrib["name"]
+
+        s = ' **' + m.attrib['name'] + '** '
+    else:
+        s = ':ref:`' + m.attrib['name'] + '<class_' + cname + "_" + m.attrib['name'] + '>` '
+
+    s += ' **(**'
+    argfound = False
+    for a in mdata['argidx']:
+        arg = mdata[a]
+        if a < 0:
+            continue
+        if a > 0:
+            s += ', '
+        else:
+            s += ' '
+
+        s += make_type(arg.attrib['type'])
+        if 'name' in arg.attrib:
+            s += ' ' + arg.attrib['name']
+        else:
+            s += ' arg' + str(a)
+
+        if 'default' in arg.attrib:
+            s += '=' + arg.attrib['default']
+
+        argfound = True
+
+    if argfound:
+        s += ' '
+    s += ' **)**'
+
+    if 'qualifiers' in m.attrib:
+        s += ' ' + m.attrib['qualifiers']
 
 
 #	f.write(s)
 #	f.write(s)
-	if (not declare):
-		if (pp!=None):
-			pp.append( (t,s) )
-		else:
-			f.write("- "+t+" "+s+"\n")
-	else:
-		f.write(t+s+"\n")
+    if (not declare):
+        if (pp != None):
+            pp.append((t, s))
+        else:
+            f.write("- " + t + " " + s + "\n")
+    else:
+        f.write(t + s + "\n")
 
 
 
 
 def make_heading(title, underline):
 def make_heading(title, underline):
-	return title + '\n' + underline*len(title) + "\n\n"
-
+    return title + '\n' + underline * len(title) + "\n\n"
 
 
 
 
 def make_rst_class(node):
 def make_rst_class(node):
 
 
-	name = node.attrib['name']
+    name = node.attrib['name']
 
 
-	f = codecs.open("class_"+name.lower() + '.rst', 'wb', 'utf-8')
+    f = codecs.open("class_" + name.lower() + '.rst', 'wb', 'utf-8')
 
 
-	# Warn contributors not to edit this file directly
-	f.write(".. Generated automatically by doc/tools/makerst.py in Godot's source tree.\n")
-	f.write(".. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.\n\n")
+    # Warn contributors not to edit this file directly
+    f.write(".. Generated automatically by doc/tools/makerst.py in Godot's source tree.\n")
+    f.write(".. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.\n\n")
 
 
-	f.write(".. _class_"+name+":\n\n")
-	f.write(make_heading(name, '='))
+    f.write(".. _class_" + name + ":\n\n")
+    f.write(make_heading(name, '='))
 
 
-	if 'inherits' in node.attrib:
-		inh = node.attrib['inherits'].strip()
+    if 'inherits' in node.attrib:
+        inh = node.attrib['inherits'].strip()
 #		whle inh in classes[cn]
 #		whle inh in classes[cn]
-		f.write('**Inherits:** ')
-		first=True
-		while(inh in classes):
-			if (not first):
-				f.write(" **<** ")
-			else:
-				first=False
-
-			f.write(make_type(inh))
-			inode = classes[inh]
-			if ('inherits' in inode.attrib):
-				inh=inode.attrib['inherits'].strip()
-			else:
-				inh=None
-
-
-		f.write("\n\n")
-
-	inherited=[]
-	for cn in classes:
-		c=classes[cn]
-		if 'inherits' in c.attrib:
-			if (c.attrib['inherits'].strip()==name):
-				inherited.append(c.attrib['name'])
-
-	if (len(inherited)):
-		f.write('**Inherited By:** ')
-		for i in range(len(inherited)):
-			if (i>0):
-				f.write(", ")
-			f.write(make_type(inherited[i]))
-		f.write("\n\n")
-	if 'category' in node.attrib:
-		f.write('**Category:** ' + node.attrib['category'].strip() + "\n\n")
-
-	f.write(make_heading('Brief Description', '-'))
-	briefd = node.find('brief_description')
-	if briefd != None:
-		f.write(rstize_text(briefd.text.strip(),name) + "\n\n")
-
-	methods = node.find('methods')
-
-	if methods != None and len(list(methods)) > 0:
-		f.write(make_heading('Member Functions', '-'))
-		ml=[]
-		for m in list(methods):
-			make_method(f, node.attrib['name'], m, False,name,False,ml)
-		longest_t = 0
-		longest_s = 0
-		for s in ml:
-			sl = len(s[0])
-			if (sl>longest_s):
-				longest_s=sl
-			tl = len(s[1])
-			if (tl>longest_t):
-				longest_t=tl
-
-		sep="+"
-		for i in range(longest_s+2):
-			sep+="-"
-		sep+="+"
-		for i in range(longest_t+2):
-			sep+="-"
-		sep+="+\n"
-		f.write(sep)
-		for s in ml:
-			rt = s[0]
-			while( len(rt) < longest_s ):
-				rt+=" "
-			st = s[1]
-			while( len(st) < longest_t ):
-				st+=" "
-			f.write("| "+rt+" | "+st+" |\n")
-			f.write(sep)
-		f.write('\n')
-
-
-	events = node.find('signals')
-	if events != None and len(list(events)) > 0:
-		f.write(make_heading('Signals', '-'))
-		for m in list(events):
-			make_method(f, node.attrib['name'], m, True,name, True)
-		f.write('\n')
-
-	members = node.find('members')
-	if members != None and len(list(members)) > 0:
-		f.write(make_heading('Member Variables', '-'))
-
-		for c in list(members):
-			s = '- '
-			s += make_type(c.attrib['type']) + ' '
-			s += '**' + c.attrib['name'] + '**'
-			if c.text.strip() != '':
-				s += ' - ' + c.text.strip()
-			f.write(s + '\n')
-		f.write('\n')
-
-	constants = node.find('constants')
-	if constants != None and len(list(constants)) > 0:
-		f.write(make_heading('Numeric Constants', '-'))
-		for c in list(constants):
-			s = '- '
-			s += '**' + c.attrib['name'] + '**'
-			if 'value' in c.attrib:
-				s += ' = **' + c.attrib['value'] + '**'
-			if c.text.strip() != '':
-				s += ' --- ' + rstize_text(c.text.strip(),name)
-			f.write(s + '\n')
-		f.write('\n')
-
-	descr = node.find('description')
-	if descr != None and descr.text.strip() != '':
-		f.write(make_heading('Description', '-'))
-		f.write(rstize_text(descr.text.strip(),name) + "\n\n")
-
-	methods = node.find('methods')
-	if methods != None and len(list(methods)) > 0:
-		f.write(make_heading('Member Function Description', '-'))
-		for m in list(methods):
-			f.write(".. _class_"+name+"_"+m.attrib['name']+":\n\n")
+        f.write('**Inherits:** ')
+        first = True
+        while(inh in classes):
+            if (not first):
+                f.write(" **<** ")
+            else:
+                first = False
+
+            f.write(make_type(inh))
+            inode = classes[inh]
+            if ('inherits' in inode.attrib):
+                inh = inode.attrib['inherits'].strip()
+            else:
+                inh = None
+
+        f.write("\n\n")
+
+    inherited = []
+    for cn in classes:
+        c = classes[cn]
+        if 'inherits' in c.attrib:
+            if (c.attrib['inherits'].strip() == name):
+                inherited.append(c.attrib['name'])
+
+    if (len(inherited)):
+        f.write('**Inherited By:** ')
+        for i in range(len(inherited)):
+            if (i > 0):
+                f.write(", ")
+            f.write(make_type(inherited[i]))
+        f.write("\n\n")
+    if 'category' in node.attrib:
+        f.write('**Category:** ' + node.attrib['category'].strip() + "\n\n")
+
+    f.write(make_heading('Brief Description', '-'))
+    briefd = node.find('brief_description')
+    if briefd != None:
+        f.write(rstize_text(briefd.text.strip(), name) + "\n\n")
+
+    methods = node.find('methods')
+
+    if methods != None and len(list(methods)) > 0:
+        f.write(make_heading('Member Functions', '-'))
+        ml = []
+        for m in list(methods):
+            make_method(f, node.attrib['name'], m, False, name, False, ml)
+        longest_t = 0
+        longest_s = 0
+        for s in ml:
+            sl = len(s[0])
+            if (sl > longest_s):
+                longest_s = sl
+            tl = len(s[1])
+            if (tl > longest_t):
+                longest_t = tl
+
+        sep = "+"
+        for i in range(longest_s + 2):
+            sep += "-"
+        sep += "+"
+        for i in range(longest_t + 2):
+            sep += "-"
+        sep += "+\n"
+        f.write(sep)
+        for s in ml:
+            rt = s[0]
+            while(len(rt) < longest_s):
+                rt += " "
+            st = s[1]
+            while(len(st) < longest_t):
+                st += " "
+            f.write("| " + rt + " | " + st + " |\n")
+            f.write(sep)
+        f.write('\n')
+
+    events = node.find('signals')
+    if events != None and len(list(events)) > 0:
+        f.write(make_heading('Signals', '-'))
+        for m in list(events):
+            make_method(f, node.attrib['name'], m, True, name, True)
+        f.write('\n')
+
+    members = node.find('members')
+    if members != None and len(list(members)) > 0:
+        f.write(make_heading('Member Variables', '-'))
+
+        for c in list(members):
+            s = '- '
+            s += make_type(c.attrib['type']) + ' '
+            s += '**' + c.attrib['name'] + '**'
+            if c.text.strip() != '':
+                s += ' - ' + c.text.strip()
+            f.write(s + '\n')
+        f.write('\n')
+
+    constants = node.find('constants')
+    if constants != None and len(list(constants)) > 0:
+        f.write(make_heading('Numeric Constants', '-'))
+        for c in list(constants):
+            s = '- '
+            s += '**' + c.attrib['name'] + '**'
+            if 'value' in c.attrib:
+                s += ' = **' + c.attrib['value'] + '**'
+            if c.text.strip() != '':
+                s += ' --- ' + rstize_text(c.text.strip(), name)
+            f.write(s + '\n')
+        f.write('\n')
+
+    descr = node.find('description')
+    if descr != None and descr.text.strip() != '':
+        f.write(make_heading('Description', '-'))
+        f.write(rstize_text(descr.text.strip(), name) + "\n\n")
+
+    methods = node.find('methods')
+    if methods != None and len(list(methods)) > 0:
+        f.write(make_heading('Member Function Description', '-'))
+        for m in list(methods):
+            f.write(".. _class_" + name + "_" + m.attrib['name'] + ":\n\n")
 #			f.write(ul_string(m.attrib['name'],"^"))
 #			f.write(ul_string(m.attrib['name'],"^"))
-			#f.write('\n<a name="'+m.attrib['name']+'">' + m.attrib['name'] + '</a>\n------\n')
-			make_method(f, node.attrib['name'], m, True,name)
-			f.write('\n')
-			d = m.find('description')
-			if d == None or d.text.strip() == '':
-				continue
-			f.write(rstize_text(d.text.strip(),name))
-			f.write("\n\n")
-		f.write('\n')
+            #f.write('\n<a name="'+m.attrib['name']+'">' + m.attrib['name'] + '</a>\n------\n')
+            make_method(f, node.attrib['name'], m, True, name)
+            f.write('\n')
+            d = m.find('description')
+            if d == None or d.text.strip() == '':
+                continue
+            f.write(rstize_text(d.text.strip(), name))
+            f.write("\n\n")
+        f.write('\n')
 
 
 
 
 for file in input_list:
 for file in input_list:
-	tree = ET.parse(file)
-	doc = tree.getroot()
+    tree = ET.parse(file)
+    doc = tree.getroot()
 
 
-	if 'version' not in doc.attrib:
-		print "Version missing from 'doc'"
-		sys.exit(255)
+    if 'version' not in doc.attrib:
+        print "Version missing from 'doc'"
+        sys.exit(255)
 
 
-	version = doc.attrib['version']
+    version = doc.attrib['version']
 
 
-	for c in list(doc):
-		if c.attrib['name'] in class_names:
-			continue
-		class_names.append(c.attrib['name'])
-		classes[c.attrib['name']] = c
+    for c in list(doc):
+        if c.attrib['name'] in class_names:
+            continue
+        class_names.append(c.attrib['name'])
+        classes[c.attrib['name']] = c
 
 
 class_names.sort()
 class_names.sort()
 
 
-#Don't make class list for Sphinx, :toctree: handles it
+# Don't make class list for Sphinx, :toctree: handles it
 #make_class_list(class_names, 2)
 #make_class_list(class_names, 2)
 
 
 for cn in class_names:
 for cn in class_names:
-	c = classes[cn]
-	make_rst_class(c)
-
+    c = classes[cn]
+    make_rst_class(c)

+ 19 - 19
drivers/SCsub

@@ -2,41 +2,41 @@
 
 
 Import('env')
 Import('env')
 
 
-env.drivers_sources=[]
+env.drivers_sources = []
 
 
 if ("builtin_zlib" in env and env["builtin_zlib"] == "yes"):
 if ("builtin_zlib" in env and env["builtin_zlib"] == "yes"):
-	SConscript("zlib/SCsub");
+    SConscript("zlib/SCsub")
 
 
 # OS drivers
 # OS drivers
-SConscript('unix/SCsub');
-SConscript('windows/SCsub');
+SConscript('unix/SCsub')
+SConscript('windows/SCsub')
 
 
 # Sounds drivers
 # Sounds drivers
-SConscript('alsa/SCsub');
-SConscript('pulseaudio/SCsub');
+SConscript('alsa/SCsub')
+SConscript('pulseaudio/SCsub')
 if (env["platform"] == "windows"):
 if (env["platform"] == "windows"):
-	SConscript("rtaudio/SCsub");
+    SConscript("rtaudio/SCsub")
 if (env["xaudio2"] == "yes"):
 if (env["xaudio2"] == "yes"):
-	SConscript("xaudio2/SCsub");
+    SConscript("xaudio2/SCsub")
 
 
 # Graphics drivers
 # Graphics drivers
-SConscript('gles2/SCsub');
-SConscript('gl_context/SCsub');
+SConscript('gles2/SCsub')
+SConscript('gl_context/SCsub')
 
 
 # Core dependencies
 # Core dependencies
-SConscript("png/SCsub");
+SConscript("png/SCsub")
 
 
 # Tools override
 # Tools override
 # FIXME: Should likely be integrated in the tools/ codebase
 # FIXME: Should likely be integrated in the tools/ codebase
-if (env["tools"]=="yes"):
-	SConscript("convex_decomp/SCsub");
+if (env["tools"] == "yes"):
+    SConscript("convex_decomp/SCsub")
 
 
-if env['vsproj']=="yes":
-	env.AddToVSProject(env.drivers_sources)
+if env['vsproj'] == "yes":
+    env.AddToVSProject(env.drivers_sources)
 
 
 if env.split_drivers:
 if env.split_drivers:
-	env.split_lib("drivers")
+    env.split_lib("drivers")
 else:
 else:
-	env.add_source_files(env.drivers_sources,"*.cpp")
-	lib = env.Library("drivers",env.drivers_sources)
-	env.Prepend(LIBS=[lib])
+    env.add_source_files(env.drivers_sources, "*.cpp")
+    lib = env.Library("drivers", env.drivers_sources)
+    env.Prepend(LIBS=[lib])

+ 12 - 12
drivers/gl_context/SCsub

@@ -2,20 +2,20 @@
 
 
 Import('env')
 Import('env')
 
 
-if (env["platform"] in ["haiku","osx","windows","x11"]):
-	# Thirdparty source files
-	if (env["glew"] != "system"): # builtin
-		thirdparty_dir = "#thirdparty/glew/"
-		thirdparty_sources = [
-			"glew.c",
-		]
-		thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+if (env["platform"] in ["haiku", "osx", "windows", "x11"]):
+    # Thirdparty source files
+    if (env["glew"] != "system"):  # builtin
+        thirdparty_dir = "#thirdparty/glew/"
+        thirdparty_sources = [
+            "glew.c",
+        ]
+        thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 
 
-		env.add_source_files(env.drivers_sources, thirdparty_sources)
-		env.Append(CPPFLAGS = ['-DGLEW_STATIC'])
-		env.Append(CPPPATH = [thirdparty_dir])
+        env.add_source_files(env.drivers_sources, thirdparty_sources)
+        env.Append(CPPFLAGS=['-DGLEW_STATIC'])
+        env.Append(CPPPATH=[thirdparty_dir])
 
 
-	env.Append(CPPFLAGS = ['-DGLEW_ENABLED'])
+    env.Append(CPPFLAGS=['-DGLEW_ENABLED'])
 
 
 # Godot source files
 # Godot source files
 env.add_source_files(env.drivers_sources, "*.cpp")
 env.add_source_files(env.drivers_sources, "*.cpp")

+ 5 - 5
drivers/gles2/shaders/SCsub

@@ -3,10 +3,10 @@
 Import('env')
 Import('env')
 
 
 if env['BUILDERS'].has_key('GLSL120GLES'):
 if env['BUILDERS'].has_key('GLSL120GLES'):
-	env.GLSL120GLES('material.glsl');
-	env.GLSL120GLES('canvas.glsl');
-	env.GLSL120GLES('canvas_shadow.glsl');
-	env.GLSL120GLES('blur.glsl');
-	env.GLSL120GLES('copy.glsl');
+    env.GLSL120GLES('material.glsl')
+    env.GLSL120GLES('canvas.glsl')
+    env.GLSL120GLES('canvas_shadow.glsl')
+    env.GLSL120GLES('blur.glsl')
+    env.GLSL120GLES('copy.glsl')
 
 
 Export('env')
 Export('env')

+ 35 - 35
drivers/png/SCsub

@@ -6,43 +6,43 @@ env_png = env.Clone()
 
 
 # Thirdparty source files
 # Thirdparty source files
 if (env["libpng"] == "builtin"):
 if (env["libpng"] == "builtin"):
-	thirdparty_dir = "#thirdparty/libpng/"
-	thirdparty_sources = [
-		"png.c",
-		"pngerror.c",
-		"pngget.c",
-		"pngmem.c",
-		"pngpread.c",
-		"pngread.c",
-		"pngrio.c",
-		"pngrtran.c",
-		"pngrutil.c",
-		"pngset.c",
-		"pngtrans.c",
-		"pngwio.c",
-		"pngwrite.c",
-		"pngwtran.c",
-		"pngwutil.c",
-	]
-	thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+    thirdparty_dir = "#thirdparty/libpng/"
+    thirdparty_sources = [
+        "png.c",
+        "pngerror.c",
+        "pngget.c",
+        "pngmem.c",
+        "pngpread.c",
+        "pngread.c",
+        "pngrio.c",
+        "pngrtran.c",
+        "pngrutil.c",
+        "pngset.c",
+        "pngtrans.c",
+        "pngwio.c",
+        "pngwrite.c",
+        "pngwtran.c",
+        "pngwutil.c",
+    ]
+    thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 
 
-	env_png.add_source_files(env.drivers_sources, thirdparty_sources)
-	env_png.Append(CPPPATH = [thirdparty_dir])
+    env_png.add_source_files(env.drivers_sources, thirdparty_sources)
+    env_png.Append(CPPPATH=[thirdparty_dir])
 
 
-	# Currently .ASM filter_neon.S does not compile on NT.
-	import os
-	if ("neon_enabled" in env and env["neon_enabled"]) and os.name!="nt":
-		env_png.Append(CPPFLAGS = ["-DPNG_ARM_NEON_OPT=2"])
-		env_neon = env_png.Clone();
-		if "S_compiler" in env:
-			env_neon['CC'] = env['S_compiler']
-		neon_sources = []
-		neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/arm_init.c"))
-		neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon_intrinsics.c"))
-		neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon.S"))
-		env.drivers_sources += neon_sources
-	else:
-		env_png.Append(CPPFLAGS = ["-DPNG_ARM_NEON_OPT=0"])
+    # Currently .ASM filter_neon.S does not compile on NT.
+    import os
+    if ("neon_enabled" in env and env["neon_enabled"]) and os.name != "nt":
+        env_png.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=2"])
+        env_neon = env_png.Clone()
+        if "S_compiler" in env:
+            env_neon['CC'] = env['S_compiler']
+        neon_sources = []
+        neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/arm_init.c"))
+        neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon_intrinsics.c"))
+        neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon.S"))
+        env.drivers_sources += neon_sources
+    else:
+        env_png.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=0"])
 
 
 # Godot source files
 # Godot source files
 env_png.add_source_files(env.drivers_sources, "*.cpp")
 env_png.add_source_files(env.drivers_sources, "*.cpp")

+ 2 - 2
drivers/rtaudio/SCsub

@@ -7,12 +7,12 @@ Import('env')
 # Thirdparty source files
 # Thirdparty source files
 thirdparty_dir = "#thirdparty/rtaudio/"
 thirdparty_dir = "#thirdparty/rtaudio/"
 thirdparty_sources = [
 thirdparty_sources = [
-	"RtAudio.cpp",
+    "RtAudio.cpp",
 ]
 ]
 thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 
 
 env.add_source_files(env.drivers_sources, thirdparty_sources)
 env.add_source_files(env.drivers_sources, thirdparty_sources)
-env.Append(CPPPATH = [thirdparty_dir])
+env.Append(CPPPATH=[thirdparty_dir])
 
 
 # Driver source files
 # Driver source files
 env.add_source_files(env.drivers_sources, "*.cpp")
 env.add_source_files(env.drivers_sources, "*.cpp")

+ 7 - 7
drivers/unix/SCsub

@@ -2,13 +2,13 @@
 
 
 Import('env')
 Import('env')
 
 
-g_set_p='#ifdef UNIX_ENABLED\n'
-g_set_p+='#include "os_unix.h"\n'
-g_set_p+='String OS_Unix::get_global_settings_path() const {\n'
-g_set_p+='\treturn "' + env["unix_global_settings_path"]+'";\n'
-g_set_p+='}\n'
-g_set_p+='#endif'
-f = open("os_unix_global_settings_path.cpp","wb")
+g_set_p = '#ifdef UNIX_ENABLED\n'
+g_set_p += '#include "os_unix.h"\n'
+g_set_p += 'String OS_Unix::get_global_settings_path() const {\n'
+g_set_p += '\treturn "' + env["unix_global_settings_path"] + '";\n'
+g_set_p += '}\n'
+g_set_p += '#endif'
+f = open("os_unix_global_settings_path.cpp", "wb")
 f.write(g_set_p)
 f.write(g_set_p)
 f.close()
 f.close()
 
 

+ 12 - 12
drivers/zlib/SCsub

@@ -8,19 +8,19 @@ Import('env')
 # No check here as already done in drivers/SCsub
 # No check here as already done in drivers/SCsub
 thirdparty_dir = "#thirdparty/zlib/"
 thirdparty_dir = "#thirdparty/zlib/"
 thirdparty_sources = [
 thirdparty_sources = [
-	"adler32.c",
-	"compress.c",
-	"crc32.c",
-	"deflate.c",
-	"infback.c",
-	"inffast.c",
-	"inflate.c",
-	"inftrees.c",
-	"trees.c",
-	"uncompr.c",
-	"zutil.c",
+    "adler32.c",
+    "compress.c",
+    "crc32.c",
+    "deflate.c",
+    "infback.c",
+    "inffast.c",
+    "inflate.c",
+    "inftrees.c",
+    "trees.c",
+    "uncompr.c",
+    "zutil.c",
 ]
 ]
 thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 
 
 env.add_source_files(env.drivers_sources, thirdparty_sources)
 env.add_source_files(env.drivers_sources, thirdparty_sources)
-env.Append(CPPPATH = [thirdparty_dir])
+env.Append(CPPPATH=[thirdparty_dir])

+ 3 - 3
main/SCsub

@@ -2,11 +2,11 @@
 
 
 Import('env')
 Import('env')
 
 
-env.main_sources=[]
-env.add_source_files(env.main_sources,"*.cpp")
+env.main_sources = []
+env.add_source_files(env.main_sources, "*.cpp")
 
 
 Export('env')
 Export('env')
 
 
-lib = env.Library("main",env.main_sources)
+lib = env.Library("main", env.main_sources)
 
 
 env.Prepend(LIBS=[lib])
 env.Prepend(LIBS=[lib])

File diff suppressed because it is too large
+ 723 - 745
methods.py


+ 8 - 8
modules/SCsub

@@ -6,18 +6,18 @@ env_modules = env.Clone()
 
 
 Export('env_modules')
 Export('env_modules')
 
 
-env.modules_sources=[
-	"register_module_types.cpp",
+env.modules_sources = [
+    "register_module_types.cpp",
 ]
 ]
-#env.add_source_files(env.modules_sources,"*.cpp")
+# env.add_source_files(env.modules_sources,"*.cpp")
 Export('env')
 Export('env')
 
 
 for x in env.module_list:
 for x in env.module_list:
-	if (x in env.disabled_modules):
-		continue
-	env_modules.Append(CPPFLAGS=["-DMODULE_"+x.upper()+"_ENABLED"])
-	SConscript(x+"/SCsub")
+    if (x in env.disabled_modules):
+        continue
+    env_modules.Append(CPPFLAGS=["-DMODULE_" + x.upper() + "_ENABLED"])
+    SConscript(x + "/SCsub")
 
 
-lib = env_modules.Library("modules",env.modules_sources)
+lib = env_modules.Library("modules", env.modules_sources)
 
 
 env.Prepend(LIBS=[lib])
 env.Prepend(LIBS=[lib])

+ 3 - 2
modules/chibi/config.py

@@ -1,6 +1,7 @@
 
 
 def can_build(platform):
 def can_build(platform):
-	return True
+    return True
+
 
 
 def configure(env):
 def configure(env):
-	pass
+    pass

+ 2 - 5
modules/cscript/config.py

@@ -1,11 +1,8 @@
 
 
 
 
 def can_build(platform):
 def can_build(platform):
-  return True
+    return True
 
 
 
 
 def configure(env):
 def configure(env):
-	pass
-
-
-
+    pass

+ 3 - 2
modules/dds/config.py

@@ -1,6 +1,7 @@
 
 
 def can_build(platform):
 def can_build(platform):
-	return True
+    return True
+
 
 
 def configure(env):
 def configure(env):
-	pass
+    pass

+ 16 - 16
modules/enet/SCsub

@@ -7,22 +7,22 @@ Import('env_modules')
 
 
 env_enet = env_modules.Clone()
 env_enet = env_modules.Clone()
 
 
-if (env["enet"] != "system"): # builtin
-	thirdparty_dir = "#thirdparty/enet/"
-	thirdparty_sources = [
-		"callbacks.c",
-		"compress.c",
-		"host.c",
-		"list.c",
-		"packet.c",
-		"peer.c",
-		"protocol.c",
-		"unix.c",
-		"win32.c",
-	]
-	thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+if (env["enet"] != "system"):  # builtin
+    thirdparty_dir = "#thirdparty/enet/"
+    thirdparty_sources = [
+        "callbacks.c",
+        "compress.c",
+        "host.c",
+        "list.c",
+        "packet.c",
+        "peer.c",
+        "protocol.c",
+        "unix.c",
+        "win32.c",
+    ]
+    thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 
 
-	env_enet.add_source_files(env.modules_sources, thirdparty_sources)
-	env_enet.Append(CPPPATH = [thirdparty_dir])
+    env_enet.add_source_files(env.modules_sources, thirdparty_sources)
+    env_enet.Append(CPPPATH=[thirdparty_dir])
 
 
 env_enet.add_source_files(env.modules_sources, "*.cpp")
 env_enet.add_source_files(env.modules_sources, "*.cpp")

+ 3 - 2
modules/enet/config.py

@@ -1,6 +1,7 @@
 
 
 def can_build(platform):
 def can_build(platform):
-	return True
+    return True
+
 
 
 def configure(env):
 def configure(env):
-	pass
+    pass

+ 2 - 2
modules/etc1/SCsub

@@ -9,12 +9,12 @@ env_etc1 = env_modules.Clone()
 # Not unbundled so far since not widespread as shared library
 # Not unbundled so far since not widespread as shared library
 thirdparty_dir = "#thirdparty/rg-etc1/"
 thirdparty_dir = "#thirdparty/rg-etc1/"
 thirdparty_sources = [
 thirdparty_sources = [
-	"rg_etc1.cpp",
+    "rg_etc1.cpp",
 ]
 ]
 thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 
 
 env_etc1.add_source_files(env.modules_sources, thirdparty_sources)
 env_etc1.add_source_files(env.modules_sources, thirdparty_sources)
-env_etc1.Append(CPPPATH = [thirdparty_dir])
+env_etc1.Append(CPPPATH=[thirdparty_dir])
 
 
 # Godot source files
 # Godot source files
 env_etc1.add_source_files(env.modules_sources, "*.cpp")
 env_etc1.add_source_files(env.modules_sources, "*.cpp")

+ 3 - 2
modules/etc1/config.py

@@ -1,6 +1,7 @@
 
 
 def can_build(platform):
 def can_build(platform):
-	return True
+    return True
+
 
 
 def configure(env):
 def configure(env):
-	pass
+    pass

+ 59 - 59
modules/freetype/SCsub

@@ -5,66 +5,66 @@ Import('env')
 # Not building in a separate env as core needs it
 # Not building in a separate env as core needs it
 
 
 # Thirdparty source files
 # Thirdparty source files
-if (env["freetype"] != "system"): # builtin
-	thirdparty_dir = "#thirdparty/freetype/"
-	thirdparty_sources = [
-		"src/autofit/autofit.c",
-		"src/base/ftapi.c",
-		"src/base/ftbase.c",
-		"src/base/ftbbox.c",
-		"src/base/ftbdf.c",
-		"src/base/ftbitmap.c",
-		"src/base/ftcid.c",
-		"src/base/ftdebug.c",
-		"src/base/ftfntfmt.c",
-		"src/base/ftfstype.c",
-		"src/base/ftgasp.c",
-		"src/base/ftglyph.c",
-		"src/base/ftgxval.c",
-		"src/base/ftinit.c",
-		"src/base/ftlcdfil.c",
-		"src/base/ftmm.c",
-		"src/base/ftotval.c",
-		"src/base/ftpatent.c",
-		"src/base/ftpfr.c",
-		"src/base/ftpic.c",
-		"src/base/ftstroke.c",
-		"src/base/ftsynth.c",
-		"src/base/ftsystem.c",
-		"src/base/fttype1.c",
-		"src/base/ftwinfnt.c",
-		"src/bdf/bdf.c",
-		"src/cache/ftcache.c",
-		"src/cff/cff.c",
-		"src/cid/type1cid.c",
-		"src/gxvalid/gxvalid.c",
-		"src/otvalid/otvalid.c",
-		"src/pcf/pcf.c",
-		"src/pfr/pfr.c",
-		"src/psaux/psaux.c",
-		"src/pshinter/pshinter.c",
-		"src/psnames/psnames.c",
-		"src/raster/raster.c",
-		"src/sfnt/sfnt.c",
-		"src/smooth/smooth.c",
-		"src/truetype/truetype.c",
-		"src/type1/type1.c",
-		"src/type42/type42.c",
-		"src/winfonts/winfnt.c",
-	]
-	thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+if (env["freetype"] != "system"):  # builtin
+    thirdparty_dir = "#thirdparty/freetype/"
+    thirdparty_sources = [
+        "src/autofit/autofit.c",
+        "src/base/ftapi.c",
+        "src/base/ftbase.c",
+        "src/base/ftbbox.c",
+        "src/base/ftbdf.c",
+        "src/base/ftbitmap.c",
+        "src/base/ftcid.c",
+        "src/base/ftdebug.c",
+        "src/base/ftfntfmt.c",
+        "src/base/ftfstype.c",
+        "src/base/ftgasp.c",
+        "src/base/ftglyph.c",
+        "src/base/ftgxval.c",
+        "src/base/ftinit.c",
+        "src/base/ftlcdfil.c",
+        "src/base/ftmm.c",
+        "src/base/ftotval.c",
+        "src/base/ftpatent.c",
+        "src/base/ftpfr.c",
+        "src/base/ftpic.c",
+        "src/base/ftstroke.c",
+        "src/base/ftsynth.c",
+        "src/base/ftsystem.c",
+        "src/base/fttype1.c",
+        "src/base/ftwinfnt.c",
+        "src/bdf/bdf.c",
+        "src/cache/ftcache.c",
+        "src/cff/cff.c",
+        "src/cid/type1cid.c",
+        "src/gxvalid/gxvalid.c",
+        "src/otvalid/otvalid.c",
+        "src/pcf/pcf.c",
+        "src/pfr/pfr.c",
+        "src/psaux/psaux.c",
+        "src/pshinter/pshinter.c",
+        "src/psnames/psnames.c",
+        "src/raster/raster.c",
+        "src/sfnt/sfnt.c",
+        "src/smooth/smooth.c",
+        "src/truetype/truetype.c",
+        "src/type1/type1.c",
+        "src/type42/type42.c",
+        "src/winfonts/winfnt.c",
+    ]
+    thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 
 
-	# Include header for WinRT to fix build issues
-	if "platform" in env and env["platform"] == "winrt":
-		env.Append(CCFLAGS = ['/FI', '"modules/freetype/winrtdef.h"'])
+    # Include header for WinRT to fix build issues
+    if "platform" in env and env["platform"] == "winrt":
+        env.Append(CCFLAGS=['/FI', '"modules/freetype/winrtdef.h"'])
 
 
-	env.Append(CPPPATH = [thirdparty_dir, thirdparty_dir + "/include"])
+    env.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "/include"])
 
 
-	# also requires libpng headers
-	if (env["libpng"] != "system"): # builtin
-		env.Append(CPPPATH = ["#thirdparty/libpng"])
+    # also requires libpng headers
+    if (env["libpng"] != "system"):  # builtin
+        env.Append(CPPPATH=["#thirdparty/libpng"])
 
 
-	""" FIXME: Remove this commented code if Windows can handle the monolithic lib
+    """ FIXME: Remove this commented code if Windows can handle the monolithic lib
 	# fix for Windows' shell miserably failing on long lines, split in two libraries
 	# fix for Windows' shell miserably failing on long lines, split in two libraries
 	half1 = []
 	half1 = []
 	half2 = []
 	half2 = []
@@ -80,11 +80,11 @@ if (env["freetype"] != "system"): # builtin
 	env.Append(LIBS = [lib])
 	env.Append(LIBS = [lib])
 	"""
 	"""
 
 
-	lib = env.Library("freetype_builtin", thirdparty_sources)
-	env.Append(LIBS = [lib])
+    lib = env.Library("freetype_builtin", thirdparty_sources)
+    env.Append(LIBS=[lib])
 
 
 # Godot source files
 # Godot source files
 env.add_source_files(env.modules_sources, "*.cpp")
 env.add_source_files(env.modules_sources, "*.cpp")
-env.Append(CCFLAGS = ['-DFREETYPE_ENABLED'])
+env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
 
 
 Export('env')
 Export('env')

+ 3 - 2
modules/freetype/config.py

@@ -1,6 +1,7 @@
 
 
 def can_build(platform):
 def can_build(platform):
-	return True
+    return True
+
 
 
 def configure(env):
 def configure(env):
-	pass
+    pass

+ 2 - 5
modules/gdscript/config.py

@@ -1,11 +1,8 @@
 
 
 
 
 def can_build(platform):
 def can_build(platform):
-  return True
+    return True
 
 
 
 
 def configure(env):
 def configure(env):
-	pass
-
-
-
+    pass

+ 2 - 5
modules/gridmap/config.py

@@ -1,11 +1,8 @@
 
 
 
 
 def can_build(platform):
 def can_build(platform):
-  return True
+    return True
 
 
 
 
 def configure(env):
 def configure(env):
-	pass
-
-
-
+    pass

+ 4 - 7
modules/ik/config.py

@@ -1,11 +1,8 @@
 
 
 
 
 def can_build(platform):
 def can_build(platform):
-  return True
-  
-  
+    return True
+
+
 def configure(env):
 def configure(env):
-	pass
-  
-  
-  
+    pass

+ 2 - 2
modules/jpg/SCsub

@@ -9,12 +9,12 @@ env_jpg = env_modules.Clone()
 # Not unbundled for now as they are not commonly available as shared library
 # Not unbundled for now as they are not commonly available as shared library
 thirdparty_dir = "#thirdparty/jpeg-compressor/"
 thirdparty_dir = "#thirdparty/jpeg-compressor/"
 thirdparty_sources = [
 thirdparty_sources = [
-	"jpgd.cpp",
+    "jpgd.cpp",
 ]
 ]
 thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 
 
 env_jpg.add_source_files(env.modules_sources, thirdparty_sources)
 env_jpg.add_source_files(env.modules_sources, thirdparty_sources)
-env_jpg.Append(CPPPATH = [thirdparty_dir])
+env_jpg.Append(CPPPATH=[thirdparty_dir])
 
 
 # Godot's own source files
 # Godot's own source files
 env_jpg.add_source_files(env.modules_sources, "*.cpp")
 env_jpg.add_source_files(env.modules_sources, "*.cpp")

+ 3 - 2
modules/jpg/config.py

@@ -1,6 +1,7 @@
 
 
 def can_build(platform):
 def can_build(platform):
-	return True
+    return True
+
 
 
 def configure(env):
 def configure(env):
-	pass
+    pass

+ 15 - 15
modules/mpc/SCsub

@@ -6,23 +6,23 @@ Import('env_modules')
 env_mpc = env_modules.Clone()
 env_mpc = env_modules.Clone()
 
 
 # Thirdparty source files
 # Thirdparty source files
-if (env["libmpcdec"] != "system"): # builtin
-	thirdparty_dir = "#thirdparty/libmpcdec/"
-	thirdparty_sources = [
-		"huffman.c",
-		"mpc_bits_reader.c",
-		"mpc_decoder.c",
-		"mpc_demux.c",
-		"mpc_reader.c",
-		"requant.c",
-		"streaminfo.c",
-		"synth_filter.c",
-	]
+if (env["libmpcdec"] != "system"):  # builtin
+    thirdparty_dir = "#thirdparty/libmpcdec/"
+    thirdparty_sources = [
+        "huffman.c",
+        "mpc_bits_reader.c",
+        "mpc_decoder.c",
+        "mpc_demux.c",
+        "mpc_reader.c",
+        "requant.c",
+        "streaminfo.c",
+        "synth_filter.c",
+    ]
 
 
-	thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+    thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 
 
-	env_mpc.add_source_files(env.modules_sources, thirdparty_sources)
-	env_mpc.Append(CPPPATH = [thirdparty_dir])
+    env_mpc.add_source_files(env.modules_sources, thirdparty_sources)
+    env_mpc.Append(CPPPATH=[thirdparty_dir])
 
 
 # Godot source files
 # Godot source files
 env_mpc.add_source_files(env.modules_sources, "*.cpp")
 env_mpc.add_source_files(env.modules_sources, "*.cpp")

+ 3 - 2
modules/mpc/config.py

@@ -1,6 +1,7 @@
 
 
 def can_build(platform):
 def can_build(platform):
-	return True
+    return True
+
 
 
 def configure(env):
 def configure(env):
-	pass
+    pass

+ 9 - 9
modules/ogg/SCsub

@@ -6,16 +6,16 @@ Import('env_modules')
 env_ogg = env_modules.Clone()
 env_ogg = env_modules.Clone()
 
 
 # Thirdparty source files
 # Thirdparty source files
-if (env["libogg"] != "system"): # builtin
-	thirdparty_dir = "#thirdparty/libogg/"
-	thirdparty_sources = [
-		"bitwise.c",
-		"framing.c",
-	]
-	thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+if (env["libogg"] != "system"):  # builtin
+    thirdparty_dir = "#thirdparty/libogg/"
+    thirdparty_sources = [
+        "bitwise.c",
+        "framing.c",
+    ]
+    thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 
 
-	env_ogg.add_source_files(env.modules_sources, thirdparty_sources)
-	env_ogg.Append(CPPPATH = [thirdparty_dir])
+    env_ogg.add_source_files(env.modules_sources, thirdparty_sources)
+    env_ogg.Append(CPPPATH=[thirdparty_dir])
 
 
 # Godot source files
 # Godot source files
 env_ogg.add_source_files(env.modules_sources, "*.cpp")
 env_ogg.add_source_files(env.modules_sources, "*.cpp")

+ 3 - 2
modules/ogg/config.py

@@ -1,6 +1,7 @@
 
 
 def can_build(platform):
 def can_build(platform):
-	return True
+    return True
+
 
 
 def configure(env):
 def configure(env):
-	pass
+    pass

File diff suppressed because it is too large
+ 660 - 660
modules/openssl/SCsub


+ 3 - 2
modules/openssl/config.py

@@ -1,6 +1,7 @@
 
 
 def can_build(platform):
 def can_build(platform):
-	return True
+    return True
+
 
 
 def configure(env):
 def configure(env):
-	pass
+    pass

+ 197 - 197
modules/opus/SCsub

@@ -6,210 +6,210 @@ Import('env_modules')
 env_opus = env_modules.Clone()
 env_opus = env_modules.Clone()
 
 
 # Thirdparty source files
 # Thirdparty source files
-if (env["opus"] != "system"): # builtin
-	thirdparty_dir = "#thirdparty/opus/"
+if (env["opus"] != "system"):  # builtin
+    thirdparty_dir = "#thirdparty/opus/"
 
 
-	thirdparty_sources = [
-		"silk/tables_other.c",
-		"silk/sum_sqr_shift.c",
-		"silk/PLC.c",
-		"silk/dec_API.c",
-		"silk/decode_pulses.c",
-		"silk/inner_prod_aligned.c",
-		"silk/init_encoder.c",
-		"silk/interpolate.c",
-		"silk/stereo_encode_pred.c",
-		"silk/decode_frame.c",
-		"silk/NLSF_del_dec_quant.c",
-		"silk/VAD.c",
-		"silk/resampler_private_AR2.c",
-		"silk/NLSF_unpack.c",
-		"silk/resampler_down2.c",
-		"silk/sort.c",
-		"silk/resampler_private_IIR_FIR.c",
-		"silk/resampler_down2_3.c",
-		"silk/resampler_private_up2_HQ.c",
-		"silk/tables_gain.c",
-		"silk/stereo_find_predictor.c",
-		"silk/stereo_quant_pred.c",
-		"silk/NLSF_stabilize.c",
-		"silk/ana_filt_bank_1.c",
-		"silk/check_control_input.c",
-		"silk/bwexpander.c",
-		"silk/A2NLSF.c",
-		"silk/LPC_inv_pred_gain.c",
-		"silk/log2lin.c",
-		"silk/process_NLSFs.c",
-		"silk/sigm_Q15.c",
-		"silk/VQ_WMat_EC.c",
-		"silk/quant_LTP_gains.c",
-		"silk/resampler_private_down_FIR.c",
-		"silk/NLSF_decode.c",
-		"silk/control_codec.c",
-		"silk/NLSF_VQ_weights_laroia.c",
-		"silk/decode_pitch.c",
-		"silk/stereo_decode_pred.c",
-		"silk/tables_pulses_per_block.c",
-		"silk/init_decoder.c",
-		"silk/table_LSF_cos.c",
-		"silk/decode_core.c",
-		"silk/code_signs.c",
-		"silk/enc_API.c",
-		"silk/tables_LTP.c",
-		"silk/pitch_est_tables.c",
-		"silk/biquad_alt.c",
-		"silk/encode_indices.c",
-		"silk/tables_NLSF_CB_WB.c",
-		"silk/debug.c",
-		"silk/decode_parameters.c",
-		"silk/tables_pitch_lag.c",
-		"silk/NLSF2A.c",
-		"silk/resampler.c",
-		"silk/decode_indices.c",
-		"silk/NLSF_VQ.c",
-		"silk/bwexpander_32.c",
-		"silk/tables_NLSF_CB_NB_MB.c",
-		"silk/encode_pulses.c",
-		"silk/NSQ_del_dec.c",
-		"silk/control_SNR.c",
-		"silk/shell_coder.c",
-		"silk/NLSF_encode.c",
-		"silk/stereo_MS_to_LR.c",
-		"silk/stereo_LR_to_MS.c",
-		"silk/HP_variable_cutoff.c",
-		"silk/LPC_analysis_filter.c",
-		"silk/CNG.c",
-		"silk/decoder_set_fs.c",
-		"silk/resampler_rom.c",
-		"silk/control_audio_bandwidth.c",
-		"silk/lin2log.c",
-		"silk/LP_variable_cutoff.c",
-		"silk/NSQ.c",
-		"silk/gain_quant.c",
-		"celt/laplace.c",
-		"celt/vq.c",
-		"celt/quant_bands.c",
-		"celt/kiss_fft.c",
-		"celt/entcode.c",
-		"celt/entenc.c",
-		"celt/celt_lpc.c",
-		"celt/pitch.c",
-		"celt/rate.c",
-		"celt/mathops.c",
-		#"celt/arm/armcpu.c",
-		#"celt/arm/celt_neon_intr.c",
-		#"celt/arm/celt_ne10_mdct.c",
-		#"celt/arm/celt_ne10_fft.c",
-		#"celt/arm/arm_celt_map.c",
-		"celt/celt_encoder.c",
-		"celt/celt.c",
-		"celt/bands.c",
-		"celt/cwrs.c",
-		"celt/entdec.c",
-		"celt/celt_decoder.c",
-		"celt/mdct.c",
-		"celt/modes.c",
-		"repacketizer.c",
-		"mlp_data.c",
-		"opus_multistream.c",
-		"opusfile.c",
-		"opus_encoder.c",
-		"analysis.c",
-		"mlp.c",
-		"info.c",
-		"stream.c",
-		"opus_decoder.c",
-		"internal.c",
-		"wincerts.c",
-		"opus.c",
-		"opus_multistream_encoder.c",
-		"http.c",
-		"opus_multistream_decoder.c"
-	]
+    thirdparty_sources = [
+        "silk/tables_other.c",
+        "silk/sum_sqr_shift.c",
+        "silk/PLC.c",
+        "silk/dec_API.c",
+        "silk/decode_pulses.c",
+        "silk/inner_prod_aligned.c",
+        "silk/init_encoder.c",
+        "silk/interpolate.c",
+        "silk/stereo_encode_pred.c",
+        "silk/decode_frame.c",
+        "silk/NLSF_del_dec_quant.c",
+        "silk/VAD.c",
+        "silk/resampler_private_AR2.c",
+        "silk/NLSF_unpack.c",
+        "silk/resampler_down2.c",
+        "silk/sort.c",
+        "silk/resampler_private_IIR_FIR.c",
+        "silk/resampler_down2_3.c",
+        "silk/resampler_private_up2_HQ.c",
+        "silk/tables_gain.c",
+        "silk/stereo_find_predictor.c",
+        "silk/stereo_quant_pred.c",
+        "silk/NLSF_stabilize.c",
+        "silk/ana_filt_bank_1.c",
+        "silk/check_control_input.c",
+        "silk/bwexpander.c",
+        "silk/A2NLSF.c",
+        "silk/LPC_inv_pred_gain.c",
+        "silk/log2lin.c",
+        "silk/process_NLSFs.c",
+        "silk/sigm_Q15.c",
+        "silk/VQ_WMat_EC.c",
+        "silk/quant_LTP_gains.c",
+        "silk/resampler_private_down_FIR.c",
+        "silk/NLSF_decode.c",
+        "silk/control_codec.c",
+        "silk/NLSF_VQ_weights_laroia.c",
+        "silk/decode_pitch.c",
+        "silk/stereo_decode_pred.c",
+        "silk/tables_pulses_per_block.c",
+        "silk/init_decoder.c",
+        "silk/table_LSF_cos.c",
+        "silk/decode_core.c",
+        "silk/code_signs.c",
+        "silk/enc_API.c",
+        "silk/tables_LTP.c",
+        "silk/pitch_est_tables.c",
+        "silk/biquad_alt.c",
+        "silk/encode_indices.c",
+        "silk/tables_NLSF_CB_WB.c",
+        "silk/debug.c",
+        "silk/decode_parameters.c",
+        "silk/tables_pitch_lag.c",
+        "silk/NLSF2A.c",
+        "silk/resampler.c",
+        "silk/decode_indices.c",
+        "silk/NLSF_VQ.c",
+        "silk/bwexpander_32.c",
+        "silk/tables_NLSF_CB_NB_MB.c",
+        "silk/encode_pulses.c",
+        "silk/NSQ_del_dec.c",
+        "silk/control_SNR.c",
+        "silk/shell_coder.c",
+        "silk/NLSF_encode.c",
+        "silk/stereo_MS_to_LR.c",
+        "silk/stereo_LR_to_MS.c",
+        "silk/HP_variable_cutoff.c",
+        "silk/LPC_analysis_filter.c",
+        "silk/CNG.c",
+        "silk/decoder_set_fs.c",
+        "silk/resampler_rom.c",
+        "silk/control_audio_bandwidth.c",
+        "silk/lin2log.c",
+        "silk/LP_variable_cutoff.c",
+        "silk/NSQ.c",
+        "silk/gain_quant.c",
+        "celt/laplace.c",
+        "celt/vq.c",
+        "celt/quant_bands.c",
+        "celt/kiss_fft.c",
+        "celt/entcode.c",
+        "celt/entenc.c",
+        "celt/celt_lpc.c",
+        "celt/pitch.c",
+        "celt/rate.c",
+        "celt/mathops.c",
+        #"celt/arm/armcpu.c",
+        #"celt/arm/celt_neon_intr.c",
+        #"celt/arm/celt_ne10_mdct.c",
+        #"celt/arm/celt_ne10_fft.c",
+        #"celt/arm/arm_celt_map.c",
+        "celt/celt_encoder.c",
+        "celt/celt.c",
+        "celt/bands.c",
+        "celt/cwrs.c",
+        "celt/entdec.c",
+        "celt/celt_decoder.c",
+        "celt/mdct.c",
+        "celt/modes.c",
+        "repacketizer.c",
+        "mlp_data.c",
+        "opus_multistream.c",
+        "opusfile.c",
+        "opus_encoder.c",
+        "analysis.c",
+        "mlp.c",
+        "info.c",
+        "stream.c",
+        "opus_decoder.c",
+        "internal.c",
+        "wincerts.c",
+        "opus.c",
+        "opus_multistream_encoder.c",
+        "http.c",
+        "opus_multistream_decoder.c"
+    ]
 
 
-	opus_sources_silk = []
+    opus_sources_silk = []
 
 
-	if("opus_fixed_point" in env and env.opus_fixed_point=="yes"):
-		env_opus.Append(CFLAGS = ["-DFIXED_POINT"])
-		opus_sources_silk = [
-			"silk/fixed/schur64_FIX.c",
-			"silk/fixed/residual_energy16_FIX.c",
-			"silk/fixed/encode_frame_FIX.c",
-			"silk/fixed/regularize_correlations_FIX.c",
-			"silk/fixed/apply_sine_window_FIX.c",
-			"silk/fixed/solve_LS_FIX.c",
-			"silk/fixed/schur_FIX.c",
-			"silk/fixed/pitch_analysis_core_FIX.c",
-			"silk/fixed/noise_shape_analysis_FIX.c",
-			"silk/fixed/find_LTP_FIX.c",
-			"silk/fixed/vector_ops_FIX.c",
-			"silk/fixed/autocorr_FIX.c",
-			"silk/fixed/warped_autocorrelation_FIX.c",
-			"silk/fixed/find_pitch_lags_FIX.c",
-			"silk/fixed/k2a_Q16_FIX.c",
-			"silk/fixed/LTP_scale_ctrl_FIX.c",
-			"silk/fixed/corrMatrix_FIX.c",
-			"silk/fixed/prefilter_FIX.c",
-			"silk/fixed/find_LPC_FIX.c",
-			"silk/fixed/residual_energy_FIX.c",
-			"silk/fixed/process_gains_FIX.c",
-			"silk/fixed/LTP_analysis_filter_FIX.c",
-			"silk/fixed/k2a_FIX.c",
-			"silk/fixed/burg_modified_FIX.c",
-			"silk/fixed/find_pred_coefs_FIX.c"
-		]
-	else:
-		opus_sources_silk = [
-			"silk/float/LTP_scale_ctrl_FLP.c",
-			"silk/float/regularize_correlations_FLP.c",
-			"silk/float/corrMatrix_FLP.c",
-			"silk/float/LPC_analysis_filter_FLP.c",
-			"silk/float/levinsondurbin_FLP.c",
-			"silk/float/schur_FLP.c",
-			"silk/float/scale_vector_FLP.c",
-			"silk/float/apply_sine_window_FLP.c",
-			"silk/float/pitch_analysis_core_FLP.c",
-			"silk/float/wrappers_FLP.c",
-			"silk/float/bwexpander_FLP.c",
-			"silk/float/warped_autocorrelation_FLP.c",
-			"silk/float/solve_LS_FLP.c",
-			"silk/float/find_LPC_FLP.c",
-			"silk/float/autocorrelation_FLP.c",
-			"silk/float/find_pred_coefs_FLP.c",
-			"silk/float/find_pitch_lags_FLP.c",
-			"silk/float/burg_modified_FLP.c",
-			"silk/float/find_LTP_FLP.c",
-			"silk/float/energy_FLP.c",
-			"silk/float/sort_FLP.c",
-			"silk/float/LPC_inv_pred_gain_FLP.c",
-			"silk/float/k2a_FLP.c",
-			"silk/float/noise_shape_analysis_FLP.c",
-			"silk/float/inner_product_FLP.c",
-			"silk/float/process_gains_FLP.c",
-			"silk/float/encode_frame_FLP.c",
-			"silk/float/scale_copy_vector_FLP.c",
-			"silk/float/residual_energy_FLP.c",
-			"silk/float/LTP_analysis_filter_FLP.c",
-			"silk/float/prefilter_FLP.c"
-	]
+    if("opus_fixed_point" in env and env.opus_fixed_point == "yes"):
+        env_opus.Append(CFLAGS=["-DFIXED_POINT"])
+        opus_sources_silk = [
+            "silk/fixed/schur64_FIX.c",
+            "silk/fixed/residual_energy16_FIX.c",
+            "silk/fixed/encode_frame_FIX.c",
+            "silk/fixed/regularize_correlations_FIX.c",
+            "silk/fixed/apply_sine_window_FIX.c",
+            "silk/fixed/solve_LS_FIX.c",
+            "silk/fixed/schur_FIX.c",
+            "silk/fixed/pitch_analysis_core_FIX.c",
+            "silk/fixed/noise_shape_analysis_FIX.c",
+            "silk/fixed/find_LTP_FIX.c",
+            "silk/fixed/vector_ops_FIX.c",
+            "silk/fixed/autocorr_FIX.c",
+            "silk/fixed/warped_autocorrelation_FIX.c",
+            "silk/fixed/find_pitch_lags_FIX.c",
+            "silk/fixed/k2a_Q16_FIX.c",
+            "silk/fixed/LTP_scale_ctrl_FIX.c",
+            "silk/fixed/corrMatrix_FIX.c",
+            "silk/fixed/prefilter_FIX.c",
+            "silk/fixed/find_LPC_FIX.c",
+            "silk/fixed/residual_energy_FIX.c",
+            "silk/fixed/process_gains_FIX.c",
+            "silk/fixed/LTP_analysis_filter_FIX.c",
+            "silk/fixed/k2a_FIX.c",
+            "silk/fixed/burg_modified_FIX.c",
+            "silk/fixed/find_pred_coefs_FIX.c"
+        ]
+    else:
+        opus_sources_silk = [
+            "silk/float/LTP_scale_ctrl_FLP.c",
+            "silk/float/regularize_correlations_FLP.c",
+            "silk/float/corrMatrix_FLP.c",
+            "silk/float/LPC_analysis_filter_FLP.c",
+            "silk/float/levinsondurbin_FLP.c",
+            "silk/float/schur_FLP.c",
+            "silk/float/scale_vector_FLP.c",
+            "silk/float/apply_sine_window_FLP.c",
+            "silk/float/pitch_analysis_core_FLP.c",
+            "silk/float/wrappers_FLP.c",
+            "silk/float/bwexpander_FLP.c",
+            "silk/float/warped_autocorrelation_FLP.c",
+            "silk/float/solve_LS_FLP.c",
+            "silk/float/find_LPC_FLP.c",
+            "silk/float/autocorrelation_FLP.c",
+            "silk/float/find_pred_coefs_FLP.c",
+            "silk/float/find_pitch_lags_FLP.c",
+            "silk/float/burg_modified_FLP.c",
+            "silk/float/find_LTP_FLP.c",
+            "silk/float/energy_FLP.c",
+            "silk/float/sort_FLP.c",
+            "silk/float/LPC_inv_pred_gain_FLP.c",
+            "silk/float/k2a_FLP.c",
+            "silk/float/noise_shape_analysis_FLP.c",
+            "silk/float/inner_product_FLP.c",
+            "silk/float/process_gains_FLP.c",
+            "silk/float/encode_frame_FLP.c",
+            "silk/float/scale_copy_vector_FLP.c",
+            "silk/float/residual_energy_FLP.c",
+            "silk/float/LTP_analysis_filter_FLP.c",
+            "silk/float/prefilter_FLP.c"
+        ]
 
 
-	thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources + opus_sources_silk]
+    thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources + opus_sources_silk]
 
 
-	env_opus.add_source_files(env.modules_sources, thirdparty_sources)
-	env_opus.Append(CFLAGS=["-DHAVE_CONFIG_H"])
+    env_opus.add_source_files(env.modules_sources, thirdparty_sources)
+    env_opus.Append(CFLAGS=["-DHAVE_CONFIG_H"])
 
 
-	thirdparty_include_paths = [
-		"",
-		"celt",
-		"silk",
-		"silk/fixed",
-		"silk/float",
-	]
-	env_opus.Append(CPPPATH = [thirdparty_dir + "/" + dir for dir in thirdparty_include_paths])
+    thirdparty_include_paths = [
+        "",
+        "celt",
+        "silk",
+        "silk/fixed",
+        "silk/float",
+    ]
+    env_opus.Append(CPPPATH=[thirdparty_dir + "/" + dir for dir in thirdparty_include_paths])
 
 
-	# also requires libogg
-	if (env["libogg"] != "system"): # builtin
-		env_opus.Append(CPPPATH = ["#thirdparty/libogg"])
+    # also requires libogg
+    if (env["libogg"] != "system"):  # builtin
+        env_opus.Append(CPPPATH=["#thirdparty/libogg"])
 
 
 # Module files
 # Module files
 env_opus.add_source_files(env.modules_sources, "*.cpp")
 env_opus.add_source_files(env.modules_sources, "*.cpp")

+ 3 - 2
modules/opus/config.py

@@ -1,6 +1,7 @@
 
 
 def can_build(platform):
 def can_build(platform):
-	return True
+    return True
+
 
 
 def configure(env):
 def configure(env):
-	pass
+    pass

+ 3 - 2
modules/pbm/config.py

@@ -1,6 +1,7 @@
 
 
 def can_build(platform):
 def can_build(platform):
-	return True
+    return True
+
 
 
 def configure(env):
 def configure(env):
-	pass
+    pass

+ 6 - 6
modules/pvr/SCsub

@@ -9,16 +9,16 @@ env_pvr = env_modules.Clone()
 # Not unbundled so far since not widespread as shared library
 # Not unbundled so far since not widespread as shared library
 thirdparty_dir = "#thirdparty/pvrtccompressor/"
 thirdparty_dir = "#thirdparty/pvrtccompressor/"
 thirdparty_sources = [
 thirdparty_sources = [
-	"BitScale.cpp",
-	"MortonTable.cpp",
-	"PvrTcDecoder.cpp",
-	"PvrTcEncoder.cpp",
-	"PvrTcPacket.cpp",
+    "BitScale.cpp",
+    "MortonTable.cpp",
+    "PvrTcDecoder.cpp",
+    "PvrTcEncoder.cpp",
+    "PvrTcPacket.cpp",
 ]
 ]
 thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 
 
 env_pvr.add_source_files(env.modules_sources, thirdparty_sources)
 env_pvr.add_source_files(env.modules_sources, thirdparty_sources)
-env_pvr.Append(CPPPATH = [thirdparty_dir])
+env_pvr.Append(CPPPATH=[thirdparty_dir])
 
 
 # Godot source files
 # Godot source files
 env_pvr.add_source_files(env.modules_sources, "*.cpp")
 env_pvr.add_source_files(env.modules_sources, "*.cpp")

+ 3 - 2
modules/pvr/config.py

@@ -1,6 +1,7 @@
 
 
 def can_build(platform):
 def can_build(platform):
-	return True
+    return True
+
 
 
 def configure(env):
 def configure(env):
-	pass
+    pass

+ 2 - 1
modules/regex/config.py

@@ -1,8 +1,9 @@
 #!/usr/bin/env python
 #!/usr/bin/env python
 
 
+
 def can_build(platform):
 def can_build(platform):
     return True
     return True
 
 
+
 def configure(env):
 def configure(env):
     pass
     pass
-

+ 16 - 16
modules/squish/SCsub

@@ -6,24 +6,24 @@ Import('env_modules')
 env_squish = env_modules.Clone()
 env_squish = env_modules.Clone()
 
 
 # Thirdparty source files
 # Thirdparty source files
-if (env["squish"] != "system"): # builtin
-	thirdparty_dir = "#thirdparty/squish/"
-	thirdparty_sources = [
-		"alpha.cpp",
-		"clusterfit.cpp",
-		"colourblock.cpp",
-		"colourfit.cpp",
-		"colourset.cpp",
-		"maths.cpp",
-		"rangefit.cpp",
-		"singlecolourfit.cpp",
-		"squish.cpp",
-	]
+if (env["squish"] != "system"):  # builtin
+    thirdparty_dir = "#thirdparty/squish/"
+    thirdparty_sources = [
+        "alpha.cpp",
+        "clusterfit.cpp",
+        "colourblock.cpp",
+        "colourfit.cpp",
+        "colourset.cpp",
+        "maths.cpp",
+        "rangefit.cpp",
+        "singlecolourfit.cpp",
+        "squish.cpp",
+    ]
 
 
-	thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+    thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 
 
-	env_squish.add_source_files(env.modules_sources, thirdparty_sources)
-	env_squish.Append(CPPPATH = [thirdparty_dir])
+    env_squish.add_source_files(env.modules_sources, thirdparty_sources)
+    env_squish.Append(CPPPATH=[thirdparty_dir])
 
 
 # Godot source files
 # Godot source files
 env_squish.add_source_files(env.modules_sources, "*.cpp")
 env_squish.add_source_files(env.modules_sources, "*.cpp")

+ 7 - 6
modules/squish/config.py

@@ -1,10 +1,11 @@
 
 
 def can_build(platform):
 def can_build(platform):
-	return True
+    return True
+
 
 
 def configure(env):
 def configure(env):
-	# Tools only, disabled for non-tools
-	# TODO: Find a cleaner way to achieve that
-	if (env["tools"] == "no"):
-		env["module_squish_enabled"] = "no"
-		env.disabled_modules.append("squish")
+    # Tools only, disabled for non-tools
+    # TODO: Find a cleaner way to achieve that
+    if (env["tools"] == "no"):
+        env["module_squish_enabled"] = "no"
+        env.disabled_modules.append("squish")

+ 64 - 64
modules/theora/SCsub

@@ -6,78 +6,78 @@ Import('env_modules')
 env_theora = env_modules.Clone()
 env_theora = env_modules.Clone()
 
 
 # Thirdparty source files
 # Thirdparty source files
-if (env["libtheora"] != "system"): # builtin
-	thirdparty_dir = "#thirdparty/libtheora/"
-	thirdparty_sources = [
-		#"analyze.c",
-		#"apiwrapper.c",
-		"bitpack.c",
-		"cpu.c",
-		#"decapiwrapper.c",
-		"decinfo.c",
-		"decode.c",
-		"dequant.c",
-		#"encapiwrapper.c",
-		#"encfrag.c",
-		#"encinfo.c",
-		#"encode.c",
-		#"encoder_disabled.c",
-		#"enquant.c",
-		#"fdct.c",
-		"fragment.c",
-		"huffdec.c",
-		#"huffenc.c",
-		"idct.c",
-		"info.c",
-		"internal.c",
-		#"mathops.c",
-		#"mcenc.c",
-		"quant.c",
-		#"rate.c",
-		"state.c",
-		#"tokenize.c",
-	]
+if (env["libtheora"] != "system"):  # builtin
+    thirdparty_dir = "#thirdparty/libtheora/"
+    thirdparty_sources = [
+        #"analyze.c",
+        #"apiwrapper.c",
+        "bitpack.c",
+        "cpu.c",
+        #"decapiwrapper.c",
+        "decinfo.c",
+        "decode.c",
+        "dequant.c",
+        #"encapiwrapper.c",
+        #"encfrag.c",
+        #"encinfo.c",
+        #"encode.c",
+        #"encoder_disabled.c",
+        #"enquant.c",
+        #"fdct.c",
+        "fragment.c",
+        "huffdec.c",
+        #"huffenc.c",
+        "idct.c",
+        "info.c",
+        "internal.c",
+        #"mathops.c",
+        #"mcenc.c",
+        "quant.c",
+        #"rate.c",
+        "state.c",
+        #"tokenize.c",
+    ]
 
 
-	thirdparty_sources_x86 = [
-		#"x86/mmxencfrag.c",
-		#"x86/mmxfdct.c",
-		"x86/mmxfrag.c",
-		"x86/mmxidct.c",
-		"x86/mmxstate.c",
-		#"x86/sse2fdct.c",
-		#"x86/x86enc.c",
-		"x86/x86state.c",
-	]
+    thirdparty_sources_x86 = [
+        #"x86/mmxencfrag.c",
+        #"x86/mmxfdct.c",
+        "x86/mmxfrag.c",
+        "x86/mmxidct.c",
+        "x86/mmxstate.c",
+        #"x86/sse2fdct.c",
+        #"x86/x86enc.c",
+        "x86/x86state.c",
+    ]
 
 
-	thirdparty_sources_x86_vc = [
-		#"x86_vc/mmxencfrag.c",
-		#"x86_vc/mmxfdct.c",
-		"x86_vc/mmxfrag.c",
-		"x86_vc/mmxidct.c",
-		"x86_vc/mmxstate.c",
-		#"x86_vc/x86enc.c",
-		"x86_vc/x86state.c",
-	]
+    thirdparty_sources_x86_vc = [
+        #"x86_vc/mmxencfrag.c",
+        #"x86_vc/mmxfdct.c",
+        "x86_vc/mmxfrag.c",
+        "x86_vc/mmxidct.c",
+        "x86_vc/mmxstate.c",
+        #"x86_vc/x86enc.c",
+        "x86_vc/x86state.c",
+    ]
 
 
-	if (env["x86_libtheora_opt_gcc"]):
-		thirdparty_sources += thirdparty_sources_x86
+    if (env["x86_libtheora_opt_gcc"]):
+        thirdparty_sources += thirdparty_sources_x86
 
 
-	if (env["x86_libtheora_opt_vc"]):
-		thirdparty_sources += thirdparty_sources_x86_vc
+    if (env["x86_libtheora_opt_vc"]):
+        thirdparty_sources += thirdparty_sources_x86_vc
 
 
-	if (env["x86_libtheora_opt_gcc"] or env["x86_libtheora_opt_vc"]):
-		env_theora.Append(CCFLAGS = ["-DOC_X86_ASM"])
+    if (env["x86_libtheora_opt_gcc"] or env["x86_libtheora_opt_vc"]):
+        env_theora.Append(CCFLAGS=["-DOC_X86_ASM"])
 
 
-	thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+    thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 
 
-	env_theora.add_source_files(env.modules_sources, thirdparty_sources)
-	env_theora.Append(CPPPATH = [thirdparty_dir])
+    env_theora.add_source_files(env.modules_sources, thirdparty_sources)
+    env_theora.Append(CPPPATH=[thirdparty_dir])
 
 
-	# also requires libogg and libvorbis
-	if (env["libogg"] != "system"): # builtin
-		env_theora.Append(CPPPATH = ["#thirdparty/libogg"])
-	if (env["libvorbis"] != "system"): # builtin
-		env_theora.Append(CPPPATH = ["#thirdparty/libvorbis"])
+    # also requires libogg and libvorbis
+    if (env["libogg"] != "system"):  # builtin
+        env_theora.Append(CPPPATH=["#thirdparty/libogg"])
+    if (env["libvorbis"] != "system"):  # builtin
+        env_theora.Append(CPPPATH=["#thirdparty/libvorbis"])
 
 
 # Godot source files
 # Godot source files
 env_theora.add_source_files(env.modules_sources, "*.cpp")
 env_theora.add_source_files(env.modules_sources, "*.cpp")

+ 3 - 2
modules/theora/config.py

@@ -1,6 +1,7 @@
 
 
 def can_build(platform):
 def can_build(platform):
-	return True
+    return True
+
 
 
 def configure(env):
 def configure(env):
-	pass
+    pass

+ 2 - 5
modules/visual_script/config.py

@@ -1,11 +1,8 @@
 
 
 
 
 def can_build(platform):
 def can_build(platform):
-  return True
+    return True
 
 
 
 
 def configure(env):
 def configure(env):
-	pass
-
-
-
+    pass

+ 35 - 35
modules/vorbis/SCsub

@@ -6,44 +6,44 @@ Import('env_modules')
 env_vorbis = env_modules.Clone()
 env_vorbis = env_modules.Clone()
 
 
 # Thirdparty source files
 # Thirdparty source files
-if (env["libvorbis"] != "system"): # builtin
-	thirdparty_dir = "#thirdparty/libvorbis/"
-	thirdparty_sources = [
-		#"analysis.c",
-		#"barkmel.c",
-		"bitrate.c",
-		"block.c",
-		"codebook.c",
-		"envelope.c",
-		"floor0.c",
-		"floor1.c",
-		"info.c",
-		"lookup.c",
-		"lpc.c",
-		"lsp.c",
-		"mapping0.c",
-		"mdct.c",
-		"psy.c",
-		#"psytune.c",
-		"registry.c",
-		"res0.c",
-		"sharedbook.c",
-		"smallft.c",
-		"synthesis.c",
-		#"tone.c",
-		#"vorbisenc.c",
-		"vorbisfile.c",
-		"window.c",
-	]
+if (env["libvorbis"] != "system"):  # builtin
+    thirdparty_dir = "#thirdparty/libvorbis/"
+    thirdparty_sources = [
+        #"analysis.c",
+        #"barkmel.c",
+        "bitrate.c",
+        "block.c",
+        "codebook.c",
+        "envelope.c",
+        "floor0.c",
+        "floor1.c",
+        "info.c",
+        "lookup.c",
+        "lpc.c",
+        "lsp.c",
+        "mapping0.c",
+        "mdct.c",
+        "psy.c",
+        #"psytune.c",
+        "registry.c",
+        "res0.c",
+        "sharedbook.c",
+        "smallft.c",
+        "synthesis.c",
+        #"tone.c",
+        #"vorbisenc.c",
+        "vorbisfile.c",
+        "window.c",
+    ]
 
 
-	thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+    thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 
 
-	env_vorbis.add_source_files(env.modules_sources, thirdparty_sources)
-	env_vorbis.Append(CPPPATH = [thirdparty_dir])
+    env_vorbis.add_source_files(env.modules_sources, thirdparty_sources)
+    env_vorbis.Append(CPPPATH=[thirdparty_dir])
 
 
-	# also requires libogg
-	if (env["libogg"] != "system"): # builtin
-		env_vorbis.Append(CPPPATH = ["#thirdparty/libogg"])
+    # also requires libogg
+    if (env["libogg"] != "system"):  # builtin
+        env_vorbis.Append(CPPPATH=["#thirdparty/libogg"])
 
 
 # Godot source files
 # Godot source files
 env_vorbis.add_source_files(env.modules_sources, "*.cpp")
 env_vorbis.add_source_files(env.modules_sources, "*.cpp")

+ 3 - 2
modules/vorbis/config.py

@@ -1,6 +1,7 @@
 
 
 def can_build(platform):
 def can_build(platform):
-	return True
+    return True
+
 
 
 def configure(env):
 def configure(env):
-	pass
+    pass

+ 14 - 14
modules/webm/SCsub

@@ -8,27 +8,27 @@ env_webm = env_modules.Clone()
 # Thirdparty source files
 # Thirdparty source files
 thirdparty_libsimplewebm_dir = "#thirdparty/libsimplewebm/"
 thirdparty_libsimplewebm_dir = "#thirdparty/libsimplewebm/"
 thirdparty_libsimplewebm_sources = [
 thirdparty_libsimplewebm_sources = [
-	"libwebm/mkvparser/mkvparser.cc",
-	"OpusVorbisDecoder.cpp",
-	"VPXDecoder.cpp",
-	"WebMDemuxer.cpp",
+    "libwebm/mkvparser/mkvparser.cc",
+    "OpusVorbisDecoder.cpp",
+    "VPXDecoder.cpp",
+    "WebMDemuxer.cpp",
 ]
 ]
 thirdparty_libsimplewebm_sources = [thirdparty_libsimplewebm_dir + file for file in thirdparty_libsimplewebm_sources]
 thirdparty_libsimplewebm_sources = [thirdparty_libsimplewebm_dir + file for file in thirdparty_libsimplewebm_sources]
 
 
 env_webm.add_source_files(env.modules_sources, thirdparty_libsimplewebm_sources)
 env_webm.add_source_files(env.modules_sources, thirdparty_libsimplewebm_sources)
-env_webm.Append(CPPPATH = [thirdparty_libsimplewebm_dir, thirdparty_libsimplewebm_dir + "libwebm/"])
+env_webm.Append(CPPPATH=[thirdparty_libsimplewebm_dir, thirdparty_libsimplewebm_dir + "libwebm/"])
 
 
 # also requires libogg, libvorbis and libopus
 # also requires libogg, libvorbis and libopus
-if (env["libogg"] != "system"): # builtin
-	env_webm.Append(CPPPATH = ["#thirdparty/libogg"])
-if (env["libvorbis"] != "system"): # builtin
-	env_webm.Append(CPPPATH = ["#thirdparty/libvorbis"])
-if (env["opus"] != "system"): # builtin
-	env_webm.Append(CPPPATH = ["#thirdparty"])
+if (env["libogg"] != "system"):  # builtin
+    env_webm.Append(CPPPATH=["#thirdparty/libogg"])
+if (env["libvorbis"] != "system"):  # builtin
+    env_webm.Append(CPPPATH=["#thirdparty/libvorbis"])
+if (env["opus"] != "system"):  # builtin
+    env_webm.Append(CPPPATH=["#thirdparty"])
 
 
-if (env["libvpx"] != "system"): # builtin
-	Export('env_webm')
-	SConscript("libvpx/SCsub")
+if (env["libvpx"] != "system"):  # builtin
+    Export('env_webm')
+    SConscript("libvpx/SCsub")
 
 
 # Godot source files
 # Godot source files
 env_webm.add_source_files(env.modules_sources, "*.cpp")
 env_webm.add_source_files(env.modules_sources, "*.cpp")

+ 3 - 2
modules/webm/config.py

@@ -1,6 +1,7 @@
 
 
 def can_build(platform):
 def can_build(platform):
-	return True
+    return True
+
 
 
 def configure(env):
 def configure(env):
-	pass
+    pass

+ 297 - 297
modules/webm/libvpx/SCsub

@@ -3,231 +3,231 @@
 libvpx_dir = "#thirdparty/libvpx/"
 libvpx_dir = "#thirdparty/libvpx/"
 
 
 libvpx_sources = [
 libvpx_sources = [
-	"vp8/vp8_dx_iface.c",
-
-	"vp8/common/generic/systemdependent.c",
-
-	"vp8/common/alloccommon.c",
-	"vp8/common/blockd.c",
-	"vp8/common/copy_c.c",
-	"vp8/common/debugmodes.c",
-	"vp8/common/dequantize.c",
-	"vp8/common/entropy.c",
-	"vp8/common/entropymode.c",
-	"vp8/common/entropymv.c",
-	"vp8/common/extend.c",
-	"vp8/common/filter.c",
-	"vp8/common/findnearmv.c",
-	"vp8/common/idct_blk.c",
-	"vp8/common/idctllm.c",
-	"vp8/common/loopfilter_filters.c",
-	"vp8/common/mbpitch.c",
-	"vp8/common/modecont.c",
-	"vp8/common/quant_common.c",
-	"vp8/common/reconinter.c",
-	"vp8/common/reconintra.c",
-	"vp8/common/reconintra4x4.c",
-	"vp8/common/rtcd.c",
-	"vp8/common/setupintrarecon.c",
-	"vp8/common/swapyv12buffer.c",
-	"vp8/common/treecoder.c",
-	"vp8/common/vp8_loopfilter.c",
-
-	"vp8/decoder/dboolhuff.c",
-	"vp8/decoder/decodeframe.c",
-	"vp8/decoder/decodemv.c",
-	"vp8/decoder/detokenize.c",
-	"vp8/decoder/onyxd_if.c",
-	"vp8/decoder/threading.c",
-
-
-	"vp9/vp9_dx_iface.c",
-
-	"vp9/common/vp9_alloccommon.c",
-	"vp9/common/vp9_blockd.c",
-	"vp9/common/vp9_common_data.c",
-	"vp9/common/vp9_debugmodes.c",
-	"vp9/common/vp9_entropy.c",
-	"vp9/common/vp9_entropymode.c",
-	"vp9/common/vp9_entropymv.c",
-	"vp9/common/vp9_filter.c",
-	"vp9/common/vp9_frame_buffers.c",
-	"vp9/common/vp9_idct.c",
-	"vp9/common/vp9_loopfilter.c",
-	"vp9/common/vp9_mvref_common.c",
-	"vp9/common/vp9_pred_common.c",
-	"vp9/common/vp9_quant_common.c",
-	"vp9/common/vp9_reconinter.c",
-	"vp9/common/vp9_reconintra.c",
-	"vp9/common/vp9_rtcd.c",
-	"vp9/common/vp9_scale.c",
-	"vp9/common/vp9_scan.c",
-	"vp9/common/vp9_seg_common.c",
-	"vp9/common/vp9_thread_common.c",
-	"vp9/common/vp9_tile_common.c",
-
-	"vp9/decoder/vp9_decodeframe.c",
-	"vp9/decoder/vp9_decodemv.c",
-	"vp9/decoder/vp9_decoder.c",
-	"vp9/decoder/vp9_detokenize.c",
-	"vp9/decoder/vp9_dsubexp.c",
-	"vp9/decoder/vp9_dthread.c",
-
-
-	"vpx/src/vpx_codec.c",
-	"vpx/src/vpx_decoder.c",
-	"vpx/src/vpx_image.c",
-	"vpx/src/vpx_psnr.c",
-
-
-	"vpx_dsp/bitreader.c",
-	"vpx_dsp/bitreader_buffer.c",
-	"vpx_dsp/intrapred.c",
-	"vpx_dsp/inv_txfm.c",
-	"vpx_dsp/loopfilter.c",
-	"vpx_dsp/prob.c",
-	"vpx_dsp/vpx_convolve.c",
-	"vpx_dsp/vpx_dsp_rtcd.c",
-
-
-	"vpx_mem/vpx_mem.c",
-
-
-	"vpx_scale/vpx_scale_rtcd.c",
-
-	"vpx_scale/generic/yv12config.c",
-	"vpx_scale/generic/yv12extend.c",
-
-
-	"vpx_util/vpx_thread.c"
+    "vp8/vp8_dx_iface.c",
+
+    "vp8/common/generic/systemdependent.c",
+
+    "vp8/common/alloccommon.c",
+    "vp8/common/blockd.c",
+    "vp8/common/copy_c.c",
+    "vp8/common/debugmodes.c",
+    "vp8/common/dequantize.c",
+    "vp8/common/entropy.c",
+    "vp8/common/entropymode.c",
+    "vp8/common/entropymv.c",
+    "vp8/common/extend.c",
+    "vp8/common/filter.c",
+    "vp8/common/findnearmv.c",
+    "vp8/common/idct_blk.c",
+    "vp8/common/idctllm.c",
+    "vp8/common/loopfilter_filters.c",
+    "vp8/common/mbpitch.c",
+    "vp8/common/modecont.c",
+    "vp8/common/quant_common.c",
+    "vp8/common/reconinter.c",
+    "vp8/common/reconintra.c",
+    "vp8/common/reconintra4x4.c",
+    "vp8/common/rtcd.c",
+    "vp8/common/setupintrarecon.c",
+    "vp8/common/swapyv12buffer.c",
+    "vp8/common/treecoder.c",
+    "vp8/common/vp8_loopfilter.c",
+
+    "vp8/decoder/dboolhuff.c",
+    "vp8/decoder/decodeframe.c",
+    "vp8/decoder/decodemv.c",
+    "vp8/decoder/detokenize.c",
+    "vp8/decoder/onyxd_if.c",
+    "vp8/decoder/threading.c",
+
+
+    "vp9/vp9_dx_iface.c",
+
+    "vp9/common/vp9_alloccommon.c",
+    "vp9/common/vp9_blockd.c",
+    "vp9/common/vp9_common_data.c",
+    "vp9/common/vp9_debugmodes.c",
+    "vp9/common/vp9_entropy.c",
+    "vp9/common/vp9_entropymode.c",
+    "vp9/common/vp9_entropymv.c",
+    "vp9/common/vp9_filter.c",
+    "vp9/common/vp9_frame_buffers.c",
+    "vp9/common/vp9_idct.c",
+    "vp9/common/vp9_loopfilter.c",
+    "vp9/common/vp9_mvref_common.c",
+    "vp9/common/vp9_pred_common.c",
+    "vp9/common/vp9_quant_common.c",
+    "vp9/common/vp9_reconinter.c",
+    "vp9/common/vp9_reconintra.c",
+    "vp9/common/vp9_rtcd.c",
+    "vp9/common/vp9_scale.c",
+    "vp9/common/vp9_scan.c",
+    "vp9/common/vp9_seg_common.c",
+    "vp9/common/vp9_thread_common.c",
+    "vp9/common/vp9_tile_common.c",
+
+    "vp9/decoder/vp9_decodeframe.c",
+    "vp9/decoder/vp9_decodemv.c",
+    "vp9/decoder/vp9_decoder.c",
+    "vp9/decoder/vp9_detokenize.c",
+    "vp9/decoder/vp9_dsubexp.c",
+    "vp9/decoder/vp9_dthread.c",
+
+
+    "vpx/src/vpx_codec.c",
+    "vpx/src/vpx_decoder.c",
+    "vpx/src/vpx_image.c",
+    "vpx/src/vpx_psnr.c",
+
+
+    "vpx_dsp/bitreader.c",
+    "vpx_dsp/bitreader_buffer.c",
+    "vpx_dsp/intrapred.c",
+    "vpx_dsp/inv_txfm.c",
+    "vpx_dsp/loopfilter.c",
+    "vpx_dsp/prob.c",
+    "vpx_dsp/vpx_convolve.c",
+    "vpx_dsp/vpx_dsp_rtcd.c",
+
+
+    "vpx_mem/vpx_mem.c",
+
+
+    "vpx_scale/vpx_scale_rtcd.c",
+
+    "vpx_scale/generic/yv12config.c",
+    "vpx_scale/generic/yv12extend.c",
+
+
+    "vpx_util/vpx_thread.c"
 ]
 ]
 
 
 libvpx_sources_intrin_x86 = [
 libvpx_sources_intrin_x86 = [
-	"vp8/common/x86/filter_x86.c",
-	"vp8/common/x86/loopfilter_x86.c",
-	"vp8/common/x86/vp8_asm_stubs.c",
+    "vp8/common/x86/filter_x86.c",
+    "vp8/common/x86/loopfilter_x86.c",
+    "vp8/common/x86/vp8_asm_stubs.c",
 
 
 
 
-	"vpx_dsp/x86/vpx_asm_stubs.c"
+    "vpx_dsp/x86/vpx_asm_stubs.c"
 ]
 ]
 libvpx_sources_intrin_x86_mmx = [
 libvpx_sources_intrin_x86_mmx = [
-	"vp8/common/x86/idct_blk_mmx.c",
+    "vp8/common/x86/idct_blk_mmx.c",
 ]
 ]
 libvpx_sources_intrin_x86_sse2 = [
 libvpx_sources_intrin_x86_sse2 = [
-	"vp8/common/x86/idct_blk_sse2.c",
+    "vp8/common/x86/idct_blk_sse2.c",
 
 
 
 
-	"vp9/common/x86/vp9_idct_intrin_sse2.c",
+    "vp9/common/x86/vp9_idct_intrin_sse2.c",
 
 
 
 
-	"vpx_dsp/x86/inv_txfm_sse2.c",
-	"vpx_dsp/x86/loopfilter_sse2.c",
+    "vpx_dsp/x86/inv_txfm_sse2.c",
+    "vpx_dsp/x86/loopfilter_sse2.c",
 ]
 ]
 libvpx_sources_intrin_x86_ssse3 = [
 libvpx_sources_intrin_x86_ssse3 = [
-	"vpx_dsp/x86/vpx_subpixel_8t_intrin_ssse3.c"
+    "vpx_dsp/x86/vpx_subpixel_8t_intrin_ssse3.c"
 ]
 ]
 libvpx_sources_intrin_x86_avx2 = [
 libvpx_sources_intrin_x86_avx2 = [
-	"vpx_dsp/x86/loopfilter_avx2.c",
-	"vpx_dsp/x86/vpx_subpixel_8t_intrin_avx2.c"
+    "vpx_dsp/x86/loopfilter_avx2.c",
+    "vpx_dsp/x86/vpx_subpixel_8t_intrin_avx2.c"
 ]
 ]
 libvpx_sources_x86asm = [
 libvpx_sources_x86asm = [
-	"vp8/common/x86/copy_sse2.asm",
-	"vp8/common/x86/copy_sse3.asm",
-	"vp8/common/x86/dequantize_mmx.asm",
-	"vp8/common/x86/idctllm_mmx.asm",
-	"vp8/common/x86/idctllm_sse2.asm",
-	"vp8/common/x86/iwalsh_mmx.asm",
-	"vp8/common/x86/iwalsh_sse2.asm",
-	"vp8/common/x86/loopfilter_sse2.asm",
-	"vp8/common/x86/recon_mmx.asm",
-	"vp8/common/x86/recon_sse2.asm",
-	"vp8/common/x86/subpixel_mmx.asm",
-	"vp8/common/x86/subpixel_sse2.asm",
-	"vp8/common/x86/subpixel_ssse3.asm",
-	"vp8/common/x86/vp8_loopfilter_mmx.asm",
-
-
-	"vpx_dsp/x86/intrapred_sse2.asm",
-	"vpx_dsp/x86/intrapred_ssse3.asm",
-	"vpx_dsp/x86/inv_wht_sse2.asm",
-	"vpx_dsp/x86/vpx_convolve_copy_sse2.asm",
-	"vpx_dsp/x86/vpx_subpixel_8t_sse2.asm",
-	"vpx_dsp/x86/vpx_subpixel_8t_ssse3.asm",
-	"vpx_dsp/x86/vpx_subpixel_bilinear_sse2.asm",
-	"vpx_dsp/x86/vpx_subpixel_bilinear_ssse3.asm",
-
-
-	"vpx_ports/emms.asm"
+    "vp8/common/x86/copy_sse2.asm",
+    "vp8/common/x86/copy_sse3.asm",
+    "vp8/common/x86/dequantize_mmx.asm",
+    "vp8/common/x86/idctllm_mmx.asm",
+    "vp8/common/x86/idctllm_sse2.asm",
+    "vp8/common/x86/iwalsh_mmx.asm",
+    "vp8/common/x86/iwalsh_sse2.asm",
+    "vp8/common/x86/loopfilter_sse2.asm",
+    "vp8/common/x86/recon_mmx.asm",
+    "vp8/common/x86/recon_sse2.asm",
+    "vp8/common/x86/subpixel_mmx.asm",
+    "vp8/common/x86/subpixel_sse2.asm",
+    "vp8/common/x86/subpixel_ssse3.asm",
+    "vp8/common/x86/vp8_loopfilter_mmx.asm",
+
+
+    "vpx_dsp/x86/intrapred_sse2.asm",
+    "vpx_dsp/x86/intrapred_ssse3.asm",
+    "vpx_dsp/x86/inv_wht_sse2.asm",
+    "vpx_dsp/x86/vpx_convolve_copy_sse2.asm",
+    "vpx_dsp/x86/vpx_subpixel_8t_sse2.asm",
+    "vpx_dsp/x86/vpx_subpixel_8t_ssse3.asm",
+    "vpx_dsp/x86/vpx_subpixel_bilinear_sse2.asm",
+    "vpx_dsp/x86/vpx_subpixel_bilinear_ssse3.asm",
+
+
+    "vpx_ports/emms.asm"
 ]
 ]
 libvpx_sources_x86_64asm = [
 libvpx_sources_x86_64asm = [
-	"vp8/common/x86/loopfilter_block_sse2_x86_64.asm",
+    "vp8/common/x86/loopfilter_block_sse2_x86_64.asm",
 
 
 
 
-	"vpx_dsp/x86/inv_txfm_ssse3_x86_64.asm"
+    "vpx_dsp/x86/inv_txfm_ssse3_x86_64.asm"
 ]
 ]
 
 
 libvpx_sources_arm = [
 libvpx_sources_arm = [
-	"vpx_ports/arm_cpudetect.c",
+    "vpx_ports/arm_cpudetect.c",
 
 
 
 
-	"vp8/common/arm/loopfilter_arm.c",
+    "vp8/common/arm/loopfilter_arm.c",
 ]
 ]
 libvpx_sources_arm_neon = [
 libvpx_sources_arm_neon = [
-	"vp8/common/arm/neon/bilinearpredict_neon.c",
-	"vp8/common/arm/neon/copymem_neon.c",
-	"vp8/common/arm/neon/dc_only_idct_add_neon.c",
-	"vp8/common/arm/neon/dequant_idct_neon.c",
-	"vp8/common/arm/neon/dequantizeb_neon.c",
-	"vp8/common/arm/neon/idct_blk_neon.c",
-	"vp8/common/arm/neon/idct_dequant_0_2x_neon.c",
-	"vp8/common/arm/neon/idct_dequant_full_2x_neon.c",
-	"vp8/common/arm/neon/iwalsh_neon.c",
-	"vp8/common/arm/neon/loopfiltersimplehorizontaledge_neon.c",
-	"vp8/common/arm/neon/loopfiltersimpleverticaledge_neon.c",
-	"vp8/common/arm/neon/mbloopfilter_neon.c",
-	"vp8/common/arm/neon/shortidct4x4llm_neon.c",
-	"vp8/common/arm/neon/sixtappredict_neon.c",
-	"vp8/common/arm/neon/vp8_loopfilter_neon.c",
-
-
-	"vp9/common/arm/neon/vp9_iht4x4_add_neon.c",
-	"vp9/common/arm/neon/vp9_iht8x8_add_neon.c",
-
-
-	"vpx_dsp/arm/idct16x16_1_add_neon.c",
-	"vpx_dsp/arm/idct16x16_add_neon.c",
-	"vpx_dsp/arm/idct16x16_neon.c",
-	"vpx_dsp/arm/idct32x32_1_add_neon.c",
-	"vpx_dsp/arm/idct32x32_add_neon.c",
-	"vpx_dsp/arm/idct4x4_1_add_neon.c",
-	"vpx_dsp/arm/idct4x4_add_neon.c",
-	"vpx_dsp/arm/idct8x8_1_add_neon.c",
-	"vpx_dsp/arm/idct8x8_add_neon.c",
-	"vpx_dsp/arm/intrapred_neon.c",
-	"vpx_dsp/arm/loopfilter_16_neon.c",
-	"vpx_dsp/arm/loopfilter_4_neon.c",
-	"vpx_dsp/arm/loopfilter_8_neon.c",
-	"vpx_dsp/arm/loopfilter_neon.c",
-	"vpx_dsp/arm/vpx_convolve8_avg_neon.c",
-	"vpx_dsp/arm/vpx_convolve8_neon.c",
-	"vpx_dsp/arm/vpx_convolve_avg_neon.c",
-	"vpx_dsp/arm/vpx_convolve_copy_neon.c",
-	"vpx_dsp/arm/vpx_convolve_neon.c"
+    "vp8/common/arm/neon/bilinearpredict_neon.c",
+    "vp8/common/arm/neon/copymem_neon.c",
+    "vp8/common/arm/neon/dc_only_idct_add_neon.c",
+    "vp8/common/arm/neon/dequant_idct_neon.c",
+    "vp8/common/arm/neon/dequantizeb_neon.c",
+    "vp8/common/arm/neon/idct_blk_neon.c",
+    "vp8/common/arm/neon/idct_dequant_0_2x_neon.c",
+    "vp8/common/arm/neon/idct_dequant_full_2x_neon.c",
+    "vp8/common/arm/neon/iwalsh_neon.c",
+    "vp8/common/arm/neon/loopfiltersimplehorizontaledge_neon.c",
+    "vp8/common/arm/neon/loopfiltersimpleverticaledge_neon.c",
+    "vp8/common/arm/neon/mbloopfilter_neon.c",
+    "vp8/common/arm/neon/shortidct4x4llm_neon.c",
+    "vp8/common/arm/neon/sixtappredict_neon.c",
+    "vp8/common/arm/neon/vp8_loopfilter_neon.c",
+
+
+    "vp9/common/arm/neon/vp9_iht4x4_add_neon.c",
+    "vp9/common/arm/neon/vp9_iht8x8_add_neon.c",
+
+
+    "vpx_dsp/arm/idct16x16_1_add_neon.c",
+    "vpx_dsp/arm/idct16x16_add_neon.c",
+    "vpx_dsp/arm/idct16x16_neon.c",
+    "vpx_dsp/arm/idct32x32_1_add_neon.c",
+    "vpx_dsp/arm/idct32x32_add_neon.c",
+    "vpx_dsp/arm/idct4x4_1_add_neon.c",
+    "vpx_dsp/arm/idct4x4_add_neon.c",
+    "vpx_dsp/arm/idct8x8_1_add_neon.c",
+    "vpx_dsp/arm/idct8x8_add_neon.c",
+    "vpx_dsp/arm/intrapred_neon.c",
+    "vpx_dsp/arm/loopfilter_16_neon.c",
+    "vpx_dsp/arm/loopfilter_4_neon.c",
+    "vpx_dsp/arm/loopfilter_8_neon.c",
+    "vpx_dsp/arm/loopfilter_neon.c",
+    "vpx_dsp/arm/vpx_convolve8_avg_neon.c",
+    "vpx_dsp/arm/vpx_convolve8_neon.c",
+    "vpx_dsp/arm/vpx_convolve_avg_neon.c",
+    "vpx_dsp/arm/vpx_convolve_copy_neon.c",
+    "vpx_dsp/arm/vpx_convolve_neon.c"
 ]
 ]
 libvpx_sources_arm_neon_gas = [
 libvpx_sources_arm_neon_gas = [
-	"vpx_dsp/arm/gas/intrapred_neon_asm.s",
-	"vpx_dsp/arm/gas/loopfilter_mb_neon.s",
-	"vpx_dsp/arm/gas/save_reg_neon.s"
+    "vpx_dsp/arm/gas/intrapred_neon_asm.s",
+    "vpx_dsp/arm/gas/loopfilter_mb_neon.s",
+    "vpx_dsp/arm/gas/save_reg_neon.s"
 ]
 ]
 libvpx_sources_arm_neon_armasm_ms = [
 libvpx_sources_arm_neon_armasm_ms = [
-	"vpx_dsp/arm/armasm_ms/intrapred_neon_asm.asm",
-	"vpx_dsp/arm/armasm_ms/loopfilter_mb_neon.asm",
-	"vpx_dsp/arm/armasm_ms/save_reg_neon.asm"
+    "vpx_dsp/arm/armasm_ms/intrapred_neon_asm.asm",
+    "vpx_dsp/arm/armasm_ms/loopfilter_mb_neon.asm",
+    "vpx_dsp/arm/armasm_ms/save_reg_neon.asm"
 ]
 ]
 libvpx_sources_arm_neon_gas_apple = [
 libvpx_sources_arm_neon_gas_apple = [
-	"vpx_dsp/arm/gas_apple/intrapred_neon_asm.s",
-	"vpx_dsp/arm/gas_apple/loopfilter_mb_neon.s",
-	"vpx_dsp/arm/gas_apple/save_reg_neon.s"
+    "vpx_dsp/arm/gas_apple/intrapred_neon_asm.s",
+    "vpx_dsp/arm/gas_apple/loopfilter_mb_neon.s",
+    "vpx_dsp/arm/gas_apple/save_reg_neon.s"
 ]
 ]
 
 
 libvpx_sources = [libvpx_dir + file for file in libvpx_sources]
 libvpx_sources = [libvpx_dir + file for file in libvpx_sources]
@@ -248,143 +248,143 @@ libvpx_sources_arm_neon_gas_apple = [libvpx_dir + file for file in libvpx_source
 Import('env')
 Import('env')
 Import('env_webm')
 Import('env_webm')
 
 
-env_webm.Append(CPPPATH = [libvpx_dir])
+env_webm.Append(CPPPATH=[libvpx_dir])
 
 
 env_libvpx = env.Clone()
 env_libvpx = env.Clone()
-env_libvpx.Append(CPPPATH = [libvpx_dir])
+env_libvpx.Append(CPPPATH=[libvpx_dir])
 
 
 cpu_bits = env["bits"]
 cpu_bits = env["bits"]
 osx_fat = (env["platform"] == 'osx' and cpu_bits == 'fat')
 osx_fat = (env["platform"] == 'osx' and cpu_bits == 'fat')
 webm_cpu_x86 = False
 webm_cpu_x86 = False
 webm_cpu_arm = False
 webm_cpu_arm = False
 if env["platform"] == 'winrt':
 if env["platform"] == 'winrt':
-	if 'arm' in env["PROGSUFFIX"]:
-		webm_cpu_arm = True
-	else:
-		webm_cpu_x86 = True
+    if 'arm' in env["PROGSUFFIX"]:
+        webm_cpu_arm = True
+    else:
+        webm_cpu_x86 = True
 else:
 else:
-	is_android_x86 = (env["platform"] == 'android' and env["android_arch"] == 'x86')
-	if is_android_x86:
-		cpu_bits = '32'
-	if osx_fat:
-		webm_cpu_x86 = True
-	else:
-		webm_cpu_x86 = (cpu_bits == '32' or cpu_bits == '64') and (env["platform"] == 'windows' or env["platform"] == 'x11' or env["platform"] == 'osx' or env["platform"] == 'haiku' or is_android_x86)
-		webm_cpu_arm = env["platform"] == 'iphone' or env["platform"] == 'bb10' or (env["platform"] == 'android' and env["android_arch"] != 'x86')
+    is_android_x86 = (env["platform"] == 'android' and env["android_arch"] == 'x86')
+    if is_android_x86:
+        cpu_bits = '32'
+    if osx_fat:
+        webm_cpu_x86 = True
+    else:
+        webm_cpu_x86 = (cpu_bits == '32' or cpu_bits == '64') and (env["platform"] == 'windows' or env["platform"] == 'x11' or env["platform"] == 'osx' or env["platform"] == 'haiku' or is_android_x86)
+        webm_cpu_arm = env["platform"] == 'iphone' or env["platform"] == 'bb10' or (env["platform"] == 'android' and env["android_arch"] != 'x86')
 
 
 if webm_cpu_x86:
 if webm_cpu_x86:
-	import subprocess
-	import os
-
-	yasm_paths = [
-		"yasm",
-		"../../../yasm",
-	]
-
-	yasm_found = False
-
-	devnull = open(os.devnull)
-	for yasm_path in yasm_paths:
-		try:
-			yasm_found = True
-			subprocess.Popen([yasm_path, "--version"], stdout=devnull, stderr=devnull).communicate()
-		except:
-			yasm_found = False
-		if yasm_found:
-			break
-
-	if not yasm_found:
-		webm_cpu_x86 = False
-		print "YASM is necessary for WebM SIMD optimizations."
+    import subprocess
+    import os
+
+    yasm_paths = [
+        "yasm",
+        "../../../yasm",
+    ]
+
+    yasm_found = False
+
+    devnull = open(os.devnull)
+    for yasm_path in yasm_paths:
+        try:
+            yasm_found = True
+            subprocess.Popen([yasm_path, "--version"], stdout=devnull, stderr=devnull).communicate()
+        except:
+            yasm_found = False
+        if yasm_found:
+            break
+
+    if not yasm_found:
+        webm_cpu_x86 = False
+        print "YASM is necessary for WebM SIMD optimizations."
 
 
 webm_simd_optimizations = False
 webm_simd_optimizations = False
 
 
 if webm_cpu_x86:
 if webm_cpu_x86:
-	if osx_fat:
-		#'osx' platform only: run python script which will compile using 'yasm' command and then merge 32-bit and 64-bit using 'lipo' command
-		env_libvpx["AS"] = 'python modules/webm/libvpx/yasm_osx_fat.py'
-		env_libvpx["ASFLAGS"] = '-I' + libvpx_dir[1:]
-		env_libvpx["ASCOM"] = '$AS $ASFLAGS $TARGET $SOURCES'
-	else:
-		if env["platform"] == 'windows' or env["platform"] == 'winrt':
-			env_libvpx["ASFORMAT"] = 'win'
-		elif env["platform"] == 'osx':
-			env_libvpx["ASFORMAT"] = 'macho'
-		else:
-			env_libvpx["ASFORMAT"] = 'elf'
-		env_libvpx["ASFORMAT"] += cpu_bits
-
-		env_libvpx["AS"] = 'yasm'
-		env_libvpx["ASFLAGS"] = '-I' + libvpx_dir[1:] + ' -f $ASFORMAT -D $ASCPU'
-		env_libvpx["ASCOM"] = '$AS $ASFLAGS -o $TARGET $SOURCES'
-
-		if cpu_bits == '32':
-			env_libvpx["ASCPU"] = 'X86_32'
-		elif cpu_bits == '64':
-			env_libvpx["ASCPU"] = 'X86_64'
-
-	env_libvpx.Append(CCFLAGS=['-DWEBM_X86ASM'])
-
-	webm_simd_optimizations = True
+    if osx_fat:
+        #'osx' platform only: run python script which will compile using 'yasm' command and then merge 32-bit and 64-bit using 'lipo' command
+        env_libvpx["AS"] = 'python modules/webm/libvpx/yasm_osx_fat.py'
+        env_libvpx["ASFLAGS"] = '-I' + libvpx_dir[1:]
+        env_libvpx["ASCOM"] = '$AS $ASFLAGS $TARGET $SOURCES'
+    else:
+        if env["platform"] == 'windows' or env["platform"] == 'winrt':
+            env_libvpx["ASFORMAT"] = 'win'
+        elif env["platform"] == 'osx':
+            env_libvpx["ASFORMAT"] = 'macho'
+        else:
+            env_libvpx["ASFORMAT"] = 'elf'
+        env_libvpx["ASFORMAT"] += cpu_bits
+
+        env_libvpx["AS"] = 'yasm'
+        env_libvpx["ASFLAGS"] = '-I' + libvpx_dir[1:] + ' -f $ASFORMAT -D $ASCPU'
+        env_libvpx["ASCOM"] = '$AS $ASFLAGS -o $TARGET $SOURCES'
+
+        if cpu_bits == '32':
+            env_libvpx["ASCPU"] = 'X86_32'
+        elif cpu_bits == '64':
+            env_libvpx["ASCPU"] = 'X86_64'
+
+    env_libvpx.Append(CCFLAGS=['-DWEBM_X86ASM'])
+
+    webm_simd_optimizations = True
 
 
 if webm_cpu_arm:
 if webm_cpu_arm:
-	if env["platform"] == 'iphone':
-		env_libvpx["ASFLAGS"] = '-arch armv7'
-	elif env["platform"] == 'android':
-		env_libvpx["ASFLAGS"] = '-mfpu=neon'
-	elif env["platform"] == 'winrt':
-		env_libvpx["AS"] = 'armasm'
-		env_libvpx["ASFLAGS"] = ''
-		env_libvpx["ASCOM"] = '$AS $ASFLAGS -o $TARGET $SOURCES'
+    if env["platform"] == 'iphone':
+        env_libvpx["ASFLAGS"] = '-arch armv7'
+    elif env["platform"] == 'android':
+        env_libvpx["ASFLAGS"] = '-mfpu=neon'
+    elif env["platform"] == 'winrt':
+        env_libvpx["AS"] = 'armasm'
+        env_libvpx["ASFLAGS"] = ''
+        env_libvpx["ASCOM"] = '$AS $ASFLAGS -o $TARGET $SOURCES'
 
 
-	env_libvpx.Append(CCFLAGS=['-DWEBM_ARMASM'])
+    env_libvpx.Append(CCFLAGS=['-DWEBM_ARMASM'])
 
 
-	webm_simd_optimizations = True
+    webm_simd_optimizations = True
 
 
 if webm_simd_optimizations == False:
 if webm_simd_optimizations == False:
-	print "WebM SIMD optimizations are disabled. Check if your CPU architecture, CPU bits or platform are supported!"
+    print "WebM SIMD optimizations are disabled. Check if your CPU architecture, CPU bits or platform are supported!"
 
 
 
 
 env_libvpx.add_source_files(env.modules_sources, libvpx_sources)
 env_libvpx.add_source_files(env.modules_sources, libvpx_sources)
 if webm_cpu_x86:
 if webm_cpu_x86:
-	is_clang_or_gcc = ('gcc' in env["CC"]) or ('clang' in env["CC"])
+    is_clang_or_gcc = ('gcc' in env["CC"]) or ('clang' in env["CC"])
 
 
-	env_libvpx_mmx = env_libvpx.Clone()
-	if cpu_bits == '32' and is_clang_or_gcc:
-		env_libvpx_mmx.Append(CCFLAGS=['-mmmx'])
-	env_libvpx_mmx.add_source_files(env.modules_sources, libvpx_sources_intrin_x86_mmx)
+    env_libvpx_mmx = env_libvpx.Clone()
+    if cpu_bits == '32' and is_clang_or_gcc:
+        env_libvpx_mmx.Append(CCFLAGS=['-mmmx'])
+    env_libvpx_mmx.add_source_files(env.modules_sources, libvpx_sources_intrin_x86_mmx)
 
 
-	env_libvpx_sse2 = env_libvpx.Clone()
-	if cpu_bits == '32' and is_clang_or_gcc:
-		env_libvpx_sse2.Append(CCFLAGS=['-msse2'])
-	env_libvpx_sse2.add_source_files(env.modules_sources, libvpx_sources_intrin_x86_sse2)
+    env_libvpx_sse2 = env_libvpx.Clone()
+    if cpu_bits == '32' and is_clang_or_gcc:
+        env_libvpx_sse2.Append(CCFLAGS=['-msse2'])
+    env_libvpx_sse2.add_source_files(env.modules_sources, libvpx_sources_intrin_x86_sse2)
 
 
-	env_libvpx_ssse3 = env_libvpx.Clone()
-	if is_clang_or_gcc:
-		env_libvpx_ssse3.Append(CCFLAGS=['-mssse3'])
-	env_libvpx_ssse3.add_source_files(env.modules_sources, libvpx_sources_intrin_x86_ssse3)
+    env_libvpx_ssse3 = env_libvpx.Clone()
+    if is_clang_or_gcc:
+        env_libvpx_ssse3.Append(CCFLAGS=['-mssse3'])
+    env_libvpx_ssse3.add_source_files(env.modules_sources, libvpx_sources_intrin_x86_ssse3)
 
 
-	env_libvpx_avx2 = env_libvpx.Clone()
-	if is_clang_or_gcc:
-		env_libvpx_avx2.Append(CCFLAGS=['-mavx2'])
-	env_libvpx_avx2.add_source_files(env.modules_sources, libvpx_sources_intrin_x86_avx2)
+    env_libvpx_avx2 = env_libvpx.Clone()
+    if is_clang_or_gcc:
+        env_libvpx_avx2.Append(CCFLAGS=['-mavx2'])
+    env_libvpx_avx2.add_source_files(env.modules_sources, libvpx_sources_intrin_x86_avx2)
 
 
-	env_libvpx.add_source_files(env.modules_sources, libvpx_sources_intrin_x86)
+    env_libvpx.add_source_files(env.modules_sources, libvpx_sources_intrin_x86)
 
 
-	env_libvpx.add_source_files(env.modules_sources, libvpx_sources_x86asm)
-	if cpu_bits == '64' or osx_fat:
-		env_libvpx.add_source_files(env.modules_sources, libvpx_sources_x86_64asm)
+    env_libvpx.add_source_files(env.modules_sources, libvpx_sources_x86asm)
+    if cpu_bits == '64' or osx_fat:
+        env_libvpx.add_source_files(env.modules_sources, libvpx_sources_x86_64asm)
 elif webm_cpu_arm:
 elif webm_cpu_arm:
-	env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm)
-
-	env_libvpx_neon = env_libvpx.Clone()
-	if env["platform"] == 'android' and env["android_arch"] == 'armv6':
-		env_libvpx_neon.Append(CCFLAGS=['-mfpu=neon'])
-	env_libvpx_neon.add_source_files(env.modules_sources, libvpx_sources_arm_neon)
-
-	if env["platform"] == 'winrt':
-		env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm_neon_armasm_ms)
-	elif env["platform"] == 'iphone':
-		env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm_neon_gas_apple)
-	else:
-		env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm_neon_gas)
+    env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm)
+
+    env_libvpx_neon = env_libvpx.Clone()
+    if env["platform"] == 'android' and env["android_arch"] == 'armv6':
+        env_libvpx_neon.Append(CCFLAGS=['-mfpu=neon'])
+    env_libvpx_neon.add_source_files(env.modules_sources, libvpx_sources_arm_neon)
+
+    if env["platform"] == 'winrt':
+        env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm_neon_armasm_ms)
+    elif env["platform"] == 'iphone':
+        env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm_neon_gas_apple)
+    else:
+        env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm_neon_gas)

+ 18 - 18
modules/webm/libvpx/yasm_osx_fat.py

@@ -3,9 +3,9 @@
 import sys
 import sys
 import os
 import os
 
 
-includes    = sys.argv[1]
+includes = sys.argv[1]
 output_file = sys.argv[2]
 output_file = sys.argv[2]
-input_file  = sys.argv[3]
+input_file = sys.argv[3]
 
 
 can_remove = {}
 can_remove = {}
 
 
@@ -14,25 +14,25 @@ lipo_command = ''
 exit_code = 1
 exit_code = 1
 
 
 for arch in ['32', '64']:
 for arch in ['32', '64']:
-	if arch == '32' and input_file.endswith('x86_64.asm'):
-		can_remove[arch] = False
-	else:
-		command = 'yasm ' + includes + ' -f macho' + arch + ' -D X86_' + arch + ' -o ' + output_file + '.' + arch + ' ' + input_file
-		print(command)
-		if os.system(command) == 0:
-			lipo_command += output_file + '.' + arch + ' '
-			can_remove[arch] = True
-		else:
-			can_remove[arch] = False
+    if arch == '32' and input_file.endswith('x86_64.asm'):
+        can_remove[arch] = False
+    else:
+        command = 'yasm ' + includes + ' -f macho' + arch + ' -D X86_' + arch + ' -o ' + output_file + '.' + arch + ' ' + input_file
+        print(command)
+        if os.system(command) == 0:
+            lipo_command += output_file + '.' + arch + ' '
+            can_remove[arch] = True
+        else:
+            can_remove[arch] = False
 
 
 if lipo_command != '':
 if lipo_command != '':
-	lipo_command = 'lipo -create ' + lipo_command + '-output ' + output_file
-	print(lipo_command)
-	if os.system(lipo_command) == 0:
-		exit_code = 0
+    lipo_command = 'lipo -create ' + lipo_command + '-output ' + output_file
+    print(lipo_command)
+    if os.system(lipo_command) == 0:
+        exit_code = 0
 
 
 for arch in ['32', '64']:
 for arch in ['32', '64']:
-	if can_remove[arch]:
-		os.remove(output_file + '.' + arch)
+    if can_remove[arch]:
+        os.remove(output_file + '.' + arch)
 
 
 sys.exit(exit_code)
 sys.exit(exit_code)

+ 109 - 109
modules/webp/SCsub

@@ -6,116 +6,116 @@ Import('env_modules')
 env_webp = env_modules.Clone()
 env_webp = env_modules.Clone()
 
 
 # Thirdparty source files
 # Thirdparty source files
-if (env["libwebp"] != "system"): # builtin
-	thirdparty_dir = "#thirdparty/libwebp/"
-	thirdparty_sources = [
-		"enc/webpenc.c",
-		"enc/near_lossless.c",
-		"enc/frame.c",
-		"enc/alpha.c",
-		"enc/picture_csp.c",
-		"enc/vp8l.c",
-		"enc/picture_psnr.c",
-		"enc/delta_palettization.c",
-		"enc/syntax.c",
-		"enc/backward_references.c",
-		"enc/token.c",
-		"enc/analysis.c",
-		"enc/iterator.c",
-		"enc/picture_tools.c",
-		"enc/picture_rescale.c",
-		"enc/config.c",
-		"enc/tree.c",
-		"enc/cost.c",
-		"enc/picture.c",
-		"enc/quant.c",
-		"enc/filter.c",
-		"enc/histogram.c",
-		"utils/rescaler.c",
-		"utils/filters.c",
-		"utils/quant_levels_dec.c",
-		"utils/huffman.c",
-		"utils/thread.c",
-		"utils/quant_levels.c",
-		"utils/bit_writer.c",
-		"utils/bit_reader.c",
-		"utils/random.c",
-		"utils/utils.c",
-		"utils/huffman_encode.c",
-		"utils/color_cache.c",
-		"mux/muxinternal.c",
-		"mux/muxread.c",
-		"mux/anim_encode.c",
-		"mux/muxedit.c",
-		"dec/webp.c",
-		"dec/frame.c",
-		"dec/alpha.c",
-		"dec/vp8l.c",
-		"dec/io.c",
-		"dec/vp8.c",
-		"dec/idec.c",
-		"dec/tree.c",
-		"dec/buffer.c",
-		"dec/quant.c",
-		"demux/demux.c",
-		"demux/anim_decode.c",
-		"dsp/yuv.c",
-		"dsp/filters_sse2.c",
-		"dsp/dec_sse41.c",
-		"dsp/rescaler.c",
-		"dsp/lossless_sse2.c",
-		"dsp/alpha_processing_sse41.c",
-		"dsp/alpha_processing_sse2.c",
-		"dsp/filters.c",
-		"dsp/upsampling_mips_dsp_r2.c",
-		"dsp/dec_neon.c",
-		"dsp/enc_neon.c",
-		"dsp/lossless_enc_mips32.c",
-		"dsp/lossless_enc_sse2.c",
-		"dsp/upsampling.c",
-		"dsp/lossless_enc_neon.c",
-		"dsp/alpha_processing.c",
-		"dsp/cost_sse2.c",
-		"dsp/dec_mips32.c",
-		"dsp/enc_avx2.c",
-		"dsp/rescaler_mips32.c",
-		"dsp/enc.c",
-		"dsp/lossless_enc_sse41.c",
-		"dsp/cost_mips32.c",
-		"dsp/lossless_mips_dsp_r2.c",
-		"dsp/filters_mips_dsp_r2.c",
-		"dsp/upsampling_neon.c",
-		"dsp/alpha_processing_mips_dsp_r2.c",
-		"dsp/enc_mips_dsp_r2.c",
-		"dsp/lossless.c",
-		"dsp/yuv_mips_dsp_r2.c",
-		"dsp/cost_mips_dsp_r2.c",
-		"dsp/argb.c",
-		"dsp/dec_sse2.c",
-		"dsp/rescaler_sse2.c",
-		"dsp/enc_sse41.c",
-		"dsp/argb_mips_dsp_r2.c",
-		"dsp/lossless_enc_mips_dsp_r2.c",
-		"dsp/dec_clip_tables.c",
-		"dsp/yuv_mips32.c",
-		"dsp/cpu.c",
-		"dsp/dec.c",
-		"dsp/argb_sse2.c",
-		"dsp/lossless_neon.c",
-		"dsp/lossless_enc.c",
-		"dsp/enc_mips32.c",
-		"dsp/cost.c",
-		"dsp/rescaler_mips_dsp_r2.c",
-		"dsp/dec_mips_dsp_r2.c",
-		"dsp/rescaler_neon.c",
-		"dsp/yuv_sse2.c",
-		"dsp/enc_sse2.c",
-		"dsp/upsampling_sse2.c",
-	]
-	thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+if (env["libwebp"] != "system"):  # builtin
+    thirdparty_dir = "#thirdparty/libwebp/"
+    thirdparty_sources = [
+        "enc/webpenc.c",
+        "enc/near_lossless.c",
+        "enc/frame.c",
+        "enc/alpha.c",
+        "enc/picture_csp.c",
+        "enc/vp8l.c",
+        "enc/picture_psnr.c",
+        "enc/delta_palettization.c",
+        "enc/syntax.c",
+        "enc/backward_references.c",
+        "enc/token.c",
+        "enc/analysis.c",
+        "enc/iterator.c",
+        "enc/picture_tools.c",
+        "enc/picture_rescale.c",
+        "enc/config.c",
+        "enc/tree.c",
+        "enc/cost.c",
+        "enc/picture.c",
+        "enc/quant.c",
+        "enc/filter.c",
+        "enc/histogram.c",
+        "utils/rescaler.c",
+        "utils/filters.c",
+        "utils/quant_levels_dec.c",
+        "utils/huffman.c",
+        "utils/thread.c",
+        "utils/quant_levels.c",
+        "utils/bit_writer.c",
+        "utils/bit_reader.c",
+        "utils/random.c",
+        "utils/utils.c",
+        "utils/huffman_encode.c",
+        "utils/color_cache.c",
+        "mux/muxinternal.c",
+        "mux/muxread.c",
+        "mux/anim_encode.c",
+        "mux/muxedit.c",
+        "dec/webp.c",
+        "dec/frame.c",
+        "dec/alpha.c",
+        "dec/vp8l.c",
+        "dec/io.c",
+        "dec/vp8.c",
+        "dec/idec.c",
+        "dec/tree.c",
+        "dec/buffer.c",
+        "dec/quant.c",
+        "demux/demux.c",
+        "demux/anim_decode.c",
+        "dsp/yuv.c",
+        "dsp/filters_sse2.c",
+        "dsp/dec_sse41.c",
+        "dsp/rescaler.c",
+        "dsp/lossless_sse2.c",
+        "dsp/alpha_processing_sse41.c",
+        "dsp/alpha_processing_sse2.c",
+        "dsp/filters.c",
+        "dsp/upsampling_mips_dsp_r2.c",
+        "dsp/dec_neon.c",
+        "dsp/enc_neon.c",
+        "dsp/lossless_enc_mips32.c",
+        "dsp/lossless_enc_sse2.c",
+        "dsp/upsampling.c",
+        "dsp/lossless_enc_neon.c",
+        "dsp/alpha_processing.c",
+        "dsp/cost_sse2.c",
+        "dsp/dec_mips32.c",
+        "dsp/enc_avx2.c",
+        "dsp/rescaler_mips32.c",
+        "dsp/enc.c",
+        "dsp/lossless_enc_sse41.c",
+        "dsp/cost_mips32.c",
+        "dsp/lossless_mips_dsp_r2.c",
+        "dsp/filters_mips_dsp_r2.c",
+        "dsp/upsampling_neon.c",
+        "dsp/alpha_processing_mips_dsp_r2.c",
+        "dsp/enc_mips_dsp_r2.c",
+        "dsp/lossless.c",
+        "dsp/yuv_mips_dsp_r2.c",
+        "dsp/cost_mips_dsp_r2.c",
+        "dsp/argb.c",
+        "dsp/dec_sse2.c",
+        "dsp/rescaler_sse2.c",
+        "dsp/enc_sse41.c",
+        "dsp/argb_mips_dsp_r2.c",
+        "dsp/lossless_enc_mips_dsp_r2.c",
+        "dsp/dec_clip_tables.c",
+        "dsp/yuv_mips32.c",
+        "dsp/cpu.c",
+        "dsp/dec.c",
+        "dsp/argb_sse2.c",
+        "dsp/lossless_neon.c",
+        "dsp/lossless_enc.c",
+        "dsp/enc_mips32.c",
+        "dsp/cost.c",
+        "dsp/rescaler_mips_dsp_r2.c",
+        "dsp/dec_mips_dsp_r2.c",
+        "dsp/rescaler_neon.c",
+        "dsp/yuv_sse2.c",
+        "dsp/enc_sse2.c",
+        "dsp/upsampling_sse2.c",
+    ]
+    thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
 
 
-	env_webp.add_source_files(env.modules_sources, thirdparty_sources)
-	env_webp.Append(CPPPATH = [thirdparty_dir])
+    env_webp.add_source_files(env.modules_sources, thirdparty_sources)
+    env_webp.Append(CPPPATH=[thirdparty_dir])
 
 
 # Godot source files
 # Godot source files
 env_webp.add_source_files(env.modules_sources, "*.cpp")
 env_webp.add_source_files(env.modules_sources, "*.cpp")

+ 3 - 2
modules/webp/config.py

@@ -1,6 +1,7 @@
 
 
 def can_build(platform):
 def can_build(platform):
-	return True
+    return True
+
 
 
 def configure(env):
 def configure(env):
-	pass
+    pass

+ 66 - 66
platform/android/SCsub

@@ -6,127 +6,127 @@ Import('env')
 
 
 android_files = [
 android_files = [
 
 
-	'os_android.cpp',
-	'godot_android.cpp',
-	'file_access_android.cpp',
-	'dir_access_android.cpp',
-	'audio_driver_opensl.cpp',
-	'file_access_jandroid.cpp',
-	'dir_access_jandroid.cpp',
-	'thread_jandroid.cpp',
-	'audio_driver_jandroid.cpp',
-	'ifaddrs_android.cpp',
-	'android_native_app_glue.c',
-	'java_glue.cpp',
-	'cpu-features.c',
-	'java_class_wrapper.cpp'
+    'os_android.cpp',
+    'godot_android.cpp',
+    'file_access_android.cpp',
+    'dir_access_android.cpp',
+    'audio_driver_opensl.cpp',
+    'file_access_jandroid.cpp',
+    'dir_access_jandroid.cpp',
+    'thread_jandroid.cpp',
+    'audio_driver_jandroid.cpp',
+    'ifaddrs_android.cpp',
+    'android_native_app_glue.c',
+    'java_glue.cpp',
+    'cpu-features.c',
+    'java_class_wrapper.cpp'
 ]
 ]
 
 
-#env.Depends('#core/math/vector3.h', 'vector3_psp.h')
+# env.Depends('#core/math/vector3.h', 'vector3_psp.h')
 
 
 #obj = env.SharedObject('godot_android.cpp')
 #obj = env.SharedObject('godot_android.cpp')
 
 
 env_android = env.Clone()
 env_android = env.Clone()
 if env['target'] == "profile":
 if env['target'] == "profile":
-	env_android.Append(CPPFLAGS=['-DPROFILER_ENABLED'])
+    env_android.Append(CPPFLAGS=['-DPROFILER_ENABLED'])
 
 
-android_objects=[]
+android_objects = []
 for x in android_files:
 for x in android_files:
-	android_objects.append( env_android.SharedObject( x ) )
+    android_objects.append(env_android.SharedObject(x))
 
 
 prog = None
 prog = None
 
 
-abspath=env.Dir(".").abspath
+abspath = env.Dir(".").abspath
 
 
 
 
-gradle_basein = open(abspath+"/build.gradle.template","rb")
-gradle_baseout = open(abspath+"/java/build.gradle","wb")
+gradle_basein = open(abspath + "/build.gradle.template", "rb")
+gradle_baseout = open(abspath + "/java/build.gradle", "wb")
 
 
 gradle_text = gradle_basein.read()
 gradle_text = gradle_basein.read()
 
 
 
 
-gradle_maven_repos_text=""
+gradle_maven_repos_text = ""
 
 
 if len(env.android_maven_repos) > 0:
 if len(env.android_maven_repos) > 0:
-	gradle_maven_repos_text+="maven {\n"
-	for x in env.android_maven_repos:
-		gradle_maven_repos_text+="\t\t"+x+"\n"
-	gradle_maven_repos_text+="\t}\n"
+    gradle_maven_repos_text += "maven {\n"
+    for x in env.android_maven_repos:
+        gradle_maven_repos_text += "\t\t" + x + "\n"
+    gradle_maven_repos_text += "\t}\n"
 
 
-gradle_maven_dependencies_text=""
+gradle_maven_dependencies_text = ""
 
 
 for x in env.android_dependencies:
 for x in env.android_dependencies:
-	gradle_maven_dependencies_text+=x+"\n"
+    gradle_maven_dependencies_text += x + "\n"
 
 
-gradle_java_dirs_text=""
+gradle_java_dirs_text = ""
 
 
 for x in env.android_java_dirs:
 for x in env.android_java_dirs:
-	gradle_java_dirs_text+=",'"+x.replace("\\","/")+"'"
+    gradle_java_dirs_text += ",'" + x.replace("\\", "/") + "'"
 
 
 
 
-gradle_res_dirs_text=""
+gradle_res_dirs_text = ""
 
 
 for x in env.android_res_dirs:
 for x in env.android_res_dirs:
-	gradle_res_dirs_text+=",'"+x.replace("\\","/")+"'"
+    gradle_res_dirs_text += ",'" + x.replace("\\", "/") + "'"
 
 
-gradle_aidl_dirs_text=""
+gradle_aidl_dirs_text = ""
 
 
 for x in env.android_aidl_dirs:
 for x in env.android_aidl_dirs:
-	gradle_aidl_dirs_text+=",'"+x.replace("\\","/")+"'"
+    gradle_aidl_dirs_text += ",'" + x.replace("\\", "/") + "'"
 
 
-gradle_jni_dirs_text=""
+gradle_jni_dirs_text = ""
 
 
 for x in env.android_jni_dirs:
 for x in env.android_jni_dirs:
-	gradle_jni_dirs_text+=",'"+x.replace("\\","/")+"'"
+    gradle_jni_dirs_text += ",'" + x.replace("\\", "/") + "'"
 
 
-gradle_asset_dirs_text=""
+gradle_asset_dirs_text = ""
 
 
-gradle_default_config_text=""
+gradle_default_config_text = ""
 
 
 for x in env.android_default_config:
 for x in env.android_default_config:
-	gradle_default_config_text+=x+"\n\t\t"
+    gradle_default_config_text += x + "\n\t\t"
 
 
-gradle_text = gradle_text.replace("$$GRADLE_REPOSITORY_URLS$$",gradle_maven_repos_text)
-gradle_text = gradle_text.replace("$$GRADLE_DEPENDENCIES$$",gradle_maven_dependencies_text)
-gradle_text = gradle_text.replace("$$GRADLE_JAVA_DIRS$$",gradle_java_dirs_text)
-gradle_text = gradle_text.replace("$$GRADLE_RES_DIRS$$",gradle_res_dirs_text)
-gradle_text = gradle_text.replace("$$GRADLE_ASSET_DIRS$$",gradle_asset_dirs_text)
-gradle_text = gradle_text.replace("$$GRADLE_AIDL_DIRS$$",gradle_aidl_dirs_text)
-gradle_text = gradle_text.replace("$$GRADLE_JNI_DIRS$$",gradle_jni_dirs_text)
-gradle_text = gradle_text.replace("$$GRADLE_DEFAULT_CONFIG$$",gradle_default_config_text)
+gradle_text = gradle_text.replace("$$GRADLE_REPOSITORY_URLS$$", gradle_maven_repos_text)
+gradle_text = gradle_text.replace("$$GRADLE_DEPENDENCIES$$", gradle_maven_dependencies_text)
+gradle_text = gradle_text.replace("$$GRADLE_JAVA_DIRS$$", gradle_java_dirs_text)
+gradle_text = gradle_text.replace("$$GRADLE_RES_DIRS$$", gradle_res_dirs_text)
+gradle_text = gradle_text.replace("$$GRADLE_ASSET_DIRS$$", gradle_asset_dirs_text)
+gradle_text = gradle_text.replace("$$GRADLE_AIDL_DIRS$$", gradle_aidl_dirs_text)
+gradle_text = gradle_text.replace("$$GRADLE_JNI_DIRS$$", gradle_jni_dirs_text)
+gradle_text = gradle_text.replace("$$GRADLE_DEFAULT_CONFIG$$", gradle_default_config_text)
 
 
 
 
-gradle_baseout.write( gradle_text )
+gradle_baseout.write(gradle_text)
 gradle_baseout.close()
 gradle_baseout.close()
 
 
 
 
-pp_basein = open(abspath+"/AndroidManifest.xml.template","rb")
-pp_baseout = open(abspath+"/java/AndroidManifest.xml","wb")
+pp_basein = open(abspath + "/AndroidManifest.xml.template", "rb")
+pp_baseout = open(abspath + "/java/AndroidManifest.xml", "wb")
 manifest = pp_basein.read()
 manifest = pp_basein.read()
-manifest = manifest.replace("$$ADD_APPLICATION_CHUNKS$$",env.android_manifest_chunk)
-manifest = manifest.replace("$$ADD_PERMISSION_CHUNKS$$",env.android_permission_chunk)
-manifest = manifest.replace("$$ADD_APPATTRIBUTE_CHUNKS$$",env.android_appattributes_chunk)
-pp_baseout.write( manifest )
+manifest = manifest.replace("$$ADD_APPLICATION_CHUNKS$$", env.android_manifest_chunk)
+manifest = manifest.replace("$$ADD_PERMISSION_CHUNKS$$", env.android_permission_chunk)
+manifest = manifest.replace("$$ADD_APPATTRIBUTE_CHUNKS$$", env.android_appattributes_chunk)
+pp_baseout.write(manifest)
 
 
 
 
-env_android.SharedLibrary("#bin/libgodot",[android_objects],SHLIBSUFFIX=env["SHLIBSUFFIX"])
+env_android.SharedLibrary("#bin/libgodot", [android_objects], SHLIBSUFFIX=env["SHLIBSUFFIX"])
 
 
 
 
 lib_arch_dir = ''
 lib_arch_dir = ''
 if env['android_arch'] == 'armv6':
 if env['android_arch'] == 'armv6':
-	lib_arch_dir = 'armeabi'
+    lib_arch_dir = 'armeabi'
 elif env['android_arch'] == 'armv7':
 elif env['android_arch'] == 'armv7':
-	lib_arch_dir = 'armeabi-v7a'
+    lib_arch_dir = 'armeabi-v7a'
 elif env['android_arch'] == 'x86':
 elif env['android_arch'] == 'x86':
-	lib_arch_dir = 'x86'
+    lib_arch_dir = 'x86'
 else:
 else:
-	print 'WARN: Architecture not suitable for embedding into APK; keeping .so at \\bin'
+    print 'WARN: Architecture not suitable for embedding into APK; keeping .so at \\bin'
 
 
 if lib_arch_dir != '':
 if lib_arch_dir != '':
-	if env['target'] == 'release':
-		lib_type_dir = 'release'
-	else: # release_debug, debug
-		lib_type_dir = 'debug'
-		
-	out_dir = '#platform/android/java/libs/'+lib_type_dir+'/'+lib_arch_dir
-	env_android.Command(out_dir+'/libgodot_android.so', '#bin/libgodot'+env['SHLIBSUFFIX'], Move("$TARGET", "$SOURCE"))
+    if env['target'] == 'release':
+        lib_type_dir = 'release'
+    else:  # release_debug, debug
+        lib_type_dir = 'debug'
+
+    out_dir = '#platform/android/java/libs/' + lib_type_dir + '/' + lib_arch_dir
+    env_android.Command(out_dir + '/libgodot_android.so', '#bin/libgodot' + env['SHLIBSUFFIX'], Move("$TARGET", "$SOURCE"))

+ 215 - 212
platform/android/detect.py

@@ -3,248 +3,251 @@ import sys
 import string
 import string
 import platform
 import platform
 
 
+
 def is_active():
 def is_active():
-	return True
+    return True
+
 
 
 def get_name():
 def get_name():
-	return "Android"
+    return "Android"
+
 
 
 def can_build():
 def can_build():
 
 
-        import os
-        if (not os.environ.has_key("ANDROID_NDK_ROOT")):
-        	return False
+    import os
+    if (not os.environ.has_key("ANDROID_NDK_ROOT")):
+        return False
+
+    return True
 
 
-	return True
 
 
 def get_opts():
 def get_opts():
 
 
-	return [
-			('ANDROID_NDK_ROOT', 'the path to Android NDK', os.environ.get("ANDROID_NDK_ROOT", 0)),
-			('NDK_TARGET', 'toolchain to use for the NDK',os.environ.get("NDK_TARGET", "arm-linux-androideabi-4.9")),
-			('NDK_TARGET_X86', 'toolchain to use for the NDK x86',os.environ.get("NDK_TARGET_X86", "x86-4.9")),
-			('ndk_platform', 'compile for platform: (android-<api> , example: android-14)',"android-14"),
-			('android_arch', 'select compiler architecture: (armv7/armv6/x86)',"armv7"),
-			('android_neon','enable neon (armv7 only)',"yes"),
-			('android_stl','enable STL support in android port (for modules)',"no")
-	]
+    return [
+        ('ANDROID_NDK_ROOT', 'the path to Android NDK', os.environ.get("ANDROID_NDK_ROOT", 0)),
+        ('NDK_TARGET', 'toolchain to use for the NDK', os.environ.get("NDK_TARGET", "arm-linux-androideabi-4.9")),
+        ('NDK_TARGET_X86', 'toolchain to use for the NDK x86', os.environ.get("NDK_TARGET_X86", "x86-4.9")),
+        ('ndk_platform', 'compile for platform: (android-<api> , example: android-14)', "android-14"),
+        ('android_arch', 'select compiler architecture: (armv7/armv6/x86)', "armv7"),
+        ('android_neon', 'enable neon (armv7 only)', "yes"),
+        ('android_stl', 'enable STL support in android port (for modules)', "no")
+    ]
 
 
 
 
 def get_flags():
 def get_flags():
 
 
-	return [
-		('tools', 'no'),
-		('openssl', 'builtin'), #use builtin openssl
-	]
+    return [
+        ('tools', 'no'),
+        ('openssl', 'builtin'),  # use builtin openssl
+    ]
 
 
 
 
 def create(env):
 def create(env):
-	tools = env['TOOLS']
-	if "mingw" in tools:
-		tools.remove('mingw')
-	if "applelink" in tools:
-		tools.remove("applelink")
-		env.Tool('gcc')
-	return env.Clone(tools=tools);
+    tools = env['TOOLS']
+    if "mingw" in tools:
+        tools.remove('mingw')
+    if "applelink" in tools:
+        tools.remove("applelink")
+        env.Tool('gcc')
+    return env.Clone(tools=tools)
+
 
 
 def configure(env):
 def configure(env):
 
 
-	# Workaround for MinGW. See:
-	# http://www.scons.org/wiki/LongCmdLinesOnWin32
-	import os
-	if (os.name=="nt"):
-
-		import subprocess
-
-		def mySubProcess(cmdline,env):
-			#print "SPAWNED : " + cmdline
-			startupinfo = subprocess.STARTUPINFO()
-			startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
-			proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
-				stderr=subprocess.PIPE, startupinfo=startupinfo, shell = False, env = env)
-			data, err = proc.communicate()
-			rv = proc.wait()
-			if rv:
-				print "====="
-				print err
-				print "====="
-			return rv
-
-		def mySpawn(sh, escape, cmd, args, env):
-
-			newargs = ' '.join(args[1:])
-			cmdline = cmd + " " + newargs
-
-			rv=0
-			if len(cmdline) > 32000 and cmd.endswith("ar") :
-				cmdline = cmd + " " + args[1] + " " + args[2] + " "
-				for i in range(3,len(args)) :
-					rv = mySubProcess( cmdline + args[i], env )
-					if rv :
-						break
-			else:
-				rv = mySubProcess( cmdline, env )
-
-			return rv
-
-		env['SPAWN'] = mySpawn
-
-	ndk_platform=env['ndk_platform']
-
-	if env['android_arch'] not in ['armv7','armv6','x86']:
-		env['android_arch']='armv7'
-
-	if env['android_arch']=='x86':
-		env['NDK_TARGET']=env['NDK_TARGET_X86']
-		env["x86_libtheora_opt_gcc"]=True
-
-	if env['PLATFORM'] == 'win32':
-		env.Tool('gcc')
-		env['SHLIBSUFFIX'] = '.so'
-
-
-	neon_text=""
-	if env["android_arch"]=="armv7" and env['android_neon']=='yes':
-		neon_text=" (with neon)"
-	print("Godot Android!!!!! ("+env['android_arch']+")"+neon_text)
-
-	env.Append(CPPPATH=['#platform/android'])
-
-	if env['android_arch']=='x86':
-		env.extra_suffix=".x86"+env.extra_suffix
-	elif env['android_arch']=='armv6':
-		env.extra_suffix=".armv6"+env.extra_suffix
-	elif env["android_arch"]=="armv7":
-		if env['android_neon']=='yes':
-			env.extra_suffix=".armv7.neon"+env.extra_suffix
-		else:
-			env.extra_suffix=".armv7"+env.extra_suffix
-
-	gcc_path=env["ANDROID_NDK_ROOT"]+"/toolchains/"+env["NDK_TARGET"]+"/prebuilt/";
-
-	if (sys.platform.startswith("linux")):
-		if (platform.machine().endswith('64')):
-			gcc_path=gcc_path+"/linux-x86_64/bin"
-		else:
-			gcc_path=gcc_path+"/linux-x86/bin"
-	elif (sys.platform.startswith("darwin")):
-		gcc_path=gcc_path+"/darwin-x86_64/bin"
-		env['SHLINKFLAGS'][1] = '-shared'
-		env['SHLIBSUFFIX'] = '.so'
-	elif (sys.platform.startswith('win')):
-                if (platform.machine().endswith('64')):
-			gcc_path=gcc_path+"/windows-x86_64/bin"
-                else:
-			gcc_path=gcc_path+"/windows-x86/bin"
-
-	env['ENV']['PATH'] = gcc_path+":"+env['ENV']['PATH']
-	if env['android_arch']=='x86':
-		env['CC'] = gcc_path+'/i686-linux-android-gcc'
-		env['CXX'] = gcc_path+'/i686-linux-android-g++'
-		env['AR'] = gcc_path+"/i686-linux-android-ar"
-		env['RANLIB'] = gcc_path+"/i686-linux-android-ranlib"
-		env['AS'] = gcc_path+"/i686-linux-android-as"
-	else:
-		env['CC'] = gcc_path+'/arm-linux-androideabi-gcc'
-		env['CXX'] = gcc_path+'/arm-linux-androideabi-g++'
-		env['AR'] = gcc_path+"/arm-linux-androideabi-ar"
-		env['RANLIB'] = gcc_path+"/arm-linux-androideabi-ranlib"
-		env['AS'] = gcc_path+"/arm-linux-androideabi-as"
-
-	if env['android_arch']=='x86':
-		env['ARCH'] = 'arch-x86'
-	else:
-		env['ARCH'] = 'arch-arm'
-
-	import string
-	#include path
-	gcc_include=env["ANDROID_NDK_ROOT"]+"/platforms/"+ndk_platform+"/"+env['ARCH'] +"/usr/include"
-	ld_sysroot=env["ANDROID_NDK_ROOT"]+"/platforms/"+ndk_platform+"/"+env['ARCH']
-	#glue_include=env["ANDROID_NDK_ROOT"]+"/sources/android/native_app_glue"
-	ld_path=env["ANDROID_NDK_ROOT"]+"/platforms/"+ndk_platform+"/"+env['ARCH']+"/usr/lib"
-	env.Append(CPPPATH=[gcc_include])
+    # Workaround for MinGW. See:
+    # http://www.scons.org/wiki/LongCmdLinesOnWin32
+    import os
+    if (os.name == "nt"):
+
+        import subprocess
+
+        def mySubProcess(cmdline, env):
+            # print "SPAWNED : " + cmdline
+            startupinfo = subprocess.STARTUPINFO()
+            startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
+            proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
+                                    stderr=subprocess.PIPE, startupinfo=startupinfo, shell=False, env=env)
+            data, err = proc.communicate()
+            rv = proc.wait()
+            if rv:
+                print "====="
+                print err
+                print "====="
+            return rv
+
+        def mySpawn(sh, escape, cmd, args, env):
+
+            newargs = ' '.join(args[1:])
+            cmdline = cmd + " " + newargs
+
+            rv = 0
+            if len(cmdline) > 32000 and cmd.endswith("ar"):
+                cmdline = cmd + " " + args[1] + " " + args[2] + " "
+                for i in range(3, len(args)):
+                    rv = mySubProcess(cmdline + args[i], env)
+                    if rv:
+                        break
+            else:
+                rv = mySubProcess(cmdline, env)
+
+            return rv
+
+        env['SPAWN'] = mySpawn
+
+    ndk_platform = env['ndk_platform']
+
+    if env['android_arch'] not in ['armv7', 'armv6', 'x86']:
+        env['android_arch'] = 'armv7'
+
+    if env['android_arch'] == 'x86':
+        env['NDK_TARGET'] = env['NDK_TARGET_X86']
+        env["x86_libtheora_opt_gcc"] = True
+
+    if env['PLATFORM'] == 'win32':
+        env.Tool('gcc')
+        env['SHLIBSUFFIX'] = '.so'
+
+    neon_text = ""
+    if env["android_arch"] == "armv7" and env['android_neon'] == 'yes':
+        neon_text = " (with neon)"
+    print("Godot Android!!!!! (" + env['android_arch'] + ")" + neon_text)
+
+    env.Append(CPPPATH=['#platform/android'])
+
+    if env['android_arch'] == 'x86':
+        env.extra_suffix = ".x86" + env.extra_suffix
+    elif env['android_arch'] == 'armv6':
+        env.extra_suffix = ".armv6" + env.extra_suffix
+    elif env["android_arch"] == "armv7":
+        if env['android_neon'] == 'yes':
+            env.extra_suffix = ".armv7.neon" + env.extra_suffix
+        else:
+            env.extra_suffix = ".armv7" + env.extra_suffix
+
+    gcc_path = env["ANDROID_NDK_ROOT"] + "/toolchains/" + env["NDK_TARGET"] + "/prebuilt/"
+
+    if (sys.platform.startswith("linux")):
+        if (platform.machine().endswith('64')):
+            gcc_path = gcc_path + "/linux-x86_64/bin"
+        else:
+            gcc_path = gcc_path + "/linux-x86/bin"
+    elif (sys.platform.startswith("darwin")):
+        gcc_path = gcc_path + "/darwin-x86_64/bin"
+        env['SHLINKFLAGS'][1] = '-shared'
+        env['SHLIBSUFFIX'] = '.so'
+    elif (sys.platform.startswith('win')):
+        if (platform.machine().endswith('64')):
+            gcc_path = gcc_path + "/windows-x86_64/bin"
+        else:
+            gcc_path = gcc_path + "/windows-x86/bin"
+
+    env['ENV']['PATH'] = gcc_path + ":" + env['ENV']['PATH']
+    if env['android_arch'] == 'x86':
+        env['CC'] = gcc_path + '/i686-linux-android-gcc'
+        env['CXX'] = gcc_path + '/i686-linux-android-g++'
+        env['AR'] = gcc_path + "/i686-linux-android-ar"
+        env['RANLIB'] = gcc_path + "/i686-linux-android-ranlib"
+        env['AS'] = gcc_path + "/i686-linux-android-as"
+    else:
+        env['CC'] = gcc_path + '/arm-linux-androideabi-gcc'
+        env['CXX'] = gcc_path + '/arm-linux-androideabi-g++'
+        env['AR'] = gcc_path + "/arm-linux-androideabi-ar"
+        env['RANLIB'] = gcc_path + "/arm-linux-androideabi-ranlib"
+        env['AS'] = gcc_path + "/arm-linux-androideabi-as"
+
+    if env['android_arch'] == 'x86':
+        env['ARCH'] = 'arch-x86'
+    else:
+        env['ARCH'] = 'arch-arm'
+
+    import string
+    # include path
+    gcc_include = env["ANDROID_NDK_ROOT"] + "/platforms/" + ndk_platform + "/" + env['ARCH'] + "/usr/include"
+    ld_sysroot = env["ANDROID_NDK_ROOT"] + "/platforms/" + ndk_platform + "/" + env['ARCH']
+    # glue_include=env["ANDROID_NDK_ROOT"]+"/sources/android/native_app_glue"
+    ld_path = env["ANDROID_NDK_ROOT"] + "/platforms/" + ndk_platform + "/" + env['ARCH'] + "/usr/lib"
+    env.Append(CPPPATH=[gcc_include])
 #	env['CCFLAGS'] = string.split('-DNO_THREADS -MMD -MP -MF -fpic -ffunction-sections -funwind-tables -fstack-protector -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__  -Wno-psabi -march=armv5te -mtune=xscale -msoft-float  -fno-exceptions -mthumb -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED ')
 #	env['CCFLAGS'] = string.split('-DNO_THREADS -MMD -MP -MF -fpic -ffunction-sections -funwind-tables -fstack-protector -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__  -Wno-psabi -march=armv5te -mtune=xscale -msoft-float  -fno-exceptions -mthumb -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED ')
 
 
-	env['neon_enabled']=False
-	if env['android_arch']=='x86':
-		env.Append(CCFLAGS=string.split('-DNO_STATVFS -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__GLIBC__  -Wno-psabi -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED'))
-	elif env["android_arch"]=="armv6":
-		env.Append(CCFLAGS=string.split('-DNO_STATVFS -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_6__ -D__GLIBC__  -Wno-psabi -march=armv6 -mfpu=vfp -mfloat-abi=softfp -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED'))
-	elif env["android_arch"]=="armv7":
-		env.Append(CCFLAGS=string.split('-DNO_STATVFS -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_7__ -D__ARM_ARCH_7A__ -D__GLIBC__  -Wno-psabi -march=armv7-a -mfloat-abi=softfp -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED'))
-		if env['android_neon']=='yes':
-			env['neon_enabled']=True
-			env.Append(CCFLAGS=['-mfpu=neon','-D__ARM_NEON__'])
-		else:
-			env.Append(CCFLAGS=['-mfpu=vfpv3-d16'])
-
-	env.Append(LDPATH=[ld_path])
-	env.Append(LIBS=['OpenSLES'])
+    env['neon_enabled'] = False
+    if env['android_arch'] == 'x86':
+        env.Append(CCFLAGS=string.split('-DNO_STATVFS -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__GLIBC__  -Wno-psabi -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED'))
+    elif env["android_arch"] == "armv6":
+        env.Append(CCFLAGS=string.split('-DNO_STATVFS -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_6__ -D__GLIBC__  -Wno-psabi -march=armv6 -mfpu=vfp -mfloat-abi=softfp -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED'))
+    elif env["android_arch"] == "armv7":
+        env.Append(CCFLAGS=string.split('-DNO_STATVFS -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_7__ -D__ARM_ARCH_7A__ -D__GLIBC__  -Wno-psabi -march=armv7-a -mfloat-abi=softfp -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED'))
+        if env['android_neon'] == 'yes':
+            env['neon_enabled'] = True
+            env.Append(CCFLAGS=['-mfpu=neon', '-D__ARM_NEON__'])
+        else:
+            env.Append(CCFLAGS=['-mfpu=vfpv3-d16'])
+
+    env.Append(LDPATH=[ld_path])
+    env.Append(LIBS=['OpenSLES'])
 #	env.Append(LIBS=['c','m','stdc++','log','EGL','GLESv1_CM','GLESv2','OpenSLES','supc++','android'])
 #	env.Append(LIBS=['c','m','stdc++','log','EGL','GLESv1_CM','GLESv2','OpenSLES','supc++','android'])
-	env.Append(LIBS=['EGL','OpenSLES','android'])
-	env.Append(LIBS=['c','m','stdc++','log','GLESv1_CM','GLESv2', 'z'])
+    env.Append(LIBS=['EGL', 'OpenSLES', 'android'])
+    env.Append(LIBS=['c', 'm', 'stdc++', 'log', 'GLESv1_CM', 'GLESv2', 'z'])
 
 
-	env["LINKFLAGS"]= string.split(" -g --sysroot="+ld_sysroot+" -Wl,--no-undefined -Wl,-z,noexecstack ")
-	env.Append(LINKFLAGS=["-Wl,-soname,libgodot_android.so"])
+    env["LINKFLAGS"] = string.split(" -g --sysroot=" + ld_sysroot + " -Wl,--no-undefined -Wl,-z,noexecstack ")
+    env.Append(LINKFLAGS=["-Wl,-soname,libgodot_android.so"])
 
 
-	if (env["target"]=="release"):
+    if (env["target"] == "release"):
 
 
-		env.Append(CCFLAGS=['-O2', '-ffast-math','-fomit-frame-pointer'])
+        env.Append(CCFLAGS=['-O2', '-ffast-math', '-fomit-frame-pointer'])
 
 
-	elif (env["target"]=="release_debug"):
+    elif (env["target"] == "release_debug"):
 
 
-		env.Append(CCFLAGS=['-O2', '-ffast-math','-DDEBUG_ENABLED'])
+        env.Append(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED'])
 
 
-	elif (env["target"]=="debug"):
+    elif (env["target"] == "debug"):
 
 
-		env.Append(CCFLAGS=['-D_DEBUG', '-g1', '-Wall', '-O0', '-DDEBUG_ENABLED'])
-		env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC'])
+        env.Append(CCFLAGS=['-D_DEBUG', '-g1', '-Wall', '-O0', '-DDEBUG_ENABLED'])
+        env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC'])
 
 
-	env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED', '-DNO_FCNTL','-DMPC_FIXED_POINT'])
+    env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED', '-DNO_FCNTL', '-DMPC_FIXED_POINT'])
 #	env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED','-DMPC_FIXED_POINT'])
 #	env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED','-DMPC_FIXED_POINT'])
 
 
-	# TODO: Move that to opus module's config
-	if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"):
-		if (env["android_arch"]=="armv6" or env["android_arch"]=="armv7"):
-			env.Append(CFLAGS=["-DOPUS_ARM_OPT"])
-		env.opus_fixed_point="yes"
-
-	if (env['android_stl']=='yes'):
-		#env.Append(CCFLAGS=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/system/include"])
-		env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/include"])
-		if env['android_arch']=='x86':
-			env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/include"])
-			env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86"])
-		elif env['android_arch']=='armv6':
-			env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include"])
-			env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi"])
-		elif env["android_arch"]=="armv7":
-			env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include"])
-			env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a"])
-
-		env.Append(LIBS=["gnustl_static","supc++"])
-		env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cpufeatures"])
-
-		#env.Append(CCFLAGS=["-I"+env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/stlport/stlport"])
-		#env.Append(CCFLAGS=["-I"+env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include"])
-		#env.Append(LINKFLAGS=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/libs/armeabi/libstdc++.a"])
-	else:
-
-		env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/include"])
-		env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cpufeatures"])
-		if env['android_arch']=='x86':
-			env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86"])
-		elif env["android_arch"]=="armv6":
-			env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi"])
-		elif env["android_arch"]=="armv7":
-			env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a"])
-		env.Append(LIBS=['gnustl_static'])
-		env.Append(CCFLAGS=["-fno-exceptions",'-DNO_SAFE_CAST'])
-
-
-	import methods
-	env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
-	env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
-	env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
-
-	env.use_windows_spawn_fix()
+    # TODO: Move that to opus module's config
+    if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"):
+        if (env["android_arch"] == "armv6" or env["android_arch"] == "armv7"):
+            env.Append(CFLAGS=["-DOPUS_ARM_OPT"])
+        env.opus_fixed_point = "yes"
+
+    if (env['android_stl'] == 'yes'):
+        # env.Append(CCFLAGS=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/system/include"])
+        env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/include"])
+        if env['android_arch'] == 'x86':
+            env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/include"])
+            env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86"])
+        elif env['android_arch'] == 'armv6':
+            env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include"])
+            env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi"])
+        elif env["android_arch"] == "armv7":
+            env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include"])
+            env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a"])
+
+        env.Append(LIBS=["gnustl_static", "supc++"])
+        env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cpufeatures"])
+
+        # env.Append(CCFLAGS=["-I"+env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/stlport/stlport"])
+        # env.Append(CCFLAGS=["-I"+env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include"])
+        # env.Append(LINKFLAGS=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/libs/armeabi/libstdc++.a"])
+    else:
+
+        env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/include"])
+        env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cpufeatures"])
+        if env['android_arch'] == 'x86':
+            env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86"])
+        elif env["android_arch"] == "armv6":
+            env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi"])
+        elif env["android_arch"] == "armv7":
+            env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a"])
+        env.Append(LIBS=['gnustl_static'])
+        env.Append(CCFLAGS=["-fno-exceptions", '-DNO_SAFE_CAST'])
+
+    import methods
+    env.Append(BUILDERS={'GLSL120': env.Builder(action=methods.build_legacygl_headers, suffix='glsl.h', src_suffix='.glsl')})
+    env.Append(BUILDERS={'GLSL': env.Builder(action=methods.build_glsl_headers, suffix='glsl.h', src_suffix='.glsl')})
+    env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.h', src_suffix='.glsl')})
+
+    env.use_windows_spawn_fix()

+ 7 - 7
platform/bb10/SCsub

@@ -4,19 +4,19 @@ Import('env')
 
 
 bb10_lib = [
 bb10_lib = [
 
 
-	'bbutil.c',
-	'os_bb10.cpp',
-	'audio_driver_bb10.cpp',
-	'godot_bb10.cpp',
-	'payment_service.cpp',
+    'bbutil.c',
+    'os_bb10.cpp',
+    'audio_driver_bb10.cpp',
+    'godot_bb10.cpp',
+    'payment_service.cpp',
 ]
 ]
 
 
 env_bps = env.Clone()
 env_bps = env.Clone()
 if env['bb10_payment_service'] == "yes":
 if env['bb10_payment_service'] == "yes":
-	env_bps.Append(CPPFLAGS=['-DPAYMENT_SERVICE_ENABLED'])
+    env_bps.Append(CPPFLAGS=['-DPAYMENT_SERVICE_ENABLED'])
 
 
 if env['bb10_lgles_override'] == "yes":
 if env['bb10_lgles_override'] == "yes":
-	env_bps.Append(CPPFLAGS=['-DBB10_LGLES_OVERRIDE'])
+    env_bps.Append(CPPFLAGS=['-DBB10_LGLES_OVERRIDE'])
 
 
 
 
 prog = None
 prog = None

+ 61 - 57
platform/bb10/detect.py

@@ -5,85 +5,89 @@ import methods
 
 
 
 
 def is_active():
 def is_active():
-	return True
+    return True
+
 
 
 def get_name():
 def get_name():
-	return "BlackBerry 10"
+    return "BlackBerry 10"
+
 
 
 def can_build():
 def can_build():
 
 
-	import os
-	if (not os.environ.has_key("QNX_TARGET")):
-		return False
-	return True
+    import os
+    if (not os.environ.has_key("QNX_TARGET")):
+        return False
+    return True
+
 
 
 def get_opts():
 def get_opts():
 
 
-	return [
-		('QNX_HOST', 'path to qnx host', os.environ.get("QNX_HOST", 0)),
-		('QNX_TARGET', 'path to qnx target', os.environ.get("QNX_TARGET", 0)),
-		('QNX_CONFIGURATION', 'path to qnx configuration', os.environ.get("QNX_CONFIGURATION", 0)),
-		('qnx_target', 'Qnx target (armle or x86', 'armle'),
-		('bb10_payment_service', 'Enable Payment Service for BlackBerry10', 'yes'),
-		('bb10_lgles_override', 'Force legacy GLES (1.1) on iOS', 'no'),
-		('bb10_exceptions', 'Use exceptions when compiling on bb10', 'no'),
-	]
+    return [
+        ('QNX_HOST', 'path to qnx host', os.environ.get("QNX_HOST", 0)),
+        ('QNX_TARGET', 'path to qnx target', os.environ.get("QNX_TARGET", 0)),
+        ('QNX_CONFIGURATION', 'path to qnx configuration', os.environ.get("QNX_CONFIGURATION", 0)),
+        ('qnx_target', 'Qnx target (armle or x86', 'armle'),
+        ('bb10_payment_service', 'Enable Payment Service for BlackBerry10', 'yes'),
+        ('bb10_lgles_override', 'Force legacy GLES (1.1) on iOS', 'no'),
+        ('bb10_exceptions', 'Use exceptions when compiling on bb10', 'no'),
+    ]
+
 
 
 def get_flags():
 def get_flags():
 
 
-	return [
-		('tools', 'no'),
-		('builtin_zlib', 'yes'),
-		('module_theora_enabled', 'no'),
-	]
+    return [
+        ('tools', 'no'),
+        ('builtin_zlib', 'yes'),
+        ('module_theora_enabled', 'no'),
+    ]
 
 
-def configure(env):
 
 
-	if env['PLATFORM'] == 'win32':
-		env.Tool('mingw')
-		env['SPAWN'] = methods.win32_spawn
+def configure(env):
 
 
-	env['qnx_target_ver'] = env['qnx_target']
-	if env['qnx_target'] == "armle":
-		env['qnx_prefix'] = 'ntoarmv7'
-		env['qnx_target_ver'] = 'armle-v7'
-	else:
-		env['qnx_prefix'] = 'ntox86'
+    if env['PLATFORM'] == 'win32':
+        env.Tool('mingw')
+        env['SPAWN'] = methods.win32_spawn
 
 
-	env['OBJSUFFIX'] = ".qnx.${qnx_target}.o"
-	env['LIBSUFFIX'] = ".qnx.${qnx_target}.a"
-	env['PROGSUFFIX'] = ".qnx.${qnx_target}"
-	print("PROGSUFFIX: "+env['PROGSUFFIX']+" target: "+env['qnx_target'])
+    env['qnx_target_ver'] = env['qnx_target']
+    if env['qnx_target'] == "armle":
+        env['qnx_prefix'] = 'ntoarmv7'
+        env['qnx_target_ver'] = 'armle-v7'
+    else:
+        env['qnx_prefix'] = 'ntox86'
 
 
-	env.PrependENVPath('PATH', env['QNX_CONFIGURATION'] + '/bin')
-	env.PrependENVPath('PATH', env['QNX_CONFIGURATION'] + '/usr/bin')
-	env['ENV']['QNX_HOST'] = env['QNX_HOST']
-	env['ENV']['QNX_TARGET'] = env['QNX_TARGET']
-	env['ENV']['QNX_CONFIGURATION'] = env['QNX_CONFIGURATION']
+    env['OBJSUFFIX'] = ".qnx.${qnx_target}.o"
+    env['LIBSUFFIX'] = ".qnx.${qnx_target}.a"
+    env['PROGSUFFIX'] = ".qnx.${qnx_target}"
+    print("PROGSUFFIX: " + env['PROGSUFFIX'] + " target: " + env['qnx_target'])
 
 
-	env['CC'] = '$qnx_prefix-gcc'
-	env['CXX'] = '$qnx_prefix-g++'
-	env['AR'] = '$qnx_prefix-ar'
-	env['RANLIB'] = '$qnx_prefix-ranlib'
+    env.PrependENVPath('PATH', env['QNX_CONFIGURATION'] + '/bin')
+    env.PrependENVPath('PATH', env['QNX_CONFIGURATION'] + '/usr/bin')
+    env['ENV']['QNX_HOST'] = env['QNX_HOST']
+    env['ENV']['QNX_TARGET'] = env['QNX_TARGET']
+    env['ENV']['QNX_CONFIGURATION'] = env['QNX_CONFIGURATION']
 
 
-	env.Append(CPPPATH = ['#platform/bb10'])
-	env.Append(LIBPATH = ['#platform/bb10/lib/$qnx_target', '#platform/bb10/lib/$qnx_target_ver'])
-	env.Append(CCFLAGS = string.split('-DBB10_ENABLED -DUNIX_ENABLED -DGLES2_ENABLED -DGLES1_ENABLED -D_LITTLE_ENDIAN -DNO_THREADS -DNO_FCNTL'))
-	if env['bb10_exceptions']=="yes":
-		env.Append(CCFLAGS = ['-fexceptions'])
-	else:
-		env.Append(CCFLAGS = ['-fno-exceptions'])
+    env['CC'] = '$qnx_prefix-gcc'
+    env['CXX'] = '$qnx_prefix-g++'
+    env['AR'] = '$qnx_prefix-ar'
+    env['RANLIB'] = '$qnx_prefix-ranlib'
 
 
-	#env.Append(LINKFLAGS = string.split()
+    env.Append(CPPPATH=['#platform/bb10'])
+    env.Append(LIBPATH=['#platform/bb10/lib/$qnx_target', '#platform/bb10/lib/$qnx_target_ver'])
+    env.Append(CCFLAGS=string.split('-DBB10_ENABLED -DUNIX_ENABLED -DGLES2_ENABLED -DGLES1_ENABLED -D_LITTLE_ENDIAN -DNO_THREADS -DNO_FCNTL'))
+    if env['bb10_exceptions'] == "yes":
+        env.Append(CCFLAGS=['-fexceptions'])
+    else:
+        env.Append(CCFLAGS=['-fno-exceptions'])
 
 
-	if (env["target"]=="release"):
+    # env.Append(LINKFLAGS = string.split()
 
 
-		env.Append(CCFLAGS=['-O3','-DRELEASE_BUILD'])
+    if (env["target"] == "release"):
 
 
-	elif (env["target"]=="debug"):
+        env.Append(CCFLAGS=['-O3', '-DRELEASE_BUILD'])
 
 
-		env.Append(CCFLAGS=['-g', '-O0','-DDEBUG_ENABLED', '-D_DEBUG'])
-		env.Append(LINKFLAGS=['-g'])
+    elif (env["target"] == "debug"):
 
 
-	env.Append(LIBS=['bps', 'pps', 'screen', 'socket', 'EGL', 'GLESv2', 'GLESv1_CM', 'm', 'asound'])
+        env.Append(CCFLAGS=['-g', '-O0', '-DDEBUG_ENABLED', '-D_DEBUG'])
+        env.Append(LINKFLAGS=['-g'])
 
 
+    env.Append(LIBS=['bps', 'pps', 'screen', 'socket', 'EGL', 'GLESv2', 'GLESv1_CM', 'm', 'asound'])

+ 13 - 12
platform/haiku/SCsub

@@ -3,25 +3,26 @@
 Import('env')
 Import('env')
 
 
 common_haiku = [
 common_haiku = [
-	'os_haiku.cpp',
-	'context_gl_haiku.cpp',
-	'haiku_application.cpp',
-	'haiku_direct_window.cpp',
-	'haiku_gl_view.cpp',
-	'key_mapping_haiku.cpp',
-	'audio_driver_media_kit.cpp'
+    'os_haiku.cpp',
+    'context_gl_haiku.cpp',
+    'haiku_application.cpp',
+    'haiku_direct_window.cpp',
+    'haiku_gl_view.cpp',
+    'key_mapping_haiku.cpp',
+    'audio_driver_media_kit.cpp'
 ]
 ]
 
 
 target = env.Program(
 target = env.Program(
-	'#bin/godot',
-	['godot_haiku.cpp'] + common_haiku
+    '#bin/godot',
+    ['godot_haiku.cpp'] + common_haiku
 )
 )
 
 
 command = env.Command('#bin/godot.rsrc', '#platform/haiku/godot.rdef',
 command = env.Command('#bin/godot.rsrc', '#platform/haiku/godot.rdef',
-		['rc -o $TARGET $SOURCE'])
+                      ['rc -o $TARGET $SOURCE'])
 
 
-def addResourcesAction(target = None, source = None, env = None):
-	return env.Execute('xres -o ' + File(target)[0].path + ' bin/godot.rsrc')
+
+def addResourcesAction(target=None, source=None, env=None):
+    return env.Execute('xres -o ' + File(target)[0].path + ' bin/godot.rsrc')
 
 
 env.AddPostAction(target, addResourcesAction)
 env.AddPostAction(target, addResourcesAction)
 env.Depends(target, command)
 env.Depends(target, command)

+ 51 - 45
platform/haiku/detect.py

@@ -1,61 +1,67 @@
 import os
 import os
 import sys
 import sys
 
 
+
 def is_active():
 def is_active():
-	return True
+    return True
+
 
 
 def get_name():
 def get_name():
-	return "Haiku"
+    return "Haiku"
+
 
 
 def can_build():
 def can_build():
-	if (os.name != "posix"):
-		return False
+    if (os.name != "posix"):
+        return False
 
 
-	if (sys.platform == "darwin"):
-		return False
+    if (sys.platform == "darwin"):
+        return False
+
+    return True
 
 
-	return True
 
 
 def get_opts():
 def get_opts():
-	return [
-		('debug_release', 'Add debug symbols to release version','no')
-	]
+    return [
+        ('debug_release', 'Add debug symbols to release version', 'no')
+    ]
+
 
 
 def get_flags():
 def get_flags():
-	return [
-	]
+    return [
+    ]
+
 
 
 def configure(env):
 def configure(env):
-	is64 = sys.maxsize > 2**32
-
-	if (env["bits"]=="default"):
-		if (is64):
-			env["bits"]="64"
-		else:
-			env["bits"]="32"
-
-	env.Append(CPPPATH = ['#platform/haiku'])
-
-	env["CC"] = "gcc-x86"
-	env["CXX"] = "g++-x86"
-
-	if (env["target"]=="release"):
-		if (env["debug_release"]=="yes"):
-			env.Append(CCFLAGS=['-g2'])
-		else:
-			env.Append(CCFLAGS=['-O3','-ffast-math'])
-	elif (env["target"]=="release_debug"):
-		env.Append(CCFLAGS=['-O2','-ffast-math','-DDEBUG_ENABLED'])
-	elif (env["target"]=="debug"):
-		env.Append(CCFLAGS=['-g2', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
-
-	#env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
-	env.Append(CPPFLAGS = ['-DPTHREAD_NO_RENAME']) # TODO: enable when we have pthread_setname_np
-	env.Append(CPPFLAGS = ['-DOPENGL_ENABLED', '-DMEDIA_KIT_ENABLED'])
-	env.Append(CPPFLAGS = ['-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DGLES_OVER_GL'])
-	env.Append(LIBS = ['be', 'game', 'media', 'network', 'bnetapi', 'z', 'GL'])
-
-	import methods
-	env.Append(BUILDERS = {'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl')})
-	env.Append(BUILDERS = {'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl')})
-	env.Append(BUILDERS = {'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl')})
+    is64 = sys.maxsize > 2**32
+
+    if (env["bits"] == "default"):
+        if (is64):
+            env["bits"] = "64"
+        else:
+            env["bits"] = "32"
+
+    env.Append(CPPPATH=['#platform/haiku'])
+
+    env["CC"] = "gcc-x86"
+    env["CXX"] = "g++-x86"
+
+    if (env["target"] == "release"):
+        if (env["debug_release"] == "yes"):
+            env.Append(CCFLAGS=['-g2'])
+        else:
+            env.Append(CCFLAGS=['-O3', '-ffast-math'])
+    elif (env["target"] == "release_debug"):
+        env.Append(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED'])
+    elif (env["target"] == "debug"):
+        env.Append(CCFLAGS=['-g2', '-Wall', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
+
+    # env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
+    env.Append(CPPFLAGS=['-DPTHREAD_NO_RENAME'])  # TODO: enable when we have pthread_setname_np
+    env.Append(CPPFLAGS=['-DOPENGL_ENABLED', '-DMEDIA_KIT_ENABLED'])
+    env.Append(CPPFLAGS=['-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DGLES_OVER_GL'])
+    env.Append(LIBS=['be', 'game', 'media', 'network', 'bnetapi', 'z', 'GL'])
+
+    import methods
+    env.Append(BUILDERS={'GLSL120': env.Builder(action=methods.build_legacygl_headers, suffix='glsl.h', src_suffix='.glsl')})
+    env.Append(BUILDERS={'GLSL': env.Builder(action=methods.build_glsl_headers, suffix='glsl.h', src_suffix='.glsl')})
+    env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.h', src_suffix='.glsl')})

+ 18 - 18
platform/iphone/SCsub

@@ -4,33 +4,33 @@ Import('env')
 
 
 iphone_lib = [
 iphone_lib = [
 
 
-	'os_iphone.cpp',
-	#'rasterizer_iphone.cpp',
-	'audio_driver_iphone.cpp',
-	'sem_iphone.cpp',
-	'gl_view.mm',
-	'main.m',
-	'app_delegate.mm',
-	'view_controller.mm',
-	'game_center.mm',
-	'in_app_store.mm',
-	'icloud.mm',
-	#'Appirater.m',
-	'ios.mm',
+    'os_iphone.cpp',
+    #'rasterizer_iphone.cpp',
+    'audio_driver_iphone.cpp',
+    'sem_iphone.cpp',
+    'gl_view.mm',
+    'main.m',
+    'app_delegate.mm',
+    'view_controller.mm',
+    'game_center.mm',
+    'in_app_store.mm',
+    'icloud.mm',
+    #'Appirater.m',
+    'ios.mm',
 ]
 ]
 
 
-#env.Depends('#core/math/vector3.h', 'vector3_psp.h')
+# env.Depends('#core/math/vector3.h', 'vector3_psp.h')
 
 
 #iphone_lib = env.Library('iphone', iphone_lib)
 #iphone_lib = env.Library('iphone', iphone_lib)
 
 
-env_ios = env.Clone();
+env_ios = env.Clone()
 
 
 
 
 if env['ios_gles22_override'] == "yes":
 if env['ios_gles22_override'] == "yes":
-	env_ios.Append(CPPFLAGS=['-DGLES2_OVERRIDE'])
+    env_ios.Append(CPPFLAGS=['-DGLES2_OVERRIDE'])
 
 
 
 
-#if env['ios_appirater'] == "yes":
+# if env['ios_appirater'] == "yes":
 #	env_ios.Append(CPPFLAGS=['-DAPPIRATER_ENABLED'])
 #	env_ios.Append(CPPFLAGS=['-DAPPIRATER_ENABLED'])
 
 
 
 
@@ -38,5 +38,5 @@ obj = env_ios.Object('godot_iphone.cpp')
 
 
 prog = None
 prog = None
 prog = env_ios.Program('#bin/godot', [obj] + iphone_lib)
 prog = env_ios.Program('#bin/godot', [obj] + iphone_lib)
-action = "$IPHONEPATH/usr/bin/dsymutil "+File(prog)[0].path+" -o " + File(prog)[0].path + ".dSYM"
+action = "$IPHONEPATH/usr/bin/dsymutil " + File(prog)[0].path + " -o " + File(prog)[0].path + ".dSYM"
 env.AddPostAction(prog, action)
 env.AddPostAction(prog, action)

+ 171 - 168
platform/iphone/detect.py

@@ -3,187 +3,190 @@ import sys
 
 
 
 
 def is_active():
 def is_active():
-	return True
+    return True
+
 
 
 def get_name():
 def get_name():
-	return "iOS"
+    return "iOS"
+
 
 
 def can_build():
 def can_build():
 
 
-	import sys
-	import os
-	if sys.platform == 'darwin' or os.environ.has_key("OSXCROSS_IOS"):
-		return True
+    import sys
+    import os
+    if sys.platform == 'darwin' or os.environ.has_key("OSXCROSS_IOS"):
+        return True
+
+    return False
 
 
-	return False
 
 
 def get_opts():
 def get_opts():
 
 
-	return [
-		('IPHONEPLATFORM', 'name of the iphone platform', 'iPhoneOS'),
-		('IPHONEPATH', 'the path to iphone toolchain', '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain'),
-		('IPHONESDK', 'path to the iphone SDK', '/Applications/Xcode.app/Contents/Developer/Platforms/${IPHONEPLATFORM}.platform/Developer/SDKs/${IPHONEPLATFORM}.sdk/'),
-		('game_center', 'Support for game center', 'yes'),
-		('store_kit', 'Support for in-app store', 'yes'),
-		('icloud', 'Support for iCloud', 'yes'),
-		('ios_gles22_override', 'Force GLES2.0 on iOS', 'yes'),
-		('ios_appirater', 'Enable Appirater', 'no'),
-		('ios_exceptions', 'Use exceptions when compiling on playbook', 'yes'),
-		('ios_triple', 'Triple for ios toolchain', ''),
-		('ios_sim', 'Build simulator binary', 'no'),
-	]
+    return [
+        ('IPHONEPLATFORM', 'name of the iphone platform', 'iPhoneOS'),
+        ('IPHONEPATH', 'the path to iphone toolchain', '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain'),
+        ('IPHONESDK', 'path to the iphone SDK', '/Applications/Xcode.app/Contents/Developer/Platforms/${IPHONEPLATFORM}.platform/Developer/SDKs/${IPHONEPLATFORM}.sdk/'),
+        ('game_center', 'Support for game center', 'yes'),
+        ('store_kit', 'Support for in-app store', 'yes'),
+        ('icloud', 'Support for iCloud', 'yes'),
+        ('ios_gles22_override', 'Force GLES2.0 on iOS', 'yes'),
+        ('ios_appirater', 'Enable Appirater', 'no'),
+        ('ios_exceptions', 'Use exceptions when compiling on playbook', 'yes'),
+        ('ios_triple', 'Triple for ios toolchain', ''),
+        ('ios_sim', 'Build simulator binary', 'no'),
+    ]
 
 
-def get_flags():
 
 
-	return [
-		('tools', 'no'),
-		('webp', 'yes'),
-		('builtin_zlib', 'yes'),
-		('openssl','builtin'), #use builtin openssl
-	]
+def get_flags():
 
 
+    return [
+        ('tools', 'no'),
+        ('webp', 'yes'),
+        ('builtin_zlib', 'yes'),
+        ('openssl', 'builtin'),  # use builtin openssl
+    ]
 
 
 
 
 def configure(env):
 def configure(env):
 
 
-	env.Append(CPPPATH=['#platform/iphone'])
-
-	env['ENV']['PATH'] = env['IPHONEPATH']+"/Developer/usr/bin/:"+env['ENV']['PATH']
-
-	env['CC'] = '$IPHONEPATH/usr/bin/${ios_triple}clang'
-	env['CXX'] = '$IPHONEPATH/usr/bin/${ios_triple}clang++'
-	env['AR'] = '$IPHONEPATH/usr/bin/${ios_triple}ar'
-	env['RANLIB'] = '$IPHONEPATH/usr/bin/${ios_triple}ranlib'
-
-	import string
-	if (env["ios_sim"]=="yes" or env["arch"] == "x86"): # i386, simulator
-		env["arch"]="x86"
-		env["bits"]="32"
-		env['CCFLAGS'] = string.split('-arch i386 -fobjc-abi-version=2 -fobjc-legacy-dispatch -fmessage-length=0 -fpascal-strings -fasm-blocks  -Wall -D__IPHONE_OS_VERSION_MIN_REQUIRED=40100 -isysroot $IPHONESDK -mios-simulator-version-min=4.3 -DCUSTOM_MATRIX_TRANSFORM_H=\\\"build/iphone/matrix4_iphone.h\\\" -DCUSTOM_VECTOR3_TRANSFORM_H=\\\"build/iphone/vector3_iphone.h\\\"')
-	elif (env["arch"]=="arm64"): # arm64
-		env["bits"] = "64"
-		env['CCFLAGS'] = string.split('-fno-objc-arc -arch arm64 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -fvisibility=hidden -Wno-sign-conversion -MMD -MT dependencies -miphoneos-version-min=5.1.1 -isysroot $IPHONESDK')
-		env.Append(CPPFLAGS=['-DNEED_LONG_INT'])
-		env.Append(CPPFLAGS=['-DLIBYUV_DISABLE_NEON'])
-	else: # armv7
-		env["arch"] = "arm"
-		env["bits"] = "32"
-		env['CCFLAGS'] = string.split('-fno-objc-arc -arch armv7 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -fvisibility=hidden -Wno-sign-conversion -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=5.1.1 -MMD -MT dependencies -isysroot $IPHONESDK')
-
-	if (env["arch"]=="x86"):
-		env['IPHONEPLATFORM'] = 'iPhoneSimulator'
-		env.Append(LINKFLAGS=['-arch', 'i386', '-mios-simulator-version-min=4.3',
-							'-isysroot', '$IPHONESDK',
-							#'-mmacosx-version-min=10.6',
-							'-Xlinker',
-							'-objc_abi_version',
-							'-Xlinker', '2',
-							'-framework', 'AudioToolbox',
-							'-framework', 'AVFoundation',
-							'-framework', 'CoreAudio',
-							'-framework', 'CoreGraphics',
-							'-framework', 'CoreMedia',
-							'-framework', 'Foundation',
-							'-framework', 'Security',
-							'-framework', 'UIKit',
-							'-framework', 'MediaPlayer',
-							'-framework', 'OpenGLES',
-							'-framework', 'QuartzCore',
-							'-framework', 'SystemConfiguration',
-							'-F$IPHONESDK',
-							])
-	elif (env["arch"]=="arm64"):
-		env.Append(LINKFLAGS=['-arch', 'arm64', '-Wl,-dead_strip', '-miphoneos-version-min=5.1.1',
-							'-isysroot', '$IPHONESDK',
-							#'-stdlib=libc++',
-							'-framework', 'Foundation',
-							'-framework', 'UIKit',
-							'-framework', 'CoreGraphics',
-							'-framework', 'OpenGLES',
-							'-framework', 'QuartzCore',
-							'-framework', 'CoreAudio',
-							'-framework', 'AudioToolbox',
-							'-framework', 'SystemConfiguration',
-							'-framework', 'Security',
-							#'-framework', 'AdSupport',
-							'-framework', 'MediaPlayer',
-							'-framework', 'AVFoundation',
-							'-framework', 'CoreMedia',
-							])
-	else:
-		env.Append(LINKFLAGS=['-arch', 'armv7', '-Wl,-dead_strip', '-miphoneos-version-min=5.1.1',
-							'-isysroot', '$IPHONESDK',
-							'-framework', 'Foundation',
-							'-framework', 'UIKit',
-							'-framework', 'CoreGraphics',
-							'-framework', 'OpenGLES',
-							'-framework', 'QuartzCore',
-							'-framework', 'CoreAudio',
-							'-framework', 'AudioToolbox',
-							'-framework', 'SystemConfiguration',
-							'-framework', 'Security',
-							#'-framework', 'AdSupport',
-							'-framework', 'MediaPlayer',
-							'-framework', 'AVFoundation',
-							'-framework', 'CoreMedia',
-							])
-
-	if env['game_center'] == 'yes':
-		env.Append(CPPFLAGS=['-fblocks', '-DGAME_CENTER_ENABLED'])
-		env.Append(LINKFLAGS=['-framework', 'GameKit'])
-
-	if env['store_kit'] == 'yes':
-		env.Append(CPPFLAGS=['-DSTOREKIT_ENABLED'])
-		env.Append(LINKFLAGS=['-framework', 'StoreKit'])
-
-	if env['icloud'] == 'yes':
-		env.Append(CPPFLAGS=['-DICLOUD_ENABLED'])
-
-	env.Append(CPPPATH = ['$IPHONESDK/usr/include', '$IPHONESDK/System/Library/Frameworks/OpenGLES.framework/Headers', '$IPHONESDK/System/Library/Frameworks/AudioUnit.framework/Headers'])
-
-	if (env["target"]=="release"):
-
-		env.Append(CCFLAGS=['-O3', '-DNS_BLOCK_ASSERTIONS=1','-Wall', '-gdwarf-2']) # removed -ffast-math
-		env.Append(LINKFLAGS=['-O3']) #
-
-	elif env["target"] == "release_debug":
-		env.Append(CCFLAGS=['-Os', '-DNS_BLOCK_ASSERTIONS=1','-Wall','-DDEBUG_ENABLED'])
-		env.Append(LINKFLAGS=['-Os'])
-		env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ENABLED'])
-
-	elif (env["target"]=="debug"):
-
-		env.Append(CCFLAGS=['-D_DEBUG', '-DDEBUG=1', '-gdwarf-2', '-Wall', '-O0', '-DDEBUG_ENABLED'])
-		env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ENABLED'])
-
-	elif (env["target"]=="profile"):
-
-		env.Append(CCFLAGS=['-g','-pg', '-Os'])
-		env.Append(LINKFLAGS=['-pg'])
-
-	if (env["ios_sim"]=="yes"): #TODO: Check if needed?
-		env['ENV']['MACOSX_DEPLOYMENT_TARGET'] = '10.6'
-	env['ENV']['CODESIGN_ALLOCATE'] = '/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate'
-	env.Append(CPPFLAGS=['-DIPHONE_ENABLED', '-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DMPC_FIXED_POINT'])
-
-	# TODO: Move that to opus module's config
-	if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"):
-		env.opus_fixed_point="yes"
-		if env["arch"]=="x86":
-			pass
-		elif(env["arch"]=="arm64"):
-			env.Append(CFLAGS=["-DOPUS_ARM64_OPT"])
-		else:
-			env.Append(CFLAGS=["-DOPUS_ARM_OPT"])
-
-	if env['ios_exceptions'] == 'yes':
-		env.Append(CPPFLAGS=['-fexceptions'])
-	else:
-		env.Append(CPPFLAGS=['-fno-exceptions'])
-	#env['neon_enabled']=True
-	env['S_compiler'] = '$IPHONEPATH/Developer/usr/bin/gcc'
-
-	import methods
-	env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
-	env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
-	env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
+    env.Append(CPPPATH=['#platform/iphone'])
+
+    env['ENV']['PATH'] = env['IPHONEPATH'] + "/Developer/usr/bin/:" + env['ENV']['PATH']
+
+    env['CC'] = '$IPHONEPATH/usr/bin/${ios_triple}clang'
+    env['CXX'] = '$IPHONEPATH/usr/bin/${ios_triple}clang++'
+    env['AR'] = '$IPHONEPATH/usr/bin/${ios_triple}ar'
+    env['RANLIB'] = '$IPHONEPATH/usr/bin/${ios_triple}ranlib'
+
+    import string
+    if (env["ios_sim"] == "yes" or env["arch"] == "x86"):  # i386, simulator
+        env["arch"] = "x86"
+        env["bits"] = "32"
+        env['CCFLAGS'] = string.split('-arch i386 -fobjc-abi-version=2 -fobjc-legacy-dispatch -fmessage-length=0 -fpascal-strings -fasm-blocks  -Wall -D__IPHONE_OS_VERSION_MIN_REQUIRED=40100 -isysroot $IPHONESDK -mios-simulator-version-min=4.3 -DCUSTOM_MATRIX_TRANSFORM_H=\\\"build/iphone/matrix4_iphone.h\\\" -DCUSTOM_VECTOR3_TRANSFORM_H=\\\"build/iphone/vector3_iphone.h\\\"')
+    elif (env["arch"] == "arm64"):  # arm64
+        env["bits"] = "64"
+        env['CCFLAGS'] = string.split('-fno-objc-arc -arch arm64 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -fvisibility=hidden -Wno-sign-conversion -MMD -MT dependencies -miphoneos-version-min=5.1.1 -isysroot $IPHONESDK')
+        env.Append(CPPFLAGS=['-DNEED_LONG_INT'])
+        env.Append(CPPFLAGS=['-DLIBYUV_DISABLE_NEON'])
+    else:  # armv7
+        env["arch"] = "arm"
+        env["bits"] = "32"
+        env['CCFLAGS'] = string.split('-fno-objc-arc -arch armv7 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -fvisibility=hidden -Wno-sign-conversion -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=5.1.1 -MMD -MT dependencies -isysroot $IPHONESDK')
+
+    if (env["arch"] == "x86"):
+        env['IPHONEPLATFORM'] = 'iPhoneSimulator'
+        env.Append(LINKFLAGS=['-arch', 'i386', '-mios-simulator-version-min=4.3',
+                              '-isysroot', '$IPHONESDK',
+                              #'-mmacosx-version-min=10.6',
+                              '-Xlinker',
+                              '-objc_abi_version',
+                              '-Xlinker', '2',
+                              '-framework', 'AudioToolbox',
+                              '-framework', 'AVFoundation',
+                              '-framework', 'CoreAudio',
+                              '-framework', 'CoreGraphics',
+                              '-framework', 'CoreMedia',
+                              '-framework', 'Foundation',
+                              '-framework', 'Security',
+                              '-framework', 'UIKit',
+                              '-framework', 'MediaPlayer',
+                              '-framework', 'OpenGLES',
+                              '-framework', 'QuartzCore',
+                              '-framework', 'SystemConfiguration',
+                              '-F$IPHONESDK',
+                              ])
+    elif (env["arch"] == "arm64"):
+        env.Append(LINKFLAGS=['-arch', 'arm64', '-Wl,-dead_strip', '-miphoneos-version-min=5.1.1',
+                                                '-isysroot', '$IPHONESDK',
+                                                #'-stdlib=libc++',
+                                                '-framework', 'Foundation',
+                                                '-framework', 'UIKit',
+                                                '-framework', 'CoreGraphics',
+                                                '-framework', 'OpenGLES',
+                                                '-framework', 'QuartzCore',
+                                                '-framework', 'CoreAudio',
+                                                '-framework', 'AudioToolbox',
+                                                '-framework', 'SystemConfiguration',
+                                                '-framework', 'Security',
+                                                #'-framework', 'AdSupport',
+                                                '-framework', 'MediaPlayer',
+                                                '-framework', 'AVFoundation',
+                                                '-framework', 'CoreMedia',
+                              ])
+    else:
+        env.Append(LINKFLAGS=['-arch', 'armv7', '-Wl,-dead_strip', '-miphoneos-version-min=5.1.1',
+                                                '-isysroot', '$IPHONESDK',
+                                                '-framework', 'Foundation',
+                                                '-framework', 'UIKit',
+                                                '-framework', 'CoreGraphics',
+                                                '-framework', 'OpenGLES',
+                                                '-framework', 'QuartzCore',
+                                                '-framework', 'CoreAudio',
+                                                '-framework', 'AudioToolbox',
+                                                '-framework', 'SystemConfiguration',
+                                                '-framework', 'Security',
+                                                #'-framework', 'AdSupport',
+                                                '-framework', 'MediaPlayer',
+                                                '-framework', 'AVFoundation',
+                                                '-framework', 'CoreMedia',
+                              ])
+
+    if env['game_center'] == 'yes':
+        env.Append(CPPFLAGS=['-fblocks', '-DGAME_CENTER_ENABLED'])
+        env.Append(LINKFLAGS=['-framework', 'GameKit'])
+
+    if env['store_kit'] == 'yes':
+        env.Append(CPPFLAGS=['-DSTOREKIT_ENABLED'])
+        env.Append(LINKFLAGS=['-framework', 'StoreKit'])
+
+    if env['icloud'] == 'yes':
+        env.Append(CPPFLAGS=['-DICLOUD_ENABLED'])
+
+    env.Append(CPPPATH=['$IPHONESDK/usr/include', '$IPHONESDK/System/Library/Frameworks/OpenGLES.framework/Headers', '$IPHONESDK/System/Library/Frameworks/AudioUnit.framework/Headers'])
+
+    if (env["target"] == "release"):
+
+        env.Append(CCFLAGS=['-O3', '-DNS_BLOCK_ASSERTIONS=1', '-Wall', '-gdwarf-2'])  # removed -ffast-math
+        env.Append(LINKFLAGS=['-O3'])
+
+    elif env["target"] == "release_debug":
+        env.Append(CCFLAGS=['-Os', '-DNS_BLOCK_ASSERTIONS=1', '-Wall', '-DDEBUG_ENABLED'])
+        env.Append(LINKFLAGS=['-Os'])
+        env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ENABLED'])
+
+    elif (env["target"] == "debug"):
+
+        env.Append(CCFLAGS=['-D_DEBUG', '-DDEBUG=1', '-gdwarf-2', '-Wall', '-O0', '-DDEBUG_ENABLED'])
+        env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ENABLED'])
+
+    elif (env["target"] == "profile"):
+
+        env.Append(CCFLAGS=['-g', '-pg', '-Os'])
+        env.Append(LINKFLAGS=['-pg'])
+
+    if (env["ios_sim"] == "yes"):  # TODO: Check if needed?
+        env['ENV']['MACOSX_DEPLOYMENT_TARGET'] = '10.6'
+    env['ENV']['CODESIGN_ALLOCATE'] = '/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate'
+    env.Append(CPPFLAGS=['-DIPHONE_ENABLED', '-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DMPC_FIXED_POINT'])
+
+    # TODO: Move that to opus module's config
+    if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"):
+        env.opus_fixed_point = "yes"
+        if env["arch"] == "x86":
+            pass
+        elif(env["arch"] == "arm64"):
+            env.Append(CFLAGS=["-DOPUS_ARM64_OPT"])
+        else:
+            env.Append(CFLAGS=["-DOPUS_ARM_OPT"])
+
+    if env['ios_exceptions'] == 'yes':
+        env.Append(CPPFLAGS=['-fexceptions'])
+    else:
+        env.Append(CPPFLAGS=['-fno-exceptions'])
+    # env['neon_enabled']=True
+    env['S_compiler'] = '$IPHONEPATH/Developer/usr/bin/gcc'
+
+    import methods
+    env.Append(BUILDERS={'GLSL120': env.Builder(action=methods.build_legacygl_headers, suffix='glsl.h', src_suffix='.glsl')})
+    env.Append(BUILDERS={'GLSL': env.Builder(action=methods.build_glsl_headers, suffix='glsl.h', src_suffix='.glsl')})
+    env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.h', src_suffix='.glsl')})

+ 20 - 20
platform/javascript/SCsub

@@ -3,35 +3,35 @@
 Import('env')
 Import('env')
 
 
 javascript_files = [
 javascript_files = [
-	"os_javascript.cpp",
-	"audio_driver_javascript.cpp",
-	"javascript_main.cpp",
-	"audio_server_javascript.cpp",
-	"javascript_eval.cpp"
+    "os_javascript.cpp",
+    "audio_driver_javascript.cpp",
+    "javascript_main.cpp",
+    "audio_server_javascript.cpp",
+    "javascript_eval.cpp"
 ]
 ]
 
 
 env_javascript = env.Clone()
 env_javascript = env.Clone()
 if env['target'] == "profile":
 if env['target'] == "profile":
-	env_javascript.Append(CPPFLAGS=['-DPROFILER_ENABLED'])
+    env_javascript.Append(CPPFLAGS=['-DPROFILER_ENABLED'])
 
 
-javascript_objects=[]
+javascript_objects = []
 for x in javascript_files:
 for x in javascript_files:
-	javascript_objects.append( env_javascript.Object( x ) )
+    javascript_objects.append(env_javascript.Object(x))
 
 
-env.Append(LINKFLAGS=["-s","EXPORTED_FUNCTIONS=\"['_main','_audio_server_mix_function','_main_after_fs_sync']\""])
-env.Append(LINKFLAGS=["--shell-file",'"platform/javascript/godot_shell.html"'])
+env.Append(LINKFLAGS=["-s", "EXPORTED_FUNCTIONS=\"['_main','_audio_server_mix_function','_main_after_fs_sync']\""])
+env.Append(LINKFLAGS=["--shell-file", '"platform/javascript/godot_shell.html"'])
 
 
-build = env.Program('#bin/godot',javascript_objects,PROGSUFFIX=env["PROGSUFFIX"]+".html")
+build = env.Program('#bin/godot', javascript_objects, PROGSUFFIX=env["PROGSUFFIX"] + ".html")
 
 
 def make_html_shell(target, source, env):
 def make_html_shell(target, source, env):
-	html_path = target[0].rstr()
-	assert html_path[:4] == 'bin/'
-	assert html_path[-5:] == '.html'
-	basename = html_path[4:-5]
-	with open(html_path, 'r+') as html_file:
-		fixed_html = html_file.read().replace('.html.mem', '.mem').replace(basename, '$GODOT_BASE')
-		html_file.seek(0)
-		html_file.truncate()
-		html_file.write(fixed_html)
+    html_path = target[0].rstr()
+    assert html_path[:4] == 'bin/'
+    assert html_path[-5:] == '.html'
+    basename = html_path[4:-5]
+    with open(html_path, 'r+') as html_file:
+        fixed_html = html_file.read().replace('.html.mem', '.mem').replace(basename, '$GODOT_BASE')
+        html_file.seek(0)
+        html_file.truncate()
+        html_file.write(fixed_html)
 
 
 env.AddPostAction(build, Action(make_html_shell, "Creating HTML shell file"))
 env.AddPostAction(build, Action(make_html_shell, "Creating HTML shell file"))

+ 73 - 69
platform/javascript/detect.py

@@ -2,104 +2,108 @@ import os
 import sys
 import sys
 import string
 import string
 
 
+
 def is_active():
 def is_active():
-	return True
+    return True
+
 
 
 def get_name():
 def get_name():
-	return "JavaScript"
+    return "JavaScript"
+
 
 
 def can_build():
 def can_build():
 
 
-	import os
-	if (not os.environ.has_key("EMSCRIPTEN_ROOT")):
-		return False
-	return True
+    import os
+    if (not os.environ.has_key("EMSCRIPTEN_ROOT")):
+        return False
+    return True
+
 
 
 def get_opts():
 def get_opts():
 
 
-	return [
-		['wasm','Compile to WebAssembly','no'],
-		['javascript_eval','Enable JavaScript eval interface','yes'],
-	]
+    return [
+        ['wasm', 'Compile to WebAssembly', 'no'],
+        ['javascript_eval', 'Enable JavaScript eval interface', 'yes'],
+    ]
 
 
-def get_flags():
 
 
-	return [
-		('tools', 'no'),
-		('builtin_zlib', 'yes'),
-		('module_etc1_enabled', 'no'),
-		('module_mpc_enabled', 'no'),
-		('module_theora_enabled', 'no'),
-	]
+def get_flags():
 
 
+    return [
+        ('tools', 'no'),
+        ('builtin_zlib', 'yes'),
+        ('module_etc1_enabled', 'no'),
+        ('module_mpc_enabled', 'no'),
+        ('module_theora_enabled', 'no'),
+    ]
 
 
 
 
 def configure(env):
 def configure(env):
-	env['ENV'] = os.environ;
-	env.use_windows_spawn_fix('javascript')
+    env['ENV'] = os.environ
+    env.use_windows_spawn_fix('javascript')
 
 
-	env.Append(CPPPATH=['#platform/javascript'])
+    env.Append(CPPPATH=['#platform/javascript'])
 
 
-	em_path=os.environ["EMSCRIPTEN_ROOT"]
+    em_path = os.environ["EMSCRIPTEN_ROOT"]
 
 
-	env['ENV']['PATH'] = em_path+":"+env['ENV']['PATH']
-	env['CC'] = em_path+'/emcc'
-	env['CXX'] = em_path+'/emcc'
-	#env['AR'] = em_path+"/emar"
-	env['AR'] = em_path+"/emcc"
-	env['ARFLAGS'] = "-o"
+    env['ENV']['PATH'] = em_path + ":" + env['ENV']['PATH']
+    env['CC'] = em_path + '/emcc'
+    env['CXX'] = em_path + '/emcc'
+    #env['AR'] = em_path+"/emar"
+    env['AR'] = em_path + "/emcc"
+    env['ARFLAGS'] = "-o"
 
 
 #	env['RANLIB'] = em_path+"/emranlib"
 #	env['RANLIB'] = em_path+"/emranlib"
-	env['RANLIB'] = em_path + "/emcc"
-	env['OBJSUFFIX'] = '.bc'
-	env['LIBSUFFIX'] = '.bc'
-	env['CCCOM'] = "$CC -o $TARGET $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES"
-	env['CXXCOM'] = "$CC -o $TARGET $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES"
+    env['RANLIB'] = em_path + "/emcc"
+    env['OBJSUFFIX'] = '.bc'
+    env['LIBSUFFIX'] = '.bc'
+    env['CCCOM'] = "$CC -o $TARGET $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES"
+    env['CXXCOM'] = "$CC -o $TARGET $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES"
 
 
 #	env.Append(LIBS=['c','m','stdc++','log','GLESv1_CM','GLESv2'])
 #	env.Append(LIBS=['c','m','stdc++','log','GLESv1_CM','GLESv2'])
 
 
 #	env["LINKFLAGS"]= string.split(" -g --sysroot="+ld_sysroot+" -Wl,--no-undefined -Wl,-z,noexecstack ")
 #	env["LINKFLAGS"]= string.split(" -g --sysroot="+ld_sysroot+" -Wl,--no-undefined -Wl,-z,noexecstack ")
 
 
-	if (env["target"]=="release"):
-		env.Append(CCFLAGS=['-O2'])
-	elif (env["target"]=="release_debug"):
-		env.Append(CCFLAGS=['-O2','-DDEBUG_ENABLED'])
-	elif (env["target"]=="debug"):
-		env.Append(CCFLAGS=['-D_DEBUG', '-Wall', '-O2', '-DDEBUG_ENABLED'])
-		#env.Append(CCFLAGS=['-D_DEBUG', '-Wall', '-g4', '-DDEBUG_ENABLED'])
-		env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC'])
-
-	# TODO: Move that to opus module's config
-	if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"):
-		env.opus_fixed_point = "yes"
-
-	env.Append(CPPFLAGS=["-fno-exceptions",'-DNO_SAFE_CAST','-fno-rtti'])
-	env.Append(CPPFLAGS=['-DJAVASCRIPT_ENABLED', '-DUNIX_ENABLED', '-DPTHREAD_NO_RENAME', '-DNO_FCNTL','-DMPC_FIXED_POINT','-DTYPED_METHOD_BIND','-DNO_THREADS'])
-	env.Append(CPPFLAGS=['-DGLES2_ENABLED'])
-	env.Append(CPPFLAGS=['-DGLES_NO_CLIENT_ARRAYS'])
-	env.Append(CPPFLAGS=['-s','FULL_ES2=1'])
+    if (env["target"] == "release"):
+        env.Append(CCFLAGS=['-O2'])
+    elif (env["target"] == "release_debug"):
+        env.Append(CCFLAGS=['-O2', '-DDEBUG_ENABLED'])
+    elif (env["target"] == "debug"):
+        env.Append(CCFLAGS=['-D_DEBUG', '-Wall', '-O2', '-DDEBUG_ENABLED'])
+        #env.Append(CCFLAGS=['-D_DEBUG', '-Wall', '-g4', '-DDEBUG_ENABLED'])
+        env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC'])
+
+    # TODO: Move that to opus module's config
+    if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"):
+        env.opus_fixed_point = "yes"
+
+    env.Append(CPPFLAGS=["-fno-exceptions", '-DNO_SAFE_CAST', '-fno-rtti'])
+    env.Append(CPPFLAGS=['-DJAVASCRIPT_ENABLED', '-DUNIX_ENABLED', '-DPTHREAD_NO_RENAME', '-DNO_FCNTL', '-DMPC_FIXED_POINT', '-DTYPED_METHOD_BIND', '-DNO_THREADS'])
+    env.Append(CPPFLAGS=['-DGLES2_ENABLED'])
+    env.Append(CPPFLAGS=['-DGLES_NO_CLIENT_ARRAYS'])
+    env.Append(CPPFLAGS=['-s', 'FULL_ES2=1'])
 #	env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED','-DMPC_FIXED_POINT'])
 #	env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED','-DMPC_FIXED_POINT'])
 
 
-	if env['wasm'] == 'yes':
-		env.Append(LINKFLAGS=['-s','BINARYEN=1'])
-		env.Append(LINKFLAGS=['-s','\'BINARYEN_METHOD="native-wasm"\''])
-		env["PROGSUFFIX"]+=".webassembly"
-	else:
-		env.Append(CPPFLAGS=['-s','ASM_JS=1'])
-		env.Append(LINKFLAGS=['-s','ASM_JS=1'])
+    if env['wasm'] == 'yes':
+        env.Append(LINKFLAGS=['-s', 'BINARYEN=1'])
+        env.Append(LINKFLAGS=['-s', '\'BINARYEN_METHOD="native-wasm"\''])
+        env["PROGSUFFIX"] += ".webassembly"
+    else:
+        env.Append(CPPFLAGS=['-s', 'ASM_JS=1'])
+        env.Append(LINKFLAGS=['-s', 'ASM_JS=1'])
 
 
-	if env['javascript_eval'] == 'yes':
-		env.Append(CPPFLAGS=['-DJAVASCRIPT_EVAL_ENABLED'])
+    if env['javascript_eval'] == 'yes':
+        env.Append(CPPFLAGS=['-DJAVASCRIPT_EVAL_ENABLED'])
 
 
-	env.Append(LINKFLAGS=['-O2'])
-	#env.Append(LINKFLAGS=['-g4'])
+    env.Append(LINKFLAGS=['-O2'])
+    # env.Append(LINKFLAGS=['-g4'])
 
 
-	#print "CCCOM is:", env.subst('$CCCOM')
-	#print "P: ", env['p'], " Platofrm: ", env['platform']
+    # print "CCCOM is:", env.subst('$CCCOM')
+    # print "P: ", env['p'], " Platofrm: ", env['platform']
 
 
-	import methods
+    import methods
 
 
-	env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
-	env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
-	env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
-	#env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )
+    env.Append(BUILDERS={'GLSL120': env.Builder(action=methods.build_legacygl_headers, suffix='glsl.h', src_suffix='.glsl')})
+    env.Append(BUILDERS={'GLSL': env.Builder(action=methods.build_glsl_headers, suffix='glsl.h', src_suffix='.glsl')})
+    env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.h', src_suffix='.glsl')})
+    #env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )

+ 9 - 9
platform/osx/SCsub

@@ -3,13 +3,13 @@
 Import('env')
 Import('env')
 
 
 files = [
 files = [
-	'os_osx.mm',
-	'godot_main_osx.mm',
-	'audio_driver_osx.cpp',
-	'sem_osx.cpp',
-#	'context_gl_osx.cpp',
-	'dir_access_osx.mm',
-	'joystick_osx.cpp',
-	]
+    'os_osx.mm',
+    'godot_main_osx.mm',
+    'audio_driver_osx.cpp',
+    'sem_osx.cpp',
+    #	'context_gl_osx.cpp',
+    'dir_access_osx.mm',
+    'joystick_osx.cpp',
+]
 
 
-env.Program('#bin/godot',files)
+env.Program('#bin/godot', files)

+ 62 - 64
platform/osx/detect.py

@@ -4,99 +4,97 @@ import sys
 
 
 
 
 def is_active():
 def is_active():
-	return True
+    return True
+
 
 
 def get_name():
 def get_name():
-	return "OSX"
+    return "OSX"
+
 
 
 def can_build():
 def can_build():
 
 
-	if (sys.platform == "darwin" or os.environ.has_key("OSXCROSS_ROOT")):
-		return True
+    if (sys.platform == "darwin" or os.environ.has_key("OSXCROSS_ROOT")):
+        return True
 
 
+    return False
 
 
-	return False
 
 
 def get_opts():
 def get_opts():
 
 
-	return [
-	    ('force_64_bits','Force 64 bits binary','no'),
-	    ('osxcross_sdk','OSXCross SDK version','darwin14'),
+    return [
+        ('force_64_bits', 'Force 64 bits binary', 'no'),
+        ('osxcross_sdk', 'OSXCross SDK version', 'darwin14'),
 
 
-	 ]
+    ]
 
 
-def get_flags():
 
 
-	return [
-	]
+def get_flags():
 
 
+    return [
+    ]
 
 
 
 
 def configure(env):
 def configure(env):
 
 
-	env.Append(CPPPATH=['#platform/osx'])
-
-	if (env["bits"]=="default"):
-	    env["bits"]="32"
-
-	if (env["target"]=="release"):
-
-		env.Append(CCFLAGS=['-O2','-ffast-math','-fomit-frame-pointer','-ftree-vectorize','-msse2'])
-
-	elif (env["target"]=="release_debug"):
+    env.Append(CPPPATH=['#platform/osx'])
 
 
-		env.Append(CCFLAGS=['-O2','-DDEBUG_ENABLED'])
+    if (env["bits"] == "default"):
+        env["bits"] = "32"
 
 
-	elif (env["target"]=="debug"):
+    if (env["target"] == "release"):
 
 
-		env.Append(CCFLAGS=['-g3', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
+        env.Append(CCFLAGS=['-O2', '-ffast-math', '-fomit-frame-pointer', '-ftree-vectorize', '-msse2'])
 
 
+    elif (env["target"] == "release_debug"):
 
 
+        env.Append(CCFLAGS=['-O2', '-DDEBUG_ENABLED'])
 
 
-	if (not os.environ.has_key("OSXCROSS_ROOT")):
-		#regular native build
-		if (env["bits"]=="64"):
-		    env.Append(CCFLAGS=['-arch', 'x86_64'])
-		    env.Append(LINKFLAGS=['-arch', 'x86_64'])
-		elif (env["bits"]=="32"):
-		    env.Append(CCFLAGS=['-arch', 'i386'])
-		    env.Append(LINKFLAGS=['-arch', 'i386'])
-		else:
-		    env.Append(CCFLAGS=['-arch', 'i386', '-arch', 'x86_64'])
-		    env.Append(LINKFLAGS=['-arch', 'i386', '-arch', 'x86_64'])
-	else:
-		#osxcross build
-		root=os.environ.get("OSXCROSS_ROOT",0)
-		if env["bits"]=="64":
-			basecmd=root+"/target/bin/x86_64-apple-"+env["osxcross_sdk"]+"-"
-		else:
-			basecmd=root+"/target/bin/i386-apple-"+env["osxcross_sdk"]+"-"
+    elif (env["target"] == "debug"):
 
 
+        env.Append(CCFLAGS=['-g3', '-Wall', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
 
 
-		env['CC'] = basecmd+"cc"
-		env['CXX'] = basecmd+"c++"
-		env['AR'] = basecmd+"ar"
-		env['RANLIB'] = basecmd+"ranlib"
-		env['AS'] = basecmd+"as"
+    if (not os.environ.has_key("OSXCROSS_ROOT")):
+        # regular native build
+        if (env["bits"] == "64"):
+            env.Append(CCFLAGS=['-arch', 'x86_64'])
+            env.Append(LINKFLAGS=['-arch', 'x86_64'])
+        elif (env["bits"] == "32"):
+            env.Append(CCFLAGS=['-arch', 'i386'])
+            env.Append(LINKFLAGS=['-arch', 'i386'])
+        else:
+            env.Append(CCFLAGS=['-arch', 'i386', '-arch', 'x86_64'])
+            env.Append(LINKFLAGS=['-arch', 'i386', '-arch', 'x86_64'])
+    else:
+        # osxcross build
+        root = os.environ.get("OSXCROSS_ROOT", 0)
+        if env["bits"] == "64":
+            basecmd = root + "/target/bin/x86_64-apple-" + env["osxcross_sdk"] + "-"
+        else:
+            basecmd = root + "/target/bin/i386-apple-" + env["osxcross_sdk"] + "-"
 
 
+        env['CC'] = basecmd + "cc"
+        env['CXX'] = basecmd + "c++"
+        env['AR'] = basecmd + "ar"
+        env['RANLIB'] = basecmd + "ranlib"
+        env['AS'] = basecmd + "as"
 
 
-	env.Append(CPPFLAGS=["-DAPPLE_STYLE_KEYS"])
-	env.Append(CPPFLAGS=['-DUNIX_ENABLED','-DGLES2_ENABLED','-DOSX_ENABLED'])
-	env.Append(LIBS=['pthread'])
-	#env.Append(CPPFLAGS=['-F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks', '-isysroot', '/Developer/SDKs/MacOSX10.4u.sdk', '-mmacosx-version-min=10.4'])
-	#env.Append(LINKFLAGS=['-mmacosx-version-min=10.4', '-isysroot', '/Developer/SDKs/MacOSX10.4u.sdk', '-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk'])
-	env.Append(LINKFLAGS=['-framework', 'Cocoa', '-framework', 'Carbon', '-framework', 'OpenGL', '-framework', 'AGL', '-framework', 'AudioUnit','-lz', '-framework', 'IOKit', '-framework', 'ForceFeedback'])
+    env.Append(CPPFLAGS=["-DAPPLE_STYLE_KEYS"])
+    env.Append(CPPFLAGS=['-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DOSX_ENABLED'])
+    env.Append(LIBS=['pthread'])
+    #env.Append(CPPFLAGS=['-F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks', '-isysroot', '/Developer/SDKs/MacOSX10.4u.sdk', '-mmacosx-version-min=10.4'])
+    #env.Append(LINKFLAGS=['-mmacosx-version-min=10.4', '-isysroot', '/Developer/SDKs/MacOSX10.4u.sdk', '-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk'])
+    env.Append(LINKFLAGS=['-framework', 'Cocoa', '-framework', 'Carbon', '-framework', 'OpenGL', '-framework', 'AGL', '-framework', 'AudioUnit', '-lz', '-framework', 'IOKit', '-framework', 'ForceFeedback'])
 
 
-	if (env["CXX"]=="clang++"):
-		env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
-		env["CC"]="clang"
-		env["LD"]="clang++"
+    if (env["CXX"] == "clang++"):
+        env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
+        env["CC"] = "clang"
+        env["LD"] = "clang++"
 
 
-	import methods
+    import methods
 
 
-	env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
-	env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
-	env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
-	#env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )
+    env.Append(BUILDERS={'GLSL120': env.Builder(action=methods.build_legacygl_headers, suffix='glsl.h', src_suffix='.glsl')})
+    env.Append(BUILDERS={'GLSL': env.Builder(action=methods.build_glsl_headers, suffix='glsl.h', src_suffix='.glsl')})
+    env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.h', src_suffix='.glsl')})
+    #env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )
 
 
-	env["x86_libtheora_opt_gcc"]=True
+    env["x86_libtheora_opt_gcc"] = True

+ 3 - 3
platform/server/SCsub

@@ -3,8 +3,8 @@
 Import('env')
 Import('env')
 
 
 
 
-common_server=[\
-	"os_server.cpp",\
+common_server = [\
+    "os_server.cpp",\
 ]
 ]
 
 
-env.Program('#bin/godot_server',['godot_server.cpp']+common_server)
+env.Program('#bin/godot_server', ['godot_server.cpp'] + common_server)

+ 41 - 42
platform/server/detect.py

@@ -4,73 +4,72 @@ import sys
 
 
 
 
 def is_active():
 def is_active():
-	return True
+    return True
+
 
 
 def get_name():
 def get_name():
-	return "Server"
+    return "Server"
 
 
 
 
 def can_build():
 def can_build():
 
 
-	if (os.name!="posix"):
-		return False
+    if (os.name != "posix"):
+        return False
+
+    return True  # enabled
 
 
-	return True # enabled
 
 
 def get_opts():
 def get_opts():
 
 
-	return [
-	('use_llvm','Use llvm compiler','no'),
-	('force_32_bits','Force 32 bits binary','no')
-	]
+    return [
+        ('use_llvm', 'Use llvm compiler', 'no'),
+        ('force_32_bits', 'Force 32 bits binary', 'no')
+    ]
 
 
-def get_flags():
 
 
-	return [
-	]
+def get_flags():
 
 
+    return [
+    ]
 
 
 
 
 def configure(env):
 def configure(env):
 
 
-	env.Append(CPPPATH=['#platform/server'])
-	if (env["use_llvm"]=="yes"):
-		env["CC"]="clang"
-		env["CXX"]="clang++"
-		env["LD"]="clang++"
-
-	is64=sys.maxsize > 2**32
-
-	if (env["bits"]=="default"):
-		if (is64):
-			env["bits"]="64"
-		else:
-			env["bits"]="32"
-
+    env.Append(CPPPATH=['#platform/server'])
+    if (env["use_llvm"] == "yes"):
+        env["CC"] = "clang"
+        env["CXX"] = "clang++"
+        env["LD"] = "clang++"
 
 
-	#if (env["tools"]=="no"):
-	#	#no tools suffix
-	#	env['OBJSUFFIX'] = ".nt"+env['OBJSUFFIX']
-	#	env['LIBSUFFIX'] = ".nt"+env['LIBSUFFIX']
+    is64 = sys.maxsize > 2**32
 
 
+    if (env["bits"] == "default"):
+        if (is64):
+            env["bits"] = "64"
+        else:
+            env["bits"] = "32"
 
 
-	if (env["target"]=="release"):
+    # if (env["tools"]=="no"):
+    #	#no tools suffix
+    #	env['OBJSUFFIX'] = ".nt"+env['OBJSUFFIX']
+    #	env['LIBSUFFIX'] = ".nt"+env['LIBSUFFIX']
 
 
-		env.Append(CCFLAGS=['-O2','-ffast-math','-fomit-frame-pointer'])
+    if (env["target"] == "release"):
 
 
-	elif (env["target"]=="release_debug"):
+        env.Append(CCFLAGS=['-O2', '-ffast-math', '-fomit-frame-pointer'])
 
 
-		env.Append(CCFLAGS=['-O2','-ffast-math','-DDEBUG_ENABLED'])
+    elif (env["target"] == "release_debug"):
 
 
-	elif (env["target"]=="debug"):
+        env.Append(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED'])
 
 
-		env.Append(CCFLAGS=['-g2', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
+    elif (env["target"] == "debug"):
 
 
-	env.Append(CPPFLAGS=['-DSERVER_ENABLED','-DUNIX_ENABLED'])
-	env.Append(LIBS=['pthread','z']) #TODO detect linux/BSD!
+        env.Append(CCFLAGS=['-g2', '-Wall', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
 
 
-	if (env["CXX"]=="clang++"):
-		env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
-		env["CC"]="clang"
-		env["LD"]="clang++"
+    env.Append(CPPFLAGS=['-DSERVER_ENABLED', '-DUNIX_ENABLED'])
+    env.Append(LIBS=['pthread', 'z'])  # TODO detect linux/BSD!
 
 
+    if (env["CXX"] == "clang++"):
+        env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
+        env["CC"] = "clang"
+        env["LD"] = "clang++"

+ 16 - 16
platform/windows/SCsub

@@ -3,27 +3,27 @@
 Import('env')
 Import('env')
 
 
 
 
-common_win=[
-	"context_gl_win.cpp",
-	"os_windows.cpp",
-	"ctxgl_procaddr.cpp",
-	"key_mapping_win.cpp",
-	"tcp_server_winsock.cpp",
-	"packet_peer_udp_winsock.cpp",
-	"stream_peer_winsock.cpp",
-	"joystick.cpp",
+common_win = [
+    "context_gl_win.cpp",
+    "os_windows.cpp",
+    "ctxgl_procaddr.cpp",
+    "key_mapping_win.cpp",
+    "tcp_server_winsock.cpp",
+    "packet_peer_udp_winsock.cpp",
+    "stream_peer_winsock.cpp",
+    "joystick.cpp",
 ]
 ]
 
 
-restarget="godot_res"+env["OBJSUFFIX"]
+restarget = "godot_res" + env["OBJSUFFIX"]
 
 
-obj = env.RES(restarget,'godot_res.rc')
+obj = env.RES(restarget, 'godot_res.rc')
 
 
 common_win.append(obj)
 common_win.append(obj)
 
 
-env.Program('#bin/godot',['godot_win.cpp']+common_win,PROGSUFFIX=env["PROGSUFFIX"])
+env.Program('#bin/godot', ['godot_win.cpp'] + common_win, PROGSUFFIX=env["PROGSUFFIX"])
 
 
 # Microsoft Visual Studio Project Generation
 # Microsoft Visual Studio Project Generation
-if (env['vsproj'])=="yes":
-	env.vs_srcs = env.vs_srcs + ["platform/windows/godot_win.cpp"]
-	for x in common_win:
-		env.vs_srcs = env.vs_srcs + ["platform/windows/" + str(x)]
+if (env['vsproj']) == "yes":
+    env.vs_srcs = env.vs_srcs + ["platform/windows/godot_win.cpp"]
+    for x in common_win:
+        env.vs_srcs = env.vs_srcs + ["platform/windows/" + str(x)]

+ 270 - 273
platform/windows/detect.py

@@ -85,7 +85,7 @@
 
 
 #####
 #####
 # TODO :
 # TODO :
-# 
+#
 #	- finish to cleanup this script to remove all the remains of previous hacks and workarounds
 #	- finish to cleanup this script to remove all the remains of previous hacks and workarounds
 #	- make it work with the Windows7 SDK that is supposed to enable 64bits compilation for MSVC2010-Express
 #	- make it work with the Windows7 SDK that is supposed to enable 64bits compilation for MSVC2010-Express
 #	- confirm it works well with other Visual Studio versions.
 #	- confirm it works well with other Visual Studio versions.
@@ -99,300 +99,297 @@ import sys
 
 
 import methods
 import methods
 
 
-def is_active():
-	return True
-
-def get_name():
-        return "Windows"
-
-def can_build():
-
-	if (os.name=="nt"):
-		#building natively on windows!
-		if ( os.getenv("VCINSTALLDIR") ):
-			return True
-		else:
-			print("\nMSVC not detected, attempting Mingw.")
-			mingw32 = ""
-			mingw64 = ""
-			if ( os.getenv("MINGW32_PREFIX") ) :
-				mingw32 = os.getenv("MINGW32_PREFIX")
-			if ( os.getenv("MINGW64_PREFIX") ) :
-				mingw64 = os.getenv("MINGW64_PREFIX")
-
-			test = "gcc --version > NUL 2>&1"
-			if os.system(test)!= 0 and os.system(mingw32+test)!=0 and os.system(mingw64+test)!=0 :
-				print("- could not detect gcc.")
-				print("Please, make sure a path to a Mingw /bin directory is accessible into the environment PATH.\n")
-				return False
-			else:
-				print("- gcc detected.")
-
-			return True
-
-	if (os.name=="posix"):
-
-		mingw = "i586-mingw32msvc-"
-		mingw64 = "x86_64-w64-mingw32-"
-		mingw32 = "i686-w64-mingw32-"
-
-		if (os.getenv("MINGW32_PREFIX")):
-			mingw32=os.getenv("MINGW32_PREFIX")
-			mingw = mingw32
-		if (os.getenv("MINGW64_PREFIX")):
-			mingw64=os.getenv("MINGW64_PREFIX")
-
-		test = "gcc --version &>/dev/null"
-		if (os.system(mingw+test) == 0 or os.system(mingw64+test) == 0 or os.system(mingw32+test) == 0):
-			return True
-
-	return False
-
-def get_opts():
-
-	mingw=""
-	mingw32=""
-	mingw64=""
-	if ( os.name == "posix" ):
-		mingw = "i586-mingw32msvc-"
-		mingw32 = "i686-w64-mingw32-"
-		mingw64 = "x86_64-w64-mingw32-"
-
-		if os.system(mingw32+"gcc --version &>/dev/null") != 0 :
-			mingw32 = mingw
-
-	if (os.getenv("MINGW32_PREFIX")):
-		mingw32=os.getenv("MINGW32_PREFIX")
-		mingw = mingw32
-	if (os.getenv("MINGW64_PREFIX")):
-		mingw64=os.getenv("MINGW64_PREFIX")
-
-
-	return [
-		('mingw_prefix','Mingw Prefix',mingw32),
-		('mingw_prefix_64','Mingw Prefix 64 bits',mingw64),
-	]
-
-def get_flags():
-
-	return [
-		('builtin_zlib', 'yes'),
-		('openssl','builtin'), #use builtin openssl
-	]
-
-def build_res_file( target, source, env ):
-
-	cmdbase = ""
-	if (env["bits"] == "32"):
-		cmdbase = env['mingw_prefix']
-	else:
-		cmdbase = env['mingw_prefix_64']
-	CPPPATH = env['CPPPATH']
-	cmdbase = cmdbase + 'windres --include-dir . '
-	import subprocess
-	for x in range(len(source)):
-		cmd = cmdbase + '-i ' + str(source[x]) + ' -o ' + str(target[x])
-		try:
-			out = subprocess.Popen(cmd,shell = True,stderr = subprocess.PIPE).communicate()
-			if len(out[1]):
-				return 1
-		except:
-			return 1
-	return 0
-
-def configure(env):
-
-	env.Append(CPPPATH=['#platform/windows'])
-	env['is_mingw']=False
-	if (os.name=="nt" and os.getenv("VCINSTALLDIR") ):
-		#build using visual studio
-		env['ENV']['TMP'] = os.environ['TMP']
-		env.Append(CPPPATH=['#platform/windows/include'])
-		env.Append(LIBPATH=['#platform/windows/lib'])
-
-
-		if (env["target"]=="release"):
-
-			env.Append(CCFLAGS=['/O2'])
-			env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS'])
-			env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup'])
-
-		elif (env["target"]=="release_debug"):
-
-			env.Append(CCFLAGS=['/O2','/DDEBUG_ENABLED'])
-			env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
-		elif (env["target"]=="debug_release"):
-
-			env.Append(CCFLAGS=['/Z7','/Od'])
-			env.Append(LINKFLAGS=['/DEBUG'])
-			env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS'])
-			env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup'])
-
-		elif (env["target"]=="debug"):
-
-			env.Append(CCFLAGS=['/Z7','/DDEBUG_ENABLED','/DDEBUG_MEMORY_ENABLED','/DD3D_DEBUG_INFO','/Od'])
-			env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
-			env.Append(LINKFLAGS=['/DEBUG'])
-
-
-		env.Append(CCFLAGS=['/MT','/Gd','/GR','/nologo'])
-		env.Append(CXXFLAGS=['/TP'])
-		env.Append(CPPFLAGS=['/DMSVC', '/GR', ])
-		env.Append(CCFLAGS=['/I'+os.getenv("WindowsSdkDir")+"/Include"])
-		env.Append(CCFLAGS=['/DWINDOWS_ENABLED'])
-		env.Append(CCFLAGS=['/DRTAUDIO_ENABLED'])
-		env.Append(CCFLAGS=['/DWIN32'])
-		env.Append(CCFLAGS=['/DTYPED_METHOD_BIND'])
-
-		env.Append(CCFLAGS=['/DGLES2_ENABLED'])
-		LIBS=['winmm','opengl32','dsound','kernel32','ole32','oleaut32','user32','gdi32', 'IPHLPAPI','Shlwapi', 'wsock32','Ws2_32', 'shell32','advapi32','dinput8','dxguid']
-		env.Append(LINKFLAGS=[p+env["LIBSUFFIX"] for p in LIBS])
-
-		env.Append(LIBPATH=[os.getenv("WindowsSdkDir")+"/Lib"])
-                if (os.getenv("DXSDK_DIR")):
-                        DIRECTX_PATH=os.getenv("DXSDK_DIR")
-                else:
-                        DIRECTX_PATH="C:/Program Files/Microsoft DirectX SDK (March 2009)"
 
 
-                if (os.getenv("VCINSTALLDIR")):
-                        VC_PATH=os.getenv("VCINSTALLDIR")
-                else:
-                        VC_PATH=""
-
-		env.Append(CCFLAGS=["/I" + p for p in os.getenv("INCLUDE").split(";")])
-		env.Append(LIBPATH=[p for p in os.getenv("LIB").split(";")])
-		env.Append(CCFLAGS=["/I"+DIRECTX_PATH+"/Include"])
-		env.Append(LIBPATH=[DIRECTX_PATH+"/Lib/x86"])
-		env['ENV'] = os.environ;
-
-		# This detection function needs the tools env (that is env['ENV'], not SCons's env), and that is why it's this far bellow in the code
-		compiler_version_str = methods.detect_visual_c_compiler_version(env['ENV'])
-
-		# Note: this detection/override code from here onward should be here instead of in SConstruct because it's platform and compiler specific (MSVC/Windows)
-		if(env["bits"] != "default"):
-                        print "Error: bits argument is disabled for MSVC"
-                        print ("Bits argument is not supported for MSVC compilation. Architecture depends on the Native/Cross Compile Tools Prompt/Developer Console (or Visual Studio settings)"
-                               +" that is being used to run SCons. As a consequence, bits argument is disabled. Run scons again without bits argument (example: scons p=windows) and SCons will attempt to detect what MSVC compiler"
-                               +" will be executed and inform you.")
-                        sys.exit()
-
-		# Forcing bits argument because MSVC does not have a flag to set this through SCons... it's different compilers (cl.exe's) called from the propper command prompt
-                # that decide the architecture that is build for. Scons can only detect the os.getenviron (because vsvarsall.bat sets a lot of stuff for cl.exe to work with)
-                env["bits"]="32"
-		env["x86_libtheora_opt_vc"]=True
-
-		print "Detected MSVC compiler: "+compiler_version_str
-		# If building for 64bit architecture, disable assembly optimisations for 32 bit builds (theora as of writting)... vc compiler for 64bit can not compile _asm
-		if(compiler_version_str == "amd64" or compiler_version_str == "x86_amd64"):
-                        env["bits"]="64"
-                        env["x86_libtheora_opt_vc"]=False
-                        print "Compiled program architecture will be a 64 bit executable (forcing bits=64)."
-                elif (compiler_version_str=="x86" or compiler_version_str == "amd64_x86"):
-                        print "Compiled program architecture will be a 32 bit executable. (forcing bits=32)."
-                else:
-                        print "Failed to detect MSVC compiler architecture version... Defaulting to 32bit executable settings (forcing bits=32). Compilation attempt will continue, but SCons can not detect for what architecture this build is compiled for. You should check your settings/compilation setup."
-		if env["bits"]=="64":
-			env.Append(CCFLAGS=['/D_WIN64'])
-
-		# Incremental linking fix
-		env['BUILDERS']['ProgramOriginal'] = env['BUILDERS']['Program']
-		env['BUILDERS']['Program'] = methods.precious_program
-
-	else:
-
-		# Workaround for MinGW. See:
-		# http://www.scons.org/wiki/LongCmdLinesOnWin32
-		env.use_windows_spawn_fix()
-
-		#build using mingw
-		if (os.name=="nt"):
-			env['ENV']['TMP'] = os.environ['TMP'] #way to go scons, you can be so stupid sometimes
-		else:
-			env["PROGSUFFIX"]=env["PROGSUFFIX"]+".exe" # for linux cross-compilation
-
-		mingw_prefix=""
-
-		if (env["bits"]=="default"):
-			env["bits"]="32"
-
-		if (env["bits"]=="32"):
-			env.Append(LINKFLAGS=['-static'])
-			env.Append(LINKFLAGS=['-static-libgcc'])
-			env.Append(LINKFLAGS=['-static-libstdc++'])
-			mingw_prefix=env["mingw_prefix"];
-		else:
-			env.Append(LINKFLAGS=['-static'])
-			mingw_prefix=env["mingw_prefix_64"];
-
-		nulstr=""
+def is_active():
+    return True
 
 
-		if (os.name=="posix"):
-		    nulstr=">/dev/null"
-		else:
-		    nulstr=">nul"
 
 
+def get_name():
+    return "Windows"
 
 
 
 
-		# if os.system(mingw_prefix+"gcc --version"+nulstr)!=0:
-			# #not really super consistent but..
-			# print("Can't find Windows compiler: "+mingw_prefix)
-			# sys.exit(255)
+def can_build():
 
 
-		if (env["target"]=="release"):
+    if (os.name == "nt"):
+        # building natively on windows!
+        if (os.getenv("VCINSTALLDIR")):
+            return True
+        else:
+            print("\nMSVC not detected, attempting Mingw.")
+            mingw32 = ""
+            mingw64 = ""
+            if (os.getenv("MINGW32_PREFIX")):
+                mingw32 = os.getenv("MINGW32_PREFIX")
+            if (os.getenv("MINGW64_PREFIX")):
+                mingw64 = os.getenv("MINGW64_PREFIX")
 
 
-			env.Append(CCFLAGS=['-msse2'])
+            test = "gcc --version > NUL 2>&1"
+            if os.system(test) != 0 and os.system(mingw32 + test) != 0 and os.system(mingw64 + test) != 0:
+                print("- could not detect gcc.")
+                print("Please, make sure a path to a Mingw /bin directory is accessible into the environment PATH.\n")
+                return False
+            else:
+                print("- gcc detected.")
 
 
-			if (env["bits"]=="64"):
-				env.Append(CCFLAGS=['-O3'])
-			else:
-				env.Append(CCFLAGS=['-O2'])
+            return True
 
 
-			env.Append(LINKFLAGS=['-Wl,--subsystem,windows'])
+    if (os.name == "posix"):
 
 
-		elif (env["target"]=="release_debug"):
+        mingw = "i586-mingw32msvc-"
+        mingw64 = "x86_64-w64-mingw32-"
+        mingw32 = "i686-w64-mingw32-"
 
 
-			env.Append(CCFLAGS=['-O2','-DDEBUG_ENABLED'])
+        if (os.getenv("MINGW32_PREFIX")):
+            mingw32 = os.getenv("MINGW32_PREFIX")
+            mingw = mingw32
+        if (os.getenv("MINGW64_PREFIX")):
+            mingw64 = os.getenv("MINGW64_PREFIX")
 
 
-		elif (env["target"]=="debug"):
+        test = "gcc --version &>/dev/null"
+        if (os.system(mingw + test) == 0 or os.system(mingw64 + test) == 0 or os.system(mingw32 + test) == 0):
+            return True
 
 
-			env.Append(CCFLAGS=['-g', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
+    return False
 
 
 
 
+def get_opts():
 
 
-		env["CC"]=mingw_prefix+"gcc"
-		env['AS']=mingw_prefix+"as"
-		env['CXX'] = mingw_prefix+"g++"
-		env['AR'] = mingw_prefix+"ar"
-		env['RANLIB'] = mingw_prefix+"ranlib"
-		env['LD'] = mingw_prefix+"g++"
-		env["x86_libtheora_opt_gcc"]=True
+    mingw = ""
+    mingw32 = ""
+    mingw64 = ""
+    if (os.name == "posix"):
+        mingw = "i586-mingw32msvc-"
+        mingw32 = "i686-w64-mingw32-"
+        mingw64 = "x86_64-w64-mingw32-"
 
 
-		#env['CC'] = "winegcc"
-		#env['CXX'] = "wineg++"
+        if os.system(mingw32 + "gcc --version &>/dev/null") != 0:
+            mingw32 = mingw
 
 
-		env.Append(CCFLAGS=['-DWINDOWS_ENABLED','-mwindows'])
-		env.Append(CPPFLAGS=['-DRTAUDIO_ENABLED'])
-		env.Append(CCFLAGS=['-DGLES2_ENABLED'])
-		env.Append(LIBS=['mingw32','opengl32', 'dsound', 'ole32', 'd3d9','winmm','gdi32','iphlpapi','shlwapi','wsock32','ws2_32','kernel32', 'oleaut32', 'dinput8', 'dxguid'])
+    if (os.getenv("MINGW32_PREFIX")):
+        mingw32 = os.getenv("MINGW32_PREFIX")
+        mingw = mingw32
+    if (os.getenv("MINGW64_PREFIX")):
+        mingw64 = os.getenv("MINGW64_PREFIX")
 
 
-		# if (env["bits"]=="32"):
-			# env.Append(LIBS=['gcc_s'])
-			# #--with-arch=i686
-			# env.Append(CPPFLAGS=['-march=i686'])
-			# env.Append(LINKFLAGS=['-march=i686'])
+    return [
+        ('mingw_prefix', 'Mingw Prefix', mingw32),
+        ('mingw_prefix_64', 'Mingw Prefix 64 bits', mingw64),
+    ]
 
 
 
 
+def get_flags():
 
 
+    return [
+        ('builtin_zlib', 'yes'),
+        ('openssl', 'builtin'),  # use builtin openssl
+    ]
+
+
+def build_res_file(target, source, env):
+
+    cmdbase = ""
+    if (env["bits"] == "32"):
+        cmdbase = env['mingw_prefix']
+    else:
+        cmdbase = env['mingw_prefix_64']
+    CPPPATH = env['CPPPATH']
+    cmdbase = cmdbase + 'windres --include-dir . '
+    import subprocess
+    for x in range(len(source)):
+        cmd = cmdbase + '-i ' + str(source[x]) + ' -o ' + str(target[x])
+        try:
+            out = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE).communicate()
+            if len(out[1]):
+                return 1
+        except:
+            return 1
+    return 0
 
 
-		#'d3dx9d'
-		env.Append(CPPFLAGS=['-DMINGW_ENABLED'])
-		#env.Append(LINKFLAGS=['-g'])
 
 
-		# resrc
-		env['is_mingw']=True
-		env.Append( BUILDERS = { 'RES' : env.Builder(action = build_res_file, suffix = '.o',src_suffix = '.rc') } )
+def configure(env):
 
 
-	env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
-	env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
-	env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )
-	env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
+    env.Append(CPPPATH=['#platform/windows'])
+    env['is_mingw'] = False
+    if (os.name == "nt" and os.getenv("VCINSTALLDIR")):
+        # build using visual studio
+        env['ENV']['TMP'] = os.environ['TMP']
+        env.Append(CPPPATH=['#platform/windows/include'])
+        env.Append(LIBPATH=['#platform/windows/lib'])
+
+        if (env["target"] == "release"):
+
+            env.Append(CCFLAGS=['/O2'])
+            env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS'])
+            env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup'])
+
+        elif (env["target"] == "release_debug"):
+
+            env.Append(CCFLAGS=['/O2', '/DDEBUG_ENABLED'])
+            env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
+        elif (env["target"] == "debug_release"):
+
+            env.Append(CCFLAGS=['/Z7', '/Od'])
+            env.Append(LINKFLAGS=['/DEBUG'])
+            env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS'])
+            env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup'])
+
+        elif (env["target"] == "debug"):
+
+            env.Append(CCFLAGS=['/Z7', '/DDEBUG_ENABLED', '/DDEBUG_MEMORY_ENABLED', '/DD3D_DEBUG_INFO', '/Od'])
+            env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
+            env.Append(LINKFLAGS=['/DEBUG'])
+
+        env.Append(CCFLAGS=['/MT', '/Gd', '/GR', '/nologo'])
+        env.Append(CXXFLAGS=['/TP'])
+        env.Append(CPPFLAGS=['/DMSVC', '/GR', ])
+        env.Append(CCFLAGS=['/I' + os.getenv("WindowsSdkDir") + "/Include"])
+        env.Append(CCFLAGS=['/DWINDOWS_ENABLED'])
+        env.Append(CCFLAGS=['/DRTAUDIO_ENABLED'])
+        env.Append(CCFLAGS=['/DWIN32'])
+        env.Append(CCFLAGS=['/DTYPED_METHOD_BIND'])
+
+        env.Append(CCFLAGS=['/DGLES2_ENABLED'])
+        LIBS = ['winmm', 'opengl32', 'dsound', 'kernel32', 'ole32', 'oleaut32', 'user32', 'gdi32', 'IPHLPAPI', 'Shlwapi', 'wsock32', 'Ws2_32', 'shell32', 'advapi32', 'dinput8', 'dxguid']
+        env.Append(LINKFLAGS=[p + env["LIBSUFFIX"] for p in LIBS])
+
+        env.Append(LIBPATH=[os.getenv("WindowsSdkDir") + "/Lib"])
+        if (os.getenv("DXSDK_DIR")):
+            DIRECTX_PATH = os.getenv("DXSDK_DIR")
+        else:
+            DIRECTX_PATH = "C:/Program Files/Microsoft DirectX SDK (March 2009)"
+
+        if (os.getenv("VCINSTALLDIR")):
+            VC_PATH = os.getenv("VCINSTALLDIR")
+        else:
+            VC_PATH = ""
+
+        env.Append(CCFLAGS=["/I" + p for p in os.getenv("INCLUDE").split(";")])
+        env.Append(LIBPATH=[p for p in os.getenv("LIB").split(";")])
+        env.Append(CCFLAGS=["/I" + DIRECTX_PATH + "/Include"])
+        env.Append(LIBPATH=[DIRECTX_PATH + "/Lib/x86"])
+        env['ENV'] = os.environ
+
+        # This detection function needs the tools env (that is env['ENV'], not SCons's env), and that is why it's this far bellow in the code
+        compiler_version_str = methods.detect_visual_c_compiler_version(env['ENV'])
+
+        # Note: this detection/override code from here onward should be here instead of in SConstruct because it's platform and compiler specific (MSVC/Windows)
+        if(env["bits"] != "default"):
+            print "Error: bits argument is disabled for MSVC"
+            print ("Bits argument is not supported for MSVC compilation. Architecture depends on the Native/Cross Compile Tools Prompt/Developer Console (or Visual Studio settings)"
+                   + " that is being used to run SCons. As a consequence, bits argument is disabled. Run scons again without bits argument (example: scons p=windows) and SCons will attempt to detect what MSVC compiler"
+                   + " will be executed and inform you.")
+            sys.exit()
+
+        # Forcing bits argument because MSVC does not have a flag to set this through SCons... it's different compilers (cl.exe's) called from the propper command prompt
+        # that decide the architecture that is build for. Scons can only detect the os.getenviron (because vsvarsall.bat sets a lot of stuff for cl.exe to work with)
+        env["bits"] = "32"
+        env["x86_libtheora_opt_vc"] = True
+
+        print "Detected MSVC compiler: " + compiler_version_str
+        # If building for 64bit architecture, disable assembly optimisations for 32 bit builds (theora as of writting)... vc compiler for 64bit can not compile _asm
+        if(compiler_version_str == "amd64" or compiler_version_str == "x86_amd64"):
+            env["bits"] = "64"
+            env["x86_libtheora_opt_vc"] = False
+            print "Compiled program architecture will be a 64 bit executable (forcing bits=64)."
+        elif (compiler_version_str == "x86" or compiler_version_str == "amd64_x86"):
+            print "Compiled program architecture will be a 32 bit executable. (forcing bits=32)."
+        else:
+            print "Failed to detect MSVC compiler architecture version... Defaulting to 32bit executable settings (forcing bits=32). Compilation attempt will continue, but SCons can not detect for what architecture this build is compiled for. You should check your settings/compilation setup."
+        if env["bits"] == "64":
+            env.Append(CCFLAGS=['/D_WIN64'])
+
+        # Incremental linking fix
+        env['BUILDERS']['ProgramOriginal'] = env['BUILDERS']['Program']
+        env['BUILDERS']['Program'] = methods.precious_program
+
+    else:
+
+        # Workaround for MinGW. See:
+        # http://www.scons.org/wiki/LongCmdLinesOnWin32
+        env.use_windows_spawn_fix()
+
+        # build using mingw
+        if (os.name == "nt"):
+            env['ENV']['TMP'] = os.environ['TMP']  # way to go scons, you can be so stupid sometimes
+        else:
+            env["PROGSUFFIX"] = env["PROGSUFFIX"] + ".exe"  # for linux cross-compilation
+
+        mingw_prefix = ""
+
+        if (env["bits"] == "default"):
+            env["bits"] = "32"
+
+        if (env["bits"] == "32"):
+            env.Append(LINKFLAGS=['-static'])
+            env.Append(LINKFLAGS=['-static-libgcc'])
+            env.Append(LINKFLAGS=['-static-libstdc++'])
+            mingw_prefix = env["mingw_prefix"]
+        else:
+            env.Append(LINKFLAGS=['-static'])
+            mingw_prefix = env["mingw_prefix_64"]
+
+        nulstr = ""
+
+        if (os.name == "posix"):
+            nulstr = ">/dev/null"
+        else:
+            nulstr = ">nul"
+
+        # if os.system(mingw_prefix+"gcc --version"+nulstr)!=0:
+            # #not really super consistent but..
+            # print("Can't find Windows compiler: "+mingw_prefix)
+            # sys.exit(255)
+
+        if (env["target"] == "release"):
+
+            env.Append(CCFLAGS=['-msse2'])
+
+            if (env["bits"] == "64"):
+                env.Append(CCFLAGS=['-O3'])
+            else:
+                env.Append(CCFLAGS=['-O2'])
+
+            env.Append(LINKFLAGS=['-Wl,--subsystem,windows'])
+
+        elif (env["target"] == "release_debug"):
+
+            env.Append(CCFLAGS=['-O2', '-DDEBUG_ENABLED'])
+
+        elif (env["target"] == "debug"):
+
+            env.Append(CCFLAGS=['-g', '-Wall', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
+
+        env["CC"] = mingw_prefix + "gcc"
+        env['AS'] = mingw_prefix + "as"
+        env['CXX'] = mingw_prefix + "g++"
+        env['AR'] = mingw_prefix + "ar"
+        env['RANLIB'] = mingw_prefix + "ranlib"
+        env['LD'] = mingw_prefix + "g++"
+        env["x86_libtheora_opt_gcc"] = True
+
+        #env['CC'] = "winegcc"
+        #env['CXX'] = "wineg++"
+
+        env.Append(CCFLAGS=['-DWINDOWS_ENABLED', '-mwindows'])
+        env.Append(CPPFLAGS=['-DRTAUDIO_ENABLED'])
+        env.Append(CCFLAGS=['-DGLES2_ENABLED'])
+        env.Append(LIBS=['mingw32', 'opengl32', 'dsound', 'ole32', 'd3d9', 'winmm', 'gdi32', 'iphlpapi', 'shlwapi', 'wsock32', 'ws2_32', 'kernel32', 'oleaut32', 'dinput8', 'dxguid'])
+
+        # if (env["bits"]=="32"):
+        # env.Append(LIBS=['gcc_s'])
+        # #--with-arch=i686
+        # env.Append(CPPFLAGS=['-march=i686'])
+        # env.Append(LINKFLAGS=['-march=i686'])
+
+        #'d3dx9d'
+        env.Append(CPPFLAGS=['-DMINGW_ENABLED'])
+        # env.Append(LINKFLAGS=['-g'])
+
+        # resrc
+        env['is_mingw'] = True
+        env.Append(BUILDERS={'RES': env.Builder(action=build_res_file, suffix='.o', src_suffix='.rc')})
+
+    env.Append(BUILDERS={'GLSL120': env.Builder(action=methods.build_legacygl_headers, suffix='glsl.h', src_suffix='.glsl')})
+    env.Append(BUILDERS={'GLSL': env.Builder(action=methods.build_glsl_headers, suffix='glsl.h', src_suffix='.glsl')})
+    env.Append(BUILDERS={'HLSL9': env.Builder(action=methods.build_hlsl_dx9_headers, suffix='hlsl.h', src_suffix='.hlsl')})
+    env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.h', src_suffix='.glsl')})

+ 11 - 11
platform/winrt/SCsub

@@ -3,21 +3,21 @@
 Import('env')
 Import('env')
 
 
 files = [
 files = [
-	'thread_winrt.cpp',
-	'#platform/windows/tcp_server_winsock.cpp',
-	'#platform/windows/packet_peer_udp_winsock.cpp',
-	'#platform/windows/stream_peer_winsock.cpp',
-	'#platform/windows/key_mapping_win.cpp',
-	'joystick_winrt.cpp',
-	'gl_context_egl.cpp',
-	'app.cpp',
-	'os_winrt.cpp',
+    'thread_winrt.cpp',
+    '#platform/windows/tcp_server_winsock.cpp',
+    '#platform/windows/packet_peer_udp_winsock.cpp',
+    '#platform/windows/stream_peer_winsock.cpp',
+    '#platform/windows/key_mapping_win.cpp',
+    'joystick_winrt.cpp',
+    'gl_context_egl.cpp',
+    'app.cpp',
+    'os_winrt.cpp',
 ]
 ]
 
 
 if "build_angle" in env and env["build_angle"]:
 if "build_angle" in env and env["build_angle"]:
-	cmd = env.AlwaysBuild(env.ANGLE('libANGLE.lib', None))
+    cmd = env.AlwaysBuild(env.ANGLE('libANGLE.lib', None))
 
 
 prog = env.Program('#bin/godot', files)
 prog = env.Program('#bin/godot', files)
 
 
 if "build_angle" in env and env["build_angle"]:
 if "build_angle" in env and env["build_angle"]:
-	env.Depends(prog, [cmd])
+    env.Depends(prog, [cmd])

+ 112 - 110
platform/winrt/detect.py

@@ -6,161 +6,163 @@ import methods
 
 
 
 
 def is_active():
 def is_active():
-	return True
+    return True
+
 
 
 def get_name():
 def get_name():
-		return "WinRT"
+    return "WinRT"
+
 
 
 def can_build():
 def can_build():
-	if (os.name=="nt"):
-		#building natively on windows!
-		if (os.getenv("VSINSTALLDIR")):
+    if (os.name == "nt"):
+        # building natively on windows!
+        if (os.getenv("VSINSTALLDIR")):
+
+            if (os.getenv("ANGLE_SRC_PATH") == None):
+                return False
 
 
-			if (os.getenv("ANGLE_SRC_PATH") == None):
-				return False
+            return True
+    return False
 
 
-			return True
-	return False
 
 
 def get_opts():
 def get_opts():
-	return []
+    return []
+
 
 
 def get_flags():
 def get_flags():
 
 
-	return [
-	('tools', 'no'),
-	('builtin_zlib', 'yes'),
-	('openssl', 'builtin'),
-	('xaudio2', 'yes'),
-	]
+    return [
+        ('tools', 'no'),
+        ('builtin_zlib', 'yes'),
+        ('openssl', 'builtin'),
+        ('xaudio2', 'yes'),
+    ]
 
 
 
 
 def configure(env):
 def configure(env):
 
 
-	if(env["bits"] != "default"):
-		print "Error: bits argument is disabled for MSVC"
-		print ("Bits argument is not supported for MSVC compilation. Architecture depends on the Native/Cross Compile Tools Prompt/Developer Console (or Visual Studio settings)"
-			   +" that is being used to run SCons. As a consequence, bits argument is disabled. Run scons again without bits argument (example: scons p=winrt) and SCons will attempt to detect what MSVC compiler"
-			   +" will be executed and inform you.")
-		sys.exit()
-
-	arch = ""
-	env['ENV'] = os.environ;
-
-	# ANGLE
-	angle_root = os.getenv("ANGLE_SRC_PATH")
-	env.Append(CPPPATH=[angle_root + '/include'])
-	jobs = str(env.GetOption("num_jobs"))
-	angle_build_cmd = "msbuild.exe " + angle_root + "/winrt/10/src/angle.sln /nologo /v:m /m:" + jobs + " /p:Configuration=Release /p:Platform="
+    if(env["bits"] != "default"):
+        print "Error: bits argument is disabled for MSVC"
+        print ("Bits argument is not supported for MSVC compilation. Architecture depends on the Native/Cross Compile Tools Prompt/Developer Console (or Visual Studio settings)"
+               + " that is being used to run SCons. As a consequence, bits argument is disabled. Run scons again without bits argument (example: scons p=winrt) and SCons will attempt to detect what MSVC compiler"
+               + " will be executed and inform you.")
+        sys.exit()
 
 
-	if os.path.isfile(str(os.getenv("ANGLE_SRC_PATH")) + "/winrt/10/src/angle.sln"):
-		env["build_angle"] = True
+    arch = ""
+    env['ENV'] = os.environ
 
 
-	if os.getenv('Platform') == "ARM":
+    # ANGLE
+    angle_root = os.getenv("ANGLE_SRC_PATH")
+    env.Append(CPPPATH=[angle_root + '/include'])
+    jobs = str(env.GetOption("num_jobs"))
+    angle_build_cmd = "msbuild.exe " + angle_root + "/winrt/10/src/angle.sln /nologo /v:m /m:" + jobs + " /p:Configuration=Release /p:Platform="
 
 
-		print "Compiled program architecture will be an ARM executable. (forcing bits=32)."
+    if os.path.isfile(str(os.getenv("ANGLE_SRC_PATH")) + "/winrt/10/src/angle.sln"):
+        env["build_angle"] = True
 
 
-		arch="arm"
-		env["bits"]="32"
-		env.Append(LINKFLAGS=['/MACHINE:ARM'])
-		env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/arm'])
+    if os.getenv('Platform') == "ARM":
 
 
-		angle_build_cmd += "ARM"
+        print "Compiled program architecture will be an ARM executable. (forcing bits=32)."
 
 
-		env.Append(LIBPATH=[angle_root + '/winrt/10/src/Release_ARM/lib'])
+        arch = "arm"
+        env["bits"] = "32"
+        env.Append(LINKFLAGS=['/MACHINE:ARM'])
+        env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/arm'])
 
 
-	else:
+        angle_build_cmd += "ARM"
 
 
-		compiler_version_str = methods.detect_visual_c_compiler_version(env['ENV'])
+        env.Append(LIBPATH=[angle_root + '/winrt/10/src/Release_ARM/lib'])
 
 
-		if(compiler_version_str == "amd64" or compiler_version_str == "x86_amd64"):
-			env["bits"]="64"
-			print "Compiled program architecture will be a x64 executable (forcing bits=64)."
-		elif (compiler_version_str=="x86" or compiler_version_str == "amd64_x86"):
-			env["bits"]="32"
-			print "Compiled program architecture will be a x86 executable. (forcing bits=32)."
-		else:
-			print "Failed to detect MSVC compiler architecture version... Defaulting to 32bit executable settings (forcing bits=32). Compilation attempt will continue, but SCons can not detect for what architecture this build is compiled for. You should check your settings/compilation setup."
-			env["bits"]="32"
+    else:
 
 
-		if (env["bits"] == "32"):
-			arch = "x86"
+        compiler_version_str = methods.detect_visual_c_compiler_version(env['ENV'])
 
 
-			angle_build_cmd += "Win32"
+        if(compiler_version_str == "amd64" or compiler_version_str == "x86_amd64"):
+            env["bits"] = "64"
+            print "Compiled program architecture will be a x64 executable (forcing bits=64)."
+        elif (compiler_version_str == "x86" or compiler_version_str == "amd64_x86"):
+            env["bits"] = "32"
+            print "Compiled program architecture will be a x86 executable. (forcing bits=32)."
+        else:
+            print "Failed to detect MSVC compiler architecture version... Defaulting to 32bit executable settings (forcing bits=32). Compilation attempt will continue, but SCons can not detect for what architecture this build is compiled for. You should check your settings/compilation setup."
+            env["bits"] = "32"
 
 
-			env.Append(CPPFLAGS=['/DPNG_ABORT=abort'])
-			env.Append(LINKFLAGS=['/MACHINE:X86'])
-			env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store'])
-			env.Append(LIBPATH=[angle_root + '/winrt/10/src/Release_Win32/lib'])
+        if (env["bits"] == "32"):
+            arch = "x86"
 
 
-		else:
-			arch = "x64"
+            angle_build_cmd += "Win32"
 
 
-			angle_build_cmd += "x64"
+            env.Append(CPPFLAGS=['/DPNG_ABORT=abort'])
+            env.Append(LINKFLAGS=['/MACHINE:X86'])
+            env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store'])
+            env.Append(LIBPATH=[angle_root + '/winrt/10/src/Release_Win32/lib'])
 
 
-			env.Append(LINKFLAGS=['/MACHINE:X64'])
-			env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/amd64'])
-			env.Append(LIBPATH=[angle_root + '/winrt/10/src/Release_x64/lib'])
+        else:
+            arch = "x64"
 
 
-	env.Append(CPPPATH=['#platform/winrt','#drivers/windows'])
-	env.Append(LINKFLAGS=['/MANIFEST:NO', '/NXCOMPAT', '/DYNAMICBASE', '/WINMD', '/APPCONTAINER', '/ERRORREPORT:PROMPT', '/NOLOGO', '/TLBID:1', '/NODEFAULTLIB:"kernel32.lib"', '/NODEFAULTLIB:"ole32.lib"'])
-	env.Append(CPPFLAGS=['/D','__WRL_NO_DEFAULT_LIB__','/D','WIN32'])
-	env.Append(CPPFLAGS=['/FU', os.environ['VCINSTALLDIR'] + 'lib/store/references/platform.winmd'])
-	env.Append(CPPFLAGS=['/AI', os.environ['VCINSTALLDIR'] + 'lib/store/references'])
+            angle_build_cmd += "x64"
 
 
-	env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/references'])
+            env.Append(LINKFLAGS=['/MACHINE:X64'])
+            env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/amd64'])
+            env.Append(LIBPATH=[angle_root + '/winrt/10/src/Release_x64/lib'])
 
 
-	if (env["target"]=="release"):
+    env.Append(CPPPATH=['#platform/winrt', '#drivers/windows'])
+    env.Append(LINKFLAGS=['/MANIFEST:NO', '/NXCOMPAT', '/DYNAMICBASE', '/WINMD', '/APPCONTAINER', '/ERRORREPORT:PROMPT', '/NOLOGO', '/TLBID:1', '/NODEFAULTLIB:"kernel32.lib"', '/NODEFAULTLIB:"ole32.lib"'])
+    env.Append(CPPFLAGS=['/D', '__WRL_NO_DEFAULT_LIB__', '/D', 'WIN32'])
+    env.Append(CPPFLAGS=['/FU', os.environ['VCINSTALLDIR'] + 'lib/store/references/platform.winmd'])
+    env.Append(CPPFLAGS=['/AI', os.environ['VCINSTALLDIR'] + 'lib/store/references'])
 
 
-		env.Append(CPPFLAGS=['/O2', '/GL'])
-		env.Append(CPPFLAGS=['/MD'])
-		env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS', '/LTCG'])
+    env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/references'])
 
 
-	elif (env["target"]=="release_debug"):
+    if (env["target"] == "release"):
 
 
-		env.Append(CCFLAGS=['/O2','/Zi','/DDEBUG_ENABLED'])
-		env.Append(CPPFLAGS=['/MD'])
-		env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
+        env.Append(CPPFLAGS=['/O2', '/GL'])
+        env.Append(CPPFLAGS=['/MD'])
+        env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS', '/LTCG'])
 
 
-	elif (env["target"]=="debug"):
+    elif (env["target"] == "release_debug"):
 
 
-		env.Append(CCFLAGS=['/Zi','/DDEBUG_ENABLED','/DDEBUG_MEMORY_ENABLED'])
-		env.Append(CPPFLAGS=['/MDd'])
-		env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
-		env.Append(LINKFLAGS=['/DEBUG'])
+        env.Append(CCFLAGS=['/O2', '/Zi', '/DDEBUG_ENABLED'])
+        env.Append(CPPFLAGS=['/MD'])
+        env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
 
 
+    elif (env["target"] == "debug"):
 
 
-	env.Append(CCFLAGS=string.split('/FS /MP /GS /wd"4453" /wd"28204" /wd"4291" /Zc:wchar_t /Gm- /fp:precise /D "_UNICODE" /D "UNICODE" /D "WINAPI_FAMILY=WINAPI_FAMILY_APP" /errorReport:prompt /WX- /Zc:forScope /Gd /EHsc /nologo'))
-	env.Append(CXXFLAGS=string.split('/ZW /FS'))
-	env.Append(CCFLAGS=['/AI', os.environ['VCINSTALLDIR']+'\\vcpackages', '/AI', os.environ['WINDOWSSDKDIR']+'\\References\\CommonConfiguration\\Neutral'])
+        env.Append(CCFLAGS=['/Zi', '/DDEBUG_ENABLED', '/DDEBUG_MEMORY_ENABLED'])
+        env.Append(CPPFLAGS=['/MDd'])
+        env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
+        env.Append(LINKFLAGS=['/DEBUG'])
 
 
+    env.Append(CCFLAGS=string.split('/FS /MP /GS /wd"4453" /wd"28204" /wd"4291" /Zc:wchar_t /Gm- /fp:precise /D "_UNICODE" /D "UNICODE" /D "WINAPI_FAMILY=WINAPI_FAMILY_APP" /errorReport:prompt /WX- /Zc:forScope /Gd /EHsc /nologo'))
+    env.Append(CXXFLAGS=string.split('/ZW /FS'))
+    env.Append(CCFLAGS=['/AI', os.environ['VCINSTALLDIR'] + '\\vcpackages', '/AI', os.environ['WINDOWSSDKDIR'] + '\\References\\CommonConfiguration\\Neutral'])
 
 
-	env["PROGSUFFIX"]="."+arch+env["PROGSUFFIX"]
-	env["OBJSUFFIX"]="."+arch+env["OBJSUFFIX"]
-	env["LIBSUFFIX"]="."+arch+env["LIBSUFFIX"]
+    env["PROGSUFFIX"] = "." + arch + env["PROGSUFFIX"]
+    env["OBJSUFFIX"] = "." + arch + env["OBJSUFFIX"]
+    env["LIBSUFFIX"] = "." + arch + env["LIBSUFFIX"]
 
 
-	env.Append(CCFLAGS=['/DWINRT_ENABLED'])
-	env.Append(CCFLAGS=['/DWINDOWS_ENABLED'])
-	env.Append(CCFLAGS=['/DTYPED_METHOD_BIND'])
+    env.Append(CCFLAGS=['/DWINRT_ENABLED'])
+    env.Append(CCFLAGS=['/DWINDOWS_ENABLED'])
+    env.Append(CCFLAGS=['/DTYPED_METHOD_BIND'])
 
 
-	env.Append(CCFLAGS=['/DGLES2_ENABLED','/DGL_GLEXT_PROTOTYPES','/DEGL_EGLEXT_PROTOTYPES','/DANGLE_ENABLED'])
+    env.Append(CCFLAGS=['/DGLES2_ENABLED', '/DGL_GLEXT_PROTOTYPES', '/DEGL_EGLEXT_PROTOTYPES', '/DANGLE_ENABLED'])
 
 
-	LIBS = [
-		'WindowsApp',
-		'mincore',
-		'libANGLE',
-		'libEGL',
-		'libGLESv2',
-		]
-	env.Append(LINKFLAGS=[p+".lib" for p in LIBS])
+    LIBS = [
+        'WindowsApp',
+        'mincore',
+        'libANGLE',
+        'libEGL',
+        'libGLESv2',
+    ]
+    env.Append(LINKFLAGS=[p + ".lib" for p in LIBS])
 
 
-	# Incremental linking fix
-	env['BUILDERS']['ProgramOriginal'] = env['BUILDERS']['Program']
-	env['BUILDERS']['Program'] = methods.precious_program
+    # Incremental linking fix
+    env['BUILDERS']['ProgramOriginal'] = env['BUILDERS']['Program']
+    env['BUILDERS']['Program'] = methods.precious_program
 
 
-	env.Append( BUILDERS = { 'ANGLE' : env.Builder(action = angle_build_cmd) } )
+    env.Append(BUILDERS={'ANGLE': env.Builder(action=angle_build_cmd)})
 
 
-	env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
-	env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
-	env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )
-	env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
+    env.Append(BUILDERS={'GLSL120': env.Builder(action=methods.build_legacygl_headers, suffix='glsl.h', src_suffix='.glsl')})
+    env.Append(BUILDERS={'GLSL': env.Builder(action=methods.build_glsl_headers, suffix='glsl.h', src_suffix='.glsl')})
+    env.Append(BUILDERS={'HLSL9': env.Builder(action=methods.build_hlsl_dx9_headers, suffix='hlsl.h', src_suffix='.hlsl')})
+    env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.h', src_suffix='.glsl')})

+ 6 - 6
platform/x11/SCsub

@@ -3,11 +3,11 @@
 Import('env')
 Import('env')
 
 
 
 
-common_x11=[\
-	"context_gl_x11.cpp",\
-	"os_x11.cpp",\
-	"key_mapping_x11.cpp",\
-	"joystick_linux.cpp",\
+common_x11 = [\
+    "context_gl_x11.cpp",\
+    "os_x11.cpp",\
+    "key_mapping_x11.cpp",\
+    "joystick_linux.cpp",\
 ]
 ]
 
 
-env.Program('#bin/godot',['godot_x11.cpp']+common_x11)
+env.Program('#bin/godot', ['godot_x11.cpp'] + common_x11)

+ 190 - 194
platform/x11/detect.py

@@ -5,236 +5,232 @@ import platform
 
 
 
 
 def is_active():
 def is_active():
-	return True
+    return True
+
 
 
 def get_name():
 def get_name():
-        return "X11"
+    return "X11"
 
 
 
 
 def can_build():
 def can_build():
 
 
-	if (os.name!="posix"):
-		return False
+    if (os.name != "posix"):
+        return False
 
 
-	if sys.platform == "darwin":
-		return False # no x11 on mac for now
+    if sys.platform == "darwin":
+        return False  # no x11 on mac for now
 
 
-	errorval=os.system("pkg-config --version > /dev/null")
+    errorval = os.system("pkg-config --version > /dev/null")
 
 
-	if (errorval):
-		print("pkg-config not found.. x11 disabled.")
-		return False
+    if (errorval):
+        print("pkg-config not found.. x11 disabled.")
+        return False
 
 
-	x11_error=os.system("pkg-config x11 --modversion > /dev/null ")
-	if (x11_error):
-		print("X11 not found.. x11 disabled.")
-		return False
+    x11_error = os.system("pkg-config x11 --modversion > /dev/null ")
+    if (x11_error):
+        print("X11 not found.. x11 disabled.")
+        return False
 
 
-        ssl_error=os.system("pkg-config openssl --modversion > /dev/null ")
-        if (ssl_error):
-                print("OpenSSL not found.. x11 disabled.")
-                return False
+    ssl_error = os.system("pkg-config openssl --modversion > /dev/null ")
+    if (ssl_error):
+        print("OpenSSL not found.. x11 disabled.")
+        return False
 
 
-	x11_error=os.system("pkg-config xcursor --modversion > /dev/null ")
-	if (x11_error):
-		print("xcursor not found.. x11 disabled.")
-		return False
+    x11_error = os.system("pkg-config xcursor --modversion > /dev/null ")
+    if (x11_error):
+        print("xcursor not found.. x11 disabled.")
+        return False
 
 
-	x11_error=os.system("pkg-config xinerama --modversion > /dev/null ")
-	if (x11_error):
-		print("xinerama not found.. x11 disabled.")
-		return False
+    x11_error = os.system("pkg-config xinerama --modversion > /dev/null ")
+    if (x11_error):
+        print("xinerama not found.. x11 disabled.")
+        return False
 
 
-	x11_error=os.system("pkg-config xrandr --modversion > /dev/null ")
-	if (x11_error):
-			print("xrandr not found.. x11 disabled.")
-			return False
+    x11_error = os.system("pkg-config xrandr --modversion > /dev/null ")
+    if (x11_error):
+        print("xrandr not found.. x11 disabled.")
+        return False
 
 
+    return True  # X11 enabled
 
 
-	return True # X11 enabled
 
 
 def get_opts():
 def get_opts():
 
 
-	return [
-	('use_llvm','Use llvm compiler','no'),
-	('use_static_cpp','link stdc++ statically','no'),
-	('use_sanitizer','Use llvm compiler sanitize address','no'),
-	('use_leak_sanitizer','Use llvm compiler sanitize memory leaks','no'),
-	('pulseaudio','Detect & Use pulseaudio','yes'),
-	('udev','Use udev for gamepad connection callbacks','no'),
-	('debug_release', 'Add debug symbols to release version','no'),
-	]
+    return [
+        ('use_llvm', 'Use llvm compiler', 'no'),
+        ('use_static_cpp', 'link stdc++ statically', 'no'),
+        ('use_sanitizer', 'Use llvm compiler sanitize address', 'no'),
+        ('use_leak_sanitizer', 'Use llvm compiler sanitize memory leaks', 'no'),
+        ('pulseaudio', 'Detect & Use pulseaudio', 'yes'),
+        ('udev', 'Use udev for gamepad connection callbacks', 'no'),
+        ('debug_release', 'Add debug symbols to release version', 'no'),
+    ]
 
 
-def get_flags():
 
 
-	return [
-	("openssl", "system"),
-	('freetype', 'system'),
-	('libpng', 'system'),
-	]
+def get_flags():
 
 
+    return [
+        ("openssl", "system"),
+        ('freetype', 'system'),
+        ('libpng', 'system'),
+    ]
 
 
 
 
 def configure(env):
 def configure(env):
 
 
-	is64=sys.maxsize > 2**32
-
-	if (env["bits"]=="default"):
-		if (is64):
-			env["bits"]="64"
-		else:
-			env["bits"]="32"
-
-	env.Append(CPPPATH=['#platform/x11'])
-	if (env["use_llvm"]=="yes"):
-		if 'clang++' not in env['CXX']:
-			env["CC"]="clang"
-			env["CXX"]="clang++"
-			env["LD"]="clang++"
-		env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
-		env.extra_suffix=".llvm"
-
-	if (env["use_sanitizer"]=="yes"):
-		env.Append(CXXFLAGS=['-fsanitize=address','-fno-omit-frame-pointer'])
-		env.Append(LINKFLAGS=['-fsanitize=address'])
-		env.extra_suffix+="s"
-
-	if (env["use_leak_sanitizer"]=="yes"):
-		env.Append(CXXFLAGS=['-fsanitize=address','-fno-omit-frame-pointer'])
-		env.Append(LINKFLAGS=['-fsanitize=address'])
-		env.extra_suffix+="s"
-
-
-	#if (env["tools"]=="no"):
-	#	#no tools suffix
-	#	env['OBJSUFFIX'] = ".nt"+env['OBJSUFFIX']
-	#	env['LIBSUFFIX'] = ".nt"+env['LIBSUFFIX']
-
-
-	if (env["target"]=="release"):
-
-		if (env["debug_release"]=="yes"):
-			env.Append(CCFLAGS=['-g2'])
-		else:
-			env.Append(CCFLAGS=['-O3','-ffast-math'])
-
-	elif (env["target"]=="release_debug"):
-
-		env.Append(CCFLAGS=['-O2','-ffast-math','-DDEBUG_ENABLED'])
-		if (env["debug_release"]=="yes"):
-			env.Append(CCFLAGS=['-g2'])
-
-	elif (env["target"]=="debug"):
-
-		env.Append(CCFLAGS=['-g2', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
-
-	env.ParseConfig('pkg-config x11 --cflags --libs')
-	env.ParseConfig('pkg-config xinerama --cflags --libs')
-	env.ParseConfig('pkg-config xcursor --cflags --libs')
-	env.ParseConfig('pkg-config xrandr --cflags --libs')
-
-	if (env["openssl"] == "system"):
-		env.ParseConfig('pkg-config openssl --cflags --libs')
-
-	if (env["libwebp"] == "system"):
-		env.ParseConfig('pkg-config libwebp --cflags --libs')
-
-	if (env["freetype"] == "system"):
-		env["libpng"] = "system"  # Freetype links against libpng
-		env.ParseConfig('pkg-config freetype2 --cflags --libs')
-
-	if (env["libpng"] == "system"):
-		env.ParseConfig('pkg-config libpng --cflags --libs')
-
-	if (env["enet"] == "system"):
-		env.ParseConfig('pkg-config libenet --cflags --libs')
-
-	if (env["squish"] == "system" and env["tools"] == "yes"):
-		env.ParseConfig('pkg-config libsquish --cflags --libs')
-
-	# Sound and video libraries
-	# Keep the order as it triggers chained dependencies (ogg needed by others, etc.)
-
-	if (env["libtheora"] == "system"):
-		env["libogg"] = "system"  # Needed to link against system libtheora
-		env["libvorbis"] = "system"  # Needed to link against system libtheora
-		env.ParseConfig('pkg-config theora theoradec --cflags --libs')
-
-	if (env["libvpx"] == "system"):
-		env.ParseConfig('pkg-config vpx --cflags --libs')
-
-	if (env["libvorbis"] == "system"):
-		env["libogg"] = "system"  # Needed to link against system libvorbis
-		env.ParseConfig('pkg-config vorbis vorbisfile --cflags --libs')
-
-	if (env["opus"] == "system"):
-		env["libogg"] = "system"  # Needed to link against system opus
-		env.ParseConfig('pkg-config opus opusfile --cflags --libs')
-
-	if (env["libogg"] == "system"):
-		env.ParseConfig('pkg-config ogg --cflags --libs')
-
-
-	env.Append(CPPFLAGS=['-DOPENGL_ENABLED'])
-
-	if (env["glew"] == "system"):
-		env.ParseConfig('pkg-config glew --cflags --libs')
+    is64 = sys.maxsize > 2**32
 
 
-	if os.system("pkg-config --exists alsa")==0:
-		print("Enabling ALSA")
-		env.Append(CPPFLAGS=["-DALSA_ENABLED"])
-		env.ParseConfig('pkg-config alsa --cflags --libs')
-	else:
-		print("ALSA libraries not found, disabling driver")
+    if (env["bits"] == "default"):
+        if (is64):
+            env["bits"] = "64"
+        else:
+            env["bits"] = "32"
 
 
-	if (platform.system() == "Linux"):
-		env.Append(CPPFLAGS=["-DJOYDEV_ENABLED"])
-	if (env["udev"]=="yes"):
-		# pkg-config returns 0 when the lib exists...
-		found_udev = not os.system("pkg-config --exists libudev")
+    env.Append(CPPPATH=['#platform/x11'])
+    if (env["use_llvm"] == "yes"):
+        if 'clang++' not in env['CXX']:
+            env["CC"] = "clang"
+            env["CXX"] = "clang++"
+            env["LD"] = "clang++"
+        env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
+        env.extra_suffix = ".llvm"
 
 
-		if (found_udev):
-			print("Enabling udev support")
-			env.Append(CPPFLAGS=["-DUDEV_ENABLED"])
-			env.ParseConfig('pkg-config libudev --cflags --libs')
-		else:
-			print("libudev development libraries not found, disabling udev support")
+    if (env["use_sanitizer"] == "yes"):
+        env.Append(CXXFLAGS=['-fsanitize=address', '-fno-omit-frame-pointer'])
+        env.Append(LINKFLAGS=['-fsanitize=address'])
+        env.extra_suffix += "s"
 
 
-	if (env["pulseaudio"]=="yes"):
-		if not os.system("pkg-config --exists libpulse-simple"):
-			print("Enabling PulseAudio")
-			env.Append(CPPFLAGS=["-DPULSEAUDIO_ENABLED"])
-			env.ParseConfig('pkg-config --cflags --libs libpulse-simple')
-		else:
-			print("PulseAudio development libraries not found, disabling driver")
+    if (env["use_leak_sanitizer"] == "yes"):
+        env.Append(CXXFLAGS=['-fsanitize=address', '-fno-omit-frame-pointer'])
+        env.Append(LINKFLAGS=['-fsanitize=address'])
+        env.extra_suffix += "s"
+
+    # if (env["tools"]=="no"):
+    #	#no tools suffix
+    #	env['OBJSUFFIX'] = ".nt"+env['OBJSUFFIX']
+    #	env['LIBSUFFIX'] = ".nt"+env['LIBSUFFIX']
+
+    if (env["target"] == "release"):
 
 
-	env.Append(CPPFLAGS=['-DX11_ENABLED','-DUNIX_ENABLED','-DGLES2_ENABLED','-DGLES_OVER_GL'])
-	env.Append(LIBS=['GL', 'pthread', 'z'])
-	if (platform.system() == "Linux"):
-		env.Append(LIBS='dl')
-	#env.Append(CPPFLAGS=['-DMPC_FIXED_POINT'])
+        if (env["debug_release"] == "yes"):
+            env.Append(CCFLAGS=['-g2'])
+        else:
+            env.Append(CCFLAGS=['-O3', '-ffast-math'])
+
+    elif (env["target"] == "release_debug"):
+
+        env.Append(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED'])
+        if (env["debug_release"] == "yes"):
+            env.Append(CCFLAGS=['-g2'])
 
 
-#host compiler is default..
+    elif (env["target"] == "debug"):
+
+        env.Append(CCFLAGS=['-g2', '-Wall', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
+
+    env.ParseConfig('pkg-config x11 --cflags --libs')
+    env.ParseConfig('pkg-config xinerama --cflags --libs')
+    env.ParseConfig('pkg-config xcursor --cflags --libs')
+    env.ParseConfig('pkg-config xrandr --cflags --libs')
 
 
-	if (is64 and env["bits"]=="32"):
-		env.Append(CPPFLAGS=['-m32'])
-		env.Append(LINKFLAGS=['-m32','-L/usr/lib/i386-linux-gnu'])
-	elif (not is64 and env["bits"]=="64"):
-		env.Append(CPPFLAGS=['-m64'])
-		env.Append(LINKFLAGS=['-m64','-L/usr/lib/i686-linux-gnu'])
+    if (env["openssl"] == "system"):
+        env.ParseConfig('pkg-config openssl --cflags --libs')
+
+    if (env["libwebp"] == "system"):
+        env.ParseConfig('pkg-config libwebp --cflags --libs')
+
+    if (env["freetype"] == "system"):
+        env["libpng"] = "system"  # Freetype links against libpng
+        env.ParseConfig('pkg-config freetype2 --cflags --libs')
+
+    if (env["libpng"] == "system"):
+        env.ParseConfig('pkg-config libpng --cflags --libs')
+
+    if (env["enet"] == "system"):
+        env.ParseConfig('pkg-config libenet --cflags --libs')
+
+    if (env["squish"] == "system" and env["tools"] == "yes"):
+        env.ParseConfig('pkg-config libsquish --cflags --libs')
+
+    # Sound and video libraries
+    # Keep the order as it triggers chained dependencies (ogg needed by others, etc.)
+
+    if (env["libtheora"] == "system"):
+        env["libogg"] = "system"  # Needed to link against system libtheora
+        env["libvorbis"] = "system"  # Needed to link against system libtheora
+        env.ParseConfig('pkg-config theora theoradec --cflags --libs')
+
+    if (env["libvpx"] == "system"):
+        env.ParseConfig('pkg-config vpx --cflags --libs')
+
+    if (env["libvorbis"] == "system"):
+        env["libogg"] = "system"  # Needed to link against system libvorbis
+        env.ParseConfig('pkg-config vorbis vorbisfile --cflags --libs')
+
+    if (env["opus"] == "system"):
+        env["libogg"] = "system"  # Needed to link against system opus
+        env.ParseConfig('pkg-config opus opusfile --cflags --libs')
+
+    if (env["libogg"] == "system"):
+        env.ParseConfig('pkg-config ogg --cflags --libs')
+
+    env.Append(CPPFLAGS=['-DOPENGL_ENABLED'])
+
+    if (env["glew"] == "system"):
+        env.ParseConfig('pkg-config glew --cflags --libs')
+
+    if os.system("pkg-config --exists alsa") == 0:
+        print("Enabling ALSA")
+        env.Append(CPPFLAGS=["-DALSA_ENABLED"])
+        env.ParseConfig('pkg-config alsa --cflags --libs')
+    else:
+        print("ALSA libraries not found, disabling driver")
+
+    if (platform.system() == "Linux"):
+        env.Append(CPPFLAGS=["-DJOYDEV_ENABLED"])
+    if (env["udev"] == "yes"):
+        # pkg-config returns 0 when the lib exists...
+        found_udev = not os.system("pkg-config --exists libudev")
+
+        if (found_udev):
+            print("Enabling udev support")
+            env.Append(CPPFLAGS=["-DUDEV_ENABLED"])
+            env.ParseConfig('pkg-config libudev --cflags --libs')
+        else:
+            print("libudev development libraries not found, disabling udev support")
 
 
+    if (env["pulseaudio"] == "yes"):
+        if not os.system("pkg-config --exists libpulse-simple"):
+            print("Enabling PulseAudio")
+            env.Append(CPPFLAGS=["-DPULSEAUDIO_ENABLED"])
+            env.ParseConfig('pkg-config --cflags --libs libpulse-simple')
+        else:
+            print("PulseAudio development libraries not found, disabling driver")
 
 
-	import methods
+    env.Append(CPPFLAGS=['-DX11_ENABLED', '-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DGLES_OVER_GL'])
+    env.Append(LIBS=['GL', 'pthread', 'z'])
+    if (platform.system() == "Linux"):
+        env.Append(LIBS='dl')
+    # env.Append(CPPFLAGS=['-DMPC_FIXED_POINT'])
 
 
-	env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
-	env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
-	env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
-	#env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )
+# host compiler is default..
 
 
-	if (env["use_static_cpp"]=="yes"):
-		env.Append(LINKFLAGS=['-static-libstdc++'])
+    if (is64 and env["bits"] == "32"):
+        env.Append(CPPFLAGS=['-m32'])
+        env.Append(LINKFLAGS=['-m32', '-L/usr/lib/i386-linux-gnu'])
+    elif (not is64 and env["bits"] == "64"):
+        env.Append(CPPFLAGS=['-m64'])
+        env.Append(LINKFLAGS=['-m64', '-L/usr/lib/i686-linux-gnu'])
 
 
-	list_of_x86 = ['x86_64', 'x86', 'i386', 'i586']
-	if any(platform.machine() in s for s in list_of_x86):
-		env["x86_libtheora_opt_gcc"]=True
+    import methods
 
 
+    env.Append(BUILDERS={'GLSL120': env.Builder(action=methods.build_legacygl_headers, suffix='glsl.h', src_suffix='.glsl')})
+    env.Append(BUILDERS={'GLSL': env.Builder(action=methods.build_glsl_headers, suffix='glsl.h', src_suffix='.glsl')})
+    env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.h', src_suffix='.glsl')})
+    #env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )
+
+    if (env["use_static_cpp"] == "yes"):
+        env.Append(LINKFLAGS=['-static-libstdc++'])
+
+    list_of_x86 = ['x86_64', 'x86', 'i386', 'i586']
+    if any(platform.machine() in s for s in list_of_x86):
+        env["x86_libtheora_opt_gcc"] = True

+ 1 - 1
scene/2d/SCsub

@@ -2,6 +2,6 @@
 
 
 Import('env')
 Import('env')
 
 
-env.add_source_files(env.scene_sources,"*.cpp")
+env.add_source_files(env.scene_sources, "*.cpp")
 
 
 Export('env')
 Export('env')

+ 4 - 4
scene/3d/SCsub

@@ -3,11 +3,11 @@
 Import('env')
 Import('env')
 
 
 
 
-if (env["disable_3d"]=="yes"):
+if (env["disable_3d"] == "yes"):
 
 
-	env.scene_sources.append("3d/spatial.cpp")
-	env.scene_sources.append("3d/skeleton.cpp")
+    env.scene_sources.append("3d/spatial.cpp")
+    env.scene_sources.append("3d/skeleton.cpp")
 else:
 else:
-	env.add_source_files(env.scene_sources,"*.cpp")
+    env.add_source_files(env.scene_sources, "*.cpp")
 
 
 Export('env')
 Export('env')

+ 11 - 11
scene/SCsub

@@ -2,21 +2,21 @@
 
 
 Import('env')
 Import('env')
 
 
-env.scene_sources=[]
-env.add_source_files(env.scene_sources,"*.cpp")
+env.scene_sources = []
+env.add_source_files(env.scene_sources, "*.cpp")
 
 
 Export('env')
 Export('env')
 
 
-SConscript('main/SCsub');
-SConscript('gui/SCsub');
-SConscript('3d/SCsub');
-SConscript('2d/SCsub');
-SConscript('animation/SCsub');
-SConscript('audio/SCsub');
-SConscript('resources/SCsub');
-SConscript('io/SCsub');
+SConscript('main/SCsub')
+SConscript('gui/SCsub')
+SConscript('3d/SCsub')
+SConscript('2d/SCsub')
+SConscript('animation/SCsub')
+SConscript('audio/SCsub')
+SConscript('resources/SCsub')
+SConscript('io/SCsub')
 
 
 
 
-lib = env.Library("scene",env.scene_sources)
+lib = env.Library("scene", env.scene_sources)
 
 
 env.Prepend(LIBS=[lib])
 env.Prepend(LIBS=[lib])

+ 1 - 1
scene/animation/SCsub

@@ -2,6 +2,6 @@
 
 
 Import('env')
 Import('env')
 
 
-env.add_source_files(env.scene_sources,"*.cpp")
+env.add_source_files(env.scene_sources, "*.cpp")
 
 
 Export('env')
 Export('env')

+ 1 - 1
scene/audio/SCsub

@@ -2,6 +2,6 @@
 
 
 Import('env')
 Import('env')
 
 
-env.add_source_files(env.scene_sources,"*.cpp")
+env.add_source_files(env.scene_sources, "*.cpp")
 
 
 Export('env')
 Export('env')

+ 1 - 1
scene/gui/SCsub

@@ -2,6 +2,6 @@
 
 
 Import('env')
 Import('env')
 
 
-env.add_source_files(env.scene_sources,"*.cpp")
+env.add_source_files(env.scene_sources, "*.cpp")
 
 
 Export('env')
 Export('env')

+ 1 - 1
scene/io/SCsub

@@ -2,6 +2,6 @@
 
 
 Import('env')
 Import('env')
 
 
-env.add_source_files(env.scene_sources,"*.cpp")
+env.add_source_files(env.scene_sources, "*.cpp")
 
 
 Export('env')
 Export('env')

+ 1 - 1
scene/main/SCsub

@@ -2,6 +2,6 @@
 
 
 Import('env')
 Import('env')
 
 
-env.add_source_files(env.scene_sources,"*.cpp")
+env.add_source_files(env.scene_sources, "*.cpp")
 
 
 Export('env')
 Export('env')

+ 3 - 3
scene/resources/SCsub

@@ -2,9 +2,9 @@
 
 
 Import('env')
 Import('env')
 
 
-env.add_source_files(env.scene_sources,"*.cpp")
-env.add_source_files(env.scene_sources,"*.c")
+env.add_source_files(env.scene_sources, "*.cpp")
+env.add_source_files(env.scene_sources, "*.c")
 
 
 Export('env')
 Export('env')
 
 
-SConscript("default_theme/SCsub");
+SConscript("default_theme/SCsub")

+ 1 - 1
scene/resources/default_theme/SCsub

@@ -2,6 +2,6 @@
 
 
 Import('env')
 Import('env')
 
 
-env.add_source_files(env.scene_sources,"*.cpp")
+env.add_source_files(env.scene_sources, "*.cpp")
 
 
 Export('env')
 Export('env')

+ 41 - 42
scene/resources/default_theme/make_header.py

@@ -1,72 +1,71 @@
 
 
-import os;
-import glob;
-import string;
+import os
+import glob
+import string
 
 
 
 
-#Generate include files
+# Generate include files
 
 
-f=open("theme_data.h","wb")
+f = open("theme_data.h", "wb")
 
 
-f.write("// THIS FILE HAS BEEN AUTOGENERATED, DONT EDIT!!\n");
+f.write("// THIS FILE HAS BEEN AUTOGENERATED, DONT EDIT!!\n")
 
 
-f.write("\n\n");
+f.write("\n\n")
 
 
-#Generate png image block
+# Generate png image block
 
 
-pixmaps = glob.glob("*.png");
+pixmaps = glob.glob("*.png")
 
 
-pixmaps.sort();
+pixmaps.sort()
 
 
-f.write("\n\n\n");
+f.write("\n\n\n")
 
 
 for x in pixmaps:
 for x in pixmaps:
 
 
-	var_str=x[:-4]+"_png";
+    var_str = x[:-4] + "_png"
 
 
-	f.write("static const unsigned char "+ var_str +"[]={\n");
+    f.write("static const unsigned char " + var_str + "[]={\n")
 
 
-	pngf=open(x,"rb");
+    pngf = open(x, "rb")
 
 
-	b=pngf.read(1);
-	while(len(b)==1):
-		f.write(hex(ord(b)))
-		b=pngf.read(1);
-		if (len(b)==1):
-			f.write(",")
+    b = pngf.read(1)
+    while(len(b) == 1):
+        f.write(hex(ord(b)))
+        b = pngf.read(1)
+        if (len(b) == 1):
+            f.write(",")
 
 
-	f.write("\n};\n\n\n");
-	pngf.close();
+    f.write("\n};\n\n\n")
+    pngf.close()
 
 
-#Generate shaders block
+# Generate shaders block
 
 
 shaders = glob.glob("*.gsl")
 shaders = glob.glob("*.gsl")
 
 
-shaders.sort();
+shaders.sort()
 
 
-f.write("\n\n\n");
+f.write("\n\n\n")
 
 
 for x in shaders:
 for x in shaders:
 
 
-	var_str=x[:-4]+"_shader_code";
+    var_str = x[:-4] + "_shader_code"
 
 
-	f.write("static const char *"+ var_str +"=\n");
+    f.write("static const char *" + var_str + "=\n")
 
 
-	sf=open(x,"rb");
+    sf = open(x, "rb")
 
 
+    b = sf.readline()
+    while(b != ""):
+        if (b.endswith("\r\n")):
+            b = b[:-2]
+        if (b.endswith("\n")):
+            b = b[:-1]
+        f.write("			\"" + b)
+        b = sf.readline()
+        if (b != ""):
+            f.write("\"\n")
 
 
-	b=sf.readline();
-	while(b!=""):
-		if (b.endswith("\r\n")):
-			b=b[:-2]
-		if (b.endswith("\n")):
-			b=b[:-1]
-		f.write("			\""+b)
-		b=sf.readline();
-		if (b!=""):
-			f.write("\"\n")
+    f.write("\";\n\n\n")
+    sf.close()
 
 
-	f.write("\";\n\n\n");
-	sf.close();
-
-f.close();
+f.close()

+ 9 - 9
servers/SCsub

@@ -2,18 +2,18 @@
 
 
 Import('env')
 Import('env')
 
 
-env.servers_sources=[]
-env.add_source_files(env.servers_sources,"*.cpp")
+env.servers_sources = []
+env.add_source_files(env.servers_sources, "*.cpp")
 
 
 Export('env')
 Export('env')
 
 
-SConscript('physics/SCsub');
-SConscript('physics_2d/SCsub');
-SConscript('visual/SCsub');
-SConscript('audio/SCsub');
-SConscript('spatial_sound/SCsub');
-SConscript('spatial_sound_2d/SCsub');
+SConscript('physics/SCsub')
+SConscript('physics_2d/SCsub')
+SConscript('visual/SCsub')
+SConscript('audio/SCsub')
+SConscript('spatial_sound/SCsub')
+SConscript('spatial_sound_2d/SCsub')
 
 
-lib = env.Library("servers",env.servers_sources)
+lib = env.Library("servers", env.servers_sources)
 
 
 env.Prepend(LIBS=[lib])
 env.Prepend(LIBS=[lib])

+ 1 - 1
servers/audio/SCsub

@@ -2,6 +2,6 @@
 
 
 Import('env')
 Import('env')
 
 
-env.add_source_files(env.servers_sources,"*.cpp")
+env.add_source_files(env.servers_sources, "*.cpp")
 
 
 Export('env')
 Export('env')

+ 1 - 1
servers/physics/SCsub

@@ -2,7 +2,7 @@
 
 
 Import('env')
 Import('env')
 
 
-env.add_source_files(env.servers_sources,"*.cpp")
+env.add_source_files(env.servers_sources, "*.cpp")
 
 
 Export('env')
 Export('env')
 
 

+ 1 - 1
servers/physics/joints/SCsub

@@ -2,6 +2,6 @@
 
 
 Import('env')
 Import('env')
 
 
-env.add_source_files(env.servers_sources,"*.cpp")
+env.add_source_files(env.servers_sources, "*.cpp")
 
 
 Export('env')
 Export('env')

+ 1 - 1
servers/physics_2d/SCsub

@@ -2,4 +2,4 @@
 
 
 Import('env')
 Import('env')
 
 
-env.add_source_files(env.servers_sources,"*.cpp")
+env.add_source_files(env.servers_sources, "*.cpp")

Some files were not shown because too many files changed in this diff