-
Notifications
You must be signed in to change notification settings - Fork 0
/
workfile.rb
executable file
·159 lines (149 loc) · 5.54 KB
/
workfile.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#!/usr/bin/ruby
CONFIG_CCOMPILE_DEFAULT = 'debug'
require './config.rb'
require File.expand_path "#{CONFIG_WOWFOOT_DIR}/rules/cExe.rb"
require './genLuaFromHeader.rb'
require './genDbc.rb'
require './libs.rb'
class GenTask < MultiFileTask
def initialize(name)
@src = "src/#{name}.rb"
@prerequisites = [FileTask.new(@src)]
super("build/#{name}.c", ["build/#{name}.h"])
end
def fileExecute
sh "ruby #{@src}"
end
end
class GenFfiSdlTask < FileTask
def initialize
super('build/ffi_SDL.h')
end
def fileExecute
open('build/stub.c', 'w') do |file|
file.puts '#include <SDL2/SDL.h>'
file.puts '#include <SDL2/SDL_ttf.h>'
file.puts '#include <SDL2/SDL_image.h>'
end
sh "gcc -E build/stub.c | grep -v '^#' > build/ffi_SDL.h"
end
end
work = ExeWork.new do
@SOURCES = ['src', 'src/worldMsgHandlers', 'server-code/Auth']
@SOURCE_FILES = [
"#{CONFIG_WOWFOOT_DIR}/wowfoot-cpp/handlers/spell/spellStrings.cpp",
"#{CONFIG_WOWFOOT_DIR}/wowfoot-cpp/handlers/dbcSkillLineAbility/SkillLineAbility.index.cpp",
# "#{CONFIG_WOWFOOT_DIR}/wowfoot-cpp/handlers/icon/icon.cpp",
]
@SOURCE_TASKS = @REQUIREMENTS = [
GenTask.new('Opcodes'),
GenTask.new('movementFlags'),
GenLuaFromHeaderTask.new('SpellMgr', 'server-code/SpellMgr.h'),
GenLuaFromHeaderTask.new('UpdateFields', 'server-code/UpdateFields.h'),
GenLuaFromHeaderTask.new('updateBlockFlags', 'src/updateBlockFlags.h'),
GenLuaFromHeaderTask.new('SharedDefines', 'server-code/SharedDefines.h',
{:includedEnums=>['SpellEffects', 'SpellRangeIndex', 'Powers',
'SpellAttributes', 'SpellAttributesEx', 'SpellAttributesEx2',
'SpellAttributesEx3', 'SpellAttributesEx4',
'SpellPreventionType',
'UnitDynFlags',
'GameobjectTypes',
'GameObjectFlags',
'GameObjectDynamicLowFlags',
'Targets',
'LockKeyType', 'LockType',
'ItemQualities',
'Stats',
'CreatureType',
'CreatureEliteType',
'Classes',
'ShapeshiftForm',
'DispelType', 'Mechanics',
'TradeStatus', 'Language', 'ChatMsg'],
:reverseListEnums=>['SpellCastResult']}),
GenLuaFromHeaderTask.new('Unit', 'server-code/Unit.h',
{:includedEnums=>['UnitFlags', 'NPCFlags', 'SpellInterruptFlags',
'SpellModOp']}),
GenLuaFromHeaderTask.new('ObjectGuid', 'server-code/ObjectGuid.h',
{:includedEnums=>['TypeMask']}),
GenLuaFromHeaderTask.new('DBCEnums', 'server-code/DBCEnums.h',
{:includedEnums=>['SpellCastTargetFlags', 'SpellFamily', 'ItemEnchantmentType',
'FactionMasks']}),
GenLuaFromHeaderTask.new('movement', 'src/movement.h',
{:includedEnums=>['MonsterMoveType']}),
GenLuaFromHeaderTask.new('QuestDef', 'server-code/QuestDef.h',
{:includedEnums=>['__QuestGiverStatus', 'QuestTypes']}),
GenLuaFromHeaderTask.new('ItemPrototype', 'server-code/ItemPrototype.h',
{:includedEnums=>['InventoryType', 'ItemClass', 'ItemSubclassWeapon',
'ItemModType',
'ItemSubclassContainer',
'BagFamily',
'ItemPrototypeFlags',
'ItemSpelltriggerType',
'ItemBondingType',
'ItemSubclassArmor']}),
GenLuaFromHeaderTask.new('Player', 'server-code/Player.h',
{:includedEnums=>['EquipmentSlots', 'InventorySlots', 'InventoryPackSlots',
'BankItemSlots', 'BankBagSlots',
'TradeSlots', 'TrainerSpellState', 'QuestSlotStateMask']}),
GenLuaFromHeaderTask.new('Config', 'server-code/SharedDefines.h',
{:includedEnums=>['Gender', 'Races', 'Classes'],
:cutPrefix=>true}),
GenLuaFromHeaderTask.new('LootMgr', 'server-code/LootMgr.h'),
GenLuaFromHeaderTask.new('GossipDef', 'server-code/GossipDef.h',
{:includedEnums=>['GossipOptionIcon']}),
GenDbcTask.new(DBCs),
GenLuaFromHeaderTask.new('SpellAuraDefines', 'server-code/SpellAuraDefines.h',
{:includedEnums=>['AuraType', 'AuraConstants']}),
GenLuaFromHeaderTask.new('worldHandlers', 'src/worldHandlers.h',
{}),#{:includedEnums=>['RaidIcons']}),
GenLuaFromHeaderTask.new('Item', 'server-code/Item.h',
{:includedEnums=>['EnchantmentSlot', 'EnchantmentOffset', 'ItemDynFlags']}),
]
@REQUIREMENTS << GenFfiSdlTask.new()
@SPECIFIC_CFLAGS = {
'worldPacketParsersLua.c' => ' -Wno-vla',
'cDbc.cpp' => " -I#{CONFIG_WOWFOOT_DIR}/wowfoot-cpp/handlers"+
" -I#{CONFIG_WOWFOOT_DIR}/wowfoot-cpp",
'cDbcAux.cpp' => " -I#{CONFIG_WOWFOOT_DIR}/wowfoot-cpp/handlers"+
" -I#{CONFIG_WOWFOOT_DIR}/wowfoot-cpp",
'exception.cpp' => " -I#{CONFIG_WOWFOOT_DIR}/wowfoot-cpp",
'stackTrace.cpp' => " -I#{CONFIG_WOWFOOT_DIR}/wowfoot-cpp",
'process.cpp' => " -I#{CONFIG_WOWFOOT_DIR}/wowfoot-cpp -Wno-missing-format-attribute",
}
@SPECIFIC_CFLAGS['cDbcAux.cpp'] = @SPECIFIC_CFLAGS['cDbc.cpp'] +
' -Ibuild/dbcSkillLineAbility -DWOWBOT=1'
@SPECIFIC_CFLAGS['SkillLineAbility.index.cpp'] = @SPECIFIC_CFLAGS['cDbcAux.cpp']
@EXTRA_INCLUDES = ['build', 'src', 'server-code', 'server-code/Auth',
"#{CONFIG_WOWFOOT_DIR}/wowfoot-cpp/handlers/spell",
]
@EXTRA_OBJECTS = DBC_WORKS + [ICON]
@LIBRARIES = ['crypto', 'z']
@EXTRA_CFLAGS = LUA_CFLAGS
@EXTRA_CPPFLAGS = LUA_CFLAGS
if(HOST == :win32)
@SOURCES << "#{CONFIG_WOWFOOT_DIR}/wowfoot-cpp/util/win32"
@SOURCES << "#{CONFIG_WOWFOOT_DIR}/wowfoot-cpp/util/win32/sym_engine"
@LIBRARIES += ['lua51', 'wsock32', 'gdi32', 'imagehlp']
elsif(HOST == :linux)
@SOURCES << "#{CONFIG_WOWFOOT_DIR}/wowfoot-cpp/util/unix"
@SOURCE_FILES << "#{CONFIG_WOWFOOT_DIR}/wowfoot-cpp/util/process.cpp"
@EXTRA_LINKFLAGS = LUA_LINKFLAGS
@LIBRARIES += ['rt']
#@LIBRARIES = ['dl']
else
raise "Unsupported platform: #{HOST}"
end
@NAME = 'wowbot'
end
DirTask.new('state')
target :run do
sh "#{work}"
end
target :gdb do
sh "gdb --args #{work}"
end
target :mc do
sh "valgrind --leak-check=full #{work}"
end
Works.run