forked from parrot/cardinal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.pir
executable file
·247 lines (207 loc) · 5.71 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
#!/usr/bin/env parrot
# Copyright (C) 2009-2010, Parrot Foundation.
=head1 NAME
setup.pir - Python distutils style
=head1 DESCRIPTION
No Configure step, no Makefile generated.
See <runtime/parrot/library/distutils.pir>.
=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'
.local pmc config
config = get_config()
# NOTE: ugly!!
# check minimum version of parrot
.local int min_major
.local int min_minor
.local int min_patch
.local int sys_major
.local int sys_minor
.local int sys_patch
min_major = 3
min_minor = 3
min_patch = 0
sys_major = config['MAJOR']
sys_minor = config['MINOR']
sys_patch = config['PATCH']
unless sys_major >= min_major goto abort
unless sys_minor >= min_minor goto abort
unless sys_patch >= min_patch goto abort
goto success
abort:
print <<'MSG'
BUILD FAILED
===================================================
Your Parrot is older version than Cardinal requires
Please upgrade to Parrot-3.3.0
See parrot download page for more details:
http://parrot.org/download
MSG
exit 1
success:
.const 'Sub' postbuild = 'postbuild'
register_step_after('build', postbuild)
.const 'Sub' clean = 'clean'
register_step_before('clean', clean)
.const 'Sub' arraytest = 'arraytest'
register_step('arraytest', arraytest)
.const 'Sub' hashtest = 'hashtest'
register_step('hashtest', hashtest)
$P0 = new 'Hash'
$P0['name'] = 'Cardinal'
$P0['abstract'] = 'Cardinal - Ruby compiler for Parrot'
$P0['authority'] = 'http://github.com/parrot'
$P0['description'] = 'Cardinal is a Ruby compiler for Parrot.'
$P1 = split ',', 'parrot,cardinal,ruby'
$P0['keywords'] = $P1
$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/parrot/cardinal.git'
$P0['browser_uri'] = 'http://github.com/parrot/cardinal'
$P0['project_uri'] = 'http://github.com/parrot/cardinal'
# build
$P2 = new 'Hash'
$P2['src/gen_grammar.pir'] = 'src/parser/grammar.pg'
$P0['pir_pge'] = $P2
$P3 = new 'Hash'
$P3['src/gen_actions.pir'] = 'src/parser/actions.pm'
$P0['pir_nqp'] = $P3
$P9 = split "\n", <<'BUILTINS_PIR'
src/builtins/guts.pir
src/builtins/control.pir
src/builtins/say.pir
src/builtins/cmp.pir
src/builtins/op.pir
src/classes/Object.pir
src/classes/Exception.pir
src/classes/NilClass.pir
src/classes/String.pir
src/classes/Numeric.pir
src/classes/Integer.pir
src/classes/Float.pir
src/classes/Array.pir
src/classes/Hash.pir
src/classes/Range.pir
src/classes/TrueClass.pir
src/classes/FalseClass.pir
src/classes/Kernel.pir
src/classes/Time.pir
src/classes/Math.pir
src/classes/GC.pir
src/classes/IO.pir
src/classes/Proc.pir
src/classes/File.pir
src/classes/FileStat.pir
src/classes/Dir.pir
src/builtins/globals.pir
src/builtins/eval.pir
src/classes/Continuation.pir
BUILTINS_PIR
$S0 = pop $P9
$P10 = new 'Hash'
$P10['src/gen_builtins.pir'] = $P9
$P0['inc_pir'] = $P10
$P4 = new 'Hash'
$P5 = split "\n", <<'SOURCES'
cardinal.pir
src/parser/quote_expression.pir
src/gen_grammar.pir
src/gen_actions.pir
src/gen_builtins.pir
SOURCES
$S0 = pop $P5
$P4['cardinal.pbc'] = $P5
$P0['pbc_pir'] = $P4
$P6 = new 'Hash'
$P6['parrot-cardinal'] = 'cardinal.pbc'
$P0['installable_pbc'] = $P6
# test
$S0 = get_parrot()
$S0 .= ' cardinal.pbc'
$P0['prove_exec'] = $S0
$P0['prove_files'] = 't/*.t t/*/*.t'
# smoke
$P7 = new 'Hash'
$S0 = config['archname']
$P7['Architecture'] = $S0
$S0 = config['osname']
$P7['Platform'] = $S0
$S0 = config['revision']
$P7['Parrot Revision'] = $S0
$S0 = get_submitter()
$P7['Submitter'] = $S0
$P0['smolder_extra_properties'] = $P7
$S0 = get_tags()
$P0['smolder_tags'] = $S0
$P0['prove_archive'] = 'report.tar.gz'
$P0['smolder_url'] = 'http://smolder.parrot.org/app/projects/process_add_report/10'
# dist
$P8 = glob('Test.rb Rakefile')
$P0['manifest_includes'] = $P8
$P0['doc_files'] = 'README'
.tailcall setup(args :flat, $P0 :flat :named)
.end
.sub 'postbuild' :anon
.param pmc kv :slurpy :named
$P1 = split ' ', 'Test.rb cardinal.pbc'
$I0 = newer('Test.pir', $P1)
if $I0 goto L1
.local string cmd
cmd = get_parrot()
cmd .= ' cardinal.pbc --target=pir --output=Test.pir Test.rb'
system(cmd, 1 :named('verbose'))
L1:
.end
.sub 'clean' :anon
.param pmc kv :slurpy :named
unlink('Test.pir', 1 :named('verbose'))
.end
.sub 'arraytest' :anon
.param pmc kv :slurpy :named
run_step('build', kv :flat :named)
$P0 = glob('t/array/*.t')
$P0 = sort_strings($P0)
$S0 = get_parrot()
$S0 .= ' cardinal.pbc'
runtests($P0 :flat, $S0 :named('exec'))
.end
.sub 'hashtest' :anon
.param pmc kv :slurpy :named
run_step('build', kv :flat :named)
$P0 = glob('t/hash/*.t')
$P0 = sort_strings($P0)
$S0 = get_parrot()
$S0 .= ' cardinal.pbc'
runtests($P0 :flat, $S0 :named('exec'))
.end
.sub 'get_tags' :anon
.local string tags
.local pmc config
config = get_config()
tags = config['osname']
tags .= ", "
$S0 = config['archname']
tags .= $S0
.return (tags)
.end
.sub 'get_submitter' :anon
$P0 = new 'Env'
$I0 = exists $P0['SMOLDER_SUBMITTER']
unless $I0 goto L1
$S0 = $P0['SMOLDER_SUBMITTER']
.return ($S0)
L1:
.return ('')
.end
# Local Variables:
# mode: pir
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4 ft=pir: