Merge with -r 22620:23107.
authorArystanbek Dyussenov <arystan.d@gmail.com>
Fri, 11 Sep 2009 18:09:58 +0000 (18:09 +0000)
committerArystanbek Dyussenov <arystan.d@gmail.com>
Fri, 11 Sep 2009 18:09:58 +0000 (18:09 +0000)
Next: update scripts and merge in 2.5.

808 files changed:
CMake/macros.cmake
CMakeLists.txt
SConstruct
blenderplayer/CMakeLists.txt [deleted file]
config/darwin-config.py
config/linux2-config.py
config/win32-mingw-config.py
config/win32-vc-config.py
config/win64-vc-config.py
extern/CMakeLists.txt
extern/Makefile
extern/SConscript
extern/binreloc/SConscript
extern/bullet2/CMakeLists.txt
extern/bullet2/src/BulletCollision/CMakeLists.txt
extern/bullet2/src/BulletSoftBody/CMakeLists.txt
extern/bullet2/src/SConscript
extern/glew/CMakeLists.txt
extern/glew/SConscript
extern/libopenjpeg/SConscript
extern/libredcode/SConscript
extern/lzma/Alloc.c [new file with mode: 0644]
extern/lzma/Alloc.h [new file with mode: 0644]
extern/lzma/CMakeLists.txt [new file with mode: 0644]
extern/lzma/LzFind.c [new file with mode: 0644]
extern/lzma/LzFind.h [new file with mode: 0644]
extern/lzma/LzHash.h [new file with mode: 0644]
extern/lzma/LzmaDec.c [new file with mode: 0644]
extern/lzma/LzmaDec.h [new file with mode: 0644]
extern/lzma/LzmaEnc.c [new file with mode: 0644]
extern/lzma/LzmaEnc.h [new file with mode: 0644]
extern/lzma/LzmaLib.c [new file with mode: 0644]
extern/lzma/LzmaLib.h [new file with mode: 0644]
extern/lzma/Makefile [new file with mode: 0644]
extern/lzma/SConscript [new file with mode: 0644]
extern/lzma/Types.h [new file with mode: 0644]
extern/lzma/history.txt [new file with mode: 0644]
extern/lzma/lzma.txt [new file with mode: 0644]
extern/lzma/make/msvc_9_0/lzma.vcproj [new file with mode: 0644]
extern/lzo/CMakeLists.txt [new file with mode: 0644]
extern/lzo/SConscript [new file with mode: 0644]
extern/lzo/make/msvc_9_0/lzo.vcproj [new file with mode: 0644]
extern/lzo/minilzo/COPYING [new file with mode: 0644]
extern/lzo/minilzo/Makefile [new file with mode: 0644]
extern/lzo/minilzo/README.LZO [new file with mode: 0644]
extern/lzo/minilzo/lzoconf.h [new file with mode: 0644]
extern/lzo/minilzo/lzodefs.h [new file with mode: 0644]
extern/lzo/minilzo/minilzo.c [new file with mode: 0644]
extern/lzo/minilzo/minilzo.h [new file with mode: 0644]
intern/CMakeLists.txt
intern/audaspace/CMakeLists.txt
intern/audaspace/FX/AUD_DoubleReader.cpp
intern/audaspace/FX/AUD_PingPongFactory.cpp
intern/audaspace/Makefile
intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
intern/audaspace/SConscript
intern/audaspace/SDL/AUD_SDLMixerReader.cpp
intern/audaspace/SDL/Makefile
intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp
intern/audaspace/ffmpeg/AUD_FFMPEGFactory.h
intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
intern/audaspace/ffmpeg/AUD_FFMPEGReader.h
intern/audaspace/ffmpeg/Makefile
intern/audaspace/intern/AUD_C-API.cpp
intern/audaspace/intern/Makefile
intern/audaspace/jack/AUD_JackDevice.cpp
intern/audaspace/jack/AUD_JackDevice.h
intern/audaspace/jack/Makefile
intern/audaspace/make/msvc_9_0/audaspace.vcproj
intern/audaspace/sndfile/AUD_SndFileFactory.cpp [new file with mode: 0644]
intern/audaspace/sndfile/AUD_SndFileFactory.h [new file with mode: 0644]
intern/audaspace/sndfile/AUD_SndFileReader.cpp [new file with mode: 0644]
intern/audaspace/sndfile/AUD_SndFileReader.h [new file with mode: 0644]
intern/audaspace/sndfile/Makefile [new file with mode: 0644]
intern/elbeem/CMakeLists.txt
intern/ghost/CMakeLists.txt
intern/ghost/SConscript
intern/ghost/intern/GHOST_System.cpp
intern/guardedalloc/CMakeLists.txt
intern/guardedalloc/SConscript
intern/iksolver/SConscript
intern/iksolver/intern/TNT/tntmath.h
intern/memutil/SConscript
intern/moto/SConscript
intern/smoke/CMakeLists.txt
intern/smoke/extern/smoke_API.h
intern/smoke/intern/FLUID_3D.cpp
intern/smoke/intern/FLUID_3D.h
intern/smoke/intern/FLUID_3D_SOLVERS.cpp
intern/smoke/intern/FLUID_3D_STATIC.cpp
intern/smoke/intern/WTURBULENCE.cpp
intern/smoke/intern/WTURBULENCE.h
intern/smoke/intern/smoke_API.cpp
intern/smoke/intern/tnt/tnt_math_utils.h
intern/string/SConscript
intern/string/STR_String.h
projectfiles_vc9/blender/BPY_python/BPY_python.vcproj
projectfiles_vc9/blender/blender.sln
projectfiles_vc9/blender/blender.vcproj
projectfiles_vc9/blender/blenkernel/BKE_blenkernel.vcproj
projectfiles_vc9/blender/blenlib/BLI_blenlib.vcproj
projectfiles_vc9/blender/editors/ED_editors.vcproj
projectfiles_vc9/blender/imbuf/BL_imbuf.vcproj
projectfiles_vc9/blender/makesrna/RNA_makesrna.vcproj
projectfiles_vc9/blender/makesrna/RNA_rna.vcproj
projectfiles_vc9/blender/render/BRE_render.vcproj
projectfiles_vc9/gameengine/videotexture/TEX_Video.vcproj
release/datafiles/blenderbuttons
release/datafiles/datatoc.c [deleted file]
release/datafiles/splash.jpg
release/io/engine_render_pov.py
release/io/export_ply.py
release/io/netrender/__init__.py [new file with mode: 0644]
release/io/netrender/client.py [new file with mode: 0644]
release/io/netrender/master.py [new file with mode: 0644]
release/io/netrender/model.py [new file with mode: 0644]
release/io/netrender/operators.py [new file with mode: 0644]
release/io/netrender/slave.py [new file with mode: 0644]
release/io/netrender/ui.py [new file with mode: 0644]
release/io/netrender/utils.py [new file with mode: 0644]
release/scripts/export_map.py
release/scripts/help_getting_started.py [deleted file]
release/scripts/help_manual.py [deleted file]
release/scripts/help_release_notes.py [deleted file]
release/scripts/help_tutorials.py [deleted file]
release/scripts/help_web_blender.py [deleted file]
release/scripts/help_web_devcomm.py [deleted file]
release/scripts/help_web_eshop.py [deleted file]
release/scripts/help_web_usercomm.py [deleted file]
release/test/rna_array.py [new file with mode: 0644]
release/ui/bpy_ops.py
release/ui/buttons_data_armature.py
release/ui/buttons_data_bone.py
release/ui/buttons_data_camera.py
release/ui/buttons_data_curve.py
release/ui/buttons_data_empty.py
release/ui/buttons_data_lamp.py
release/ui/buttons_data_lattice.py
release/ui/buttons_data_mesh.py
release/ui/buttons_data_metaball.py
release/ui/buttons_data_modifier.py
release/ui/buttons_data_text.py
release/ui/buttons_game.py
release/ui/buttons_material.py
release/ui/buttons_object.py
release/ui/buttons_object_constraint.py
release/ui/buttons_physics_cloth.py
release/ui/buttons_physics_field.py
release/ui/buttons_physics_fluid.py
release/ui/buttons_physics_smoke.py
release/ui/buttons_physics_softbody.py
release/ui/buttons_scene.py
release/ui/buttons_texture.py
release/ui/buttons_world.py
release/ui/space_buttons.py
release/ui/space_console.py
release/ui/space_filebrowser.py
release/ui/space_image.py
release/ui/space_info.py
release/ui/space_logic.py
release/ui/space_node.py
release/ui/space_outliner.py
release/ui/space_sequencer.py
release/ui/space_text.py
release/ui/space_time.py
release/ui/space_userpref.py
release/ui/space_view3d.py
release/ui/space_view3d_toolbar.py
release/windows/inno/blender.iss [new file with mode: 0644]
release/windows/inno/copyright.txt [new file with mode: 0644]
release/windows/inno/header.bmp [new file with mode: 0644]
release/windows/inno/installer.bmp [new file with mode: 0644]
release/windows/inno/installer.ico [new file with mode: 0644]
source/CMakeLists.txt
source/Makefile
source/SConscript
source/blender/CMakeLists.txt
source/blender/avi/CMakeLists.txt
source/blender/avi/SConscript
source/blender/blenfont/CMakeLists.txt
source/blender/blenfont/SConscript
source/blender/blenfont/intern/blf_font.c
source/blender/blenkernel/BKE_action.h
source/blender/blenkernel/BKE_animsys.h
source/blender/blenkernel/BKE_armature.h
source/blender/blenkernel/BKE_blender.h
source/blender/blenkernel/BKE_brush.h
source/blender/blenkernel/BKE_constraint.h
source/blender/blenkernel/BKE_curve.h
source/blender/blenkernel/BKE_depsgraph.h
source/blender/blenkernel/BKE_global.h
source/blender/blenkernel/BKE_group.h
source/blender/blenkernel/BKE_library.h
source/blender/blenkernel/BKE_modifier.h
source/blender/blenkernel/BKE_multires.h
source/blender/blenkernel/BKE_node.h
source/blender/blenkernel/BKE_object.h
source/blender/blenkernel/BKE_paint.h
source/blender/blenkernel/BKE_particle.h
source/blender/blenkernel/BKE_pointcache.h
source/blender/blenkernel/BKE_sca.h
source/blender/blenkernel/BKE_scene.h
source/blender/blenkernel/BKE_sculpt.h [deleted file]
source/blender/blenkernel/BKE_shrinkwrap.h
source/blender/blenkernel/BKE_smoke.h
source/blender/blenkernel/BKE_sound.h
source/blender/blenkernel/BKE_text.h
source/blender/blenkernel/BKE_texture.h
source/blender/blenkernel/CMakeLists.txt
source/blender/blenkernel/SConscript
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/Makefile
source/blender/blenkernel/intern/action.c
source/blender/blenkernel/intern/anim.c
source/blender/blenkernel/intern/anim_sys.c
source/blender/blenkernel/intern/armature.c
source/blender/blenkernel/intern/blender.c
source/blender/blenkernel/intern/boids.c
source/blender/blenkernel/intern/booleanops.c
source/blender/blenkernel/intern/brush.c
source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/blenkernel/intern/cloth.c
source/blender/blenkernel/intern/constraint.c
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/depsgraph.c
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/fcurve.c
source/blender/blenkernel/intern/font.c
source/blender/blenkernel/intern/gpencil.c
source/blender/blenkernel/intern/group.c
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/material.c
source/blender/blenkernel/intern/mesh.c
source/blender/blenkernel/intern/modifier.c
source/blender/blenkernel/intern/multires.c
source/blender/blenkernel/intern/nla.c
source/blender/blenkernel/intern/node.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/packedFile.c
source/blender/blenkernel/intern/paint.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/particle_system.c
source/blender/blenkernel/intern/pointcache.c
source/blender/blenkernel/intern/sca.c
source/blender/blenkernel/intern/scene.c
source/blender/blenkernel/intern/seqeffects.c
source/blender/blenkernel/intern/sequence.c
source/blender/blenkernel/intern/shrinkwrap.c
source/blender/blenkernel/intern/smoke.c
source/blender/blenkernel/intern/softbody.c
source/blender/blenkernel/intern/sound.c
source/blender/blenkernel/intern/text.c
source/blender/blenkernel/intern/texture.c
source/blender/blenlib/BLI_arithb.h
source/blender/blenlib/BLI_fileops.h
source/blender/blenlib/BLI_kdopbvh.h
source/blender/blenlib/BLI_voxel.h [new file with mode: 0644]
source/blender/blenlib/BLI_winstuff.h
source/blender/blenlib/CMakeLists.txt
source/blender/blenlib/MTC_matrixops.h [deleted file]
source/blender/blenlib/SConscript
source/blender/blenlib/intern/BLI_kdopbvh.c
source/blender/blenlib/intern/arithb.c
source/blender/blenlib/intern/bpath.c
source/blender/blenlib/intern/fileops.c
source/blender/blenlib/intern/freetypefont.c
source/blender/blenlib/intern/matrixops.c [deleted file]
source/blender/blenlib/intern/storage.c
source/blender/blenlib/intern/threads.c
source/blender/blenlib/intern/util.c
source/blender/blenlib/intern/vectorops.c [deleted file]
source/blender/blenlib/intern/voxel.c [new file with mode: 0644]
source/blender/blenloader/CMakeLists.txt
source/blender/blenloader/SConscript
source/blender/blenloader/intern/readblenentry.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/readfile.h
source/blender/blenloader/intern/writefile.c
source/blender/blenpluginapi/CMakeLists.txt
source/blender/blenpluginapi/SConscript
source/blender/editors/CMakeLists.txt
source/blender/editors/Makefile
source/blender/editors/SConscript
source/blender/editors/animation/anim_channels_defines.c
source/blender/editors/animation/anim_filter.c
source/blender/editors/animation/anim_intern.h
source/blender/editors/animation/anim_ipo_utils.c
source/blender/editors/animation/anim_ops.c
source/blender/editors/animation/drivers.c
source/blender/editors/animation/fmodifier_ui.c
source/blender/editors/animation/keyframes_draw.c
source/blender/editors/animation/keyframes_edit.c
source/blender/editors/animation/keyframes_general.c
source/blender/editors/animation/keyframing.c
source/blender/editors/animation/keyingsets.c
source/blender/editors/armature/editarmature.c
source/blender/editors/armature/editarmature_generate.c
source/blender/editors/armature/editarmature_retarget.c
source/blender/editors/armature/meshlaplacian.c
source/blender/editors/armature/poselib.c
source/blender/editors/armature/poseobject.c
source/blender/editors/curve/curve_ops.c
source/blender/editors/curve/editcurve.c
source/blender/editors/curve/editfont.c
source/blender/editors/datafiles/blenderbuttons.c
source/blender/editors/gpencil/drawgpencil.c
source/blender/editors/gpencil/gpencil_buttons.c [new file with mode: 0644]
source/blender/editors/gpencil/gpencil_edit.c
source/blender/editors/gpencil/gpencil_intern.h
source/blender/editors/gpencil/gpencil_ops.c [new file with mode: 0644]
source/blender/editors/gpencil/gpencil_paint.c [new file with mode: 0644]
source/blender/editors/include/ED_anim_api.h
source/blender/editors/include/ED_armature.h
source/blender/editors/include/ED_fileselect.h
source/blender/editors/include/ED_gpencil.h
source/blender/editors/include/ED_info.h [new file with mode: 0644]
source/blender/editors/include/ED_keyframes_draw.h
source/blender/editors/include/ED_keyframes_edit.h
source/blender/editors/include/ED_keyframing.h
source/blender/editors/include/ED_mball.h
source/blender/editors/include/ED_mesh.h
source/blender/editors/include/ED_object.h
source/blender/editors/include/ED_particle.h
source/blender/editors/include/ED_screen.h
source/blender/editors/include/ED_sound.h [new file with mode: 0644]
source/blender/editors/include/ED_view3d.h
source/blender/editors/include/UI_icons.h
source/blender/editors/include/UI_interface.h
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_anim.c
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_icons.c
source/blender/editors/interface/interface_intern.h
source/blender/editors/interface/interface_layout.c
source/blender/editors/interface/interface_regions.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/interface/interface_utils.c
source/blender/editors/interface/interface_widgets.c
source/blender/editors/interface/resources.c
source/blender/editors/interface/view2d_ops.c
source/blender/editors/mesh/editmesh.c
source/blender/editors/mesh/editmesh_add.c
source/blender/editors/mesh/editmesh_loop.c
source/blender/editors/mesh/editmesh_mods.c
source/blender/editors/mesh/editmesh_tools.c
source/blender/editors/mesh/mesh_layers.c
source/blender/editors/mesh/meshtools.c
source/blender/editors/metaball/mball_edit.c [moved from source/blender/editors/metaball/editmball.c with 94% similarity]
source/blender/editors/object/object_add.c [new file with mode: 0644]
source/blender/editors/object/object_constraint.c [moved from source/blender/editors/object/editconstraint.c with 97% similarity]
source/blender/editors/object/object_edit.c
source/blender/editors/object/object_group.c [moved from source/blender/editors/object/editgroup.c with 60% similarity]
source/blender/editors/object/object_hook.c [new file with mode: 0644]
source/blender/editors/object/object_intern.h
source/blender/editors/object/object_lattice.c [moved from source/blender/editors/object/editlattice.c with 95% similarity]
source/blender/editors/object/object_modifier.c
source/blender/editors/object/object_ops.c
source/blender/editors/object/object_relations.c [new file with mode: 0644]
source/blender/editors/object/object_select.c [new file with mode: 0644]
source/blender/editors/object/object_shapekey.c [moved from source/blender/editors/object/editkey.c with 85% similarity]
source/blender/editors/object/object_transform.c [new file with mode: 0644]
source/blender/editors/object/object_vgroup.c
source/blender/editors/physics/ed_fluidsim.c
source/blender/editors/physics/ed_pointcache.c
source/blender/editors/physics/editparticle.c
source/blender/editors/preview/previewrender.c
source/blender/editors/screen/CMakeLists.txt
source/blender/editors/screen/area.c
source/blender/editors/screen/screen_context.c
source/blender/editors/screen/screen_ops.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/sculpt_paint/paint_intern.h
source/blender/editors/sculpt_paint/paint_ops.c
source/blender/editors/sculpt_paint/paint_stroke.c [new file with mode: 0644]
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/sculpt_paint/sculpt.c
source/blender/editors/sculpt_paint/sculpt_intern.h
source/blender/editors/sculpt_paint/sculpt_stroke.c [deleted file]
source/blender/editors/sound/Makefile [new file with mode: 0644]
source/blender/editors/sound/SConscript [new file with mode: 0644]
source/blender/editors/sound/sound_intern.h [new file with mode: 0644]
source/blender/editors/sound/sound_ops.c [new file with mode: 0644]
source/blender/editors/space_action/action_draw.c
source/blender/editors/space_action/action_edit.c
source/blender/editors/space_action/action_header.c
source/blender/editors/space_action/action_intern.h
source/blender/editors/space_action/action_ops.c
source/blender/editors/space_action/space_action.c
source/blender/editors/space_api/spacetypes.c
source/blender/editors/space_buttons/buttons_context.c
source/blender/editors/space_buttons/buttons_intern.h
source/blender/editors/space_buttons/buttons_ops.c
source/blender/editors/space_buttons/space_buttons.c
source/blender/editors/space_console/console_ops.c
source/blender/editors/space_console/console_report.c
source/blender/editors/space_console/space_console.c
source/blender/editors/space_file/file_draw.c
source/blender/editors/space_file/file_intern.h
source/blender/editors/space_file/file_ops.c
source/blender/editors/space_file/file_panels.c
source/blender/editors/space_file/filesel.c
source/blender/editors/space_file/space_file.c
source/blender/editors/space_graph/graph_edit.c
source/blender/editors/space_graph/graph_header.c
source/blender/editors/space_graph/space_graph.c
source/blender/editors/space_image/image_buttons.c
source/blender/editors/space_image/image_draw.c
source/blender/editors/space_image/image_intern.h
source/blender/editors/space_image/image_ops.c
source/blender/editors/space_image/space_image.c
source/blender/editors/space_info/info_stats.c [new file with mode: 0644]
source/blender/editors/space_info/space_info.c
source/blender/editors/space_logic/logic_window.c
source/blender/editors/space_logic/space_logic.c
source/blender/editors/space_nla/nla_buttons.c
source/blender/editors/space_nla/nla_channels.c
source/blender/editors/space_nla/nla_draw.c
source/blender/editors/space_nla/nla_edit.c
source/blender/editors/space_nla/nla_header.c
source/blender/editors/space_nla/space_nla.c
source/blender/editors/space_node/drawnode.c
source/blender/editors/space_node/node_edit.c
source/blender/editors/space_node/space_node.c
source/blender/editors/space_outliner/outliner.c
source/blender/editors/space_outliner/space_outliner.c
source/blender/editors/space_sequencer/sequencer_add.c
source/blender/editors/space_sequencer/sequencer_draw.c
source/blender/editors/space_sequencer/space_sequencer.c
source/blender/editors/space_text/space_text.c
source/blender/editors/space_text/text_header.c
source/blender/editors/space_text/text_intern.h
source/blender/editors/space_text/text_ops.c
source/blender/editors/space_time/space_time.c
source/blender/editors/space_time/time_header.c [deleted file]
source/blender/editors/space_view3d/SConscript
source/blender/editors/space_view3d/drawarmature.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/drawvolume.c [new file with mode: 0644]
source/blender/editors/space_view3d/space_view3d.c
source/blender/editors/space_view3d/view3d_buttons.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/space_view3d/view3d_header.c
source/blender/editors/space_view3d/view3d_intern.h
source/blender/editors/space_view3d/view3d_ops.c
source/blender/editors/space_view3d/view3d_select.c
source/blender/editors/space_view3d/view3d_snap.c
source/blender/editors/space_view3d/view3d_toolbar.c
source/blender/editors/space_view3d/view3d_view.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform.h
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_generics.c
source/blender/editors/transform/transform_manipulator.c
source/blender/editors/transform/transform_ops.c
source/blender/editors/transform/transform_orientations.c
source/blender/editors/util/editmode_undo.c
source/blender/editors/util/undo.c
source/blender/editors/uvedit/uvedit_ops.c
source/blender/editors/uvedit/uvedit_unwrap_ops.c
source/blender/gpu/CMakeLists.txt
source/blender/gpu/GPU_draw.h
source/blender/gpu/GPU_extensions.h
source/blender/gpu/SConscript
source/blender/gpu/intern/Makefile
source/blender/gpu/intern/gpu_draw.c
source/blender/gpu/intern/gpu_extensions.c
source/blender/imbuf/CMakeLists.txt
source/blender/imbuf/SConscript
source/blender/imbuf/intern/anim5.c
source/blender/imbuf/intern/cineon/CMakeLists.txt
source/blender/imbuf/intern/cineon/SConscript
source/blender/imbuf/intern/dds/CMakeLists.txt
source/blender/imbuf/intern/dds/SConscript
source/blender/imbuf/intern/hamx.c
source/blender/imbuf/intern/iff.c
source/blender/imbuf/intern/openexr/CMakeLists.txt
source/blender/imbuf/intern/openexr/Makefile
source/blender/imbuf/intern/openexr/SConscript
source/blender/imbuf/intern/openexr/openexr_api.cpp
source/blender/imbuf/intern/thumbs.c
source/blender/imbuf/intern/writeimage.c
source/blender/makesdna/DNA_action_types.h
source/blender/makesdna/DNA_brush_types.h
source/blender/makesdna/DNA_constraint_types.h
source/blender/makesdna/DNA_curve_types.h
source/blender/makesdna/DNA_gpencil_types.h
source/blender/makesdna/DNA_material_types.h
source/blender/makesdna/DNA_modifier_types.h
source/blender/makesdna/DNA_object_force.h
source/blender/makesdna/DNA_object_types.h
source/blender/makesdna/DNA_particle_types.h
source/blender/makesdna/DNA_scene_types.h
source/blender/makesdna/DNA_sensor_types.h
source/blender/makesdna/DNA_smoke_types.h
source/blender/makesdna/DNA_sound_types.h
source/blender/makesdna/DNA_space_types.h
source/blender/makesdna/DNA_texture_types.h
source/blender/makesdna/DNA_userdef_types.h
source/blender/makesdna/DNA_windowmanager_types.h
source/blender/makesdna/SConscript
source/blender/makesdna/intern/CMakeLists.txt
source/blender/makesdna/intern/SConscript
source/blender/makesrna/RNA_access.h
source/blender/makesrna/RNA_define.h
source/blender/makesrna/RNA_enum_types.h
source/blender/makesrna/RNA_types.h
source/blender/makesrna/SConscript
source/blender/makesrna/intern/CMakeLists.txt
source/blender/makesrna/intern/Makefile
source/blender/makesrna/intern/SConscript
source/blender/makesrna/intern/makesrna.c
source/blender/makesrna/intern/rna_ID.c
source/blender/makesrna/intern/rna_access.c
source/blender/makesrna/intern/rna_action.c
source/blender/makesrna/intern/rna_action_api.c
source/blender/makesrna/intern/rna_animation.c
source/blender/makesrna/intern/rna_animation_api.c [new file with mode: 0644]
source/blender/makesrna/intern/rna_armature.c
source/blender/makesrna/intern/rna_boid.c
source/blender/makesrna/intern/rna_brush.c
source/blender/makesrna/intern/rna_cloth.c
source/blender/makesrna/intern/rna_constraint.c
source/blender/makesrna/intern/rna_curve.c
source/blender/makesrna/intern/rna_define.c
source/blender/makesrna/intern/rna_fcurve.c
source/blender/makesrna/intern/rna_fluidsim.c
source/blender/makesrna/intern/rna_gpencil.c [new file with mode: 0644]
source/blender/makesrna/intern/rna_group.c
source/blender/makesrna/intern/rna_image_api.c
source/blender/makesrna/intern/rna_internal.h
source/blender/makesrna/intern/rna_internal_types.h
source/blender/makesrna/intern/rna_key.c
source/blender/makesrna/intern/rna_lattice.c
source/blender/makesrna/intern/rna_main.c
source/blender/makesrna/intern/rna_material.c
source/blender/makesrna/intern/rna_material_api.c
source/blender/makesrna/intern/rna_mesh.c
source/blender/makesrna/intern/rna_mesh_api.c
source/blender/makesrna/intern/rna_meta.c
source/blender/makesrna/intern/rna_modifier.c
source/blender/makesrna/intern/rna_nla.c
source/blender/makesrna/intern/rna_nodetree.c
source/blender/makesrna/intern/rna_nodetree_types.h
source/blender/makesrna/intern/rna_object.c
source/blender/makesrna/intern/rna_object_api.c
source/blender/makesrna/intern/rna_object_force.c
source/blender/makesrna/intern/rna_packedfile.c
source/blender/makesrna/intern/rna_particle.c
source/blender/makesrna/intern/rna_pose.c
source/blender/makesrna/intern/rna_pose_api.c
source/blender/makesrna/intern/rna_render.c
source/blender/makesrna/intern/rna_rna.c
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_scene_api.c
source/blender/makesrna/intern/rna_sculpt_paint.c
source/blender/makesrna/intern/rna_sequence.c
source/blender/makesrna/intern/rna_smoke.c
source/blender/makesrna/intern/rna_sound.c
source/blender/makesrna/intern/rna_space.c
source/blender/makesrna/intern/rna_test.c [new file with mode: 0644]
source/blender/makesrna/intern/rna_texture.c
source/blender/makesrna/intern/rna_ui_api.c
source/blender/makesrna/intern/rna_userdef.c
source/blender/makesrna/intern/rna_wm.c
source/blender/makesrna/intern/rna_world.c
source/blender/nodes/CMP_node.h
source/blender/nodes/CMakeLists.txt
source/blender/nodes/SConscript
source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c
source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c
source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c [new file with mode: 0644]
source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c
source/blender/nodes/intern/CMP_nodes/CMP_distanceMatte.c [new file with mode: 0644]
source/blender/nodes/intern/CMP_nodes/CMP_levels.c [new file with mode: 0644]
source/blender/nodes/intern/CMP_nodes/CMP_lummaMatte.c
source/blender/nodes/intern/CMP_util.c
source/blender/nodes/intern/CMP_util.h
source/blender/nodes/intern/TEX_nodes/TEX_rotate.c
source/blender/nodes/intern/TEX_util.c
source/blender/nodes/intern/TEX_util.h
source/blender/python/CMakeLists.txt
source/blender/python/SConscript
source/blender/python/epy_doc_gen.py
source/blender/python/generic/bpy_internal_import.h
source/blender/python/generic/matrix.c
source/blender/python/generic/vector.c
source/blender/python/intern/bpy_array.c [new file with mode: 0644]
source/blender/python/intern/bpy_interface.c
source/blender/python/intern/bpy_operator.c
source/blender/python/intern/bpy_operator_wrap.c
source/blender/python/intern/bpy_rna.c
source/blender/python/intern/bpy_rna.h
source/blender/python/intern/bpy_util.c
source/blender/python/intern/bpy_util.h
source/blender/quicktime/CMakeLists.txt
source/blender/quicktime/SConscript
source/blender/readblenfile/CMakeLists.txt
source/blender/readblenfile/SConscript
source/blender/readblenfile/intern/BLO_readblenfile.c
source/blender/render/CMakeLists.txt
source/blender/render/SConscript
source/blender/render/extern/include/RE_shader_ext.h
source/blender/render/intern/include/pointdensity.h [moved from source/blender/blenlib/MTC_vectorops.h with 50% similarity]
source/blender/render/intern/include/render_types.h
source/blender/render/intern/include/shading.h
source/blender/render/intern/include/texture.h
source/blender/render/intern/include/volume_precache.h [new file with mode: 0644]
source/blender/render/intern/include/volumetric.h [new file with mode: 0644]
source/blender/render/intern/include/voxeldata.h [new file with mode: 0644]
source/blender/render/intern/source/Makefile
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/envmap.c
source/blender/render/intern/source/initrender.c
source/blender/render/intern/source/occlusion.c
source/blender/render/intern/source/pixelshading.c
source/blender/render/intern/source/pointdensity.c [new file with mode: 0644]
source/blender/render/intern/source/rayshade.c
source/blender/render/intern/source/raytrace.c
source/blender/render/intern/source/rendercore.c
source/blender/render/intern/source/shadbuf.c
source/blender/render/intern/source/shadeinput.c
source/blender/render/intern/source/shadeoutput.c
source/blender/render/intern/source/texture.c
source/blender/render/intern/source/volume_precache.c [new file with mode: 0644]
source/blender/render/intern/source/volumetric.c [new file with mode: 0644]
source/blender/render/intern/source/voxeldata.c [new file with mode: 0644]
source/blender/render/intern/source/zbuf.c
source/blender/windowmanager/CMakeLists.txt
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/WM_types.h
source/blender/windowmanager/intern/Makefile
source/blender/windowmanager/intern/wm.c
source/blender/windowmanager/intern/wm_event_system.c
source/blender/windowmanager/intern/wm_files.c
source/blender/windowmanager/intern/wm_init_exit.c
source/blender/windowmanager/intern/wm_operators.c
source/blender/windowmanager/intern/wm_window.c
source/blenderplayer/CMakeLists.txt [new file with mode: 0644]
source/blenderplayer/bad_level_call_stubs/CMakeLists.txt [new file with mode: 0644]
source/blenderplayer/bad_level_call_stubs/Makefile [new file with mode: 0644]
source/blenderplayer/bad_level_call_stubs/SConscript [new file with mode: 0644]
source/blenderplayer/bad_level_call_stubs/stubs.c [new file with mode: 0644]
source/creator/CMakeLists.txt
source/creator/Makefile
source/creator/SConscript
source/creator/creator.c
source/gameengine/BlenderRoutines/CMakeLists.txt
source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
source/gameengine/BlenderRoutines/KX_BlenderGL.h
source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
source/gameengine/BlenderRoutines/SConscript
source/gameengine/CMakeLists.txt
source/gameengine/Converter/BL_ActionActuator.cpp
source/gameengine/Converter/BL_ActionActuator.h
source/gameengine/Converter/BL_ArmatureObject.cpp
source/gameengine/Converter/BL_BlenderDataConversion.cpp
source/gameengine/Converter/BL_ShapeActionActuator.cpp
source/gameengine/Converter/BL_ShapeActionActuator.h
source/gameengine/Converter/BL_ShapeDeformer.cpp
source/gameengine/Converter/CMakeLists.txt
source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp
source/gameengine/Converter/KX_BlenderScalarInterpolator.h
source/gameengine/Converter/KX_BlenderSceneConverter.cpp
source/gameengine/Converter/KX_ConvertActuators.cpp
source/gameengine/Converter/KX_ConvertProperties.cpp
source/gameengine/Converter/KX_ConvertSensors.cpp
source/gameengine/Converter/KX_IpoConvert.cpp
source/gameengine/Converter/SConscript
source/gameengine/Expressions/CMakeLists.txt
source/gameengine/Expressions/ListValue.cpp
source/gameengine/Expressions/ListValue.h
source/gameengine/Expressions/PyObjectPlus.cpp
source/gameengine/Expressions/PyObjectPlus.h
source/gameengine/Expressions/SConscript
source/gameengine/Expressions/Value.cpp
source/gameengine/Expressions/Value.h
source/gameengine/GameLogic/CMakeLists.txt
source/gameengine/GameLogic/SCA_ActuatorSensor.cpp
source/gameengine/GameLogic/SCA_ActuatorSensor.h
source/gameengine/GameLogic/SCA_DelaySensor.cpp
source/gameengine/GameLogic/SCA_DelaySensor.h
source/gameengine/GameLogic/SCA_IController.cpp
source/gameengine/GameLogic/SCA_IController.h
source/gameengine/GameLogic/SCA_ILogicBrick.cpp
source/gameengine/GameLogic/SCA_ILogicBrick.h
source/gameengine/GameLogic/SCA_ISensor.cpp
source/gameengine/GameLogic/SCA_ISensor.h
source/gameengine/GameLogic/SCA_JoystickSensor.cpp
source/gameengine/GameLogic/SCA_JoystickSensor.h
source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
source/gameengine/GameLogic/SCA_KeyboardSensor.h
source/gameengine/GameLogic/SCA_MouseSensor.cpp
source/gameengine/GameLogic/SCA_MouseSensor.h
source/gameengine/GameLogic/SCA_PropertyActuator.cpp
source/gameengine/GameLogic/SCA_PropertyActuator.h
source/gameengine/GameLogic/SCA_PropertyEventManager.h
source/gameengine/GameLogic/SCA_PropertySensor.cpp
source/gameengine/GameLogic/SCA_PropertySensor.h
source/gameengine/GameLogic/SCA_PythonController.cpp
source/gameengine/GameLogic/SCA_RandomActuator.cpp
source/gameengine/GameLogic/SCA_RandomActuator.h
source/gameengine/GameLogic/SCA_RandomSensor.cpp
source/gameengine/GameLogic/SCA_RandomSensor.h
source/gameengine/GameLogic/SConscript
source/gameengine/GamePlayer/CMakeLists.txt
source/gameengine/GamePlayer/common/CMakeLists.txt
source/gameengine/GamePlayer/common/GPC_Engine.cpp
source/gameengine/GamePlayer/common/GPC_Engine.h
source/gameengine/GamePlayer/common/SConscript
source/gameengine/GamePlayer/ghost/CMakeLists.txt
source/gameengine/GamePlayer/ghost/GPG_Application.cpp
source/gameengine/GamePlayer/ghost/GPG_Application.h
source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
source/gameengine/GamePlayer/ghost/SConscript
source/gameengine/Ketsji/CMakeLists.txt
source/gameengine/Ketsji/KXNetwork/CMakeLists.txt
source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp
source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.h
source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.h
source/gameengine/Ketsji/KXNetwork/SConscript
source/gameengine/Ketsji/KX_Camera.cpp
source/gameengine/Ketsji/KX_Camera.h
source/gameengine/Ketsji/KX_CameraActuator.cpp
source/gameengine/Ketsji/KX_CameraActuator.h
source/gameengine/Ketsji/KX_ConstraintActuator.cpp
source/gameengine/Ketsji/KX_ConstraintActuator.h
source/gameengine/Ketsji/KX_GameActuator.cpp
source/gameengine/Ketsji/KX_GameActuator.h
source/gameengine/Ketsji/KX_GameObject.cpp
source/gameengine/Ketsji/KX_GameObject.h
source/gameengine/Ketsji/KX_IpoActuator.cpp
source/gameengine/Ketsji/KX_IpoActuator.h
source/gameengine/Ketsji/KX_KetsjiEngine.cpp
source/gameengine/Ketsji/KX_MeshProxy.cpp
source/gameengine/Ketsji/KX_MouseFocusSensor.cpp
source/gameengine/Ketsji/KX_MouseFocusSensor.h
source/gameengine/Ketsji/KX_ObjectActuator.cpp
source/gameengine/Ketsji/KX_ObjectActuator.h
source/gameengine/Ketsji/KX_ParentActuator.cpp
source/gameengine/Ketsji/KX_ParentActuator.h
source/gameengine/Ketsji/KX_PolyProxy.cpp
source/gameengine/Ketsji/KX_PyMath.cpp
source/gameengine/Ketsji/KX_PyMath.h
source/gameengine/Ketsji/KX_PythonInit.cpp
source/gameengine/Ketsji/KX_PythonInitTypes.cpp
source/gameengine/Ketsji/KX_PythonSeq.cpp
source/gameengine/Ketsji/KX_RadarSensor.cpp
source/gameengine/Ketsji/KX_RadarSensor.h
source/gameengine/Ketsji/KX_RaySensor.cpp
source/gameengine/Ketsji/KX_RaySensor.h
source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h
source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp
source/gameengine/Ketsji/KX_SCA_DynamicActuator.h
source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp
source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h
source/gameengine/Ketsji/KX_Scene.cpp
source/gameengine/Ketsji/KX_Scene.h
source/gameengine/Ketsji/KX_SceneActuator.cpp
source/gameengine/Ketsji/KX_SceneActuator.h
source/gameengine/Ketsji/KX_SoundActuator.cpp
source/gameengine/Ketsji/KX_SoundActuator.h
source/gameengine/Ketsji/KX_StateActuator.cpp
source/gameengine/Ketsji/KX_StateActuator.h
source/gameengine/Ketsji/KX_TouchSensor.cpp
source/gameengine/Ketsji/KX_TouchSensor.h
source/gameengine/Ketsji/KX_TrackToActuator.cpp
source/gameengine/Ketsji/KX_TrackToActuator.h
source/gameengine/Ketsji/KX_VisibilityActuator.cpp
source/gameengine/Ketsji/KX_VisibilityActuator.h
source/gameengine/Ketsji/SConscript
source/gameengine/Network/CMakeLists.txt
source/gameengine/Network/LoopBackNetwork/CMakeLists.txt
source/gameengine/Network/LoopBackNetwork/SConscript
source/gameengine/Network/SConscript
source/gameengine/Physics/Bullet/CMakeLists.txt
source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
source/gameengine/Physics/Bullet/SConscript
source/gameengine/Physics/Dummy/CMakeLists.txt
source/gameengine/Physics/Dummy/SConscript
source/gameengine/Physics/common/CMakeLists.txt
source/gameengine/Physics/common/SConscript
source/gameengine/PyDoc/GameLogic.py
source/gameengine/PyDoc/GameTypes.py
source/gameengine/Rasterizer/CMakeLists.txt
source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
source/gameengine/Rasterizer/RAS_MaterialBucket.h
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript
source/gameengine/Rasterizer/RAS_Polygon.cpp
source/gameengine/Rasterizer/RAS_Polygon.h
source/gameengine/Rasterizer/SConscript
source/gameengine/SceneGraph/CMakeLists.txt
source/gameengine/SceneGraph/SConscript
source/gameengine/VideoTexture/CMakeLists.txt
source/gameengine/VideoTexture/Exception.cpp
source/gameengine/VideoTexture/ImageBase.cpp
source/gameengine/VideoTexture/SConscript
source/icons/SConscript
source/kernel/CMakeLists.txt
source/kernel/SConscript
source/nan_definitions.mk
tools/Blender.py
tools/btools.py

index 9ba33df..6a33750 100644 (file)
@@ -70,6 +70,9 @@ MACRO(SETUP_LIBDIRS)
   IF(WITH_JACK)
     LINK_DIRECTORIES(${JACK_LIBPATH})
   ENDIF(WITH_JACK)
+  IF(WITH_SNDFILE)
+    LINK_DIRECTORIES(${SNDFILE_LIBPATH})
+  ENDIF(WITH_SNDFILE)
   IF(WITH_FFTW3)
     LINK_DIRECTORIES(${FFTW3_LIBPATH})
   ENDIF(WITH_FFTW3)
@@ -118,6 +121,9 @@ MACRO(SETUP_LIBLINKS
   IF(WITH_JACK)
     TARGET_LINK_LIBRARIES(${target} ${JACK_LIB})
   ENDIF(WITH_JACK)
+  IF(WITH_SNDFILE)
+    TARGET_LINK_LIBRARIES(${target} ${SNDFILE_LIB})
+  ENDIF(WITH_SNDFILE)
   IF(WITH_SDL)
     TARGET_LINK_LIBRARIES(${target} ${SDL_LIBRARY})
   ENDIF(WITH_SDL)
index 2f12d34..7196049 100644 (file)
@@ -34,11 +34,11 @@ IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
 MESSAGE(FATAL_ERROR "CMake generation for blender is not allowed within the source directory! 
 Remove the CMakeCache.txt file and try again from another folder, e.g.: 
 
-   rm CMakeCache.txt 
-   cd ..
-   mkdir cmake-make 
-   cd cmake-make
-   cmake -G \"Unix Makefiles\" ../blender
+       rm CMakeCache.txt 
+       cd ..
+       mkdir cmake-make 
+       cd cmake-make
+       cmake -G \"Unix Makefiles\" ../blender
 ")
 ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
 
@@ -70,11 +70,13 @@ OPTION(WITH_OPENMP        "Enable OpenMP (has to be supported by the compiler)"
 OPTION(WITH_WEBPLUGIN     "Enable Web Plugin (Unix only)" OFF)
 OPTION(WITH_FFTW3         "Enable FFTW3 support" OFF)
 OPTION(WITH_JACK          "Enable Jack Support (http://www.jackaudio.org)" OFF)
-OPTION(WITH_CXX_GUARDEDALLOC "" OFF)
+OPTION(WITH_SNDFILE       "Enable libsndfile Support (http://www.mega-nerd.com/libsndfile)" OFF)
+OPTION(WITH_CXX_GUARDEDALLOC "Enable GuardedAlloc for C++ memory allocation" OFF)
+# OPTION(WITH_BUILDINFO     "Include extra build details" ON)
 OPTION(WITH_INSTALL       "Install accompanying scripts and language files needed to run blender" ON)
 
 IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
-  MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE")
+       MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE")
 ENDIF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
 
 # For alternate Python locations the commandline can be used to override detected/default cache settings, e.g:
@@ -93,398 +95,434 @@ INCLUDE(CMake/macros.cmake)
 #Platform specifics
 
 IF(UNIX AND NOT APPLE)
-  IF(WITH_OPENAL)
-    FIND_PACKAGE(OpenAL)
-    IF(OPENAL_FOUND)
-      SET(WITH_OPENAL ON)
-    ELSE(OPENAL_FOUND)
-      SET(WITH_OPENAL OFF)
-    ENDIF(OPENAL_FOUND)
-  ENDIF(WITH_OPENAL)
-
-  IF(WITH_JACK)
-    SET(JACK /usr)
-    SET(JACK_INC ${JACK}/include/jack)
-    SET(JACK_LIB jack)
-    SET(JACK_LIBPATH ${JACK}/lib)
-  ENDIF(WITH_JACK)
-
-  FIND_LIBRARY(INTL_LIBRARY
-    NAMES intl
-    PATHS
-    /sw/lib
-  )
-  FIND_LIBRARY(ICONV_LIBRARY
-    NAMES iconv
-    PATHS
-    /sw/lib
-  )
+       IF(WITH_OPENAL)
+               FIND_PACKAGE(OpenAL)
+               IF(OPENAL_FOUND)
+                       SET(WITH_OPENAL ON)
+               ELSE(OPENAL_FOUND)
+                       SET(WITH_OPENAL OFF)
+               ENDIF(OPENAL_FOUND)
+       ENDIF(WITH_OPENAL)
+
+       IF(WITH_JACK)
+               SET(JACK /usr)
+               SET(JACK_INC ${JACK}/include/jack)
+               SET(JACK_LIB jack)
+               SET(JACK_LIBPATH ${JACK}/lib)
+       ENDIF(WITH_JACK)
+
+       IF(WITH_SNDFILE)
+       SET(SNDFILE /usr)
+       SET(SNDFILE_INC ${SNDFILE}/include)
+       SET(SNDFILE_LIB sndfile)
+       SET(SNDFILE_LIBPATH ${SNDFILE}/lib)
+       ENDIF(WITH_SNDFILE)
+
+       FIND_LIBRARY(INTL_LIBRARY
+               NAMES intl
+               PATHS
+               /sw/lib
+       )
+       FIND_LIBRARY(ICONV_LIBRARY
+               NAMES iconv
+               PATHS
+               /sw/lib
+       )
   
-  IF(INTL_LIBRARY AND ICONV_LIBRARY)
-    SET(GETTEXT_LIB ${INTL_LIBRARY} ${ICONV_LIBRARY})
-  ENDIF(INTL_LIBRARY AND ICONV_LIBRARY)
-
-  FIND_PACKAGE(Freetype)
-  # UNSET(FREETYPE_INCLUDE_DIRS CACHE) # cant use
-
-  # No way to set py31. remove for now.
-  # FIND_PACKAGE(PythonLibs)
-  SET(PYTHON /usr)
-  SET(PYTHON_VERSION 3.1)
-  SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}" CACHE STRING "")
-  # SET(PYTHON_BINARY python) # not used yet
-  SET(PYTHON_LIB python${PYTHON_VERSION} CACHE STRING "")
-  SET(PYTHON_LIBPATH ${PYTHON}/lib CACHE STRING "")
+       IF(INTL_LIBRARY AND ICONV_LIBRARY)
+               SET(GETTEXT_LIB ${INTL_LIBRARY} ${ICONV_LIBRARY})
+       ENDIF(INTL_LIBRARY AND ICONV_LIBRARY)
+
+       FIND_PACKAGE(Freetype)
+       # UNSET(FREETYPE_INCLUDE_DIRS CACHE) # cant use
+
+       # No way to set py31. remove for now.
+       # FIND_PACKAGE(PythonLibs)
+       SET(PYTHON /usr)
+       SET(PYTHON_VERSION 3.1)
+       SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}" CACHE STRING "")
+       # SET(PYTHON_BINARY python) # not used yet
+       SET(PYTHON_LIB python${PYTHON_VERSION} CACHE STRING "")
+       SET(PYTHON_LIBPATH ${PYTHON}/lib CACHE STRING "")
   
-  # FIND_PACKAGE(PythonInterp) # not used yet
-  # SET(PYTHON_BINARY ${PYTHON_EXECUTABLE} CACHE STRING "")
+       # FIND_PACKAGE(PythonInterp) # not used yet
+       # SET(PYTHON_BINARY ${PYTHON_EXECUTABLE} CACHE STRING "")
   
-  SET(PYTHON_LINKFLAGS "-Xlinker -export-dynamic")
-
-  IF(WITH_SDL)
-    FIND_PACKAGE(SDL)
-    # UNSET(SDLMAIN_LIBRARY CACHE)
-    IF(NOT SDL_FOUND)
-      SET(WITH_SDL OFF)
-    ENDIF(NOT SDL_FOUND)
-  ENDIF(WITH_SDL)
-
-  FIND_PATH(OPENEXR_INC
-    ImfXdr.h
-    PATHS
-    /usr/local/include/OpenEXR
-    /usr/include/OpenEXR
-    /sw/include/OpenEXR
-    /opt/local/include/OpenEXR
-    /opt/csw/include/OpenEXR
-    /opt/include/OpenEXR
-  )
-  SET(OPENEXR_LIB Half IlmImf Iex Imath)
-
-  SET(FFMPEG /usr)
-  SET(FFMPEG_INC ${FFMPEG}/include)
-  SET(FFMPEG_LIB avformat avcodec avutil avdevice swscale)
-  SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
+       SET(PYTHON_LINKFLAGS "-Xlinker -export-dynamic")
+
+       IF(WITH_SDL)
+               FIND_PACKAGE(SDL)
+               # UNSET(SDLMAIN_LIBRARY CACHE)
+               IF(NOT SDL_FOUND)
+                       SET(WITH_SDL OFF)
+               ENDIF(NOT SDL_FOUND)
+       ENDIF(WITH_SDL)
+
+       FIND_PATH(OPENEXR_INC
+               ImfXdr.h
+               PATHS
+               /usr/local/include/OpenEXR
+               /usr/include/OpenEXR
+               /sw/include/OpenEXR
+               /opt/local/include/OpenEXR
+               /opt/csw/include/OpenEXR
+               /opt/include/OpenEXR
+       )
+       SET(OPENEXR_LIB Half IlmImf Iex Imath)
+
+       SET(FFMPEG /usr)
+       SET(FFMPEG_INC ${FFMPEG}/include)
+       SET(FFMPEG_LIB avformat avcodec avutil avdevice swscale)
+       SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
   
-  IF(WITH_FFTW3)
-    SET(FFTW3 /usr)
-    SET(FFTW3_INC ${FFTW3}/include)
-    SET(FFTW3_LIB fftw3)
-    SET(FFTW3_LIBPATH ${FFTW3}/lib)
-  ENDIF(WITH_FFTW3)
+       IF(WITH_FFTW3)
+               SET(FFTW3 /usr)
+               SET(FFTW3_INC ${FFTW3}/include)
+               SET(FFTW3_LIB fftw3)
+               SET(FFTW3_LIBPATH ${FFTW3}/lib)
+       ENDIF(WITH_FFTW3)
 
-  SET(LIBSAMPLERATE /usr)
-  SET(LIBSAMPLERATE_INC ${LIBSAMPLERATE}/include)
-  SET(LIBSAMPLERATE_LIB samplerate)
-  SET(LIBSAMPLERATE_LIBPATH ${LIBSAMPLERATE}/lib)
+       SET(LIBSAMPLERATE /usr)
+       SET(LIBSAMPLERATE_INC ${LIBSAMPLERATE}/include)
+       SET(LIBSAMPLERATE_LIB samplerate)
+       SET(LIBSAMPLERATE_LIBPATH ${LIBSAMPLERATE}/lib)
 
-  FIND_PACKAGE(JPEG REQUIRED)
+       FIND_PACKAGE(JPEG REQUIRED)
 
-  FIND_PACKAGE(PNG REQUIRED)
+       FIND_PACKAGE(PNG REQUIRED)
 
-  FIND_PACKAGE(ZLIB REQUIRED)
+       FIND_PACKAGE(ZLIB REQUIRED)
 
-  # Could use ${X11_Xinput_LIB} ${X11_X11_LIB} too
-  SET(LLIBS "-lXi -lutil -lc -lm -lpthread -lstdc++ -lX11")
+       # Could use ${X11_Xinput_LIB} ${X11_X11_LIB} too
+       SET(LLIBS "-lXi -lutil -lc -lm -lpthread -lstdc++ -lX11")
 
-  IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
-    # BSD's dont use libdl.so
-    SET(LLIBS "${LLIBS} -ldl")
-  ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
+       IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
+               # BSD's dont use libdl.so
+               SET(LLIBS "${LLIBS} -ldl")
+       ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
 
-  IF(WITH_OPENMP)
-    SET(LLIBS "${LLIBS} -lgomp")
-    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
-  ENDIF(WITH_OPENMP)
+       IF(WITH_OPENMP)
+               SET(LLIBS "${LLIBS} -lgomp")
+               SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
+               SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
+       ENDIF(WITH_OPENMP)
 
 
-  SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing -DXP_UNIX -Wno-char-subscripts")
+       SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing -DXP_UNIX -Wno-char-subscripts")
 
-  SET(PLATFORM_LINKFLAGS "-pthread")
+       SET(PLATFORM_LINKFLAGS "-pthread")
 
-  # Better warnings
-  SET(C_WARNINGS "-Wall -Wno-char-subscripts -Wpointer-arith -Wcast-align -Wnested-externs -Wdeclaration-after-statement")
-  SET(CXX_WARNINGS "-Wall -Wno-invalid-offsetof -Wno-sign-compare")
+       # Better warnings
+       SET(C_WARNINGS "-Wall -Wno-char-subscripts -Wpointer-arith -Wcast-align -Wdeclaration-after-statement")
+       SET(CXX_WARNINGS "-Wall -Wno-invalid-offsetof -Wno-sign-compare")
 
-  INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR} ${PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
+       INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR} ${PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
 ENDIF(UNIX AND NOT APPLE)
 
 IF(WIN32)
 
-  # this file is included anyway when building under Windows with cl.exe
-  #  INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake)
+       # this file is included anyway when building under Windows with cl.exe
+       #  INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake)
   
-  SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/windows)
-
-  # Setup 64bit and 64bit windows systems
-  IF(CMAKE_CL_64)
-    message("64 bit compiler detected.")
-    SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/win64)
-  ENDIF(CMAKE_CL_64)
-
-  SET(PYTHON ${LIBDIR}/python)
-  SET(PYTHON_VERSION 3.1)
-  SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}")
-  # SET(PYTHON_BINARY python) # not used yet
-  SET(PYTHON_LIB python31)
-  SET(PYTHON_LIBPATH ${PYTHON}/lib)
-
-  IF(CMAKE_CL_64)
-    SET(WITH_OPENAL OFF)
-  ELSE(CMAKE_CL_64)
-    #SET(WITH_OPENAL ON)
-    SET(OPENAL ${LIBDIR}/openal)
-    SET(OPENAL_INCLUDE_DIR ${OPENAL}/include)
-    SET(OPENAL_LIBRARY wrap_oal)
-    SET(OPENAL_LIBPATH ${OPENAL}/lib)
-  ENDIF(CMAKE_CL_64)
-
-  IF(WITH_JACK)
-    SET(JACK ${LIBDIR}/jack)
-    SET(JACK_INC ${JACK}/include/jack)
-    SET(JACK_LIB jack)
-    SET(JACK_LIBPATH ${JACK}/lib)
-  ENDIF(WITH_JACK)
-
-  IF(CMAKE_CL_64)
-    SET(PNG_LIBRARIES libpng)
-  ELSE(CMAKE_CL_64)
-    SET(PNG_LIBRARIES libpng_st)
-  ENDIF(CMAKE_CL_64)
-  SET(JPEG_LIBRARY libjpeg)
-
-  SET(ZLIB ${LIBDIR}/zlib)
-  SET(ZLIB_INC ${ZLIB}/include)
-  SET(ZLIB_LIBRARIES zlib)
-  SET(ZLIB_LIBPATH ${ZLIB}/lib)
+       SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/windows)
+
+       # Setup 64bit and 64bit windows systems
+       IF(CMAKE_CL_64)
+               message("64 bit compiler detected.")
+               SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/win64)
+       ENDIF(CMAKE_CL_64)
+
+       SET(PYTHON ${LIBDIR}/python)
+       SET(PYTHON_VERSION 3.1)
+       SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}")
+       # SET(PYTHON_BINARY python) # not used yet
+       SET(PYTHON_LIB python31)
+       SET(PYTHON_LIBPATH ${PYTHON}/lib)
+
+       IF(CMAKE_CL_64)
+               SET(WITH_OPENAL OFF)
+       ELSE(CMAKE_CL_64)
+               #SET(WITH_OPENAL ON)
+               SET(OPENAL ${LIBDIR}/openal)
+               SET(OPENAL_INCLUDE_DIR ${OPENAL}/include)
+               SET(OPENAL_LIBRARY wrap_oal)
+               SET(OPENAL_LIBPATH ${OPENAL}/lib)
+       ENDIF(CMAKE_CL_64)
+
+       IF(WITH_JACK)
+               SET(JACK ${LIBDIR}/jack)
+               SET(JACK_INC ${JACK}/include/jack ${JACK}/include)
+               SET(JACK_LIB libjack)
+               SET(JACK_LIBPATH ${JACK}/lib)
+       ENDIF(WITH_JACK)
+
+       IF(WITH_SNDFILE)
+               SET(SNDFILE ${LIBDIR}/sndfile)
+               SET(SNDFILE_INC ${SNDFILE}/include)
+               SET(SNDFILE_LIB libsndfile-1)
+               SET(SNDFILE_LIBPATH ${SNDFILE}/lib)
+       ENDIF(WITH_SNDFILE)
+
+       IF(CMAKE_CL_64)
+               SET(PNG_LIBRARIES libpng)
+       ELSE(CMAKE_CL_64)
+               SET(PNG_LIBRARIES libpng_st)
+       ENDIF(CMAKE_CL_64)
+       SET(JPEG_LIBRARY libjpeg)
+
+       SET(ZLIB ${LIBDIR}/zlib)
+       SET(ZLIB_INC ${ZLIB}/include)
+       IF(CMAKE_CL_64)
+               SET(ZLIB_LIBRARIES libz)
+       ELSE(CMAKE_CL_64)
+               SET(ZLIB_LIBRARIES zlib)
+       ENDIF(CMAKE_CL_64)
+       SET(ZLIB_LIBPATH ${ZLIB}/lib)
   
-  SET(PTHREADS ${LIBDIR}/pthreads)
-  SET(PTHREADS_INC ${PTHREADS}/include)
-  SET(PTHREADS_LIB pthreadVC2)
-  SET(PTHREADS_LIBPATH ${PTHREADS}/lib)
+       SET(PTHREADS ${LIBDIR}/pthreads)
+       SET(PTHREADS_INC ${PTHREADS}/include)
+       SET(PTHREADS_LIB pthreadVC2)
+       SET(PTHREADS_LIBPATH ${PTHREADS}/lib)
   
-  SET(ICONV ${LIBDIR}/iconv)
-  SET(ICONV_INC ${ICONV}/include)
-  SET(ICONV_LIB iconv)
-  SET(ICONV_LIBPATH ${ICONV}/lib)
+       SET(ICONV ${LIBDIR}/iconv)
+       SET(ICONV_INC ${ICONV}/include)
+       SET(ICONV_LIB iconv)
+       SET(ICONV_LIBPATH ${ICONV}/lib)
   
-  IF(WITH_FFTW3)
-    SET(FFTW3 ${LIBDIR}/fftw3)
-    SET(FFTW3_INC ${FFTW3}/include)
-    SET(FFTW3_LIB libfftw)
-    SET(FFTW3_LIBPATH ${FFTW3}/lib)
-  ENDIF(WITH_FFTW3)
+       IF(WITH_FFTW3)
+               SET(FFTW3 ${LIBDIR}/fftw3)
+               SET(FFTW3_INC ${FFTW3}/include)
+               SET(FFTW3_LIB libfftw)
+               SET(FFTW3_LIBPATH ${FFTW3}/lib)
+       ENDIF(WITH_FFTW3)
   
-  SET(GETTEXT ${LIBDIR}/gettext)
-  SET(GETTEXT_INC ${GETTEXT}/include)
-  IF(CMAKE_CL_64)
-    SET(GETTEXT_LIB gettextlib)
-  ELSE(CMAKE_CL_64)
-    SET(GETTEXT_LIB gnu_gettext)
-  ENDIF(CMAKE_CL_64)
-  SET(GETTEXT_LIBPATH ${GETTEXT}/lib)
-
-  SET(FREETYPE ${LIBDIR}/freetype)
-  SET(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
-  SET(FREETYPE_LIBPATH ${FREETYPE}/lib)
-  SET(FREETYPE_LIBRARY freetype2ST)
+       SET(GETTEXT ${LIBDIR}/gettext)
+       SET(GETTEXT_INC ${GETTEXT}/include)
+       IF(CMAKE_CL_64)
+               SET(GETTEXT_LIB gettext)
+       ELSE(CMAKE_CL_64)
+               SET(GETTEXT_LIB gnu_gettext)
+       ENDIF(CMAKE_CL_64)
+       SET(GETTEXT_LIBPATH ${GETTEXT}/lib)
+
+       SET(FREETYPE ${LIBDIR}/freetype)
+       SET(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
+       SET(FREETYPE_LIBPATH ${FREETYPE}/lib)
+       SET(FREETYPE_LIBRARY freetype2ST)
   
-  SET(OPENEXR ${LIBDIR}/openexr)
-  SET(OPENEXR_INC ${OPENEXR}/include ${OPENEXR}/include/IlmImf ${OPENEXR}/include/Iex ${OPENEXR}/include/Imath)
-  SET(OPENEXR_LIB Iex Half IlmImf Imath IlmThread)
-  IF (MSVC80)
-    SET(OPENEXR_LIBPATH ${OPENEXR}/lib_vs2005)
-  ELSE (MSVC80)
-    SET(OPENEXR_LIBPATH ${OPENEXR}/lib_msvc)
-  ENDIF(MSVC80)
-  IF (MSVC90)
-    SET(OPENEXR_LIBPATH ${OPENEXR}/lib_vs2008)
-  ENDIF(MSVC90)
+       SET(OPENEXR ${LIBDIR}/openexr)
+       SET(OPENEXR_INC ${OPENEXR}/include ${OPENEXR}/include/IlmImf ${OPENEXR}/include/Iex ${OPENEXR}/include/Imath)
+       SET(OPENEXR_LIB Iex Half IlmImf Imath IlmThread)
+       IF (MSVC80)
+               SET(OPENEXR_LIBPATH ${OPENEXR}/lib_vs2005)
+       ELSE (MSVC80)
+               SET(OPENEXR_LIBPATH ${OPENEXR}/lib_msvc)
+       ENDIF(MSVC80)
+       IF (MSVC90)
+               SET(OPENEXR_LIBPATH ${OPENEXR}/lib_vs2008)
+       ENDIF(MSVC90)
 
   
-  SET(QUICKTIME ${LIBDIR}/QTDevWin)
-  SET(QUICKTIME_INC ${QUICKTIME}/CIncludes)
-  SET(QUICKTIME_LIB qtmlClient)
-  SET(QUICKTIME_LIBPATH ${QUICKTIME}/Libraries)
-
-  SET(FFMPEG ${LIBDIR}/ffmpeg)
-  SET(FFMPEG_INC ${FFMPEG}/include)
-  SET(FFMPEG_LIB avcodec-52 avformat-52 avdevice-52 avutil-50 swscale-0)
-  SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
-
-  SET(LIBSAMPLERATE ${LIBDIR}/samplerate)
-  SET(LIBSAMPLERATE_INC ${LIBSAMPLERATE}/include)
-  SET(LIBSAMPLERATE_LIB libsamplerate)
-  SET(LIBSAMPLERATE_LIBPATH ${LIBSAMPLERATE}/lib)
-
-  IF(CMAKE_CL_64)
-    SET(LLIBS kernel32 user32 vfw32 winmm ws2_32 )
-  ELSE(CMAKE_CL_64)
-    SET(LLIBS kernel32 user32 gdi32 comdlg32 advapi32 shell32 ole32 oleaut32 uuid ws2_32 vfw32 winmm)
-  ENDIF(CMAKE_CL_64)
-
-  SET(CMAKE_CXX_FLAGS_DEBUG "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /D_DEBUG /Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /ZI /J" CACHE STRING "MSVC MT flags " FORCE)
-  SET(CMAKE_CXX_FLAGS_RELEASE "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /O2 /Ob2 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
-  SET(CMAKE_CXX_FLAGS_MINSIZEREL "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /O1 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
-  SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /O2 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
-  SET(CMAKE_C_FLAGS_DEBUG "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /D_DEBUG /Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /ZI /J" CACHE STRING "MSVC MT flags " FORCE)
-  SET(CMAKE_C_FLAGS_RELEASE "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /O2 /Ob2 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
-  SET(CMAKE_C_FLAGS_MINSIZEREL "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /O1 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
-  SET(CMAKE_C_FLAGS_RELWITHDEBINFO "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /O2 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
-
-  IF(WITH_OPENMP)
-    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /openmp ")
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /openmp ")
-  ENDIF(WITH_OPENMP)
-
-  SET(SDL ${LIBDIR}/sdl)
-  SET(SDL_INCLUDE_DIR ${SDL}/include)
-  SET(SDL_LIBRARY SDL)
-  SET(SDL_LIBPATH ${SDL}/lib)
-
-  SET(PNG "${LIBDIR}/png")
-  SET(PNG_INC "${PNG}/include")
-  SET(PNG_LIBPATH ${PNG}/lib)
-
-  SET(JPEG "${LIBDIR}/jpeg")
-  SET(JPEG_INC "${JPEG}/include")
-  SET(JPEG_LIBPATH ${JPEG}/lib)
-
-  SET(TIFF ${LIBDIR}/tiff)
-  SET(TIFF_INC ${TIFF}/include)
+       SET(QUICKTIME ${LIBDIR}/QTDevWin)
+       SET(QUICKTIME_INC ${QUICKTIME}/CIncludes)
+       SET(QUICKTIME_LIB qtmlClient)
+       SET(QUICKTIME_LIBPATH ${QUICKTIME}/Libraries)
+
+       SET(FFMPEG ${LIBDIR}/ffmpeg)
+       SET(FFMPEG_INC ${FFMPEG}/include ${FFMPEG}/include/msvc)
+       SET(FFMPEG_LIB avcodec-52 avformat-52 avdevice-52 avutil-50 swscale-0)
+       SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
+
+       SET(LIBSAMPLERATE ${LIBDIR}/samplerate)
+       SET(LIBSAMPLERATE_INC ${LIBSAMPLERATE}/include)
+       SET(LIBSAMPLERATE_LIB libsamplerate)
+       SET(LIBSAMPLERATE_LIBPATH ${LIBSAMPLERATE}/lib)
+
+       IF(CMAKE_CL_64)
+               SET(LLIBS kernel32 user32 vfw32 winmm ws2_32 )
+       ELSE(CMAKE_CL_64)
+               SET(LLIBS kernel32 user32 gdi32 comdlg32 advapi32 shell32 ole32 oleaut32 uuid ws2_32 vfw32 winmm)
+       ENDIF(CMAKE_CL_64)
+
+       SET(CMAKE_CXX_FLAGS_DEBUG "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /D_DEBUG /Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /ZI /J" CACHE STRING "MSVC MT flags " FORCE)
+       SET(CMAKE_CXX_FLAGS_RELEASE "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /O2 /Ob2 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
+       SET(CMAKE_CXX_FLAGS_MINSIZEREL "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /O1 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
+       SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /O2 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
+       SET(CMAKE_C_FLAGS_DEBUG "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /D_DEBUG /Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /ZI /J" CACHE STRING "MSVC MT flags " FORCE)
+       SET(CMAKE_C_FLAGS_RELEASE "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /O2 /Ob2 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
+       SET(CMAKE_C_FLAGS_MINSIZEREL "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /O1 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
+       SET(CMAKE_C_FLAGS_RELWITHDEBINFO "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /O2 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
+
+       IF(WITH_OPENMP)
+               SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /openmp ")
+               SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /openmp ")
+       ENDIF(WITH_OPENMP)
+
+       SET(SDL ${LIBDIR}/sdl)
+       SET(SDL_INCLUDE_DIR ${SDL}/include)
+       SET(SDL_LIBRARY SDL)
+       SET(SDL_LIBPATH ${SDL}/lib)
+
+       SET(PNG "${LIBDIR}/png")
+       SET(PNG_INC "${PNG}/include")
+       SET(PNG_LIBPATH ${PNG}/lib)
+
+       SET(JPEG "${LIBDIR}/jpeg")
+       SET(JPEG_INC "${JPEG}/include")
+       SET(JPEG_LIBPATH ${JPEG}/lib)
+
+       SET(TIFF ${LIBDIR}/tiff)
+       SET(TIFF_INC ${TIFF}/include)
   
-  SET(WINTAB_INC ${LIBDIR}/wintab/include) 
+       SET(WINTAB_INC ${LIBDIR}/wintab/include) 
 
-  IF(CMAKE_CL_64)
-    SET(PLATFORM_LINKFLAGS "/MANIFEST:NO /MANIFESTUAC:NO /MACHINE:X64 /NODEFAULTLIB:libc.lib;MSVCRT.lib ")
-  ELSE(CMAKE_CL_64)
-    SET(PLATFORM_LINKFLAGS "/NODEFAULTLIB:libc.lib ")
-  ENDIF(CMAKE_CL_64)
+       IF(CMAKE_CL_64)
+               SET(PLATFORM_LINKFLAGS "/MACHINE:X64 /NODEFAULTLIB:libc.lib;MSVCRT.lib ")
+       ELSE(CMAKE_CL_64)
+               SET(PLATFORM_LINKFLAGS "/NODEFAULTLIB:libc.lib ")
+       ENDIF(CMAKE_CL_64)
   
-  SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libcmt.lib;libc.lib ")
+       SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libcmt.lib;libc.lib ")
 ENDIF(WIN32)
 
 IF(APPLE)
-  IF(CMAKE_OSX_ARCHITECTURES MATCHES i386)
-    SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-8.x.i386)
-  ELSE(CMAKE_OSX_ARCHITECTURES MATCHES i386)
-    SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-6.1-powerpc)
-  ENDIF(CMAKE_OSX_ARCHITECTURES MATCHES i386)
-
-  IF(WITH_OPENAL)
-    FIND_PACKAGE(OpenAL)
-    IF(OPENAL_FOUND)
-      SET(WITH_OPENAL ON)
-    ELSE(OPENAL_FOUND)
-      SET(WITH_OPENAL OFF)
-    ENDIF(OPENAL_FOUND)
-  ENDIF(WITH_OPENAL)
-
-  IF(WITH_JACK)
-    SET(JACK /usr)
-    SET(JACK_INC ${JACK}/include/jack)
-    SET(JACK_LIB jack)
-    SET(JACK_LIBPATH ${JACK}/lib)
-  ENDIF(WITH_JACK)
-
-  SET(PYTHON_VERSION 3.1)
-
-  IF(PYTHON_VERSION MATCHES 3.1)
-    # we use precompiled libraries for py 3.1 and up by default
-
-    SET(PYTHON ${LIBDIR}/python)
-    SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}" CACHE STRING "")
-    # SET(PYTHON_BINARY "${PYTHON}/bin/python${PYTHON_VERSION}" CACHE STRING "") # not used yet
-    SET(PYTHON_LIB python${PYTHON_VERSION})
-    SET(PYTHON_LIBPATH "${PYTHON}/lib/python${PYTHON_VERSION}" CACHE STRING "")
-    #    SET(PYTHON_LINKFLAGS "-u _PyMac_Error")  # won't  build with this enabled
-  ELSE(PYTHON_VERSION MATCHES 3.1)
-    # otherwise, use custom system framework
-
-    SET(PYTHON /System/Library/Frameworks/Python.framework/Versions/)
-    SET(PYTHON_VERSION 2.5)
-    SET(PYTHON_INC "${PYTHON}${PYTHON_VERSION}/include/python${PYTHON_VERSION}" CACHE STRING "")
-    # SET(PYTHON_BINARY ${PYTHON}${PYTHON_VERSION}/bin/python${PYTHON_VERSION} CACHE STRING "") # not used yet
-    SET(PYTHON_LIB "")
-    SET(PYTHON_LIBPATH ${PYTHON}${PYTHON_VERSION}/lib/python${PYTHON_VERSION}/config CACHE STRING "")
-    SET(PYTHON_LINKFLAGS "-u _PyMac_Error -framework System -framework Python")
-  ENDIF(PYTHON_VERSION MATCHES 3.1)
-
-  SET(GETTEXT ${LIBDIR}/gettext)
-  SET(GETTEXT_INC "${GETTEXT}/include")
-  SET(GETTEXT_LIB intl iconv)
-  SET(GETTEXT_LIBPATH ${GETTEXT}/lib)
+       IF(CMAKE_OSX_ARCHITECTURES MATCHES i386)
+               SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-8.x.i386)
+       ELSE(CMAKE_OSX_ARCHITECTURES MATCHES i386)
+               SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-6.1-powerpc)
+       ENDIF(CMAKE_OSX_ARCHITECTURES MATCHES i386)
+
+       IF(WITH_OPENAL)
+               FIND_PACKAGE(OpenAL)
+               IF(OPENAL_FOUND)
+                       SET(WITH_OPENAL ON)
+               ELSE(OPENAL_FOUND)
+                       SET(WITH_OPENAL OFF)
+               ENDIF(OPENAL_FOUND)
+       ENDIF(WITH_OPENAL)
+
+       IF(WITH_JACK)
+               SET(JACK /usr)
+               SET(JACK_INC ${JACK}/include/jack)
+               SET(JACK_LIB jack)
+               SET(JACK_LIBPATH ${JACK}/lib)
+       ENDIF(WITH_JACK)
+
+       IF(WITH_SNDFILE)
+               SET(SNDFILE /usr)
+               SET(SNDFILE_INC ${SNDFILE}/include)
+               SET(SNDFILE_LIB sndfile)
+               SET(SNDFILE_LIBPATH ${SNDFILE}/lib)
+       ENDIF(WITH_SNDFILE)
+
+       SET(PYTHON_VERSION 3.1)
+
+       IF(PYTHON_VERSION MATCHES 3.1)
+               # we use precompiled libraries for py 3.1 and up by default
+
+               SET(PYTHON ${LIBDIR}/python)
+               SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}" CACHE STRING "")
+               # SET(PYTHON_BINARY "${PYTHON}/bin/python${PYTHON_VERSION}" CACHE STRING "") # not used yet
+               SET(PYTHON_LIB python${PYTHON_VERSION})
+               SET(PYTHON_LIBPATH "${PYTHON}/lib/python${PYTHON_VERSION}" CACHE STRING "")
+               #    SET(PYTHON_LINKFLAGS "-u _PyMac_Error")  # won't  build with this enabled
+       ELSE(PYTHON_VERSION MATCHES 3.1)
+               # otherwise, use custom system framework
+
+               SET(PYTHON /System/Library/Frameworks/Python.framework/Versions/)
+               SET(PYTHON_VERSION 2.5)
+               SET(PYTHON_INC "${PYTHON}${PYTHON_VERSION}/include/python${PYTHON_VERSION}" CACHE STRING "")
+               # SET(PYTHON_BINARY ${PYTHON}${PYTHON_VERSION}/bin/python${PYTHON_VERSION} CACHE STRING "") # not used yet
+               SET(PYTHON_LIB "")
+               SET(PYTHON_LIBPATH ${PYTHON}${PYTHON_VERSION}/lib/python${PYTHON_VERSION}/config CACHE STRING "")
+               SET(PYTHON_LINKFLAGS "-u _PyMac_Error -framework System -framework Python")
+       ENDIF(PYTHON_VERSION MATCHES 3.1)
+
+       SET(GETTEXT ${LIBDIR}/gettext)
+       SET(GETTEXT_INC "${GETTEXT}/include")
+       SET(GETTEXT_LIB intl iconv)
+       SET(GETTEXT_LIBPATH ${GETTEXT}/lib)
   
-  IF(WITH_FFTW3)
-    SET(FFTW3 ${LIBDIR}/fftw3)
-    SET(FFTW3_INC ${FFTW3}/include)
-    SET(FFTW3_LIB libfftw)
-    SET(FFTW3_LIBPATH ${FFTW3}/lib)
-  ENDIF(WITH_FFTW3)
-
-  SET(PNG_LIBRARIES png)
-  SET(JPEG_LIBRARY jpeg)
-
-  SET(ZLIB /usr)
-  SET(ZLIB_INC "${ZLIB}/include")
-  SET(ZLIB_LIBRARIES z)
-
-  SET(FREETYPE ${LIBDIR}/freetype)
-  SET(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
-  SET(FREETYPE_LIBPATH ${FREETYPE}/lib)
-  SET(FREETYPE_LIBRARY freetype)
-
-  SET(OPENEXR ${LIBDIR}/openexr)
-  SET(OPENEXR_INC ${OPENEXR}/include/OpenEXR ${OPENEXR}/include)
-  SET(OPENEXR_LIB Iex Half IlmImf Imath IlmThread)
-  SET(OPENEXR_LIBPATH ${OPENEXR}/lib)
-
-  SET(FFMPEG ${LIBDIR}/ffmpeg)
-  SET(FFMPEG_INC ${CMAKE_SOURCE_DIR}/extern/ffmpeg)
-  SET(FFMPEG_LIB avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore)
-  SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
-
-  SET(LIBSAMPLERATE ${LIBDIR}/samplerate)
-  SET(LIBSAMPLERATE_INC ${LIBSAMPLERATE}/include)
-  SET(LIBSAMPLERATE_LIB samplerate)
-  SET(LIBSAMPLERATE_LIBPATH ${LIBSAMPLERATE}/lib)
-
-  SET(LLIBS stdc++ SystemStubs)
-
-  SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
-  SET(PLATFORM_LINKFLAGS "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Carbon -framework AGL -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework QuickTime")
-
-  IF(WITH_OPENMP)
-    SET(LLIBS "${LLIBS} -lgomp ")
-    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp ")
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp ")
-  ENDIF(WITH_OPENMP)
-
-  SET(SDL ${LIBDIR}/sdl)
-  SET(SDL_INCLUDE_DIR ${SDL}/include)
-  SET(SDL_LIBRARY SDL)
-  SET(SDL_LIBPATH ${SDL}/lib)
-
-  SET(PNG "${LIBDIR}/png")
-  SET(PNG_INC "${PNG}/include")
-  SET(PNG_LIBPATH ${PNG}/lib)
-
-  SET(JPEG "${LIBDIR}/jpeg")
-  SET(JPEG_INC "${JPEG}/include")
-  SET(JPEG_LIBPATH ${JPEG}/lib)
-
-  SET(TIFF ${LIBDIR}/tiff)
-  SET(TIFF_INC ${TIFF}/include)
-
-  SET(EXETYPE MACOSX_BUNDLE)
+       IF(WITH_FFTW3)
+               SET(FFTW3 ${LIBDIR}/fftw3)
+               SET(FFTW3_INC ${FFTW3}/include)
+               SET(FFTW3_LIB libfftw)
+               SET(FFTW3_LIBPATH ${FFTW3}/lib)
+       ENDIF(WITH_FFTW3)
+
+       SET(PNG_LIBRARIES png)
+       SET(JPEG_LIBRARY jpeg)
+
+       SET(ZLIB /usr)
+       SET(ZLIB_INC "${ZLIB}/include")
+       SET(ZLIB_LIBRARIES z)
+
+       SET(FREETYPE ${LIBDIR}/freetype)
+       SET(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
+       SET(FREETYPE_LIBPATH ${FREETYPE}/lib)
+       SET(FREETYPE_LIBRARY freetype)
+
+       SET(OPENEXR ${LIBDIR}/openexr)
+       SET(OPENEXR_INC ${OPENEXR}/include/OpenEXR ${OPENEXR}/include)
+       SET(OPENEXR_LIB Iex Half IlmImf Imath IlmThread)
+       SET(OPENEXR_LIBPATH ${OPENEXR}/lib)
+
+       SET(FFMPEG ${LIBDIR}/ffmpeg)
+       SET(FFMPEG_INC ${CMAKE_SOURCE_DIR}/extern/ffmpeg)
+       SET(FFMPEG_LIB avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore)
+       SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
+
+       SET(LIBSAMPLERATE ${LIBDIR}/samplerate)
+       SET(LIBSAMPLERATE_INC ${LIBSAMPLERATE}/include)
+       SET(LIBSAMPLERATE_LIB samplerate)
+       SET(LIBSAMPLERATE_LIBPATH ${LIBSAMPLERATE}/lib)
+
+       SET(LLIBS stdc++ SystemStubs)
+
+       SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
+       SET(PLATFORM_LINKFLAGS "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Carbon -framework AGL -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework QuickTime")
+
+       IF(WITH_OPENMP)
+               SET(LLIBS "${LLIBS} -lgomp ")
+               SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp ")
+               SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp ")
+       ENDIF(WITH_OPENMP)
+
+       SET(SDL ${LIBDIR}/sdl)
+       SET(SDL_INCLUDE_DIR ${SDL}/include)
+       SET(SDL_LIBRARY SDL)
+       SET(SDL_LIBPATH ${SDL}/lib)
+
+       SET(PNG "${LIBDIR}/png")
+       SET(PNG_INC "${PNG}/include")
+       SET(PNG_LIBPATH ${PNG}/lib)
+
+       SET(JPEG "${LIBDIR}/jpeg")
+       SET(JPEG_INC "${JPEG}/include")
+       SET(JPEG_LIBPATH ${JPEG}/lib)
+
+       SET(TIFF ${LIBDIR}/tiff)
+       SET(TIFF_INC ${TIFF}/include)
+
+       SET(EXETYPE MACOSX_BUNDLE)
 ENDIF(APPLE)
 
 IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
-  SET(BINRELOC ${CMAKE_SOURCE_DIR}/extern/binreloc)
-  SET(BINRELOC_INC ${BINRELOC}/include)
+       SET(BINRELOC ${CMAKE_SOURCE_DIR}/extern/binreloc)
+       SET(BINRELOC_INC ${BINRELOC}/include)
 ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
 
+
+# TODO - buildinfo
+# IF(UNIX)
+#   IF(WITH_BUILDINFO)
+#     EXEC_PROGRAM("date \"+%Y-%m-%d\"" OUTPUT_VARIABLE BUILD_DATE)
+#     EXEC_PROGRAM("date \"+%H:%M:%S\"" OUTPUT_VARIABLE BUILD_TIME)  
+#     EXEC_PROGRAM("svnversion ${CMAKE_SOURCE_DIR}" OUTPUT_VARIABLE BUILD_REV)
+#     SET(BUILD_TYPE ${CMAKE_BUILD_TYPE})
+#   ENDIF(WITH_BUILDINFO)
+# ENDIF(UNIX)
+
 #-----------------------------------------------------------------------------
 # Common.
 
@@ -496,10 +534,10 @@ set(OPENJPEG_LIb extern_libopenjpeg)
 # Blender WebPlugin
 
 IF(WITH_WEBPLUGIN) 
-  SET(GECKO_DIR "${CMAKE_SOURCE_DIR}/../gecko-sdk/" CACHE PATH "Gecko SDK path")
-  SET(WEBPLUGIN_SANDBOX_MODE "apparmor" CACHE STRING "WEB Plugin sandbox mode, can be apparmor, privsep, none")
+       SET(GECKO_DIR "${CMAKE_SOURCE_DIR}/../gecko-sdk/" CACHE PATH "Gecko SDK path")
+       SET(WEBPLUGIN_SANDBOX_MODE "apparmor" CACHE STRING "WEB Plugin sandbox mode, can be apparmor, privsep, none")
 
-  SET(WITH_PLAYER ON)
+       SET(WITH_PLAYER ON)
 ENDIF(WITH_WEBPLUGIN)
 
 
@@ -517,7 +555,7 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PLATFORM_CFLAGS} ${CXX_WARNINGS}")
 
 # better not define flags here but this is a debugging option thats off by default.
 IF(WITH_CXX_GUARDEDALLOC)
-  SET(CMAKE_CXX_FLAGS " -DWITH_CXX_GUARDEDALLOC -I${CMAKE_SOURCE_DIR}/intern/guardedalloc ${CMAKE_CXX_FLAGS}")
+       SET(CMAKE_CXX_FLAGS " -DWITH_CXX_GUARDEDALLOC -I${CMAKE_SOURCE_DIR}/intern/guardedalloc ${CMAKE_CXX_FLAGS}")
 ENDIF(WITH_CXX_GUARDEDALLOC)
 
 #-----------------------------------------------------------------------------
@@ -536,6 +574,6 @@ ADD_SUBDIRECTORY(source/creator)
 #-----------------------------------------------------------------------------
 # Blender Player
 IF(WITH_PLAYER)
-  ADD_SUBDIRECTORY(blenderplayer)
+       ADD_SUBDIRECTORY(source/blenderplayer)
 ENDIF(WITH_PLAYER)
 
index a96cfc0..bacb158 100644 (file)
@@ -207,7 +207,6 @@ if env['WITH_BF_OPENMP'] == 1:
                                env.Append(CCFLAGS=['-fopenmp']) 
                                env.Append(CPPFLAGS=['-fopenmp'])
                                env.Append(CXXFLAGS=['-fopenmp'])
-                               # env.Append(LINKFLAGS=['-fprofile-generate'])
 
 #check for additional debug libnames
 
@@ -301,7 +300,6 @@ if env['WITH_BF_SDL'] == False and env['OURPLATFORM'] in ('win32-vc', 'win32-min
        env['PLATFORM_LINKFLAGS'].append('/ENTRY:main')
 
 # lastly we check for root_build_dir ( we should not do before, otherwise we might do wrong builddir
-#B.root_build_dir = B.arguments.get('BF_BUILDDIR', '..'+os.sep+'build'+os.sep+platform+os.sep)
 B.root_build_dir = env['BF_BUILDDIR']
 B.doc_build_dir = env['BF_DOCDIR']
 if not B.root_build_dir[-1]==os.sep:
@@ -392,7 +390,7 @@ SConscript(B.root_build_dir+'/source/SConscript')
 # libraries to give as objects to linking phase
 mainlist = []
 for tp in B.possible_types:
-       if not tp == 'player' and not tp == 'player2':
+       if not tp == 'player':
                mainlist += B.create_blender_liblist(env, tp)
 
 if B.arguments.get('BF_PRIORITYLIST', '0')=='1':
@@ -402,15 +400,13 @@ dobj = B.buildinfo(env, "dynamic") + B.resources
 thestatlibs, thelibincs = B.setup_staticlibs(env)
 thesyslibs = B.setup_syslibs(env)
 
-if env['WITH_BF_PLAYER']:
-       print("Warning: Game player may not build on 2.5")
-
 if 'blender' in B.targets or not env['WITH_BF_NOBLENDER']:
-       #env.BlenderProg(B.root_build_dir, "blender", dobj , [], mainlist + thestatlibs + thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender')
        blen = env.BlenderProg(B.root_build_dir, "blender", dobj + mainlist, [], thestatlibs + thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender')
 
 if env['WITH_BF_PLAYER']:
        playerlist = B.create_blender_liblist(env, 'player')
+       playerlist += B.create_blender_liblist(env, 'intern')
+       playerlist += B.create_blender_liblist(env, 'extern')
        env.BlenderProg(B.root_build_dir, "blenderplayer", dobj + playerlist, [], thestatlibs + thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blenderplayer')
 
 ##### Now define some targets
@@ -576,16 +572,13 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc'):
        if env['WITH_BF_OPENAL']:
                dllsources.append('${LCGDIR}/openal/lib/OpenAL32.dll')
                dllsources.append('${LCGDIR}/openal/lib/wrap_oal.dll')
+       if env['WITH_BF_SNDFILE']:
+               dllsources.append('${LCGDIR}/sndfile/lib/libsndfile-1.dll')
        if env['WITH_BF_FFMPEG']:
                dllsources += ['${LCGDIR}/ffmpeg/lib/avcodec-52.dll',
                                                '${LCGDIR}/ffmpeg/lib/avformat-52.dll',
                                                '${LCGDIR}/ffmpeg/lib/avdevice-52.dll',
                                                '${LCGDIR}/ffmpeg/lib/avutil-50.dll',
-                                               '${LCGDIR}/ffmpeg/lib/libfaad-2.dll',
-                                               '${LCGDIR}/ffmpeg/lib/libfaac-0.dll',
-                                               '${LCGDIR}/ffmpeg/lib/libmp3lame-0.dll',
-                                               '${LCGDIR}/ffmpeg/lib/libx264-67.dll',
-                                               '${LCGDIR}/ffmpeg/lib/xvidcore.dll',
                                                '${LCGDIR}/ffmpeg/lib/swscale-0.dll']
        if env['WITH_BF_JACK']:
                dllsources += ['${LCGDIR}/jack/lib/libjack.dll']
diff --git a/blenderplayer/CMakeLists.txt b/blenderplayer/CMakeLists.txt
deleted file mode 100644 (file)
index 77bc059..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-# $Id$
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-#
-# The Original Code is Copyright (C) 2006, Blender Foundation
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurain.
-#
-# ***** END GPL LICENSE BLOCK *****
-
-MESSAGE(STATUS "Configuring blenderplayer")
-
-SETUP_LIBDIRS()
-
-IF(WITH_QUICKTIME)
-  ADD_DEFINITIONS(-DWITH_QUICKTIME)
-ENDIF(WITH_QUICKTIME)
-
-IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
-  ADD_DEFINITIONS(-DWITH_BINRELOC)
-  INCLUDE_DIRECTORIES(${BINRELOC_INC})
-ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
-
-ADD_CUSTOM_COMMAND(
-  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dna.c
-  COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/makesdna ${CMAKE_CURRENT_BINARY_DIR}/dna.c ${CMAKE_SOURCE_DIR}/source/blender/makesdna/
-  DEPENDS ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/makesdna
-)
-
-IF(WIN32)
-  ADD_EXECUTABLE(blenderplayer ${EXETYPE} ${CMAKE_CURRENT_BINARY_DIR}/dna.c ../source/icons/winblender.rc)
-ELSE(WIN32)
-  ADD_EXECUTABLE(blenderplayer ${CMAKE_CURRENT_BINARY_DIR}/dna.c)
-ENDIF(WIN32)
-
-ADD_DEPENDENCIES(blenderplayer makesdna)
-
-FILE(READ ${CMAKE_BINARY_DIR}/cmake_blender_libs.txt BLENDER_LINK_LIBS)
-
-SET(BLENDER_LINK_LIBS ${BLENDER_LINK_LIBS} gp_common gp_ghost blenkernel_blc)
-
-IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
-  SET(BLENDER_LINK_LIBS ${BLENDER_LINK_LIBS} extern_binreloc)
-ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
-
-IF(UNIX)
-  # Sort libraries
-  SET(BLENDER_SORTED_LIBS
-    gp_ghost 
-    gp_common 
-    bf_string 
-    bf_ghost 
-    bf_blenkernel 
-    verse 
-    bf_blenkernel 
-    bf_blenloader 
-    bf_blenpluginapi 
-    bf_blroutines 
-    bf_converter 
-    bf_sumo 
-    bf_ketsji 
-    extern_solid 
-    extern_qhull 
-    bf_bullet 
-    bf_common 
-    bf_dummy 
-    bf_logic 
-    bf_rasterizer 
-    bf_oglrasterizer 
-    bf_expressions 
-    bf_scenegraph 
-       bf_IK
-    bf_moto 
-    bf_kernel 
-    bf_nodes
-       bf_gpu
-    bf_imbuf
-    bf_avi 
-    kx_network 
-    bf_ngnetwork 
-    bf_loopbacknetwork 
-    extern_bullet 
-    bf_guardedalloc 
-    bf_memutil 
-    bf_blenlib 
-    bf_cineon 
-    bf_openexr 
-    extern_libopenjpeg 
-    bf_dds
-    bf_readblenfile 
-    blenkernel_blc
-    bf_quicktime
-    extern_binreloc
-       extern_glew
-  ) 
-
-  IF(WITH_CXX_GUARDEDALLOC)
-    SET(BLENDER_SORTED_LIBS ${BLENDER_SORTED_LIBS} bf_guardedalloc_cpp)
-  ENDIF(WITH_CXX_GUARDEDALLOC)
-
-  FOREACH(SORTLIB ${BLENDER_SORTED_LIBS})
-    SET(REMLIB ${SORTLIB})
-    FOREACH(SEARCHLIB ${BLENDER_LINK_LIBS})
-      IF(${SEARCHLIB} STREQUAL ${SORTLIB})
-        SET(REMLIB "")
-      ENDIF(${SEARCHLIB} STREQUAL ${SORTLIB})
-    ENDFOREACH(SEARCHLIB)
-    IF(REMLIB)
-      MESSAGE(STATUS "Removing library ${REMLIB} from blenderplayer linking because: not configured")
-      LIST(REMOVE_ITEM BLENDER_SORTED_LIBS ${REMLIB})
-    ENDIF(REMLIB)
-  ENDFOREACH(SORTLIB)
-
-  TARGET_LINK_LIBRARIES(blenderplayer ${BLENDER_SORTED_LIBS})
-ELSE(UNIX)
-  TARGET_LINK_LIBRARIES(blenderplayer ${BLENDER_LINK_LIBS})
-ENDIF(UNIX)
-
-SETUP_LIBLINKS(blenderplayer)
index 5c0fa9a..92f70d7 100644 (file)
@@ -1,10 +1,3 @@
-#
-# Note : if you want to alter this file
-# copy it as a whole in the upper folder
-# as user-config.py
-# dont create a new file with only some
-# vars changed.
-
 import commands
 
 # IMPORTANT NOTE : OFFICIAL BUILDS SHOULD BE DONE WITH SDKs
@@ -119,6 +112,12 @@ BF_JACK_INC = '${BF_JACK}/include/jack'
 BF_JACK_LIB = 'jack'
 BF_JACK_LIBPATH = '${BF_JACK}/lib'
 
+WITH_BF_SNDFILE = False
+BF_SNDFILE = LIBDIR + '/sndfile'
+BF_SNDFILE_INC = '${BF_SNDFILE}/include'
+BF_SNDFILE_LIB = 'sndfile'
+BF_SNDFILE_LIBPATH = '${BF_SNDFILE}/lib'
+
 WITH_BF_SDL = True
 BF_SDL = LIBDIR + '/sdl' #$(shell sdl-config --prefix)
 BF_SDL_INC = '${BF_SDL}/include' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
index b8e035c..757b821 100644 (file)
@@ -33,6 +33,12 @@ BF_JACK_INC = '${BF_JACK}/include/jack'
 BF_JACK_LIB = 'jack'
 BF_JACK_LIBPATH = '${BF_JACK}/lib'
 
+WITH_BF_SNDFILE = False
+BF_SNDFILE = '/usr'
+BF_SNDFILE_INC = '${BF_SNDFILE}/include/sndfile'
+BF_SNDFILE_LIB = 'sndfile'
+BF_SNDFILE_LIBPATH = '${BF_SNDFILE}/lib'
+
 WITH_BF_SDL = True
 BF_SDL = '/usr' #$(shell sdl-config --prefix)
 BF_SDL_INC = '${BF_SDL}/include/SDL' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
@@ -85,23 +91,6 @@ BF_BULLET = '#extern/bullet2/src'
 BF_BULLET_INC = '${BF_BULLET}'
 BF_BULLET_LIB = 'extern_bullet'
 
-#WITH_BF_NSPR = True
-#BF_NSPR = $(LIBDIR)/nspr
-#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
-#BF_NSPR_LIB = 
-
-# Uncomment the following line to use Mozilla inplace of netscape
-#CPPFLAGS += -DMOZ_NOT_NET
-# Location of MOZILLA/Netscape header files...
-#BF_MOZILLA = $(LIBDIR)/mozilla
-#BF_MOZILLA_INC = -I$(BF_MOZILLA)/include/mozilla/nspr -I$(BF_MOZILLA)/include/mozilla -I$(BF_MOZILLA)/include/mozilla/xpcom -I$(BF_MOZILLA)/include/mozilla/idl
-#BF_MOZILLA_LIB =
-# Will fall back to look in BF_MOZILLA_INC/nspr and BF_MOZILLA_LIB
-# if this is not set.
-#
-# Be paranoid regarding library creation (do not update archives)
-#BF_PARANOID = True
-
 # enable freetype2 support for text objects
 BF_FREETYPE = '/usr'
 BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
@@ -181,8 +170,9 @@ REL_CCFLAGS = ['-O2']
 ##ARFLAGSQUIET = ru
 ##
 C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement']
-
 CC_WARN = ['-Wall']
+CXX_WARN = ['-Wno-invalid-offsetof', '-Wno-sign-compare']
+
 
 ##FIX_STUBS_WARNINGS = -Wno-unused
 
index a7de3f6..e3834c4 100644 (file)
@@ -3,14 +3,9 @@ LIBDIR = "${LCGDIR}"
 
 BF_PYTHON = LIBDIR + '/python'
 BF_PYTHON_VERSION = '3.1'
-#BF_PYTHON_VERSION = '2.6'
-#BF_PYTHON_VERSION = '2.6'
 WITH_BF_STATICPYTHON = False
 BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
 BF_PYTHON_BINARY = 'python'
-#BF_PYTHON_LIB = 'python25'
-#BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/lib25_vs2005'
-#BF_PYTHON_LIB_STATIC = '${BF_PYTHON}/lib/lib25_vs2005/libpython25.a'
 BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION[0]}${BF_PYTHON_VERSION[2]}'
 BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
 BF_PYTHON_LIB_STATIC = '${BF_PYTHON}/lib/libpython${BF_PYTHON_VERSION[0]}${BF_PYTHON_VERSION[2]}.a'
@@ -22,9 +17,9 @@ BF_OPENAL_LIB = 'wrap_oal'
 BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
 
 WITH_BF_FFMPEG = False
-BF_FFMPEG_LIB = 'avformat swscale avcodec avutil avdevice xvidcore x264'
-BF_FFMPEG_LIBPATH = LIBDIR + '/gcc/ffmpeg/lib'
-BF_FFMPEG_INC =  LIBDIR + '/gcc/ffmpeg/include'
+BF_FFMPEG_LIB = 'avformat-52 avcodec-52 avdevice-52 avutil-50 swscale-0'
+BF_FFMPEG_LIBPATH = LIBDIR + '/ffmpeg/lib'
+BF_FFMPEG_INC =  LIBDIR + '/ffmpeg/include'
 
 BF_LIBSAMPLERATE = LIBDIR + '/samplerate'
 BF_LIBSAMPLERATE_INC = '${BF_LIBSAMPLERATE}/include'
@@ -37,6 +32,12 @@ BF_JACK_INC = '${BF_JACK}/include'
 BF_JACK_LIB = 'libjack'
 BF_JACK_LIBPATH = '${BF_JACK}/lib'
 
+WITH_BF_SNDFILE = False
+BF_SNDFILE = LIBDIR + '/sndfile'
+BF_SNDFILE_INC = '${BF_SNDFILE}/include'
+BF_SNDFILE_LIB = 'libsndfile-1'
+BF_SNDFILE_LIBPATH = '${BF_SNDFILE}/lib'
+
 WITH_BF_SDL = True
 BF_SDL = LIBDIR + '/sdl'
 BF_SDL_INC = '${BF_SDL}/include'
@@ -99,20 +100,6 @@ BF_BULLET_LIB = 'extern_bullet'
 BF_WINTAB = LIBDIR + '/wintab'
 BF_WINTAB_INC = '${BF_WINTAB}/INCLUDE'
 
-#WITH_BF_NSPR = True
-#BF_NSPR = $(LIBDIR)/nspr
-#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
-#BF_NSPR_LIB = 
-
-# Uncomment the following line to use Mozilla inplace of netscape
-#CPPFLAGS += -DMOZ_NOT_NET
-# Location of MOZILLA/Netscape header files...
-#BF_MOZILLA = $(LIBDIR)/mozilla
-#BF_MOZILLA_INC = -I$(BF_MOZILLA)/include/mozilla/nspr -I$(BF_MOZILLA)/include/mozilla -I$(BF_MOZILLA)/include/mozilla/xpcom -I$(BF_MOZILLA)/include/mozilla/idl
-#BF_MOZILLA_LIB =
-# Will fall back to look in BF_MOZILLA_INC/nspr and BF_MOZILLA_LIB
-# if this is not set.
-
 # enable freetype2 support for text objects
 BF_FREETYPE = LIBDIR + '/gcc/freetype'
 BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
index e9bbd42..1e99356 100644 (file)
@@ -4,7 +4,7 @@ LIBDIR = '${LCGDIR}'
 # enable ffmpeg  support
 WITH_BF_FFMPEG = True  # -DWITH_FFMPEG
 BF_FFMPEG = LIBDIR +'/ffmpeg'
-BF_FFMPEG_INC = '${BF_FFMPEG}/include'
+BF_FFMPEG_INC = '${BF_FFMPEG}/include ${BF_FFMPEG}/include/msvc'
 BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
 BF_FFMPEG_LIB = 'avformat-52.lib avcodec-52.lib avdevice-52.lib avutil-50.lib swscale-0.lib'
 
@@ -21,11 +21,6 @@ BF_OPENAL_INC = '${BF_OPENAL}/include '
 BF_OPENAL_LIB = 'wrap_oal'
 BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
 
-# TODO - are these useful on win32?
-# BF_CXX = '/usr'
-# WITH_BF_STATICCXX = False
-# BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
-
 WITH_BF_ICONV = True
 BF_ICONV = LIBDIR + '/iconv'
 BF_ICONV_INC = '${BF_ICONV}/include'
@@ -43,6 +38,12 @@ BF_JACK_INC = '${BF_JACK}/include'
 BF_JACK_LIB = 'libjack'
 BF_JACK_LIBPATH = '${BF_JACK}/lib'
 
+WITH_BF_SNDFILE = False
+BF_SNDFILE = LIBDIR + '/sndfile'
+BF_SNDFILE_INC = '${BF_SNDFILE}/include'
+BF_SNDFILE_LIB = 'libsndfile-1'
+BF_SNDFILE_LIBPATH = '${BF_SNDFILE}/lib'
+
 WITH_BF_SDL = True
 BF_SDL = LIBDIR + '/sdl'
 BF_SDL_INC = '${BF_SDL}/include'
@@ -108,23 +109,6 @@ BF_WINTAB_INC = '${BF_WINTAB}/INCLUDE'
 
 WITH_BF_BINRELOC = False
 
-#WITH_BF_NSPR = True
-#BF_NSPR = $(LIBDIR)/nspr
-#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
-#BF_NSPR_LIB = 
-
-# Uncomment the following line to use Mozilla inplace of netscape
-#CPPFLAGS += -DMOZ_NOT_NET
-# Location of MOZILLA/Netscape header files...
-#BF_MOZILLA = $(LIBDIR)/mozilla
-#BF_MOZILLA_INC = -I$(BF_MOZILLA)/include/mozilla/nspr -I$(BF_MOZILLA)/include/mozilla -I$(BF_MOZILLA)/include/mozilla/xpcom -I$(BF_MOZILLA)/include/mozilla/idl
-#BF_MOZILLA_LIB =
-# Will fall back to look in BF_MOZILLA_INC/nspr and BF_MOZILLA_LIB
-# if this is not set.
-#
-# Be paranoid regarding library creation (do not update archives)
-#BF_PARANOID = True
-
 # enable freetype2 support for text objects
 BF_WITH_FREETYPE = True
 BF_FREETYPE = LIBDIR + '/freetype'
@@ -165,6 +149,7 @@ CXX = 'cl.exe'
 
 CCFLAGS = ['/nologo', '/Ob1', '/J', '/W3', '/Gd', '/wd4244', '/wd4305', '/wd4800', '/wd4065', '/wd4267']
 CXXFLAGS = ['/EHsc']
+BGE_CXXFLAGS = ['/O2', '/EHsc', '/GR', '/fp:fast', '/arch:SSE']
 
 BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr']
 
index ed08e57..ce2fd8c 100644 (file)
@@ -163,6 +163,7 @@ CXX = 'cl.exe'
 CFLAGS = []
 CCFLAGS = ['/nologo', '/Ob1', '/J', '/W3', '/Gd', '/wd4244', '/wd4305', '/wd4800', '/wd4065', '/wd4267']
 CXXFLAGS = ['/EHsc']
+BGE_CXXFLAGS = ['/O2', '/EHsc', '/GR', '/fp:fast', '/arch:SSE2']
 
 BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr']
 
index b6cfe3b..44e47aa 100644 (file)
 # ***** END GPL LICENSE BLOCK *****
 
 IF(WITH_BULLET)
-  ADD_SUBDIRECTORY(bullet2)
+       ADD_SUBDIRECTORY(bullet2)
 ENDIF(WITH_BULLET)
 
 IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
-  ADD_SUBDIRECTORY(binreloc)
+       ADD_SUBDIRECTORY(binreloc)
 ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
 
 ADD_SUBDIRECTORY(glew)
 
 IF(WITH_OPENJPEG)
-  ADD_SUBDIRECTORY(libopenjpeg)
+       ADD_SUBDIRECTORY(libopenjpeg)
 ENDIF(WITH_OPENJPEG)
+
+ADD_SUBDIRECTORY(lzo)
+ADD_SUBDIRECTORY(lzma)
index 61499da..1bebf1e 100644 (file)
@@ -54,6 +54,14 @@ ifeq ($(WITH_OPENJPEG), true)
     DIRS += libopenjpeg
 endif
 
+ifeq ($(WITH_LZO), true)
+    DIRS += lzo/minilzo
+endif
+
+ifeq ($(WITH_LZMA), true)
+    DIRS += lzma
+endif
+
 TARGET = solid
 
 all::
index 175613c..20604d8 100644 (file)
@@ -22,5 +22,5 @@ if env['WITH_BF_REDCODE'] and env['BF_REDCODE_LIB'] == '':
 if env['OURPLATFORM'] == 'linux2':
     SConscript(['binreloc/SConscript']);
 
-# FFTW not needed atm - dg
-# SConscript(['fftw/SConscript'])
+SConscript(['lzo/SConscript'])
+SConscript(['lzma/SConscript'])
index 98d7adb..331b70a 100644 (file)
@@ -9,5 +9,5 @@ cflags = []
 sources = ['binreloc.c']
 incs = 'include'
 
-env.BlenderLib ( 'extern_binreloc', sources, Split(incs), Split(defs), libtype=['extern'], priority=[36], compileflags = cflags)
+env.BlenderLib ( 'extern_binreloc', sources, Split(incs), Split(defs), libtype=['extern','player'], priority=[36,225], compileflags = cflags)
 
index edb6b9c..2e2d892 100644 (file)
 SET(INC . src)
 
 FILE(GLOB SRC   
-  src/LinearMath/*.cpp
-  src/BulletCollision/BroadphaseCollision/*.cpp
-  src/BulletCollision/CollisionShapes/*.cpp
-  src/BulletCollision/NarrowPhaseCollision/*.cpp
-  src/BulletCollision/Gimpact/*.cpp
-  src/BulletCollision//CollisionDispatch/*.cpp
-  src/BulletDynamics/ConstraintSolver/*.cpp
-  src/BulletDynamics/Vehicle/*.cpp
-  src/BulletDynamics/Dynamics/*.cpp
-  src/BulletSoftBody/*.cpp
+       src/LinearMath/*.cpp
+       src/BulletCollision/BroadphaseCollision/*.cpp
+       src/BulletCollision/CollisionShapes/*.cpp
+       src/BulletCollision/NarrowPhaseCollision/*.cpp
+       src/BulletCollision/Gimpact/*.cpp
+       src/BulletCollision//CollisionDispatch/*.cpp
+       src/BulletDynamics/ConstraintSolver/*.cpp
+       src/BulletDynamics/Vehicle/*.cpp
+       src/BulletDynamics/Dynamics/*.cpp
+       src/BulletSoftBody/*.cpp
 )
 
 ADD_DEFINITIONS(-D_LIB)
index 4b4304f..ddc806a 100644 (file)
@@ -211,13 +211,13 @@ ADD_LIBRARY(BulletCollision ${BulletCollision_SRCS} ${BulletCollision_HDRS})
 SET_TARGET_PROPERTIES(BulletCollision PROPERTIES VERSION ${BULLET_VERSION})
 SET_TARGET_PROPERTIES(BulletCollision PROPERTIES SOVERSION ${BULLET_VERSION})
 IF (BUILD_SHARED_LIBS)
-  TARGET_LINK_LIBRARIES(BulletCollision LinearMath)
+       TARGET_LINK_LIBRARIES(BulletCollision LinearMath)
 ENDIF (BUILD_SHARED_LIBS)
 
 #INSTALL of other files requires CMake 2.6
 IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
        INSTALL(TARGETS BulletCollision DESTINATION lib)
-        INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include FILES_MATCHING PATTERN "*.h")
+                               INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include FILES_MATCHING PATTERN "*.h")
 ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
 
 IF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
index dbd87af..fe31d2b 100644 (file)
@@ -34,7 +34,7 @@ ENDIF (BUILD_SHARED_LIBS)
 
 IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
        INSTALL(TARGETS BulletSoftBody DESTINATION lib)
-        INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include FILES_MATCHING PATTERN "*.h")
+                               INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include FILES_MATCHING PATTERN "*.h")
 ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5)
 
 IF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK)
index 319cc57..3d0c645 100644 (file)
@@ -35,11 +35,11 @@ softbody_src = env.Glob("BulletSoftBody/*.cpp")
 
 incs = '. BulletCollision BulletDynamics LinearMath BulletSoftBody'
 
-env.BlenderLib ( libname = 'extern_bullet2linmath', sources=linearmath_src, includes=Split(incs), defines=Split(defs), libtype=['extern'], priority=[20], compileflags=cflags )
-env.BlenderLib ( libname = 'extern_bullet2dynamics', sources=bulletdyn_src, includes=Split(incs), defines=Split(defs), libtype=['extern'], priority=[19], compileflags=cflags )
-env.BlenderLib ( libname = 'extern_bullet2collision_broadphase', sources=collision_broadphase_src, includes=Split(incs), defines=Split(defs), libtype=['extern'], priority=[25], compileflags=cflags )
-env.BlenderLib ( libname = 'extern_bullet2collision_dispatch', sources=collision_dispatch_src, includes=Split(incs), defines=Split(defs), libtype=['extern'], priority=[20], compileflags=cflags )
-env.BlenderLib ( libname = 'extern_bullet2collision_gimpact', sources=collision_gimpact_src, includes=Split(incs), defines=Split(defs), libtype=['extern'], priority=[20], compileflags=cflags )
-env.BlenderLib ( libname = 'extern_bullet2collision_shapes', sources=collision_shapes_src, includes=Split(incs), defines=Split(defs), libtype=['extern'], priority=[20], compileflags=cflags )
-env.BlenderLib ( libname = 'extern_bullet2collision_narrowphase', sources=collision_narrowphase_src, includes=Split(incs), defines=Split(defs), libtype=['extern'], priority=[20], compileflags=cflags )
-env.BlenderLib ( libname = 'extern_bullet2softbody', sources=softbody_src, includes=Split(incs), defines=Split(defs), libtype=['extern'], priority=[18], compileflags=cflags )
+env.BlenderLib ( libname = 'extern_bullet2linmath', sources=linearmath_src, includes=Split(incs), defines=Split(defs), libtype=['extern','player'], priority=[20,137], compileflags=cflags )
+env.BlenderLib ( libname = 'extern_bullet2dynamics', sources=bulletdyn_src, includes=Split(incs), defines=Split(defs), libtype=['extern','player'], priority=[19,136], compileflags=cflags )
+env.BlenderLib ( libname = 'extern_bullet2collision_broadphase', sources=collision_broadphase_src, includes=Split(incs), defines=Split(defs), libtype=['extern','player'], priority=[25,145], compileflags=cflags )
+env.BlenderLib ( libname = 'extern_bullet2collision_dispatch', sources=collision_dispatch_src, includes=Split(incs), defines=Split(defs), libtype=['extern','player'], priority=[20,138], compileflags=cflags )
+env.BlenderLib ( libname = 'extern_bullet2collision_gimpact', sources=collision_gimpact_src, includes=Split(incs), defines=Split(defs), libtype=['extern','player'], priority=[20,138], compileflags=cflags )
+env.BlenderLib ( libname = 'extern_bullet2collision_shapes', sources=collision_shapes_src, includes=Split(incs), defines=Split(defs), libtype=['extern','player'], priority=[20,138], compileflags=cflags )
+env.BlenderLib ( libname = 'extern_bullet2collision_narrowphase', sources=collision_narrowphase_src, includes=Split(incs), defines=Split(defs), libtype=['extern','player'], priority=[20,138], compileflags=cflags )
+env.BlenderLib ( libname = 'extern_bullet2softbody', sources=softbody_src, includes=Split(incs), defines=Split(defs), libtype=['extern','player'], priority=[18,135], compileflags=cflags )
index eea3448..26d10a6 100644 (file)
 SET(INC include src)
 
 IF(UNIX)
-  SET(INC ${INC} ${X11_X11_INCLUDE_PATH})
+       SET(INC ${INC} ${X11_X11_INCLUDE_PATH})
 ENDIF(UNIX)
 
 SET(SRC
-  src/glew.c
+       src/glew.c
 )
 
 BLENDERLIB(extern_glew "${SRC}" "${INC}")
index b83525d..81a2fc6 100644 (file)
@@ -9,4 +9,4 @@ sources = ['src/glew.c']
 defs = ''
 incs = 'include'
 
-env.BlenderLib ( 'extern_glew', sources, Split(incs), Split(defs), libtype=['extern'], priority=[50])
+env.BlenderLib ( 'extern_glew', sources, Split(incs), Split(defs), libtype=['extern','player'], priority=[50,230])
index 693fee1..da66173 100644 (file)
@@ -24,5 +24,5 @@ if not env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
 oj_env.BlenderLib ( libname='extern_openjpeg', 
                     sources=sources, includes=Split(incs),
                     defines=defs,
-                    libtype=['extern'],
-                    priority=[10], compileflags = flags)
+                    libtype=['extern','player'],
+                    priority=[10,185], compileflags = flags)
index 9fd25ad..3fb78db 100644 (file)
@@ -12,5 +12,5 @@ incs = '. ../libopenjpeg'
 env.BlenderLib ( libname='extern_redcode', 
                  sources=sources, includes=Split(incs),
                  defines=[],
-                 libtype=['core','intern','player'],
-                 priority=[5, 5, 200], compileflags = [])
+                 libtype=['core','intern'],
+                 priority=[5, 5], compileflags = [])
diff --git a/extern/lzma/Alloc.c b/extern/lzma/Alloc.c
new file mode 100644 (file)
index 0000000..358a7b5
--- /dev/null
@@ -0,0 +1,127 @@
+/* Alloc.c -- Memory allocation functions
+2008-09-24
+Igor Pavlov
+Public domain */
+
+#ifdef _WIN32
+#include <windows.h>
+#endif
+#include <stdlib.h>
+
+#include "Alloc.h"
+
+/* #define _SZ_ALLOC_DEBUG */
+
+/* use _SZ_ALLOC_DEBUG to debug alloc/free operations */
+#ifdef _SZ_ALLOC_DEBUG
+#include <stdio.h>
+int g_allocCount = 0;
+int g_allocCountMid = 0;
+int g_allocCountBig = 0;
+#endif
+
+void *MyAlloc(size_t size)
+{
+  if (size == 0)
+    return 0;
+  #ifdef _SZ_ALLOC_DEBUG
+  {
+    void *p = malloc(size);
+    fprintf(stderr, "\nAlloc %10d bytes, count = %10d,  addr = %8X", size, g_allocCount++, (unsigned)p);
+    return p;
+  }
+  #else
+  return malloc(size);
+  #endif
+}
+
+void MyFree(void *address)
+{
+  #ifdef _SZ_ALLOC_DEBUG
+  if (address != 0)
+    fprintf(stderr, "\nFree; count = %10d,  addr = %8X", --g_allocCount, (unsigned)address);
+  #endif
+  free(address);
+}
+
+#ifdef _WIN32
+
+void *MidAlloc(size_t size)
+{
+  if (size == 0)
+    return 0;
+  #ifdef _SZ_ALLOC_DEBUG
+  fprintf(stderr, "\nAlloc_Mid %10d bytes;  count = %10d", size, g_allocCountMid++);
+  #endif
+  return VirtualAlloc(0, size, MEM_COMMIT, PAGE_READWRITE);
+}
+
+void MidFree(void *address)
+{
+  #ifdef _SZ_ALLOC_DEBUG
+  if (address != 0)
+    fprintf(stderr, "\nFree_Mid; count = %10d", --g_allocCountMid);
+  #endif
+  if (address == 0)
+    return;
+  VirtualFree(address, 0, MEM_RELEASE);
+}
+
+#ifndef MEM_LARGE_PAGES
+#undef _7ZIP_LARGE_PAGES
+#endif
+
+#ifdef _7ZIP_LARGE_PAGES
+SIZE_T g_LargePageSize = 0;
+typedef SIZE_T (WINAPI *GetLargePageMinimumP)();
+#endif
+
+void SetLargePageSize()
+{
+  #ifdef _7ZIP_LARGE_PAGES
+  SIZE_T size = 0;
+  GetLargePageMinimumP largePageMinimum = (GetLargePageMinimumP)
+        GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetLargePageMinimum");
+  if (largePageMinimum == 0)
+    return;
+  size = largePageMinimum();
+  if (size == 0 || (size & (size - 1)) != 0)
+    return;
+  g_LargePageSize = size;
+  #endif
+}
+
+
+void *BigAlloc(size_t size)
+{
+  if (size == 0)
+    return 0;
+  #ifdef _SZ_ALLOC_DEBUG
+  fprintf(stderr, "\nAlloc_Big %10d bytes;  count = %10d", size, g_allocCountBig++);
+  #endif
+  
+  #ifdef _7ZIP_LARGE_PAGES
+  if (g_LargePageSize != 0 && g_LargePageSize <= (1 << 30) && size >= (1 << 18))
+  {
+    void *res = VirtualAlloc(0, (size + g_LargePageSize - 1) & (~(g_LargePageSize - 1)),
+        MEM_COMMIT | MEM_LARGE_PAGES, PAGE_READWRITE);
+    if (res != 0)
+      return res;
+  }
+  #endif
+  return VirtualAlloc(0, size, MEM_COMMIT, PAGE_READWRITE);
+}
+
+void BigFree(void *address)
+{
+  #ifdef _SZ_ALLOC_DEBUG
+  if (address != 0)
+    fprintf(stderr, "\nFree_Big; count = %10d", --g_allocCountBig);
+  #endif
+  
+  if (address == 0)
+    return;
+  VirtualFree(address, 0, MEM_RELEASE);
+}
+
+#endif
diff --git a/extern/lzma/Alloc.h b/extern/lzma/Alloc.h
new file mode 100644 (file)
index 0000000..ff0669c
--- /dev/null
@@ -0,0 +1,32 @@
+/* Alloc.h -- Memory allocation functions
+2008-03-13
+Igor Pavlov
+Public domain */
+
+#ifndef __COMMON_ALLOC_H
+#define __COMMON_ALLOC_H
+
+#include <stddef.h>
+
+void *MyAlloc(size_t size);
+void MyFree(void *address);
+
+#ifdef _WIN32
+
+void SetLargePageSize();
+
+void *MidAlloc(size_t size);
+void MidFree(void *address);
+void *BigAlloc(size_t size);
+void BigFree(void *address);
+
+#else
+
+#define MidAlloc(size) MyAlloc(size)
+#define MidFree(address) MyFree(address)
+#define BigAlloc(size) MyAlloc(size)
+#define BigFree(address) MyFree(address)
+
+#endif
+
+#endif
diff --git a/extern/lzma/CMakeLists.txt b/extern/lzma/CMakeLists.txt
new file mode 100644 (file)
index 0000000..235cd8c
--- /dev/null
@@ -0,0 +1,34 @@
+# $Id$
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+# The Original Code is Copyright (C) 2006, Blender Foundation
+# All rights reserved.
+#
+# The Original Code is: all of this file.
+#
+# Contributor(s): Daniel Genrich
+#
+# ***** END GPL LICENSE BLOCK *****
+
+SET(INC . )
+
+FILE(GLOB SRC ./*.c)
+
+
+
+BLENDERLIB(bf_lzma "${SRC}" "${INC}")
+#, libtype='blender', priority = 0 )
diff --git a/extern/lzma/LzFind.c b/extern/lzma/LzFind.c
new file mode 100644 (file)
index 0000000..34f4f09
--- /dev/null
@@ -0,0 +1,751 @@
+/* LzFind.c -- Match finder for LZ algorithms
+2008-10-04 : Igor Pavlov : Public domain */
+
+#include <string.h>
+
+#include "LzFind.h"
+#include "LzHash.h"
+
+#define kEmptyHashValue 0
+#define kMaxValForNormalize ((UInt32)0xFFFFFFFF)
+#define kNormalizeStepMin (1 << 10) /* it must be power of 2 */
+#define kNormalizeMask (~(kNormalizeStepMin - 1))
+#define kMaxHistorySize ((UInt32)3 << 30)
+
+#define kStartMaxLen 3
+
+static void LzInWindow_Free(CMatchFinder *p, ISzAlloc *alloc)
+{
+  if (!p->directInput)
+  {
+    alloc->Free(alloc, p->bufferBase);
+    p->bufferBase = 0;
+  }
+}
+
+/* keepSizeBefore + keepSizeAfter + keepSizeReserv must be < 4G) */
+
+static int LzInWindow_Create(CMatchFinder *p, UInt32 keepSizeReserv, ISzAlloc *alloc)
+{
+  UInt32 blockSize = p->keepSizeBefore + p->keepSizeAfter + keepSizeReserv;
+  if (p->directInput)
+  {
+    p->blockSize = blockSize;
+    return 1;
+  }
+  if (p->bufferBase == 0 || p->blockSize != blockSize)
+  {
+    LzInWindow_Free(p, alloc);
+    p->blockSize = blockSize;
+    p->bufferBase = (Byte *)alloc->Alloc(alloc, (size_t)blockSize);
+  }
+  return (p->bufferBase != 0);
+}
+
+Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; }
+Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; }
+
+UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; }
+
+void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue)
+{
+  p->posLimit -= subValue;
+  p->pos -= subValue;
+  p->streamPos -= subValue;
+}
+
+static void MatchFinder_ReadBlock(CMatchFinder *p)
+{
+  if (p->streamEndWasReached || p->result != SZ_OK)
+    return;
+  for (;;)
+  {
+    Byte *dest = p->buffer + (p->streamPos - p->pos);
+    size_t size = (p->bufferBase + p->blockSize - dest);
+    if (size == 0)
+      return;
+    p->result = p->stream->Read(p->stream, dest, &size);
+    if (p->result != SZ_OK)
+      return;
+    if (size == 0)
+    {
+      p->streamEndWasReached = 1;
+      return;
+    }
+    p->streamPos += (UInt32)size;
+    if (p->streamPos - p->pos > p->keepSizeAfter)
+      return;
+  }
+}
+
+void MatchFinder_MoveBlock(CMatchFinder *p)
+{
+  memmove(p->bufferBase,
+    p->buffer - p->keepSizeBefore,
+    (size_t)(p->streamPos - p->pos + p->keepSizeBefore));
+  p->buffer = p->bufferBase + p->keepSizeBefore;
+}
+
+int MatchFinder_NeedMove(CMatchFinder *p)
+{
+  /* if (p->streamEndWasReached) return 0; */
+  return ((size_t)(p->bufferBase + p->blockSize - p->buffer) <= p->keepSizeAfter);
+}
+
+void MatchFinder_ReadIfRequired(CMatchFinder *p)
+{
+  if (p->streamEndWasReached)
+    return;
+  if (p->keepSizeAfter >= p->streamPos - p->pos)
+    MatchFinder_ReadBlock(p);
+}
+
+static void MatchFinder_CheckAndMoveAndRead(CMatchFinder *p)
+{
+  if (MatchFinder_NeedMove(p))
+    MatchFinder_MoveBlock(p);
+  MatchFinder_ReadBlock(p);
+}
+
+static void MatchFinder_SetDefaultSettings(CMatchFinder *p)
+{
+  p->cutValue = 32;
+  p->btMode = 1;
+  p->numHashBytes = 4;
+  /* p->skipModeBits = 0; */
+  p->directInput = 0;
+  p->bigHash = 0;
+}
+
+#define kCrcPoly 0xEDB88320
+
+void MatchFinder_Construct(CMatchFinder *p)
+{
+  UInt32 i;
+  p->bufferBase = 0;
+  p->directInput = 0;
+  p->hash = 0;
+  MatchFinder_SetDefaultSettings(p);
+
+  for (i = 0; i < 256; i++)
+  {
+    UInt32 r = i;
+    int j;
+    for (j = 0; j < 8; j++)
+      r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1));
+    p->crc[i] = r;
+  }
+}
+
+static void MatchFinder_FreeThisClassMemory(CMatchFinder *p, ISzAlloc *alloc)
+{
+  alloc->Free(alloc, p->hash);
+  p->hash = 0;
+}
+
+void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc)
+{
+  MatchFinder_FreeThisClassMemory(p, alloc);
+  LzInWindow_Free(p, alloc);
+}
+
+static CLzRef* AllocRefs(UInt32 num, ISzAlloc *alloc)
+{
+  size_t sizeInBytes = (size_t)num * sizeof(CLzRef);
+  if (sizeInBytes / sizeof(CLzRef) != num)
+    return 0;
+  return (CLzRef *)alloc->Alloc(alloc, sizeInBytes);
+}
+
+int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
+    UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
+    ISzAlloc *alloc)
+{
+  UInt32 sizeReserv;
+  if (historySize > kMaxHistorySize)
+  {
+    MatchFinder_Free(p, alloc);
+    return 0;
+  }
+  sizeReserv = historySize >> 1;
+  if (historySize > ((UInt32)2 << 30))
+    sizeReserv = historySize >> 2;
+  sizeReserv += (keepAddBufferBefore + matchMaxLen + keepAddBufferAfter) / 2 + (1 << 19);
+
+  p->keepSizeBefore = historySize + keepAddBufferBefore + 1;
+  p->keepSizeAfter = matchMaxLen + keepAddBufferAfter;
+  /* we need one additional byte, since we use MoveBlock after pos++ and before dictionary using */
+  if (LzInWindow_Create(p, sizeReserv, alloc))
+  {
+    UInt32 newCyclicBufferSize = (historySize /* >> p->skipModeBits */) + 1;
+    UInt32 hs;
+    p->matchMaxLen = matchMaxLen;
+    {
+      p->fixedHashSize = 0;
+      if (p->numHashBytes == 2)
+        hs = (1 << 16) - 1;
+      else
+      {
+        hs = historySize - 1;
+        hs |= (hs >> 1);
+        hs |= (hs >> 2);
+        hs |= (hs >> 4);
+        hs |= (hs >> 8);
+        hs >>= 1;
+        /* hs >>= p->skipModeBits; */
+        hs |= 0xFFFF; /* don't change it! It's required for Deflate */
+        if (hs > (1 << 24))
+        {
+          if (p->numHashBytes == 3)
+            hs = (1 << 24) - 1;
+          else
+            hs >>= 1;
+        }
+      }
+      p->hashMask = hs;
+      hs++;
+      if (p->numHashBytes > 2) p->fixedHashSize += kHash2Size;
+      if (p->numHashBytes > 3) p->fixedHashSize += kHash3Size;
+      if (p->numHashBytes > 4) p->fixedHashSize += kHash4Size;
+      hs += p->fixedHashSize;
+    }
+
+    {
+      UInt32 prevSize = p->hashSizeSum + p->numSons;
+      UInt32 newSize;
+      p->historySize = historySize;
+      p->hashSizeSum = hs;
+      p->cyclicBufferSize = newCyclicBufferSize;
+      p->numSons = (p->btMode ? newCyclicBufferSize * 2 : newCyclicBufferSize);
+      newSize = p->hashSizeSum + p->numSons;
+      if (p->hash != 0 && prevSize == newSize)
+        return 1;
+      MatchFinder_FreeThisClassMemory(p, alloc);
+      p->hash = AllocRefs(newSize, alloc);
+      if (p->hash != 0)
+      {
+        p->son = p->hash + p->hashSizeSum;
+        return 1;
+      }
+    }
+  }
+  MatchFinder_Free(p, alloc);
+  return 0;
+}
+
+static void MatchFinder_SetLimits(CMatchFinder *p)
+{
+  UInt32 limit = kMaxValForNormalize - p->pos;
+  UInt32 limit2 = p->cyclicBufferSize - p->cyclicBufferPos;
+  if (limit2 < limit)
+    limit = limit2;
+  limit2 = p->streamPos - p->pos;
+  if (limit2 <= p->keepSizeAfter)
+  {
+    if (limit2 > 0)
+      limit2 = 1;
+  }
+  else
+    limit2 -= p->keepSizeAfter;
+  if (limit2 < limit)
+    limit = limit2;
+  {
+    UInt32 lenLimit = p->streamPos - p->pos;
+    if (lenLimit > p->matchMaxLen)
+      lenLimit = p->matchMaxLen;
+    p->lenLimit = lenLimit;
+  }
+  p->posLimit = p->pos + limit;
+}
+
+void MatchFinder_Init(CMatchFinder *p)
+{
+  UInt32 i;
+  for (i = 0; i < p->hashSizeSum; i++)
+    p->hash[i] = kEmptyHashValue;
+  p->cyclicBufferPos = 0;
+  p->buffer = p->bufferBase;
+  p->pos = p->streamPos = p->cyclicBufferSize;
+  p->result = SZ_OK;
+  p->streamEndWasReached = 0;
+  MatchFinder_ReadBlock(p);
+  MatchFinder_SetLimits(p);
+}
+
+static UInt32 MatchFinder_GetSubValue(CMatchFinder *p)
+{
+  return (p->pos - p->historySize - 1) & kNormalizeMask;
+}
+
+void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems)
+{
+  UInt32 i;
+  for (i = 0; i < numItems; i++)
+  {
+    UInt32 value = items[i];
+    if (value <= subValue)
+      value = kEmptyHashValue;
+    else
+      value -= subValue;
+    items[i] = value;
+  }
+}
+
+static void MatchFinder_Normalize(CMatchFinder *p)
+{
+  UInt32 subValue = MatchFinder_GetSubValue(p);
+  MatchFinder_Normalize3(subValue, p->hash, p->hashSizeSum + p->numSons);
+  MatchFinder_ReduceOffsets(p, subValue);
+}
+
+static void MatchFinder_CheckLimits(CMatchFinder *p)
+{
+  if (p->pos == kMaxValForNormalize)
+    MatchFinder_Normalize(p);
+  if (!p->streamEndWasReached && p->keepSizeAfter == p->streamPos - p->pos)
+    MatchFinder_CheckAndMoveAndRead(p);
+  if (p->cyclicBufferPos == p->cyclicBufferSize)
+    p->cyclicBufferPos = 0;
+  MatchFinder_SetLimits(p);
+}
+
+static UInt32 * Hc_GetMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
+    UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue,
+    UInt32 *distances, UInt32 maxLen)
+{
+  son[_cyclicBufferPos] = curMatch;
+  for (;;)
+  {
+    UInt32 delta = pos - curMatch;
+    if (cutValue-- == 0 || delta >= _cyclicBufferSize)
+      return distances;
+    {
+      const Byte *pb = cur - delta;
+      curMatch = son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)];
+      if (pb[maxLen] == cur[maxLen] && *pb == *cur)
+      {
+        UInt32 len = 0;
+        while (++len != lenLimit)
+          if (pb[len] != cur[len])
+            break;
+        if (maxLen < len)
+        {
+          *distances++ = maxLen = len;
+          *distances++ = delta - 1;
+          if (len == lenLimit)
+            return distances;
+        }
+      }
+    }
+  }
+}
+
+UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
+    UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue,
+    UInt32 *distances, UInt32 maxLen)
+{
+  CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1;
+  CLzRef *ptr1 = son + (_cyclicBufferPos << 1);
+  UInt32 len0 = 0, len1 = 0;
+  for (;;)
+  {
+    UInt32 delta = pos - curMatch;
+    if (cutValue-- == 0 || delta >= _cyclicBufferSize)
+    {
+      *ptr0 = *ptr1 = kEmptyHashValue;
+      return distances;
+    }
+    {
+      CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1);
+      const Byte *pb = cur - delta;
+      UInt32 len = (len0 < len1 ? len0 : len1);
+      if (pb[len] == cur[len])
+      {
+        if (++len != lenLimit && pb[len] == cur[len])
+          while (++len != lenLimit)
+            if (pb[len] != cur[len])
+              break;
+        if (maxLen < len)
+        {
+          *distances++ = maxLen = len;
+          *distances++ = delta - 1;
+          if (len == lenLimit)
+          {
+            *ptr1 = pair[0];
+            *ptr0 = pair[1];
+            return distances;
+          }
+        }
+      }
+      if (pb[len] < cur[len])
+      {
+        *ptr1 = curMatch;
+        ptr1 = pair + 1;
+        curMatch = *ptr1;
+        len1 = len;
+      }
+      else
+      {
+        *ptr0 = curMatch;
+        ptr0 = pair;
+        curMatch = *ptr0;
+        len0 = len;
+      }
+    }
+  }
+}
+
+static void SkipMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
+    UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue)
+{
+  CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1;
+  CLzRef *ptr1 = son + (_cyclicBufferPos << 1);
+  UInt32 len0 = 0, len1 = 0;
+  for (;;)
+  {
+    UInt32 delta = pos - curMatch;
+    if (cutValue-- == 0 || delta >= _cyclicBufferSize)
+    {
+      *ptr0 = *ptr1 = kEmptyHashValue;
+      return;
+    }
+    {
+      CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1);
+      const Byte *pb = cur - delta;
+      UInt32 len = (len0 < len1 ? len0 : len1);
+      if (pb[len] == cur[len])
+      {
+        while (++len != lenLimit)
+          if (pb[len] != cur[len])
+            break;
+        {
+          if (len == lenLimit)
+          {
+            *ptr1 = pair[0];
+            *ptr0 = pair[1];
+            return;
+          }
+        }
+      }
+      if (pb[len] < cur[len])
+      {
+        *ptr1 = curMatch;
+        ptr1 = pair + 1;
+        curMatch = *ptr1;
+        len1 = len;
+      }
+      else
+      {
+        *ptr0 = curMatch;
+        ptr0 = pair;
+        curMatch = *ptr0;
+        len0 = len;
+      }
+    }
+  }
+}
+
+#define MOVE_POS \
+  ++p->cyclicBufferPos; \
+  p->buffer++; \
+  if (++p->pos == p->posLimit) MatchFinder_CheckLimits(p);
+
+#define MOVE_POS_RET MOVE_POS return offset;
+
+static void MatchFinder_MovePos(CMatchFinder *p) { MOVE_POS; }
+
+#define GET_MATCHES_HEADER2(minLen, ret_op) \
+  UInt32 lenLimit; UInt32 hashValue; const Byte *cur; UInt32 curMatch; \
+  lenLimit = p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; }} \
+  cur = p->buffer;
+
+#define GET_MATCHES_HEADER(minLen) GET_MATCHES_HEADER2(minLen, return 0)
+#define SKIP_HEADER(minLen)        GET_MATCHES_HEADER2(minLen, continue)
+
+#define MF_PARAMS(p) p->pos, p->buffer, p->son, p->cyclicBufferPos, p->cyclicBufferSize, p->cutValue
+
+#define GET_MATCHES_FOOTER(offset, maxLen) \
+  offset = (UInt32)(GetMatchesSpec1(lenLimit, curMatch, MF_PARAMS(p), \
+  distances + offset, maxLen) - distances); MOVE_POS_RET;
+
+#define SKIP_FOOTER \
+  SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS;
+
+static UInt32 Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
+{
+  UInt32 offset;
+  GET_MATCHES_HEADER(2)
+  HASH2_CALC;
+  curMatch = p->hash[hashValue];
+  p->hash[hashValue] = p->pos;
+  offset = 0;
+  GET_MATCHES_FOOTER(offset, 1)
+}
+
+UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
+{
+  UInt32 offset;
+  GET_MATCHES_HEADER(3)
+  HASH_ZIP_CALC;
+  curMatch = p->hash[hashValue];
+  p->hash[hashValue] = p->pos;
+  offset = 0;
+  GET_MATCHES_FOOTER(offset, 2)
+}
+
+static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
+{
+  UInt32 hash2Value, delta2, maxLen, offset;
+  GET_MATCHES_HEADER(3)
+
+  HASH3_CALC;
+
+  delta2 = p->pos - p->hash[hash2Value];
+  curMatch = p->hash[kFix3HashSize + hashValue];
+  
+  p->hash[hash2Value] =
+  p->hash[kFix3HashSize + hashValue] = p->pos;
+
+
+  maxLen = 2;
+  offset = 0;
+  if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
+  {
+    for (; maxLen != lenLimit; maxLen++)
+      if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen])
+        break;
+    distances[0] = maxLen;
+    distances[1] = delta2 - 1;
+    offset = 2;
+    if (maxLen == lenLimit)
+    {
+      SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p));
+      MOVE_POS_RET;
+    }
+  }
+  GET_MATCHES_FOOTER(offset, maxLen)
+}
+
+static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
+{
+  UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset;
+  GET_MATCHES_HEADER(4)
+
+  HASH4_CALC;
+
+  delta2 = p->pos - p->hash[                hash2Value];
+  delta3 = p->pos - p->hash[kFix3HashSize + hash3Value];
+  curMatch = p->hash[kFix4HashSize + hashValue];
+  
+  p->hash[                hash2Value] =
+  p->hash[kFix3HashSize + hash3Value] =
+  p->hash[kFix4HashSize + hashValue] = p->pos;
+
+  maxLen = 1;
+  offset = 0;
+  if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
+  {
+    distances[0] = maxLen = 2;
+    distances[1] = delta2 - 1;
+    offset = 2;
+  }
+  if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur)
+  {
+    maxLen = 3;
+    distances[offset + 1] = delta3 - 1;
+    offset += 2;
+    delta2 = delta3;
+  }
+  if (offset != 0)
+  {
+    for (; maxLen != lenLimit; maxLen++)
+      if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen])
+        break;
+    distances[offset - 2] = maxLen;
+    if (maxLen == lenLimit)
+    {
+      SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p));
+      MOVE_POS_RET;
+    }
+  }
+  if (maxLen < 3)
+    maxLen = 3;
+  GET_MATCHES_FOOTER(offset, maxLen)
+}
+
+static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
+{
+  UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset;
+  GET_MATCHES_HEADER(4)
+
+  HASH4_CALC;
+
+  delta2 = p->pos - p->hash[                hash2Value];
+  delta3 = p->pos - p->hash[kFix3HashSize + hash3Value];
+  curMatch = p->hash[kFix4HashSize + hashValue];
+
+  p->hash[                hash2Value] =
+  p->hash[kFix3HashSize + hash3Value] =
+  p->hash[kFix4HashSize + hashValue] = p->pos;
+
+  maxLen = 1;
+  offset = 0;
+  if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
+  {
+    distances[0] = maxLen = 2;
+    distances[1] = delta2 - 1;
+    offset = 2;
+  }
+  if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur)
+  {
+    maxLen = 3;
+    distances[offset + 1] = delta3 - 1;
+    offset += 2;
+    delta2 = delta3;
+  }
+  if (offset != 0)
+  {
+    for (; maxLen != lenLimit; maxLen++)
+      if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen])
+        break;
+    distances[offset - 2] = maxLen;
+    if (maxLen == lenLimit)
+    {
+      p->son[p->cyclicBufferPos] = curMatch;
+      MOVE_POS_RET;
+    }
+  }
+  if (maxLen < 3)
+    maxLen = 3;
+  offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p),
+    distances + offset, maxLen) - (distances));
+  MOVE_POS_RET
+}
+
+UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
+{
+  UInt32 offset;
+  GET_MATCHES_HEADER(3)
+  HASH_ZIP_CALC;
+  curMatch = p->hash[hashValue];
+  p->hash[hashValue] = p->pos;
+  offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p),
+    distances, 2) - (distances));
+  MOVE_POS_RET
+}
+
+static void Bt2_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
+{
+  do
+  {
+    SKIP_HEADER(2)
+    HASH2_CALC;
+    curMatch = p->hash[hashValue];
+    p->hash[hashValue] = p->pos;
+    SKIP_FOOTER
+  }
+  while (--num != 0);
+}
+
+void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
+{
+  do
+  {
+    SKIP_HEADER(3)
+    HASH_ZIP_CALC;
+    curMatch = p->hash[hashValue];
+    p->hash[hashValue] = p->pos;
+    SKIP_FOOTER
+  }
+  while (--num != 0);
+}
+
+static void Bt3_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
+{
+  do
+  {
+    UInt32 hash2Value;
+    SKIP_HEADER(3)
+    HASH3_CALC;
+    curMatch = p->hash[kFix3HashSize + hashValue];
+    p->hash[hash2Value] =
+    p->hash[kFix3HashSize + hashValue] = p->pos;
+    SKIP_FOOTER
+  }
+  while (--num != 0);
+}
+
+static void Bt4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
+{
+  do
+  {
+    UInt32 hash2Value, hash3Value;
+    SKIP_HEADER(4)
+    HASH4_CALC;
+    curMatch = p->hash[kFix4HashSize + hashValue];
+    p->hash[                hash2Value] =
+    p->hash[kFix3HashSize + hash3Value] = p->pos;
+    p->hash[kFix4HashSize + hashValue] = p->pos;
+    SKIP_FOOTER
+  }
+  while (--num != 0);
+}
+
+static void Hc4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
+{
+  do
+  {
+    UInt32 hash2Value, hash3Value;
+    SKIP_HEADER(4)
+    HASH4_CALC;
+    curMatch = p->hash[kFix4HashSize + hashValue];
+    p->hash[                hash2Value] =
+    p->hash[kFix3HashSize + hash3Value] =
+    p->hash[kFix4HashSize + hashValue] = p->pos;
+    p->son[p->cyclicBufferPos] = curMatch;
+    MOVE_POS
+  }
+  while (--num != 0);
+}
+
+void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
+{
+  do
+  {
+    SKIP_HEADER(3)
+    HASH_ZIP_CALC;
+    curMatch = p->hash[hashValue];
+    p->hash[hashValue] = p->pos;
+    p->son[p->cyclicBufferPos] = curMatch;
+    MOVE_POS
+  }
+  while (--num != 0);
+}
+
+void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable)
+{
+  vTable->Init = (Mf_Init_Func)MatchFinder_Init;
+  vTable->GetIndexByte = (Mf_GetIndexByte_Func)MatchFinder_GetIndexByte;
+  vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinder_GetNumAvailableBytes;
+  vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinder_GetPointerToCurrentPos;
+  if (!p->btMode)
+  {
+    vTable->GetMatches = (Mf_GetMatches_Func)Hc4_MatchFinder_GetMatches;
+    vTable->Skip = (Mf_Skip_Func)Hc4_MatchFinder_Skip;
+  }
+  else if (p->numHashBytes == 2)
+  {
+    vTable->GetMatches = (Mf_GetMatches_Func)Bt2_MatchFinder_GetMatches;
+    vTable->Skip = (Mf_Skip_Func)Bt2_MatchFinder_Skip;
+  }
+  else if (p->numHashBytes == 3)
+  {
+    vTable->GetMatches = (Mf_GetMatches_Func)Bt3_MatchFinder_GetMatches;
+    vTable->Skip = (Mf_Skip_Func)Bt3_MatchFinder_Skip;
+  }
+  else
+  {
+    vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches;
+    vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip;
+  }
+}
diff --git a/extern/lzma/LzFind.h b/extern/lzma/LzFind.h
new file mode 100644 (file)
index 0000000..5b9cebf
--- /dev/null
@@ -0,0 +1,107 @@
+/* LzFind.h -- Match finder for LZ algorithms
+2008-10-04 : Igor Pavlov : Public domain */
+
+#ifndef __LZFIND_H
+#define __LZFIND_H
+
+#include "Types.h"
+
+typedef UInt32 CLzRef;
+
+typedef struct _CMatchFinder
+{
+  Byte *buffer;
+  UInt32 pos;
+  UInt32 posLimit;
+  UInt32 streamPos;
+  UInt32 lenLimit;
+
+  UInt32 cyclicBufferPos;
+  UInt32 cyclicBufferSize; /* it must be = (historySize + 1) */
+
+  UInt32 matchMaxLen;
+  CLzRef *hash;
+  CLzRef *son;
+  UInt32 hashMask;
+  UInt32 cutValue;
+
+  Byte *bufferBase;
+  ISeqInStream *stream;
+  int streamEndWasReached;
+
+  UInt32 blockSize;
+  UInt32 keepSizeBefore;
+  UInt32 keepSizeAfter;
+
+  UInt32 numHashBytes;
+  int directInput;
+  int btMode;
+  /* int skipModeBits; */
+  int bigHash;
+  UInt32 historySize;
+  UInt32 fixedHashSize;
+  UInt32 hashSizeSum;
+  UInt32 numSons;
+  SRes result;
+  UInt32 crc[256];
+} CMatchFinder;
+
+#define Inline_MatchFinder_GetPointerToCurrentPos(p) ((p)->buffer)
+#define Inline_MatchFinder_GetIndexByte(p, index) ((p)->buffer[(Int32)(index)])
+
+#define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos)
+
+int MatchFinder_NeedMove(CMatchFinder *p);
+Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p);
+void MatchFinder_MoveBlock(CMatchFinder *p);
+void MatchFinder_ReadIfRequired(CMatchFinder *p);
+
+void MatchFinder_Construct(CMatchFinder *p);
+
+/* Conditions:
+     historySize <= 3 GB
+     keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB
+*/
+int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
+    UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
+    ISzAlloc *alloc);
+void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc);
+void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems);
+void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue);
+
+UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son,
+    UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue,
+    UInt32 *distances, UInt32 maxLen);
+
+/*
+Conditions:
+  Mf_GetNumAvailableBytes_Func must be called before each Mf_GetMatchLen_Func.
+  Mf_GetPointerToCurrentPos_Func's result must be used only before any other function
+*/
+
+typedef void (*Mf_Init_Func)(void *object);
+typedef Byte (*Mf_GetIndexByte_Func)(void *object, Int32 index);
+typedef UInt32 (*Mf_GetNumAvailableBytes_Func)(void *object);
+typedef const Byte * (*Mf_GetPointerToCurrentPos_Func)(void *object);
+typedef UInt32 (*Mf_GetMatches_Func)(void *object, UInt32 *distances);
+typedef void (*Mf_Skip_Func)(void *object, UInt32);
+
+typedef struct _IMatchFinder
+{
+  Mf_Init_Func Init;
+  Mf_GetIndexByte_Func GetIndexByte;
+  Mf_GetNumAvailableBytes_Func GetNumAvailableBytes;
+  Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos;
+  Mf_GetMatches_Func GetMatches;
+  Mf_Skip_Func Skip;
+} IMatchFinder;
+
+void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable);
+
+void MatchFinder_Init(CMatchFinder *p);
+UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
+UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
+void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
+void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
+
+#endif
diff --git a/extern/lzma/LzHash.h b/extern/lzma/LzHash.h
new file mode 100644 (file)
index 0000000..9f4173e
--- /dev/null
@@ -0,0 +1,54 @@
+/* LzHash.h -- HASH functions for LZ algorithms
+2008-10-04 : Igor Pavlov : Public domain */
+
+#ifndef __LZHASH_H
+#define __LZHASH_H
+
+#define kHash2Size (1 << 10)
+#define kHash3Size (1 << 16)
+#define kHash4Size (1 << 20)
+
+#define kFix3HashSize (kHash2Size)
+#define kFix4HashSize (kHash2Size + kHash3Size)
+#define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size)
+
+#define HASH2_CALC hashValue = cur[0] | ((UInt32)cur[1] << 8);
+
+#define HASH3_CALC { \
+  UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
+  hash2Value = temp & (kHash2Size - 1); \
+  hashValue = (temp ^ ((UInt32)cur[2] << 8)) & p->hashMask; }
+
+#define HASH4_CALC { \
+  UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
+  hash2Value = temp & (kHash2Size - 1); \
+  hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \
+  hashValue = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & p->hashMask; }
+
+#define HASH5_CALC { \
+  UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
+  hash2Value = temp & (kHash2Size - 1); \
+  hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \
+  hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)); \
+  hashValue = (hash4Value ^ (p->crc[cur[4]] << 3)) & p->hashMask; \
+  hash4Value &= (kHash4Size - 1); }
+
+/* #define HASH_ZIP_CALC hashValue = ((cur[0] | ((UInt32)cur[1] << 8)) ^ p->crc[cur[2]]) & 0xFFFF; */
+#define HASH_ZIP_CALC hashValue = ((cur[2] | ((UInt32)cur[0] << 8)) ^ p->crc[cur[1]]) & 0xFFFF;
+
+
+#define MT_HASH2_CALC \
+  hash2Value = (p->crc[cur[0]] ^ cur[1]) & (kHash2Size - 1);
+
+#define MT_HASH3_CALC { \
+  UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
+  hash2Value = temp & (kHash2Size - 1); \
+  hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); }
+
+#define MT_HASH4_CALC { \
+  UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
+  hash2Value = temp & (kHash2Size - 1); \
+  hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \
+  hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & (kHash4Size - 1); }
+
+#endif
diff --git a/extern/lzma/LzmaDec.c b/extern/lzma/LzmaDec.c
new file mode 100644 (file)
index 0000000..d87eb19
--- /dev/null
@@ -0,0 +1,1007 @@
+/* LzmaDec.c -- LZMA Decoder
+2008-11-06 : Igor Pavlov : Public domain */
+
+#include "LzmaDec.h"
+
+#include <string.h>
+
+#define kNumTopBits 24
+#define kTopValue ((UInt32)1 << kNumTopBits)
+
+#define kNumBitModelTotalBits 11
+#define kBitModelTotal (1 << kNumBitModelTotalBits)
+#define kNumMoveBits 5
+
+#define RC_INIT_SIZE 5
+
+#define NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | (*buf++); }
+
+#define IF_BIT_0(p) ttt = *(p); NORMALIZE; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound)
+#define UPDATE_0(p) range = bound; *(p) = (CLzmaProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits));
+#define UPDATE_1(p) range -= bound; code -= bound; *(p) = (CLzmaProb)(ttt - (ttt >> kNumMoveBits));
+#define GET_BIT2(p, i, A0, A1) IF_BIT_0(p) \
+  { UPDATE_0(p); i = (i + i); A0; } else \
+  { UPDATE_1(p); i = (i + i) + 1; A1; }
+#define GET_BIT(p, i) GET_BIT2(p, i, ; , ;)
+
+#define TREE_GET_BIT(probs, i) { GET_BIT((probs + i), i); }
+#define TREE_DECODE(probs, limit, i) \
+  { i = 1; do { TREE_GET_BIT(probs, i); } while (i < limit); i -= limit; }
+
+/* #define _LZMA_SIZE_OPT */
+
+#ifdef _LZMA_SIZE_OPT
+#define TREE_6_DECODE(probs, i) TREE_DECODE(probs, (1 << 6), i)
+#else
+#define TREE_6_DECODE(probs, i) \
+  { i = 1; \
+  TREE_GET_BIT(probs, i); \
+  TREE_GET_BIT(probs, i); \
+  TREE_GET_BIT(probs, i); \
+  TREE_GET_BIT(probs, i); \
+  TREE_GET_BIT(probs, i); \
+  TREE_GET_BIT(probs, i); \
+  i -= 0x40; }
+#endif
+
+#define NORMALIZE_CHECK if (range < kTopValue) { if (buf >= bufLimit) return DUMMY_ERROR; range <<= 8; code = (code << 8) | (*buf++); }
+
+#define IF_BIT_0_CHECK(p) ttt = *(p); NORMALIZE_CHECK; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound)
+#define UPDATE_0_CHECK range = bound;
+#define UPDATE_1_CHECK range -= bound; code -= bound;
+#define GET_BIT2_CHECK(p, i, A0, A1) IF_BIT_0_CHECK(p) \
+  { UPDATE_0_CHECK; i = (i + i); A0; } else \
+  { UPDATE_1_CHECK; i = (i + i) + 1; A1; }
+#define GET_BIT_CHECK(p, i) GET_BIT2_CHECK(p, i, ; , ;)
+#define TREE_DECODE_CHECK(probs, limit, i) \
+  { i = 1; do { GET_BIT_CHECK(probs + i, i) } while (i < limit); i -= limit; }
+
+
+#define kNumPosBitsMax 4
+#define kNumPosStatesMax (1 << kNumPosBitsMax)
+
+#define kLenNumLowBits 3
+#define kLenNumLowSymbols (1 << kLenNumLowBits)
+#define kLenNumMidBits 3
+#define kLenNumMidSymbols (1 << kLenNumMidBits)
+#define kLenNumHighBits 8
+#define kLenNumHighSymbols (1 << kLenNumHighBits)
+
+#define LenChoice 0
+#define LenChoice2 (LenChoice + 1)
+#define LenLow (LenChoice2 + 1)
+#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
+#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
+#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
+
+
+#define kNumStates 12
+#define kNumLitStates 7
+
+#define kStartPosModelIndex 4
+#define kEndPosModelIndex 14
+#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
+
+#define kNumPosSlotBits 6
+#define kNumLenToPosStates 4
+
+#define kNumAlignBits 4
+#define kAlignTableSize (1 << kNumAlignBits)
+
+#define kMatchMinLen 2
+#define kMatchSpecLenStart (kMatchMinLen + kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols)
+
+#define IsMatch 0
+#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax))
+#define IsRepG0 (IsRep + kNumStates)
+#define IsRepG1 (IsRepG0 + kNumStates)
+#define IsRepG2 (IsRepG1 + kNumStates)
+#define IsRep0Long (IsRepG2 + kNumStates)
+#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax))
+#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits))
+#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex)
+#define LenCoder (Align + kAlignTableSize)
+#define RepLenCoder (LenCoder + kNumLenProbs)
+#define Literal (RepLenCoder + kNumLenProbs)
+
+#define LZMA_BASE_SIZE 1846
+#define LZMA_LIT_SIZE 768
+
+#define LzmaProps_GetNumProbs(p) ((UInt32)LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((p)->lc + (p)->lp)))
+
+#if Literal != LZMA_BASE_SIZE
+StopCompilingDueBUG
+#endif
+
+static const Byte kLiteralNextStates[kNumStates * 2] =
+{
+  0, 0, 0, 0, 1, 2, 3,  4,  5,  6,  4,  5,
+  7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10
+};
+
+#define LZMA_DIC_MIN (1 << 12)
+
+/* First LZMA-symbol is always decoded.
+And it decodes new LZMA-symbols while (buf < bufLimit), but "buf" is without last normalization
+Out:
+  Result:
+    SZ_OK - OK
+    SZ_ERROR_DATA - Error
+  p->remainLen:
+    < kMatchSpecLenStart : normal remain
+    = kMatchSpecLenStart : finished
+    = kMatchSpecLenStart + 1 : Flush marker
+    = kMatchSpecLenStart + 2 : State Init Marker
+*/
+
+static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte *bufLimit)
+{
+  CLzmaProb *probs = p->probs;
+
+  unsigned state = p->state;
+  UInt32 rep0 = p->reps[0], rep1 = p->reps[1], rep2 = p->reps[2], rep3 = p->reps[3];
+  unsigned pbMask = ((unsigned)1 << (p->prop.pb)) - 1;
+  unsigned lpMask = ((unsigned)1 << (p->prop.lp)) - 1;
+  unsigned lc = p->prop.lc;
+
+  Byte *dic = p->dic;
+  SizeT dicBufSize = p->dicBufSize;
+  SizeT dicPos = p->dicPos;
+  
+  UInt32 processedPos = p->processedPos;
+  UInt32 checkDicSize = p->checkDicSize;
+  unsigned len = 0;
+
+  const Byte *buf = p->buf;
+  UInt32 range = p->range;
+  UInt32 code = p->code;
+
+  do
+  {
+    CLzmaProb *prob;
+    UInt32 bound;
+    unsigned ttt;
+    unsigned posState = processedPos & pbMask;
+
+    prob = probs + IsMatch + (state << kNumPosBitsMax) + posState;
+    IF_BIT_0(prob)
+    {
+      unsigned symbol;
+      UPDATE_0(prob);
+      prob = probs + Literal;
+      if (checkDicSize != 0 || processedPos != 0)
+        prob += (LZMA_LIT_SIZE * (((processedPos & lpMask) << lc) +
+        (dic[(dicPos == 0 ? dicBufSize : dicPos) - 1] >> (8 - lc))));
+
+      if (state < kNumLitStates)
+      {
+        symbol = 1;
+        do { GET_BIT(prob + symbol, symbol) } while (symbol < 0x100);
+      }
+      else
+      {
+        unsigned matchByte = p->dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)];
+        unsigned offs = 0x100;
+        symbol = 1;
+        do
+        {
+          unsigned bit;
+          CLzmaProb *probLit;
+          matchByte <<= 1;
+          bit = (matchByte & offs);
+          probLit = prob + offs + bit + symbol;
+          GET_BIT2(probLit, symbol, offs &= ~bit, offs &= bit)
+        }
+        while (symbol < 0x100);
+      }
+      dic[dicPos++] = (Byte)symbol;
+      processedPos++;
+
+      state = kLiteralNextStates[state];
+      /* if (state < 4) state = 0; else if (state < 10) state -= 3; else state -= 6; */
+      continue;
+    }
+    else
+    {
+      UPDATE_1(prob);
+      prob = probs + IsRep + state;
+      IF_BIT_0(prob)
+      {
+        UPDATE_0(prob);
+        state += kNumStates;
+        prob = probs + LenCoder;
+      }
+      else
+      {
+        UPDATE_1(prob);
+        if (checkDicSize == 0 && processedPos == 0)
+          return SZ_ERROR_DATA;
+        prob = probs + IsRepG0 + state;
+        IF_BIT_0(prob)
+        {
+          UPDATE_0(prob);
+          prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState;
+          IF_BIT_0(prob)
+          {
+            UPDATE_0(prob);
+            dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)];
+            dicPos++;
+            processedPos++;
+            state = state < kNumLitStates ? 9 : 11;
+            continue;
+          }
+          UPDATE_1(prob);
+        }
+        else
+        {
+          UInt32 distance;
+          UPDATE_1(prob);
+          prob = probs + IsRepG1 + state;
+          IF_BIT_0(prob)
+          {
+            UPDATE_0(prob);
+            distance = rep1;
+          }
+          else
+          {
+            UPDATE_1(prob);
+            prob = probs + IsRepG2 + state;
+            IF_BIT_0(prob)
+            {
+              UPDATE_0(prob);
+              distance = rep2;
+            }
+            else
+            {
+              UPDATE_1(prob);
+              distance = rep3;
+              rep3 = rep2;
+            }
+            rep2 = rep1;
+          }
+          rep1 = rep0;
+          rep0 = distance;
+        }
+        state = state < kNumLitStates ? 8 : 11;
+        prob = probs + RepLenCoder;
+      }
+      {
+        unsigned limit, offset;
+        CLzmaProb *probLen = prob + LenChoice;
+        IF_BIT_0(probLen)
+        {
+          UPDATE_0(probLen);
+          probLen = prob + LenLow + (posState << kLenNumLowBits);
+          offset = 0;
+          limit = (1 << kLenNumLowBits);
+        }
+        else
+        {
+          UPDATE_1(probLen);
+          probLen = prob + LenChoice2;
+          IF_BIT_0(probLen)
+          {
+            UPDATE_0(probLen);
+            probLen = prob + LenMid + (posState << kLenNumMidBits);
+            offset = kLenNumLowSymbols;
+            limit = (1 << kLenNumMidBits);
+          }
+          else
+          {
+            UPDATE_1(probLen);
+            probLen = prob + LenHigh;
+            offset = kLenNumLowSymbols + kLenNumMidSymbols;
+            limit = (1 << kLenNumHighBits);
+          }
+        }
+        TREE_DECODE(probLen, limit, len);
+        len += offset;
+      }
+
+      if (state >= kNumStates)
+      {
+        UInt32 distance;
+        prob = probs + PosSlot +
+            ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits);
+        TREE_6_DECODE(prob, distance);
+        if (distance >= kStartPosModelIndex)
+        {
+          unsigned posSlot = (unsigned)distance;
+          int numDirectBits = (int)(((distance >> 1) - 1));
+          distance = (2 | (distance & 1));
+          if (posSlot < kEndPosModelIndex)
+          {
+            distance <<= numDirectBits;
+            prob = probs + SpecPos + distance - posSlot - 1;
+            {
+              UInt32 mask = 1;
+              unsigned i = 1;
+              do
+              {
+                GET_BIT2(prob + i, i, ; , distance |= mask);
+                mask <<= 1;
+              }
+              while (--numDirectBits != 0);
+            }
+          }
+          else
+          {
+            numDirectBits -= kNumAlignBits;
+            do
+            {
+              NORMALIZE
+              range >>= 1;
+              
+              {
+                UInt32 t;
+                code -= range;
+                t = (0 - ((UInt32)code >> 31)); /* (UInt32)((Int32)code >> 31) */
+                distance = (distance << 1) + (t + 1);
+                code += range & t;
+              }
+              /*
+              distance <<= 1;
+              if (code >= range)
+              {
+                code -= range;
+                distance |= 1;
+              }
+              */
+            }
+            while (--numDirectBits != 0);
+            prob = probs + Align;
+            distance <<= kNumAlignBits;
+            {
+              unsigned i = 1;
+              GET_BIT2(prob + i, i, ; , distance |= 1);
+              GET_BIT2(prob + i, i, ; , distance |= 2);
+              GET_BIT2(prob + i, i, ; , distance |= 4);
+              GET_BIT2(prob + i, i, ; , distance |= 8);
+            }
+            if (distance == (UInt32)0xFFFFFFFF)
+            {
+              len += kMatchSpecLenStart;
+              state -= kNumStates;
+              break;
+            }
+          }
+        }
+        rep3 = rep2;
+        rep2 = rep1;
+        rep1 = rep0;
+        rep0 = distance + 1;
+        if (checkDicSize == 0)
+        {
+          if (distance >= processedPos)
+            return SZ_ERROR_DATA;
+        }
+        else if (distance >= checkDicSize)
+          return SZ_ERROR_DATA;
+        state = (state < kNumStates + kNumLitStates) ? kNumLitStates : kNumLitStates + 3;
+        /* state = kLiteralNextStates[state]; */
+      }
+
+      len += kMatchMinLen;
+
+      if (limit == dicPos)
+        return SZ_ERROR_DATA;
+      {
+        SizeT rem = limit - dicPos;
+        unsigned curLen = ((rem < len) ? (unsigned)rem : len);
+        SizeT pos = (dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0);
+
+        processedPos += curLen;
+
+        len -= curLen;
+        if (pos + curLen <= dicBufSize)
+        {
+          Byte *dest = dic + dicPos;
+          ptrdiff_t src = (ptrdiff_t)pos - (ptrdiff_t)dicPos;
+          const Byte *lim = dest + curLen;
+          dicPos += curLen;
+          do
+            *(dest) = (Byte)*(dest + src);
+          while (++dest != lim);
+        }
+        else
+        {
+          do
+          {
+            dic[dicPos++] = dic[pos];
+            if (++pos == dicBufSize)
+              pos = 0;
+          }
+          while (--curLen != 0);
+        }
+      }
+    }
+  }
+  while (dicPos < limit && buf < bufLimit);
+  NORMALIZE;
+  p->buf = buf;
+  p->range = range;
+  p->code = code;
+  p->remainLen = len;
+  p->dicPos = dicPos;
+  p->processedPos = processedPos;
+  p->reps[0] = rep0;
+  p->reps[1] = rep1;
+  p->reps[2] = rep2;
+  p->reps[3] = rep3;
+  p->state = state;
+
+  return SZ_OK;
+}
+
+static void MY_FAST_CALL LzmaDec_WriteRem(CLzmaDec *p, SizeT limit)
+{
+  if (p->remainLen != 0 && p->remainLen < kMatchSpecLenStart)
+  {
+    Byte *dic = p->dic;
+    SizeT dicPos = p->dicPos;
+    SizeT dicBufSize = p->dicBufSize;
+    unsigned len = p->remainLen;
+    UInt32 rep0 = p->reps[0];
+    if (limit - dicPos < len)
+      len = (unsigned)(limit - dicPos);
+
+    if (p->checkDicSize == 0 && p->prop.dicSize - p->processedPos <= len)
+      p->checkDicSize = p->prop.dicSize;
+
+    p->processedPos += len;
+    p->remainLen -= len;
+    while (len-- != 0)
+    {
+      dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)];
+      dicPos++;
+    }
+    p->dicPos = dicPos;
+  }
+}
+
+static int MY_FAST_CALL LzmaDec_DecodeReal2(CLzmaDec *p, SizeT limit, const Byte *bufLimit)
+{
+  do
+  {
+    SizeT limit2 = limit;
+    if (p->checkDicSize == 0)
+    {
+      UInt32 rem = p->prop.dicSize - p->processedPos;
+      if (limit - p->dicPos > rem)
+        limit2 = p->dicPos + rem;
+    }
+    RINOK(LzmaDec_DecodeReal(p, limit2, bufLimit));
+    if (p->processedPos >= p->prop.dicSize)
+      p->checkDicSize = p->prop.dicSize;
+    LzmaDec_WriteRem(p, limit);
+  }
+  while (p->dicPos < limit && p->buf < bufLimit && p->remainLen < kMatchSpecLenStart);
+
+  if (p->remainLen > kMatchSpecLenStart)
+  {
+    p->remainLen = kMatchSpecLenStart;
+  }
+  return 0;
+}
+
+typedef enum
+{
+  DUMMY_ERROR, /* unexpected end of input stream */
+  DUMMY_LIT,
+  DUMMY_MATCH,
+  DUMMY_REP
+} ELzmaDummy;
+
+static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inSize)
+{
+  UInt32 range = p->range;
+  UInt32 code = p->code;
+  const Byte *bufLimit = buf + inSize;
+  CLzmaProb *probs = p->probs;
+  unsigned state = p->state;
+  ELzmaDummy res;
+
+  {
+    CLzmaProb *prob;
+    UInt32 bound;
+    unsigned ttt;
+    unsigned posState = (p->processedPos) & ((1 << p->prop.pb) - 1);
+
+    prob = probs + IsMatch + (state << kNumPosBitsMax) + posState;
+    IF_BIT_0_CHECK(prob)
+    {
+      UPDATE_0_CHECK
+
+      /* if (bufLimit - buf >= 7) return DUMMY_LIT; */
+
+      prob = probs + Literal;
+      if (p->checkDicSize != 0 || p->processedPos != 0)
+        prob += (LZMA_LIT_SIZE *
+          ((((p->processedPos) & ((1 << (p->prop.lp)) - 1)) << p->prop.lc) +
+          (p->dic[(p->dicPos == 0 ? p->dicBufSize : p->dicPos) - 1] >> (8 - p->prop.lc))));
+
+      if (state < kNumLitStates)
+      {
+        unsigned symbol = 1;
+        do { GET_BIT_CHECK(prob + symbol, symbol) } while (symbol < 0x100);
+      }
+      else
+      {
+        unsigned matchByte = p->dic[p->dicPos - p->reps[0] +
+            ((p->dicPos < p->reps[0]) ? p->dicBufSize : 0)];
+        unsigned offs = 0x100;
+        unsigned symbol = 1;
+        do
+        {
+          unsigned bit;
+          CLzmaProb *probLit;
+          matchByte <<= 1;
+          bit = (matchByte & offs);
+          probLit = prob + offs + bit + symbol;
+          GET_BIT2_CHECK(probLit, symbol, offs &= ~bit, offs &= bit)
+        }
+        while (symbol < 0x100);
+      }
+      res = DUMMY_LIT;
+    }
+    else
+    {
+      unsigned len;
+      UPDATE_1_CHECK;
+
+      prob = probs + IsRep + state;
+      IF_BIT_0_CHECK(prob)
+      {
+        UPDATE_0_CHECK;
+        state = 0;
+        prob = probs + LenCoder;
+        res = DUMMY_MATCH;
+      }
+      else
+      {
+        UPDATE_1_CHECK;
+        res = DUMMY_REP;
+        prob = probs + IsRepG0 + state;
+        IF_BIT_0_CHECK(prob)
+        {
+          UPDATE_0_CHECK;
+          prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState;
+          IF_BIT_0_CHECK(prob)
+          {
+            UPDATE_0_CHECK;
+            NORMALIZE_CHECK;
+            return DUMMY_REP;
+          }
+          else
+          {
+            UPDATE_1_CHECK;
+          }
+        }
+        else
+        {
+          UPDATE_1_CHECK;
+          prob = probs + IsRepG1 + state;
+          IF_BIT_0_CHECK(prob)
+          {
+            UPDATE_0_CHECK;
+          }
+          else
+          {
+            UPDATE_1_CHECK;
+            prob = probs + IsRepG2 + state;
+            IF_BIT_0_CHECK(prob)
+            {
+              UPDATE_0_CHECK;
+            }
+            else
+            {
+              UPDATE_1_CHECK;
+            }
+          }
+        }
+        state = kNumStates;
+        prob = probs + RepLenCoder;
+      }
+      {
+        unsigned limit, offset;
+        CLzmaProb *probLen = prob + LenChoice;
+        IF_BIT_0_CHECK(probLen)
+        {
+          UPDATE_0_CHECK;
+          probLen = prob + LenLow + (posState << kLenNumLowBits);
+          offset = 0;
+          limit = 1 << kLenNumLowBits;
+        }
+        else
+        {
+          UPDATE_1_CHECK;
+          probLen = prob + LenChoice2;
+          IF_BIT_0_CHECK(probLen)
+          {
+            UPDATE_0_CHECK;
+            probLen = prob + LenMid + (posState << kLenNumMidBits);
+            offset = kLenNumLowSymbols;
+            limit = 1 << kLenNumMidBits;
+          }
+          else
+          {
+            UPDATE_1_CHECK;
+            probLen = prob + LenHigh;
+            offset = kLenNumLowSymbols + kLenNumMidSymbols;
+            limit = 1 << kLenNumHighBits;
+          }
+        }
+        TREE_DECODE_CHECK(probLen, limit, len);
+        len += offset;
+      }
+
+      if (state < 4)
+      {
+        unsigned posSlot;
+        prob = probs + PosSlot +
+            ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
+            kNumPosSlotBits);
+        TREE_DECODE_CHECK(prob, 1 << kNumPosSlotBits, posSlot);
+        if (posSlot >= kStartPosModelIndex)
+        {
+          int numDirectBits = ((posSlot >> 1) - 1);
+
+          /* if (bufLimit - buf >= 8) return DUMMY_MATCH; */
+
+          if (posSlot < kEndPosModelIndex)
+          {
+            prob = probs + SpecPos + ((2 | (posSlot & 1)) << numDirectBits) - posSlot - 1;
+          }
+          else
+          {
+            numDirectBits -= kNumAlignBits;
+            do
+            {
+              NORMALIZE_CHECK
+              range >>= 1;
+              code -= range & (((code - range) >> 31) - 1);
+              /* if (code >= range) code -= range; */
+            }
+            while (--numDirectBits != 0);
+            prob = probs + Align;
+            numDirectBits = kNumAlignBits;
+          }
+          {
+            unsigned i = 1;
+            do
+            {
+              GET_BIT_CHECK(prob + i, i);
+            }
+            while (--numDirectBits != 0);
+          }
+        }
+      }
+    }
+  }
+  NORMALIZE_CHECK;
+  return res;
+}
+
+
+static void LzmaDec_InitRc(CLzmaDec *p, const Byte *data)
+{
+  p->code = ((UInt32)data[1] << 24) | ((UInt32)data[2] << 16) | ((UInt32)data[3] << 8) | ((UInt32)data[4]);
+  p->range = 0xFFFFFFFF;
+  p->needFlush = 0;
+}
+
+void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState)
+{
+  p->needFlush = 1;
+  p->remainLen = 0;
+  p->tempBufSize = 0;
+
+  if (initDic)
+  {
+    p->processedPos = 0;
+    p->checkDicSize = 0;
+    p->needInitState = 1;
+  }
+  if (initState)
+    p->needInitState = 1;
+}
+
+void LzmaDec_Init(CLzmaDec *p)
+{
+  p->dicPos = 0;
+  LzmaDec_InitDicAndState(p, True, True);
+}
+
+static void LzmaDec_InitStateReal(CLzmaDec *p)
+{
+  UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (p->prop.lc + p->prop.lp));
+  UInt32 i;
+  CLzmaProb *probs = p->probs;
+  for (i = 0; i < numProbs; i++)
+    probs[i] = kBitModelTotal >> 1;
+  p->reps[0] = p->reps[1] = p->reps[2] = p->reps[3] = 1;
+  p->state = 0;
+  p->needInitState = 0;
+}
+
+SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen,
+    ELzmaFinishMode finishMode, ELzmaStatus *status)
+{
+  SizeT inSize = *srcLen;
+  (*srcLen) = 0;
+  LzmaDec_WriteRem(p, dicLimit);
+  
+  *status = LZMA_STATUS_NOT_SPECIFIED;
+
+  while (p->remainLen != kMatchSpecLenStart)
+  {
+      int checkEndMarkNow;
+
+      if (p->needFlush != 0)
+      {
+        for (; inSize > 0 && p->tempBufSize < RC_INIT_SIZE; (*srcLen)++, inSize--)
+          p->tempBuf[p->tempBufSize++] = *src++;
+        if (p->tempBufSize < RC_INIT_SIZE)
+        {
+          *status = LZMA_STATUS_NEEDS_MORE_INPUT;
+          return SZ_OK;
+        }
+        if (p->tempBuf[0] != 0)
+          return SZ_ERROR_DATA;
+
+        LzmaDec_InitRc(p, p->tempBuf);
+        p->tempBufSize = 0;
+      }
+
+      checkEndMarkNow = 0;
+      if (p->dicPos >= dicLimit)
+      {
+        if (p->remainLen == 0 && p->code == 0)
+        {
+          *status = LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK;
+          return SZ_OK;
+        }
+        if (finishMode == LZMA_FINISH_ANY)
+        {
+          *status = LZMA_STATUS_NOT_FINISHED;
+          return SZ_OK;
+        }
+        if (p->remainLen != 0)
+        {
+          *status = LZMA_STATUS_NOT_FINISHED;
+          return SZ_ERROR_DATA;
+        }
+        checkEndMarkNow = 1;
+      }
+
+      if (p->needInitState)
+        LzmaDec_InitStateReal(p);
+  
+      if (p->tempBufSize == 0)
+      {
+        SizeT processed;
+        const Byte *bufLimit;
+        if (inSize < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow)
+        {
+          int dummyRes = LzmaDec_TryDummy(p, src, inSize);
+          if (dummyRes == DUMMY_ERROR)
+          {
+            memcpy(p->tempBuf, src, inSize);
+            p->tempBufSize = (unsigned)inSize;
+            (*srcLen) += inSize;
+            *status = LZMA_STATUS_NEEDS_MORE_INPUT;
+            return SZ_OK;
+          }
+          if (checkEndMarkNow && dummyRes != DUMMY_MATCH)
+          {
+            *status = LZMA_STATUS_NOT_FINISHED;
+            return SZ_ERROR_DATA;
+          }
+          bufLimit = src;
+        }
+        else
+          bufLimit = src + inSize - LZMA_REQUIRED_INPUT_MAX;
+        p->buf = src;
+        if (LzmaDec_DecodeReal2(p, dicLimit, bufLimit) != 0)
+          return SZ_ERROR_DATA;
+        processed = (SizeT)(p->buf - src);
+        (*srcLen) += processed;
+        src += processed;
+        inSize -= processed;
+      }
+      else
+      {
+        unsigned rem = p->tempBufSize, lookAhead = 0;
+        while (rem < LZMA_REQUIRED_INPUT_MAX && lookAhead < inSize)
+          p->tempBuf[rem++] = src[lookAhead++];
+        p->tempBufSize = rem;
+        if (rem < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow)
+        {
+          int dummyRes = LzmaDec_TryDummy(p, p->tempBuf, rem);
+          if (dummyRes == DUMMY_ERROR)
+          {
+            (*srcLen) += lookAhead;
+            *status = LZMA_STATUS_NEEDS_MORE_INPUT;
+            return SZ_OK;
+          }
+          if (checkEndMarkNow && dummyRes != DUMMY_MATCH)
+          {
+            *status = LZMA_STATUS_NOT_FINISHED;
+            return SZ_ERROR_DATA;
+          }
+        }
+        p->buf = p->tempBuf;
+        if (LzmaDec_DecodeReal2(p, dicLimit, p->buf) != 0)
+          return SZ_ERROR_DATA;
+        lookAhead -= (rem - (unsigned)(p->buf - p->tempBuf));
+        (*srcLen) += lookAhead;
+        src += lookAhead;
+        inSize -= lookAhead;
+        p->tempBufSize = 0;
+      }
+  }
+  if (p->code == 0)
+    *status = LZMA_STATUS_FINISHED_WITH_MARK;
+  return (p->code == 0) ? SZ_OK : SZ_ERROR_DATA;
+}
+
+SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status)
+{
+  SizeT outSize = *destLen;
+  SizeT inSize = *srcLen;
+  *srcLen = *destLen = 0;
+  for (;;)
+  {
+    SizeT inSizeCur = inSize, outSizeCur, dicPos;
+    ELzmaFinishMode curFinishMode;
+    SRes res;
+    if (p->dicPos == p->dicBufSize)
+      p->dicPos = 0;
+    dicPos = p->dicPos;
+    if (outSize > p->dicBufSize - dicPos)
+    {
+      outSizeCur = p->dicBufSize;
+      curFinishMode = LZMA_FINISH_ANY;
+    }
+    else
+    {
+      outSizeCur = dicPos + outSize;
+      curFinishMode = finishMode;
+    }
+
+    res = LzmaDec_DecodeToDic(p, outSizeCur, src, &inSizeCur, curFinishMode, status);
+    src += inSizeCur;
+    inSize -= inSizeCur;
+    *srcLen += inSizeCur;
+    outSizeCur = p->dicPos - dicPos;
+    memcpy(dest, p->dic + dicPos, outSizeCur);
+    dest += outSizeCur;
+    outSize -= outSizeCur;
+    *destLen += outSizeCur;
+    if (res != 0)
+      return res;
+    if (outSizeCur == 0 || outSize == 0)
+      return SZ_OK;
+  }
+}
+
+void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc)
+{
+  alloc->Free(alloc, p->probs);
+  p->probs = 0;
+}
+
+static void LzmaDec_FreeDict(CLzmaDec *p, ISzAlloc *alloc)
+{
+  alloc->Free(alloc, p->dic);
+  p->dic = 0;
+}
+
+void LzmaDec_Free(CLzmaDec *p, ISzAlloc *alloc)
+{
+  LzmaDec_FreeProbs(p, alloc);
+  LzmaDec_FreeDict(p, alloc);
+}
+
+SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size)
+{
+  UInt32 dicSize;
+  Byte d;
+  
+  if (size < LZMA_PROPS_SIZE)
+    return SZ_ERROR_UNSUPPORTED;
+  else
+    dicSize = data[1] | ((UInt32)data[2] << 8) | ((UInt32)data[3] << 16) | ((UInt32)data[4] << 24);
+  if (dicSize < LZMA_DIC_MIN)
+    dicSize = LZMA_DIC_MIN;
+  p->dicSize = dicSize;
+
+  d = data[0];
+  if (d >= (9 * 5 * 5))
+    return SZ_ERROR_UNSUPPORTED;
+
+  p->lc = d % 9;
+  d /= 9;
+  p->pb = d / 5;
+  p->lp = d % 5;
+
+  return SZ_OK;
+}
+
+static SRes LzmaDec_AllocateProbs2(CLzmaDec *p, const CLzmaProps *propNew, ISzAlloc *alloc)
+{
+  UInt32 numProbs = LzmaProps_GetNumProbs(propNew);
+  if (p->probs == 0 || numProbs != p->numProbs)
+  {
+    LzmaDec_FreeProbs(p, alloc);
+    p->probs = (CLzmaProb *)alloc->Alloc(alloc, numProbs * sizeof(CLzmaProb));
+    p->numProbs = numProbs;
+    if (p->probs == 0)
+      return SZ_ERROR_MEM;
+  }
+  return SZ_OK;
+}
+
+SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc)
+{
+  CLzmaProps propNew;
+  RINOK(LzmaProps_Decode(&propNew, props, propsSize));
+  RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc));
+  p->prop = propNew;
+  return SZ_OK;
+}
+
+SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc)
+{
+  CLzmaProps propNew;
+  SizeT dicBufSize;
+  RINOK(LzmaProps_Decode(&propNew, props, propsSize));
+  RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc));
+  dicBufSize = propNew.dicSize;
+  if (p->dic == 0 || dicBufSize != p->dicBufSize)
+  {
+    LzmaDec_FreeDict(p, alloc);
+    p->dic = (Byte *)alloc->Alloc(alloc, dicBufSize);
+    if (p->dic == 0)
+    {
+      LzmaDec_FreeProbs(p, alloc);
+      return SZ_ERROR_MEM;
+    }
+  }
+  p->dicBufSize = dicBufSize;
+  p->prop = propNew;
+  return SZ_OK;
+}
+
+SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
+    const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode,
+    ELzmaStatus *status, ISzAlloc *alloc)
+{
+  CLzmaDec p;
+  SRes res;
+  SizeT inSize = *srcLen;
+  SizeT outSize = *destLen;
+  *srcLen = *destLen = 0;
+  if (inSize < RC_INIT_SIZE)
+    return SZ_ERROR_INPUT_EOF;
+
+  LzmaDec_Construct(&p);
+  res = LzmaDec_AllocateProbs(&p, propData, propSize, alloc);
+  if (res != 0)
+    return res;
+  p.dic = dest;
+  p.dicBufSize = outSize;
+
+  LzmaDec_Init(&p);
+  
+  *srcLen = inSize;
+  res = LzmaDec_DecodeToDic(&p, outSize, src, srcLen, finishMode, status);
+
+  if (res == SZ_OK && *status == LZMA_STATUS_NEEDS_MORE_INPUT)
+    res = SZ_ERROR_INPUT_EOF;
+
+  (*destLen) = p.dicPos;
+  LzmaDec_FreeProbs(&p, alloc);
+  return res;
+}
diff --git a/extern/lzma/LzmaDec.h b/extern/lzma/LzmaDec.h
new file mode 100644 (file)
index 0000000..98cdbe9
--- /dev/null
@@ -0,0 +1,223 @@
+/* LzmaDec.h -- LZMA Decoder
+2008-10-04 : Igor Pavlov : Public domain */
+
+#ifndef __LZMADEC_H
+#define __LZMADEC_H
+
+#include "Types.h"
+
+/* #define _LZMA_PROB32 */
+/* _LZMA_PROB32 can increase the speed on some CPUs,
+   but memory usage for CLzmaDec::probs will be doubled in that case */
+
+#ifdef _LZMA_PROB32
+#define CLzmaProb UInt32
+#else
+#define CLzmaProb UInt16
+#endif
+
+
+/* ---------- LZMA Properties ---------- */
+
+#define LZMA_PROPS_SIZE 5
+
+typedef struct _CLzmaProps
+{
+  unsigned lc, lp, pb;
+  UInt32 dicSize;
+} CLzmaProps;
+
+/* LzmaProps_Decode - decodes properties
+Returns:
+  SZ_OK
+  SZ_ERROR_UNSUPPORTED - Unsupported properties
+*/
+
+SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size);
+
+
+/* ---------- LZMA Decoder state ---------- */
+
+/* LZMA_REQUIRED_INPUT_MAX = number of required input bytes for worst case.
+   Num bits = log2((2^11 / 31) ^ 22) + 26 < 134 + 26 = 160; */
+
+#define LZMA_REQUIRED_INPUT_MAX 20
+
+typedef struct
+{
+  CLzmaProps prop;
+  CLzmaProb *probs;
+  Byte *dic;
+  const Byte *buf;
+  UInt32 range, code;
+  SizeT dicPos;
+  SizeT dicBufSize;
+  UInt32 processedPos;
+  UInt32 checkDicSize;
+  unsigned state;
+  UInt32 reps[4];
+  unsigned remainLen;
+  int needFlush;
+  int needInitState;
+  UInt32 numProbs;
+  unsigned tempBufSize;
+  Byte tempBuf[LZMA_REQUIRED_INPUT_MAX];
+} CLzmaDec;
+
+#define LzmaDec_Construct(p) { (p)->dic = 0; (p)->probs = 0; }
+
+void LzmaDec_Init(CLzmaDec *p);
+
+/* There are two types of LZMA streams:
+     0) Stream with end mark. That end mark adds about 6 bytes to compressed size.
+     1) Stream without end mark. You must know exact uncompressed size to decompress such stream. */
+
+typedef enum
+{
+  LZMA_FINISH_ANY,   /* finish at any point */
+  LZMA_FINISH_END    /* block must be finished at the end */
+} ELzmaFinishMode;
+
+/* ELzmaFinishMode has meaning only if the decoding reaches output limit !!!
+
+   You must use LZMA_FINISH_END, when you know that current output buffer
+   covers last bytes of block. In other cases you must use LZMA_FINISH_ANY.
+
+   If LZMA decoder sees end marker before reaching output limit, it returns SZ_OK,
+   and output value of destLen will be less than output buffer size limit.
+   You can check status result also.
+
+   You can use multiple checks to test data integrity after full decompression:
+     1) Check Result and "status" variable.
+     2) Check that output(destLen) = uncompressedSize, if you know real uncompressedSize.
+     3) Check that output(srcLen) = compressedSize, if you know real compressedSize.
+        You must use correct finish mode in that case. */
+
+typedef enum
+{
+  LZMA_STATUS_NOT_SPECIFIED,               /* use main error code instead */
+  LZMA_STATUS_FINISHED_WITH_MARK,          /* stream was finished with end mark. */
+  LZMA_STATUS_NOT_FINISHED,                /* stream was not finished */
+  LZMA_STATUS_NEEDS_MORE_INPUT,            /* you must provide more input bytes */
+  LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK  /* there is probability that stream was finished without end mark */
+} ELzmaStatus;
+
+/* ELzmaStatus is used only as output value for function call */
+
+
+/* ---------- Interfaces ---------- */
+
+/* There are 3 levels of interfaces:
+     1) Dictionary Interface
+     2) Buffer Interface
+     3) One Call Interface
+   You can select any of these interfaces, but don't mix functions from different
+   groups for same object. */
+
+
+/* There are two variants to allocate state for Dictionary Interface:
+     1) LzmaDec_Allocate / LzmaDec_Free
+     2) LzmaDec_AllocateProbs / LzmaDec_FreeProbs
+   You can use variant 2, if you set dictionary buffer manually.
+   For Buffer Interface you must always use variant 1.
+
+LzmaDec_Allocate* can return:
+  SZ_OK
+  SZ_ERROR_MEM         - Memory allocation error
+  SZ_ERROR_UNSUPPORTED - Unsupported properties
+*/
+   
+SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc);
+void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc);
+
+SRes LzmaDec_Allocate(CLzmaDec *state, const Byte *prop, unsigned propsSize, ISzAlloc *alloc);
+void LzmaDec_Free(CLzmaDec *state, ISzAlloc *alloc);
+
+/* ---------- Dictionary Interface ---------- */
+
+/* You can use it, if you want to eliminate the overhead for data copying from
+   dictionary to some other external buffer.
+   You must work with CLzmaDec variables directly in this interface.
+
+   STEPS:
+     LzmaDec_Constr()
+     LzmaDec_Allocate()
+     for (each new stream)
+     {
+       LzmaDec_Init()
+       while (it needs more decompression)
+       {
+         LzmaDec_DecodeToDic()
+         use data from CLzmaDec::dic and update CLzmaDec::dicPos
+       }
+     }
+     LzmaDec_Free()
+*/
+
+/* LzmaDec_DecodeToDic
+   
+   The decoding to internal dictionary buffer (CLzmaDec::dic).
+   You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!!
+
+finishMode:
+  It has meaning only if the decoding reaches output limit (dicLimit).
+  LZMA_FINISH_ANY - Decode just dicLimit bytes.
+  LZMA_FINISH_END - Stream must be finished after dicLimit.
+
+Returns:
+  SZ_OK
+    status:
+      LZMA_STATUS_FINISHED_WITH_MARK
+      LZMA_STATUS_NOT_FINISHED
+      LZMA_STATUS_NEEDS_MORE_INPUT
+      LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
+  SZ_ERROR_DATA - Data error
+*/
+
+SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit,
+    const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
+
+
+/* ---------- Buffer Interface ---------- */
+
+/* It's zlib-like interface.
+   See LzmaDec_DecodeToDic description for information about STEPS and return results,
+   but you must use LzmaDec_DecodeToBuf instead of LzmaDec_DecodeToDic and you don't need
+   to work with CLzmaDec variables manually.
+
+finishMode:
+  It has meaning only if the decoding reaches output limit (*destLen).
+  LZMA_FINISH_ANY - Decode just destLen bytes.
+  LZMA_FINISH_END - Stream must be finished after (*destLen).
+*/
+
+SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen,
+    const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
+
+
+/* ---------- One Call Interface ---------- */
+
+/* LzmaDecode
+
+finishMode:
+  It has meaning only if the decoding reaches output limit (*destLen).
+  LZMA_FINISH_ANY - Decode just destLen bytes.
+  LZMA_FINISH_END - Stream must be finished after (*destLen).
+
+Returns:
+  SZ_OK
+    status:
+      LZMA_STATUS_FINISHED_WITH_MARK
+      LZMA_STATUS_NOT_FINISHED
+      LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
+  SZ_ERROR_DATA - Data error
+  SZ_ERROR_MEM  - Memory allocation error
+  SZ_ERROR_UNSUPPORTED - Unsupported properties
+  SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src).
+*/
+
+SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
+    const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode,
+    ELzmaStatus *status, ISzAlloc *alloc);
+
+#endif
diff --git a/extern/lzma/LzmaEnc.c b/extern/lzma/LzmaEnc.c
new file mode 100644 (file)
index 0000000..9196c43
--- /dev/null
@@ -0,0 +1,2281 @@
+/* LzmaEnc.c -- LZMA Encoder
+2009-02-02 : Igor Pavlov : Public domain */
+
+#include <string.h>
+
+/* #define SHOW_STAT */
+/* #define SHOW_STAT2 */
+
+#if defined(SHOW_STAT) || defined(SHOW_STAT2)
+#include <stdio.h>
+#endif
+
+#include "LzmaEnc.h"