Skip to content
This repository has been archived by the owner on Jun 9, 2018. It is now read-only.

Commit

Permalink
add custom targets
Browse files Browse the repository at this point in the history
  • Loading branch information
fperrad committed Nov 10, 2009
1 parent 4ec9b26 commit e81e58d
Showing 1 changed file with 118 additions and 6 deletions.
124 changes: 118 additions & 6 deletions setup.pir
Expand Up @@ -28,6 +28,18 @@ No Configure step, no Makefile generated.
.const 'Sub' clean = 'clean'
register_step_before('clean', clean)

.const 'Sub' testclean = 'testclean'
register_step_after('test', testclean)

.const 'Sub' pmctest = 'pmctest'
register_step('pmctest', pmctest)

.const 'Sub' sanity = 'sanity'
register_step('sanity', sanity)

.const 'Sub' spectest = 'spectest'
register_step('spectest', spectest)

# build
$P0 = new 'Hash'
$P1 = new 'Hash'
Expand Down Expand Up @@ -86,20 +98,58 @@ SOURCES
$P5['lua.pbc'] = 'lua.pir'
$P5['luap.pbc'] = 'luap.pir'
$P5['lua/luad.pbc'] = 'luad.pir'
$P5['lua/library/_helpers.pbc'] = 'lua/library/_helpers.pir'
$P5['lua/library/alarm.pbc'] = 'lua/library/alarm.pir'
$P5['lua/library/base64.pbc'] = 'lua/library/base64.pir'
$P5['lua/library/bc.pbc'] = 'lua/library/bc.pir'
$P5['lua/library/bit.pbc'] = 'lua/library/bit.pir'
$P5['lua/library/bitlib.pbc'] = 'lua/library/bitlib.pir'
$P5['lua/library/complex.pbc'] = 'lua/library/complex.pir'
# $P5['lua/library/gl.pbc'] = 'lua/library/gl.pir' # gl.lua
$P5['lua/library/gl_binding.pbc'] = 'lua/library/gl_binding.pir'
$P5['lua/library/glut.pbc'] = 'lua/library/glut.pir'
$P5['lua/library/lfs.pbc'] = 'lua/library/lfs.pir'
$P5['lua/library/lpeg.pbc'] = 'lua/library/lpeg.pir'
$P5['lua/library/markdown.pbc'] = 'lua/library/markdown.pir'
$P5['lua/library/mathx.pbc'] = 'lua/library/mathx.pir'
$P5['lua/library/md5.pbc'] = 'lua/library/md5.pir'
$P5['lua/library/random.pbc'] = 'lua/library/random.pir'
$P5['lua/library/sha1.pbc'] = 'lua/library/sha1.pir'
$P5['lua/library/struct.pbc'] = 'lua/library/struct.pir'
$P5['lua/library/uuid.pbc'] = 'lua/library/uuid.pir'
$P5['lua/library/zlib.pbc'] = 'lua/library/zlib.pir'
$P0['pbc_pir'] = $P5

$P7 = new 'Hash'
$P7['parrot-lua'] = 'lua.pbc'
$P7['parrot-luap'] = 'luap.pbc'
$P0['exe_pbc'] = $P7

# test
$S0 = get_parrot()
$P0['prove_exec'] = $S0
$P0['prove_files'] = 't/pmc/*.t'

# install
$P8 = split ' ', 'lua/lua.pbc lua/luad.pbc'
$P8 = split "\n", <<'LIBS'
lua/lua.pbc
lua/luad.pbc
lua/library/_helpers.pbc
lua/library/alarm.pbc
lua/library/base64.pbc
lua/library/bc.pbc
lua/library/bit.pbc
lua/library/bitlib.pbc
lua/library/complex.pbc
lua/library/gl_binding.pbc
lua/library/glut.pbc
lua/library/lfs.pbc
lua/library/lpeg.pbc
lua/library/markdown.pbc
lua/library/mathx.pbc
lua/library/md5.pbc
lua/library/random.pbc
lua/library/sha1.pbc
lua/library/struct.pbc
lua/library/uuid.pbc
lua/library/zlib.pbc
LIBS
$S0 = pop $P8
$P0['inst_lang'] = $P8
.tailcall setup(args :flat, $P0 :flat :named)
.end
Expand All @@ -115,11 +165,73 @@ SOURCES
cmd .= ' lua/lib/luabytecode.rules'
system(cmd)
L1:

$I0 = newer('lua/library/sha1.pir', 'lua/library/md5.pir')
if $I0 goto L2
cmd = 'perl -pe "s|md5|sha1|g; s|MD5|SHA1|g" lua/library/md5.pir > lua/library/sha1.pir'
system(cmd)
L2:
.end

.sub 'clean' :anon
.param pmc kv :slurpy :named
unlink('lua/lib/luabytecode_gen.pir')
unlink('lua/library/sha1.pir')
.end

.sub 'testclean' :anon
.param pmc kv :slurpy :named
system("perl -MExtUtils::Command -e rm_f t/*.lua t/*.parrot_out")
.end

.sub 'pmctest'
.param pmc kv :slurpy :named
run_step('build', kv :flat :named)
.local string cmd
cmd = "prove --exec="
$S0 = get_parrot()
cmd .= $S0
cmd .= " t/pmc/*.t"
system(cmd)
.end

.sub 'spectest'
.param pmc kv :slurpy :named
run_step('build', kv :flat :named)

.local string current_dir
current_dir = cwd()
chdir('t/lua-TestMore/test_lua51')

setenv('LUA_PATH', ";;..\src\?.lua")
setenv('LUA_INIT', "platform = { osname=[[MSWin32]], intsize=4, longsize=4 }")

.local string cmd
cmd = "prove --exec=\""
$S0 = get_parrot()
cmd .= $S0
cmd .= " ../../../lua.pbc\" *.t"
system(cmd)

chdir(current_dir)
.end

.sub 'sanity'
.param pmc kv :slurpy :named
run_step('build', kv :flat :named)

.local string current_dir
current_dir = cwd()
chdir('t/lua-TestMore/test_lua51')

.local string cmd
cmd = "prove --exec=\""
$S0 = get_parrot()
cmd .= $S0
cmd .= " ../../../lua.pbc\" 0*.t"
system(cmd)

chdir(current_dir)
.end


Expand Down

0 comments on commit e81e58d

Please sign in to comment.