Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 322 lines (273 sloc) 8.273 kb
b6ce733 @fperrad convert test to PIR (from Perl)
authored
1 #!/usr/bin/env parrot
f3baad0 @fperrad add a setup.pir (distutils)
authored
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' 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'
c98adab @fperrad add metadata in setup.pir
authored
55 $P0['name'] = 'Lua'
56 $P0['abstract'] = 'Lua on Parrot'
57 $P0['authority'] = 'http://github.com/fperrad'
58 $P0['description'] = 'Lua 5.1 on Parrot'
59 $P5 = split ',', 'lua'
60 $P0['keywords'] = $P5
61 $P0['license_type'] = 'Artistic License 2.0'
62 $P0['license_uri'] = 'http://www.perlfoundation.org/artistic_license_2_0'
63 $P0['copyright_holder'] = 'Parrot Foundation'
64 $P0['checkout_uri'] = 'git://github.com/fperrad/lua.git'
65 $P0['browser_uri'] = 'http://github.com/fperrad/lua'
66 $P0['project_uri'] = 'http://github.com/fperrad/lua'
67
bd95266 @fperrad use installable_pbc instead of exe_pbc
authored
68 # build
f3baad0 @fperrad add a setup.pir (distutils)
authored
69 $P1 = new 'Hash'
70 $P2 = split "\n", <<'SOURCES'
71 dynext/pmc/lua.pmc
72 dynext/pmc/luaany.pmc
73 dynext/pmc/luaboolean.pmc
74 dynext/pmc/luabytecode.pmc
75 dynext/pmc/luafunction.pmc
76 dynext/pmc/luanil.pmc
77 dynext/pmc/luanumber.pmc
78 dynext/pmc/luastring.pmc
79 dynext/pmc/luatable.pmc
80 dynext/pmc/luathread.pmc
81 dynext/pmc/luauserdata.pmc
08498fb @fperrad since r49086, dynpmc item allows *.h
authored
82 dynext/pmc/lua_private.h
f3baad0 @fperrad add a setup.pir (distutils)
authored
83 SOURCES
84 $S0 = pop $P2
85 $P1['lua_group'] = $P2
86 $P0['dynpmc'] = $P1
87
88 $P3 = new 'Hash'
89 $P3['lua/lua51_gen.pir'] = 'lua/lua51.pg'
90 $P3['lua/lua51_testlex_gen.pir'] = 'lua/lua51_testlex.pg'
91 $P0['pir_pge'] = $P3
92
93 $P4 = new 'Hash'
94 $P4['lua/PASTGrammar_gen.pir'] = 'lua/PASTGrammar.tg'
95 $P4['lua/POSTGrammar_gen.pir'] = 'lua/POSTGrammar.tg'
96 $P4['lua/dumplex_gen.pir'] = 'lua/dumplex.tg'
97 $P0['pir_tge'] = $P4
98
99 $P5 = new 'Hash'
100 $P6 = split "\n", <<'SOURCES'
101 lua/lua51.pir
102 lua/grammar51.pir
103 lua/lua51_gen.pir
104 lua/PASTGrammar_gen.pir
105 lua/POSTGrammar_gen.pir
106 lua/lib/luaaux.pir
107 lua/lib/luabasic.pir
108 lua/lib/luacoroutine.pir
109 lua/lib/luapackage.pir
110 lua/lib/luaregex.pir
111 lua/lib/luastring.pir
112 lua/lib/luatable.pir
113 lua/lib/luamath.pir
114 lua/lib/luaio.pir
115 lua/lib/luafile.pir
116 lua/lib/luaos.pir
117 lua/lib/luadebug.pir
118 lua/lib/luabytecode.pir
119 lua/lib/luabytecode_gen.pir
120 SOURCES
121 $S0 = pop $P6
122 $P5['lua/lua.pbc'] = $P6
123 $P5['lua.pbc'] = 'lua.pir'
124 $P5['luap.pbc'] = 'luap.pir'
125 $P5['lua/luad.pbc'] = 'luad.pir'
126 $P0['pbc_pir'] = $P5
127
6ad653d @fperrad add manifest_includes & manifest_excludes
authored
128 $P7 = new 'Hash'
129 $P7['parrot-lua'] = 'lua.pbc'
130 $P7['parrot-luap'] = 'luap.pbc'
131 $P0['installable_pbc'] = $P7
132
a7bd3d6 @fperrad generate manpages (with pod2man)
authored
133 $P8 = new 'Hash'
134 $P8['man/man1/parrot-lua.1'] = 'lua.pir'
135 $P8['man/man1/parrot-luap.1'] = 'luap.pir'
136 $P0['man_pod'] = $P8
137
6ad653d @fperrad add manifest_includes & manifest_excludes
authored
138 # post build
f7bbc12 @fperrad build Lua libraries in a custom step, after the build of the Lua comp…
authored
139 $P9 = new 'Hash'
751d587 @fperrad move Test/More.lua
authored
140 $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 comp…
authored
141 $P0['liblua__pbc_pir'] = $P9
142 $P10 = new 'Hash'
751d587 @fperrad move Test/More.lua
authored
143 $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 comp…
authored
144 $P0['liblua__pir_lua'] = $P10
145
378a9d6 @fperrad convert tests to PIR (from Perl)
authored
146 # test
147 $S0 = get_parrot()
148 $P0['prove_exec'] = $S0
149 $P0['prove_files'] = 't/pmc/*.t t/*.t'
150
05607fb @fperrad use target 'smoke'
authored
151 # smoke
152 $P0['prove_archive'] = 'test_lua51.tar.gz'
50bc750 @fperrad works with the new Smolder server
authored
153 $P0['smolder_url'] = 'http://smolder.parrot.org/app/projects/process_add_report/7'
05607fb @fperrad use target 'smoke'
authored
154 $P0['smolder_comments'] = 'parrot-lua'
155 $S0 = get_tags()
156 $P0['smolder_tags'] = $S0
157
f3baad0 @fperrad add a setup.pir (distutils)
authored
158 # install
378a9d6 @fperrad convert tests to PIR (from Perl)
authored
159 $P8 = split ' ', 'lua/lua.pbc lua/luad.pbc'
f3baad0 @fperrad add a setup.pir (distutils)
authored
160 $P0['inst_lang'] = $P8
cfdfc77 @fperrad some refactor and fix targets for test
authored
161
6ad653d @fperrad add manifest_includes & manifest_excludes
authored
162 # dist
08498fb @fperrad since r49086, dynpmc item allows *.h
authored
163 $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')
31e3d8b @fperrad restore previous semantic
authored
164 $P0['manifest_includes'] = $P1
165 $P2 = split ' ', 'lua/lib/luabytecode_gen.pir lua/library/Test/More.pir'
166 $P0['manifest_excludes'] = $P2
857f04d @fperrad add doc_files field
authored
167 $P3 = split ' ', 'CREDITS MAINTAINER README'
168 $P0['doc_files'] = $P3
6ad653d @fperrad add manifest_includes & manifest_excludes
authored
169
f3baad0 @fperrad add a setup.pir (distutils)
authored
170 .tailcall setup(args :flat, $P0 :flat :named)
171 .end
172
378a9d6 @fperrad convert tests to PIR (from Perl)
authored
173 .sub 'update' :anon
174 .param pmc kv :slurpy :named
6ad653d @fperrad add manifest_includes & manifest_excludes
authored
175 $I0 = file_exists('.git')
176 unless $I0 goto L1
bc50bfb @fperrad add flag verbose
authored
177 system('git submodule update', 1 :named('verbose'))
6ad653d @fperrad add manifest_includes & manifest_excludes
authored
178 L1:
378a9d6 @fperrad convert tests to PIR (from Perl)
authored
179 .end
180
f3baad0 @fperrad add a setup.pir (distutils)
authored
181 .sub 'prebuild' :anon
182 .param pmc kv :slurpy :named
183 .local string cmd
184 $P0 = split ' ', 'lua/lib/luabytecode.rules build/translator.pl'
185 $I0 = newer('lua/lib/luabytecode_gen.pir', $P0)
186 if $I0 goto L1
187 cmd = 'perl build/translator.pl'
188 cmd .= ' --output lua/lib/luabytecode_gen.pir'
189 cmd .= ' lua/lib/luabytecode.rules'
bc50bfb @fperrad add flag verbose
authored
190 system(cmd, 1 :named('verbose'))
f3baad0 @fperrad add a setup.pir (distutils)
authored
191 L1:
e81e58d @fperrad add custom targets
authored
192
6ad653d @fperrad add manifest_includes & manifest_excludes
authored
193 $I0 = file_exists('.git')
194 unless $I0 goto L2
3b2cf82 @fperrad git submodule (t/lua-TestMore)
authored
195 $I0 = file_exists('t/lua-TestMore/src/Test/More.lua')
196 if $I0 goto L2
bc50bfb @fperrad add flag verbose
authored
197 system('git submodule init t/lua-TestMore', 1 :named('verbose'))
198 system('git submodule update', 1 :named('verbose'))
3b2cf82 @fperrad git submodule (t/lua-TestMore)
authored
199 L2:
200
751d587 @fperrad move Test/More.lua
authored
201 $I0 = newer('lua/library/Test/More.lua', 't/lua-TestMore/src/Test/More.lua')
a233d99 @fperrad remove staging
authored
202 if $I0 goto L3
bc50bfb @fperrad add flag verbose
authored
203 install('t/lua-TestMore/src/Test/More.lua', 'lua/library/Test/More.lua', 1 :named('verbose'))
a233d99 @fperrad remove staging
authored
204 L3:
f3baad0 @fperrad add a setup.pir (distutils)
authored
205 .end
206
cfdfc77 @fperrad some refactor and fix targets for test
authored
207 .sub 'clean' :anon
f7bbc12 @fperrad build Lua libraries in a custom step, after the build of the Lua comp…
authored
208 .param pmc kv :slurpy :named
bc50bfb @fperrad add flag verbose
authored
209 unlink('lua/lib/luabytecode_gen.pir', 1 :named('verbose'))
210 unlink('lua/library/Test/More.lua', 1 :named('verbose'))
cfdfc77 @fperrad some refactor and fix targets for test
authored
211 .end
212
213 .sub 'liblua_build' :anon
214 .param pmc kv :slurpy :named
215 $P0 = kv['liblua__pir_lua']
216 build_pir_lua($P0)
217 $P0 = kv['liblua__pbc_pir']
218 build_pbc_pir($P0)
219 .end
220
221 .sub 'build_pir_lua' :anon
222 .param pmc hash
f7bbc12 @fperrad build Lua libraries in a custom step, after the build of the Lua comp…
authored
223 $P0 = iter hash
224 L1:
225 unless $P0 goto L2
226 .local string pir, lua
227 pir = shift $P0
228 lua = hash[pir]
229 $I0 = newer(pir, lua)
230 if $I0 goto L1
231 .local string cmd
232 cmd = get_parrot()
233 cmd .= " luap.pir --target=pir "
234 cmd .= lua
235 cmd .= " > "
236 cmd .= pir
bc50bfb @fperrad add flag verbose
authored
237 system(cmd, 1 :named('verbose'))
f7bbc12 @fperrad build Lua libraries in a custom step, after the build of the Lua comp…
authored
238 goto L1
239 L2:
240 .end
241
242 .sub 'liblua_clean' :anon
243 .param pmc kv :slurpy :named
244 $P0 = kv['liblua__pbc_pir']
245 clean_key($P0)
246 $P0 = kv['liblua__pir_lua']
247 clean_key($P0)
248 .end
249
250 .sub 'pmctest' :anon
e81e58d @fperrad add custom targets
authored
251 .param pmc kv :slurpy :named
252 run_step('build', kv :flat :named)
cfdfc77 @fperrad some refactor and fix targets for test
authored
253
6f78f52 @fperrad refactor with runtests (from distutils)
authored
254 $P0 = glob('t/pmc/*.t')
255 $P0 = sort_strings($P0)
e81e58d @fperrad add custom targets
authored
256 $S0 = get_parrot()
6f78f52 @fperrad refactor with runtests (from distutils)
authored
257 runtests($P0 :flat, $S0 :named('exec'))
e81e58d @fperrad add custom targets
authored
258 .end
259
cfdfc77 @fperrad some refactor and fix targets for test
authored
260 .sub 'sanity' :anon
261 .param pmc kv :slurpy :named
262 run_step('build', kv :flat :named)
263
6f78f52 @fperrad refactor with runtests (from distutils)
authored
264 $P0 = glob('t/lua-TestMore/test_lua51/0*.t')
265 $P0 = sort_strings($P0)
cfdfc77 @fperrad some refactor and fix targets for test
authored
266 $S0 = get_parrot()
68436eb @fperrad use directly TAP/Harness library
authored
267 $S0 .= ' lua.pbc'
6f78f52 @fperrad refactor with runtests (from distutils)
authored
268 runtests($P0 :flat, $S0 :named('exec'))
cfdfc77 @fperrad some refactor and fix targets for test
authored
269 .end
270
f7bbc12 @fperrad build Lua libraries in a custom step, after the build of the Lua comp…
authored
271 .sub 'spectest' :anon
e81e58d @fperrad add custom targets
authored
272 .param pmc kv :slurpy :named
273 run_step('build', kv :flat :named)
b9ccf38 @fperrad build LUA_INIT from the config
authored
274 run_step('set_LUA_INIT', kv :flat :named)
e81e58d @fperrad add custom targets
authored
275
6f78f52 @fperrad refactor with runtests (from distutils)
authored
276 $P0 = glob('t/lua-TestMore/test_lua51/*.t')
277 $P0 = sort_strings($P0)
e81e58d @fperrad add custom targets
authored
278 $S0 = get_parrot()
68436eb @fperrad use directly TAP/Harness library
authored
279 $S0 .= ' lua.pbc'
6f78f52 @fperrad refactor with runtests (from distutils)
authored
280 runtests($P0 :flat, $S0 :named('exec'))
e81e58d @fperrad add custom targets
authored
281 .end
282
05607fb @fperrad use target 'smoke'
authored
283 .sub 'get_tags'
284 .local string tags
cfdfc77 @fperrad some refactor and fix targets for test
authored
285 .local pmc config
286 config = get_config()
05607fb @fperrad use target 'smoke'
authored
287 tags = config['osname']
288 tags .= ", "
cfdfc77 @fperrad some refactor and fix targets for test
authored
289 $S0 = config['archname']
05607fb @fperrad use target 'smoke'
authored
290 tags .= $S0
291 tags .= ", parrot-lua, Lua 5.1 (on Parrot)"
292 .return (tags)
cfdfc77 @fperrad some refactor and fix targets for test
authored
293 .end
f3baad0 @fperrad add a setup.pir (distutils)
authored
294
b9ccf38 @fperrad build LUA_INIT from the config
authored
295 .sub 'set_LUA_INIT' :anon
296 .param pmc kv :slurpy :named
297 .local pmc config
298 config = get_config()
299 .local string value
800d696 @fperrad add tests with stdin
authored
300 value = "platform = { lua=[["
301 $S0 = get_parrot()
302 value .= $S0
303 value .= " lua.pbc]], osname=[["
b9ccf38 @fperrad build LUA_INIT from the config
authored
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 .= " }"
bc50bfb @fperrad add flag verbose
authored
313 setenv('LUA_INIT', value, 1 :named('verbose'))
b9ccf38 @fperrad build LUA_INIT from the config
authored
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.