OLD | NEW |
1 -- Copyright 2011 the V8 project authors. All rights reserved. | 1 -- Copyright 2011 the V8 project authors. All rights reserved. |
2 -- Redistribution and use in source and binary forms, with or without | 2 -- Redistribution and use in source and binary forms, with or without |
3 -- modification, are permitted provided that the following conditions are | 3 -- modification, are permitted provided that the following conditions are |
4 -- met: | 4 -- met: |
5 -- | 5 -- |
6 -- * Redistributions of source code must retain the above copyright | 6 -- * Redistributions of source code must retain the above copyright |
7 -- notice, this list of conditions and the following disclaimer. | 7 -- notice, this list of conditions and the following disclaimer. |
8 -- * Redistributions in binary form must reproduce the above | 8 -- * Redistributions in binary form must reproduce the above |
9 -- copyright notice, this list of conditions and the following | 9 -- copyright notice, this list of conditions and the following |
10 -- disclaimer in the documentation and/or other materials provided | 10 -- disclaimer in the documentation and/or other materials provided |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 log("-- %s", filename) | 110 log("-- %s", filename) |
111 local action = cmd_line .. " src/" .. filename .. " 2>&1" | 111 local action = cmd_line .. " src/" .. filename .. " 2>&1" |
112 if FLAGS.verbose then print('popen ', action) end | 112 if FLAGS.verbose then print('popen ', action) end |
113 local pipe = io.popen(action) | 113 local pipe = io.popen(action) |
114 func(filename, pipe:lines()) | 114 func(filename, pipe:lines()) |
115 pipe:close() | 115 pipe:close() |
116 end | 116 end |
117 end | 117 end |
118 | 118 |
119 ------------------------------------------------------------------------------- | 119 ------------------------------------------------------------------------------- |
120 -- SConscript parsing | 120 -- GYP file parsing |
121 | 121 |
122 local function ParseSConscript() | 122 local function ParseGYPFile() |
123 local f = assert(io.open("src/SConscript"), "failed to open SConscript") | 123 local f = assert(io.open("tools/gyp/v8.gyp"), "failed to open GYP file") |
124 local sconscript = f:read('*a') | 124 local gyp = f:read('*a') |
125 f:close() | 125 f:close() |
126 | 126 |
127 local SOURCES = sconscript:match "SOURCES = {(.-)}"; | 127 local result = {} |
128 | 128 |
129 local sources = {} | 129 for condition, sources in |
130 | 130 gyp:gmatch "'sources': %[.-### gcmole%((.-)%) ###(.-)%]" do |
131 for condition, list in | |
132 SOURCES:gmatch "'([^']-)': Split%(\"\"\"(.-)\"\"\"%)" do | |
133 local files = {} | 131 local files = {} |
134 for file in list:gmatch "[^%s]+" do table.insert(files, file) end | 132 for file in sources:gmatch "'%.%./%.%./src/([^']-%.cc)'" do |
135 sources[condition] = files | 133 table.insert(files, file) |
| 134 end |
| 135 result[condition] = files |
136 end | 136 end |
137 | 137 |
138 for condition, list in SOURCES:gmatch "'([^']-)': %[(.-)%]" do | 138 return result |
139 local files = {} | |
140 for file in list:gmatch "'([^']-)'" do table.insert(files, file) end | |
141 sources[condition] = files | |
142 end | |
143 | |
144 return sources | |
145 end | 139 end |
146 | 140 |
147 local function EvaluateCondition(cond, props) | 141 local function EvaluateCondition(cond, props) |
148 if cond == 'all' then return true end | 142 if cond == 'all' then return true end |
149 | 143 |
150 local p, v = cond:match "(%w+):(%w+)" | 144 local p, v = cond:match "(%w+):(%w+)" |
151 | 145 |
152 assert(p and v, "failed to parse condition: " .. cond) | 146 assert(p and v, "failed to parse condition: " .. cond) |
153 assert(props[p] ~= nil, "undefined configuration property: " .. p) | 147 assert(props[p] ~= nil, "undefined configuration property: " .. p) |
154 | 148 |
155 return props[p] == v | 149 return props[p] == v |
156 end | 150 end |
157 | 151 |
158 local function BuildFileList(sources, props) | 152 local function BuildFileList(sources, props) |
159 local list = {} | 153 local list = {} |
160 for condition, files in pairs(sources) do | 154 for condition, files in pairs(sources) do |
161 if EvaluateCondition(condition, props) then | 155 if EvaluateCondition(condition, props) then |
162 for i = 1, #files do table.insert(list, files[i]) end | 156 for i = 1, #files do table.insert(list, files[i]) end |
163 end | 157 end |
164 end | 158 end |
165 return list | 159 return list |
166 end | 160 end |
167 | 161 |
168 local sources = ParseSConscript() | 162 local sources = ParseGYPFile() |
169 | 163 |
170 local function FilesForArch(arch) | 164 local function FilesForArch(arch) |
171 return BuildFileList(sources, { os = 'linux', | 165 return BuildFileList(sources, { os = 'linux', |
172 arch = arch, | 166 arch = arch, |
173 mode = 'debug', | 167 mode = 'debug', |
174 simulator = ''}) | 168 simulator = ''}) |
175 end | 169 end |
176 | 170 |
177 local mtConfig = {} | 171 local mtConfig = {} |
178 | 172 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 | 366 |
373 for _, arch in ipairs(ARCHS) do | 367 for _, arch in ipairs(ARCHS) do |
374 if not ARCHITECTURES[arch] then | 368 if not ARCHITECTURES[arch] then |
375 error ("Unknown arch: " .. arch) | 369 error ("Unknown arch: " .. arch) |
376 end | 370 end |
377 | 371 |
378 errors = SafeCheckCorrectnessForArch(arch, report) or errors | 372 errors = SafeCheckCorrectnessForArch(arch, report) or errors |
379 end | 373 end |
380 | 374 |
381 os.exit(errors and 1 or 0) | 375 os.exit(errors and 1 or 0) |
OLD | NEW |