Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 322 lines (271 sloc) 7.542 kb
f3baad0 @fperrad add a setup.pir (distutils)
authored
1 #! /usr/local/bin/parrot
2 # Copyright (C) 2009, Parrot Foundation.
3
4 =head1 NAME
5
6 setup.pir - Python distutils style
7
8 =head1 DESCRIPTION
9
10 No Configure step, no Makefile generated.
11
12 =head1 USAGE
13
14 $ parrot setup.pir build
15 $ parrot setup.pir test
16 $ sudo parrot setup.pir install
17
18 =cut
19
20 .sub 'main' :main
21 .param pmc args
22 $S0 = shift args
23 load_bytecode 'distutils.pbc'
24
378a9d6 @fperrad convert tests to PIR (from Perl)
authored
25 .const 'Sub' update = 'update'
26 register_step_after('update', update)
27
f3baad0 @fperrad add a setup.pir (distutils)
authored
28 .const 'Sub' prebuild = 'prebuild'
29 register_step_before('build', prebuild)
30
cfdfc77 @fperrad some refactor and fix targets for test
authored
31 .const 'Sub' liblua_build = 'liblua_build'
32 register_step_after('build', liblua_build)
f7bbc12 @fperrad build Lua libraries in a custom step, after the build of the Lua comp…
authored
33
f3baad0 @fperrad add a setup.pir (distutils)
authored
34 .const 'Sub' clean = 'clean'
35 register_step_before('clean', clean)
36
f7bbc12 @fperrad build Lua libraries in a custom step, after the build of the Lua comp…
authored
37 .const 'Sub' liblua_clean = 'liblua_clean'
38 register_step_after('clean', liblua_clean)
39
e81e58d @fperrad add custom targets
authored
40 .const 'Sub' testclean = 'testclean'
41 register_step_after('test', testclean)
42
43 .const 'Sub' pmctest = 'pmctest'
44 register_step('pmctest', pmctest)
45
b9ccf38 @fperrad build LUA_INIT from the config
authored
46 .const 'Sub' set_LUA_INIT = 'set_LUA_INIT'
47 register_step('set_LUA_INIT', set_LUA_INIT)
48 register_step_before('test', set_LUA_INIT)
49
e81e58d @fperrad add custom targets
authored
50 .const 'Sub' sanity = 'sanity'
51 register_step('sanity', sanity)
52
53 .const 'Sub' spectest = 'spectest'
54 register_step('spectest', spectest)
55
cfdfc77 @fperrad some refactor and fix targets for test
authored
56 .const 'Sub' smolder = 'smolder'
57 register_step('smolder', smolder)
58
f3baad0 @fperrad add a setup.pir (distutils)
authored
59 $P0 = new 'Hash'
bd95266 @fperrad use installable_pbc instead of exe_pbc
authored
60 # build
f3baad0 @fperrad add a setup.pir (distutils)
authored
61 $P1 = new 'Hash'
62 $P2 = split "\n", <<'SOURCES'
63 dynext/pmc/lua.pmc
64 dynext/pmc/luaany.pmc
65 dynext/pmc/luaboolean.pmc
66 dynext/pmc/luabytecode.pmc
67 dynext/pmc/luafunction.pmc
68 dynext/pmc/luanil.pmc
69 dynext/pmc/luanumber.pmc
70 dynext/pmc/luastring.pmc
71 dynext/pmc/luatable.pmc
72 dynext/pmc/luathread.pmc
73 dynext/pmc/luauserdata.pmc
74 SOURCES
75 $S0 = pop $P2
76 $P1['lua_group'] = $P2
77 $P0['dynpmc'] = $P1
78
79 $P3 = new 'Hash'
80 $P3['lua/lua51_gen.pir'] = 'lua/lua51.pg'
81 $P3['lua/lua51_testlex_gen.pir'] = 'lua/lua51_testlex.pg'
82 $P0['pir_pge'] = $P3
83
84 $P4 = new 'Hash'
85 $P4['lua/PASTGrammar_gen.pir'] = 'lua/PASTGrammar.tg'
86 $P4['lua/POSTGrammar_gen.pir'] = 'lua/POSTGrammar.tg'
87 $P4['lua/dumplex_gen.pir'] = 'lua/dumplex.tg'
88 $P0['pir_tge'] = $P4
89
90 $P5 = new 'Hash'
91 $P6 = split "\n", <<'SOURCES'
92 lua/lua51.pir
93 lua/grammar51.pir
94 lua/lua51_gen.pir
95 lua/PASTGrammar_gen.pir
96 lua/POSTGrammar_gen.pir
97 lua/lib/luaaux.pir
98 lua/lib/luabasic.pir
99 lua/lib/luacoroutine.pir
100 lua/lib/luapackage.pir
101 lua/lib/luaregex.pir
102 lua/lib/luastring.pir
103 lua/lib/luatable.pir
104 lua/lib/luamath.pir
105 lua/lib/luaio.pir
106 lua/lib/luafile.pir
107 lua/lib/luaos.pir
108 lua/lib/luadebug.pir
109 lua/lib/luabytecode.pir
110 lua/lib/luabytecode_gen.pir
111 SOURCES
112 $S0 = pop $P6
113 $P5['lua/lua.pbc'] = $P6
114 $P5['lua.pbc'] = 'lua.pir'
115 $P5['luap.pbc'] = 'luap.pir'
116 $P5['lua/luad.pbc'] = 'luad.pir'
117 $P0['pbc_pir'] = $P5
118
f7bbc12 @fperrad build Lua libraries in a custom step, after the build of the Lua comp…
authored
119 $P9 = new 'Hash'
a233d99 @fperrad remove staging
authored
120 $P9['Test/More.pbc'] = 'Test/More.pir'
f7bbc12 @fperrad build Lua libraries in a custom step, after the build of the Lua comp…
authored
121 $P0['liblua__pbc_pir'] = $P9
122 $P10 = new 'Hash'
a233d99 @fperrad remove staging
authored
123 $P10['Test/More.pir'] = 'Test/More.lua'
f7bbc12 @fperrad build Lua libraries in a custom step, after the build of the Lua comp…
authored
124 $P0['liblua__pir_lua'] = $P10
125
f3baad0 @fperrad add a setup.pir (distutils)
authored
126 $P7 = new 'Hash'
127 $P7['parrot-lua'] = 'lua.pbc'
128 $P7['parrot-luap'] = 'luap.pbc'
bd95266 @fperrad use installable_pbc instead of exe_pbc
authored
129 $P0['installable_pbc'] = $P7
f3baad0 @fperrad add a setup.pir (distutils)
authored
130
378a9d6 @fperrad convert tests to PIR (from Perl)
authored
131 # test
132 $S0 = get_parrot()
133 $P0['prove_exec'] = $S0
134 $P0['prove_files'] = 't/pmc/*.t t/*.t'
135
f3baad0 @fperrad add a setup.pir (distutils)
authored
136 # install
378a9d6 @fperrad convert tests to PIR (from Perl)
authored
137 $P8 = split ' ', 'lua/lua.pbc lua/luad.pbc'
f3baad0 @fperrad add a setup.pir (distutils)
authored
138 $P0['inst_lang'] = $P8
cfdfc77 @fperrad some refactor and fix targets for test
authored
139
f3baad0 @fperrad add a setup.pir (distutils)
authored
140 .tailcall setup(args :flat, $P0 :flat :named)
141 .end
142
378a9d6 @fperrad convert tests to PIR (from Perl)
authored
143 .sub 'update' :anon
144 .param pmc kv :slurpy :named
145 system('git submodule update')
146 .end
147
f3baad0 @fperrad add a setup.pir (distutils)
authored
148 .sub 'prebuild' :anon
149 .param pmc kv :slurpy :named
150 .local string cmd
151 $P0 = split ' ', 'lua/lib/luabytecode.rules build/translator.pl'
152 $I0 = newer('lua/lib/luabytecode_gen.pir', $P0)
153 if $I0 goto L1
154 cmd = 'perl build/translator.pl'
155 cmd .= ' --output lua/lib/luabytecode_gen.pir'
156 cmd .= ' lua/lib/luabytecode.rules'
157 system(cmd)
158 L1:
e81e58d @fperrad add custom targets
authored
159
3b2cf82 @fperrad git submodule (t/lua-TestMore)
authored
160 $I0 = file_exists('t/lua-TestMore/src/Test/More.lua')
161 if $I0 goto L2
162 system('git submodule init t/lua-TestMore')
163 system('git submodule update')
164 L2:
165
a233d99 @fperrad remove staging
authored
166 $I0 = newer('Test/More.lua', 't/lua-TestMore/src/Test/More.lua')
167 if $I0 goto L3
378a9d6 @fperrad convert tests to PIR (from Perl)
authored
168 install('t/lua-TestMore/src/Test/More.lua', 'Test/More.lua')
a233d99 @fperrad remove staging
authored
169 L3:
b9ccf38 @fperrad build LUA_INIT from the config
authored
170
171 # tests not yet converted
172 unlink('t/standalone.t')
173 unlink('t/shootout.t')
174 unlink('t/tables.t')
f3baad0 @fperrad add a setup.pir (distutils)
authored
175 .end
176
cfdfc77 @fperrad some refactor and fix targets for test
authored
177 .sub 'clean' :anon
f7bbc12 @fperrad build Lua libraries in a custom step, after the build of the Lua comp…
authored
178 .param pmc kv :slurpy :named
cfdfc77 @fperrad some refactor and fix targets for test
authored
179 unlink('lua/lib/luabytecode_gen.pir')
a899688 @fperrad clean Test/More.lua
authored
180 unlink('Test/More.lua')
cfdfc77 @fperrad some refactor and fix targets for test
authored
181 .end
182
183 .sub 'liblua_build' :anon
184 .param pmc kv :slurpy :named
185 $P0 = kv['liblua__pir_lua']
186 build_pir_lua($P0)
187 $P0 = kv['liblua__pbc_pir']
188 build_pbc_pir($P0)
189 .end
190
191 .sub 'build_pir_lua' :anon
192 .param pmc hash
f7bbc12 @fperrad build Lua libraries in a custom step, after the build of the Lua comp…
authored
193 $P0 = iter hash
194 L1:
195 unless $P0 goto L2
196 .local string pir, lua
197 pir = shift $P0
198 lua = hash[pir]
199 $I0 = newer(pir, lua)
200 if $I0 goto L1
201 .local string cmd
202 cmd = get_parrot()
203 cmd .= " luap.pir --target=pir "
204 cmd .= lua
205 cmd .= " > "
206 cmd .= pir
207 system(cmd)
208 goto L1
209 L2:
210 .end
211
212 .sub 'liblua_clean' :anon
213 .param pmc kv :slurpy :named
214 $P0 = kv['liblua__pbc_pir']
215 clean_key($P0)
216 $P0 = kv['liblua__pir_lua']
217 clean_key($P0)
218 .end
219
e81e58d @fperrad add custom targets
authored
220 .sub 'testclean' :anon
221 .param pmc kv :slurpy :named
cfdfc77 @fperrad some refactor and fix targets for test
authored
222 system("perl -MExtUtils::Command -e rm_f t/*.lua t/*.parrot_out t/*.luac")
e81e58d @fperrad add custom targets
authored
223 .end
224
f7bbc12 @fperrad build Lua libraries in a custom step, after the build of the Lua comp…
authored
225 .sub 'pmctest' :anon
e81e58d @fperrad add custom targets
authored
226 .param pmc kv :slurpy :named
227 run_step('build', kv :flat :named)
cfdfc77 @fperrad some refactor and fix targets for test
authored
228
e81e58d @fperrad add custom targets
authored
229 .local string cmd
230 cmd = "prove --exec="
231 $S0 = get_parrot()
232 cmd .= $S0
233 cmd .= " t/pmc/*.t"
234 system(cmd)
235 .end
236
cfdfc77 @fperrad some refactor and fix targets for test
authored
237 .sub 'sanity' :anon
238 .param pmc kv :slurpy :named
239 run_step('build', kv :flat :named)
240
241 .local string cmd
242 cmd = "prove --exec=\""
243 $S0 = get_parrot()
244 cmd .= $S0
a233d99 @fperrad remove staging
authored
245 cmd .= " lua.pbc\" t/lua-TestMore/test_lua51/0*.t"
cfdfc77 @fperrad some refactor and fix targets for test
authored
246 system(cmd)
247 .end
248
f7bbc12 @fperrad build Lua libraries in a custom step, after the build of the Lua comp…
authored
249 .sub 'spectest' :anon
e81e58d @fperrad add custom targets
authored
250 .param pmc kv :slurpy :named
251 run_step('build', kv :flat :named)
b9ccf38 @fperrad build LUA_INIT from the config
authored
252 run_step('set_LUA_INIT', kv :flat :named)
e81e58d @fperrad add custom targets
authored
253
254 .local string cmd
255 cmd = "prove --exec=\""
256 $S0 = get_parrot()
257 cmd .= $S0
a233d99 @fperrad remove staging
authored
258 cmd .= " lua.pbc\" t/lua-TestMore/test_lua51/*.t"
e81e58d @fperrad add custom targets
authored
259 system(cmd)
260 .end
261
cfdfc77 @fperrad some refactor and fix targets for test
authored
262 .sub 'smolder' :anon
e81e58d @fperrad add custom targets
authored
263 .param pmc kv :slurpy :named
264 run_step('build', kv :flat :named)
b9ccf38 @fperrad build LUA_INIT from the config
authored
265 run_step('set_LUA_INIT', kv :flat :named)
cfdfc77 @fperrad some refactor and fix targets for test
authored
266
e81e58d @fperrad add custom targets
authored
267 .local string cmd
cfdfc77 @fperrad some refactor and fix targets for test
authored
268 cmd = "prove --archive=test_lua51.tar.gz --exec=\""
e81e58d @fperrad add custom targets
authored
269 $S0 = get_parrot()
270 cmd .= $S0
a233d99 @fperrad remove staging
authored
271 cmd .= " lua.pbc\" t/lua-TestMore/test_lua51/*.t"
cfdfc77 @fperrad some refactor and fix targets for test
authored
272 system(cmd)
273
274 .local pmc config
275 config = get_config()
276 cmd = "curl -F architecture="
277 $S0 = config['cpuarch']
278 cmd .= $S0
279 cmd .= " -F platform="
280 $S0 = config['osname']
281 cmd .= $S0
282 cmd .= " -F revision="
283 $S0 = config['revision']
284 cmd .= $S0
285 cmd .= " -F tags=\""
286 $S0 = config['osname']
287 cmd .= $S0
288 cmd .= ", "
289 $S0 = config['archname']
290 cmd .= $S0
291 cmd .= ", parrot-lua, Lua 5.1 (on Parrot)\""
292 cmd .= " -F comments=parrot-lua"
a233d99 @fperrad remove staging
authored
293 cmd .= " -F report_file=@t/lua-TestMore/test_lua51/test_lua51.tar.gz"
cfdfc77 @fperrad some refactor and fix targets for test
authored
294 cmd .= " http://smolder.plusthree.com/app/public_projects/process_add_report/12"
e81e58d @fperrad add custom targets
authored
295 system(cmd)
cfdfc77 @fperrad some refactor and fix targets for test
authored
296 .end
f3baad0 @fperrad add a setup.pir (distutils)
authored
297
b9ccf38 @fperrad build LUA_INIT from the config
authored
298 .sub 'set_LUA_INIT' :anon
299 .param pmc kv :slurpy :named
300 .local pmc config
301 config = get_config()
302 .local string value
303 value = "platform = { osname=[["
304 $S0 = config['osname']
305 value .= $S0
306 value .= "]], intsize="
307 $S0 = config['intsize']
308 value .= $S0
309 value .= ", longsize="
310 $S0 = config['longsize']
311 value .= $S0
312 value .= " }"
313 setenv('LUA_INIT', value)
314 .end
315
316
f3baad0 @fperrad add a setup.pir (distutils)
authored
317 # Local Variables:
318 # mode: pir
319 # fill-column: 100
320 # End:
321 # vim: expandtab shiftwidth=4 ft=pir:
Something went wrong with that request. Please try again.