This repository has been archived by the owner on Jun 9, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
setup.pir
executable file
·321 lines (273 loc) · 8.08 KB
/
setup.pir
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
#!/usr/bin/env parrot
# Copyright (C) 2009, Parrot Foundation.
=head1 NAME
setup.pir - Python distutils style
=head1 DESCRIPTION
No Configure step, no Makefile generated.
=head1 USAGE
$ parrot setup.pir build
$ parrot setup.pir test
$ sudo parrot setup.pir install
=cut
.sub 'main' :main
.param pmc args
$S0 = shift args
load_bytecode 'distutils.pbc'
.const 'Sub' update = 'update'
register_step_after('update', update)
.const 'Sub' prebuild = 'prebuild'
register_step_before('build', prebuild)
.const 'Sub' liblua_build = 'liblua_build'
register_step_after('build', liblua_build)
.const 'Sub' clean = 'clean'
register_step_before('clean', clean)
.const 'Sub' liblua_clean = 'liblua_clean'
register_step_after('clean', liblua_clean)
.const 'Sub' pmctest = 'pmctest'
register_step('pmctest', pmctest)
.const 'Sub' set_LUA_INIT = 'set_LUA_INIT'
register_step('set_LUA_INIT', set_LUA_INIT)
register_step_before('test', set_LUA_INIT)
register_step_before('smoke', set_LUA_INIT)
.const 'Sub' sanity = 'sanity'
register_step('sanity', sanity)
.const 'Sub' spectest = 'spectest'
register_step('spectest', spectest)
$P0 = new 'Hash'
$P0['name'] = 'Lua'
$P0['abstract'] = 'Lua on Parrot'
$P0['authority'] = 'http://github.com/fperrad'
$P0['description'] = 'Lua 5.1 on Parrot'
$P5 = split ',', 'lua'
$P0['keywords'] = $P5
$P0['license_type'] = 'Artistic License 2.0'
$P0['license_uri'] = 'http://www.perlfoundation.org/artistic_license_2_0'
$P0['copyright_holder'] = 'Parrot Foundation'
$P0['checkout_uri'] = 'git://github.com/fperrad/lua.git'
$P0['browser_uri'] = 'http://github.com/fperrad/lua'
$P0['project_uri'] = 'http://github.com/fperrad/lua'
# build
$P1 = new 'Hash'
$P2 = split "\n", <<'SOURCES'
dynext/pmc/lua.pmc
dynext/pmc/luaany.pmc
dynext/pmc/luaboolean.pmc
dynext/pmc/luabytecode.pmc
dynext/pmc/luafunction.pmc
dynext/pmc/luanil.pmc
dynext/pmc/luanumber.pmc
dynext/pmc/luastring.pmc
dynext/pmc/luatable.pmc
dynext/pmc/luathread.pmc
dynext/pmc/luauserdata.pmc
dynext/pmc/lua_private.h
SOURCES
$S0 = pop $P2
$P1['lua_group'] = $P2
$P0['dynpmc'] = $P1
$P3 = new 'Hash'
$P3['lua/lua51_gen.pir'] = 'lua/lua51.pg'
$P3['lua/lua51_testlex_gen.pir'] = 'lua/lua51_testlex.pg'
$P0['pir_pge'] = $P3
$P4 = new 'Hash'
$P4['lua/PASTGrammar_gen.pir'] = 'lua/PASTGrammar.tg'
$P4['lua/POSTGrammar_gen.pir'] = 'lua/POSTGrammar.tg'
$P4['lua/dumplex_gen.pir'] = 'lua/dumplex.tg'
$P0['pir_tge'] = $P4
$P5 = new 'Hash'
$P6 = split "\n", <<'SOURCES'
lua/lua51.pir
lua/grammar51.pir
lua/lua51_gen.pir
lua/PASTGrammar_gen.pir
lua/POSTGrammar_gen.pir
lua/lib/luaaux.pir
lua/lib/luabasic.pir
lua/lib/luacoroutine.pir
lua/lib/luapackage.pir
lua/lib/luaregex.pir
lua/lib/luastring.pir
lua/lib/luatable.pir
lua/lib/luamath.pir
lua/lib/luaio.pir
lua/lib/luafile.pir
lua/lib/luaos.pir
lua/lib/luadebug.pir
lua/lib/luabytecode.pir
lua/lib/luabytecode_gen.pir
SOURCES
$S0 = pop $P6
$P5['lua/lua.pbc'] = $P6
$P5['lua.pbc'] = 'lua.pir'
$P5['luap.pbc'] = 'luap.pir'
$P5['lua/luad.pbc'] = 'luad.pir'
$P0['pbc_pir'] = $P5
$P7 = new 'Hash'
$P7['parrot-lua'] = 'lua.pbc'
$P7['parrot-luap'] = 'luap.pbc'
$P0['installable_pbc'] = $P7
$P8 = new 'Hash'
$P8['man/man1/parrot-lua.1'] = 'lua.pir'
$P8['man/man1/parrot-luap.1'] = 'luap.pir'
$P0['man_pod'] = $P8
# post build
$P9 = new 'Hash'
$P9['lua/library/Test/More.pbc'] = 'lua/library/Test/More.pir'
$P0['liblua__pbc_pir'] = $P9
$P10 = new 'Hash'
$P10['lua/library/Test/More.pir'] = 'lua/library/Test/More.lua'
$P0['liblua__pir_lua'] = $P10
# test
$S0 = get_parrot()
$P0['prove_exec'] = $S0
$P0['prove_files'] = 't/pmc/*.t t/*.t'
# smoke
$P0['prove_archive'] = 'test_lua51.tar.gz'
$P0['smolder_url'] = 'http://smolder.parrot.org/app/projects/process_add_report/7'
$P0['smolder_comments'] = 'parrot-lua'
$S0 = get_tags()
$P0['smolder_tags'] = $S0
# install
$P8 = split ' ', 'lua/lua.pbc lua/luad.pbc'
$P0['inst_lang'] = $P8
# dist
$P1 = glob('luac2pir.pir test_lex.pir lua/lib/luabytecode.rules build/translator.pl lua/library/Test/More.lua t/lua-TestMore/test_lua51/*.t')
$P0['manifest_includes'] = $P1
$P2 = split ' ', 'lua/lib/luabytecode_gen.pir lua/library/Test/More.pir'
$P0['manifest_excludes'] = $P2
$P3 = split ' ', 'CREDITS MAINTAINER README'
$P0['doc_files'] = $P3
.tailcall setup(args :flat, $P0 :flat :named)
.end
.sub 'update' :anon
.param pmc kv :slurpy :named
$I0 = file_exists('.git')
unless $I0 goto L1
system('git submodule update', 1 :named('verbose'))
L1:
.end
.sub 'prebuild' :anon
.param pmc kv :slurpy :named
.local string cmd
$P0 = split ' ', 'lua/lib/luabytecode.rules build/translator.pl'
$I0 = newer('lua/lib/luabytecode_gen.pir', $P0)
if $I0 goto L1
cmd = 'perl build/translator.pl'
cmd .= ' --output lua/lib/luabytecode_gen.pir'
cmd .= ' lua/lib/luabytecode.rules'
system(cmd, 1 :named('verbose'))
L1:
$I0 = file_exists('.git')
unless $I0 goto L2
$I0 = file_exists('t/lua-TestMore/src/Test/More.lua')
if $I0 goto L2
system('git submodule init t/lua-TestMore', 1 :named('verbose'))
system('git submodule update', 1 :named('verbose'))
L2:
$I0 = newer('lua/library/Test/More.lua', 't/lua-TestMore/src/Test/More.lua')
if $I0 goto L3
install('t/lua-TestMore/src/Test/More.lua', 'lua/library/Test/More.lua', 1 :named('verbose'))
L3:
.end
.sub 'clean' :anon
.param pmc kv :slurpy :named
unlink('lua/lib/luabytecode_gen.pir', 1 :named('verbose'))
unlink('lua/library/Test/More.lua', 1 :named('verbose'))
.end
.sub 'liblua_build' :anon
.param pmc kv :slurpy :named
$P0 = kv['liblua__pir_lua']
build_pir_lua($P0)
$P0 = kv['liblua__pbc_pir']
build_pbc_pir($P0)
.end
.sub 'build_pir_lua' :anon
.param pmc hash
$P0 = iter hash
L1:
unless $P0 goto L2
.local string pir, lua
pir = shift $P0
lua = hash[pir]
$I0 = newer(pir, lua)
if $I0 goto L1
.local string cmd
cmd = get_parrot()
cmd .= " luap.pir --target=pir "
cmd .= lua
cmd .= " > "
cmd .= pir
system(cmd, 1 :named('verbose'))
goto L1
L2:
.end
.sub 'liblua_clean' :anon
.param pmc kv :slurpy :named
$P0 = kv['liblua__pbc_pir']
clean_key($P0)
$P0 = kv['liblua__pir_lua']
clean_key($P0)
.end
.sub 'pmctest' :anon
.param pmc kv :slurpy :named
run_step('build', kv :flat :named)
$P0 = glob('t/pmc/*.t')
$P0 = sort_strings($P0)
$S0 = get_parrot()
runtests($P0 :flat, $S0 :named('exec'))
.end
.sub 'sanity' :anon
.param pmc kv :slurpy :named
run_step('build', kv :flat :named)
$P0 = glob('t/lua-TestMore/test_lua51/0*.t')
$P0 = sort_strings($P0)
$S0 = get_parrot()
$S0 .= ' lua.pbc'
runtests($P0 :flat, $S0 :named('exec'))
.end
.sub 'spectest' :anon
.param pmc kv :slurpy :named
run_step('build', kv :flat :named)
run_step('set_LUA_INIT', kv :flat :named)
$P0 = glob('t/lua-TestMore/test_lua51/*.t')
$P0 = sort_strings($P0)
$S0 = get_parrot()
$S0 .= ' lua.pbc'
runtests($P0 :flat, $S0 :named('exec'))
.end
.sub 'get_tags'
.local string tags
.local pmc config
config = get_config()
tags = config['osname']
tags .= ", "
$S0 = config['archname']
tags .= $S0
tags .= ", parrot-lua, Lua 5.1 (on Parrot)"
.return (tags)
.end
.sub 'set_LUA_INIT' :anon
.param pmc kv :slurpy :named
.local pmc config
config = get_config()
.local string value
value = "platform = { lua=[["
$S0 = get_parrot()
value .= $S0
value .= " lua.pbc]], osname=[["
$S0 = config['osname']
value .= $S0
value .= "]], intsize="
$S0 = config['intsize']
value .= $S0
value .= ", longsize="
$S0 = config['longsize']
value .= $S0
value .= " }"
setenv('LUA_INIT', value, 1 :named('verbose'))
.end
# Local Variables:
# mode: pir
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4 ft=pir: