Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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