| 1 | import feature : feature ;
|
|---|
| 2 | import project ;
|
|---|
| 3 | import "class" : new ;
|
|---|
| 4 | import targets ;
|
|---|
| 5 | import property-set ;
|
|---|
| 6 | import common ;
|
|---|
| 7 | import type ;
|
|---|
| 8 | import toolset : flags ;
|
|---|
| 9 |
|
|---|
| 10 | # Make this module into a project.
|
|---|
| 11 | project.initialize $(__name__) ;
|
|---|
| 12 | project lua ;
|
|---|
| 13 |
|
|---|
| 14 | #feature lua : on off : composite propagated link-incompatible ;
|
|---|
| 15 |
|
|---|
| 16 | if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
|
|---|
| 17 | {
|
|---|
| 18 | .debug-configuration = true ;
|
|---|
| 19 | }
|
|---|
| 20 |
|
|---|
| 21 | rule initialized ( )
|
|---|
| 22 | {
|
|---|
| 23 | return $(.initialized) ;
|
|---|
| 24 | }
|
|---|
| 25 |
|
|---|
| 26 | rule isEnabled ( )
|
|---|
| 27 | {
|
|---|
| 28 | return $(.enabled) ;
|
|---|
| 29 | }
|
|---|
| 30 |
|
|---|
| 31 | rule isDebug ( )
|
|---|
| 32 | {
|
|---|
| 33 | return $(.debug-configuration) ;
|
|---|
| 34 | }
|
|---|
| 35 |
|
|---|
| 36 | rule printEnv ( )
|
|---|
| 37 | {
|
|---|
| 38 | echo "LUA SOURCE : change with --with-lua=<source>" ;
|
|---|
| 39 | echo "LUA SOURCE : $(.source) (change with --with-lua=<source>" ;
|
|---|
| 40 | }
|
|---|
| 41 |
|
|---|
| 42 | # Initialize Lua support.
|
|---|
| 43 | rule init (
|
|---|
| 44 | version ? :
|
|---|
| 45 | source # Location of source files
|
|---|
| 46 | )
|
|---|
| 47 | {
|
|---|
| 48 |
|
|---|
| 49 | if $(.initialized)
|
|---|
| 50 | {
|
|---|
| 51 | errors.error "Attempt the reinitialize Lua!" ;
|
|---|
| 52 | }
|
|---|
| 53 | else
|
|---|
| 54 | {
|
|---|
| 55 | .initialized = true ;
|
|---|
| 56 | .source = $(source) ;
|
|---|
| 57 |
|
|---|
| 58 | local has-lua = [ MATCH "^--with-lua=(.*)" : [ modules.peek : ARGV ] ] ;
|
|---|
| 59 | if $(has-lua) {
|
|---|
| 60 | .source = $(has-lua) ;
|
|---|
| 61 | }
|
|---|
| 62 |
|
|---|
| 63 | if ( ( --with-lua in [ modules.peek : ARGV ] ) || $(has-lua) )
|
|---|
| 64 | && ! ( --without-lua in [ modules.peek : ARGV ] ) {
|
|---|
| 65 | .enabled = true ;
|
|---|
| 66 | } else {
|
|---|
| 67 | .enabled = false ;
|
|---|
| 68 | }
|
|---|
| 69 |
|
|---|
| 70 | local project = [ project.current ] ;
|
|---|
| 71 | project.pop-current ;
|
|---|
| 72 | }
|
|---|
| 73 | }
|
|---|
| 74 | rule generate-source ( properties * )
|
|---|
| 75 | {
|
|---|
| 76 | local path = $(.source)/src ;
|
|---|
| 77 | local result ;
|
|---|
| 78 | result += <source>$(path)/lapi.c ;
|
|---|
| 79 | result += <source>$(path)/lauxlib.c ;
|
|---|
| 80 | result += <source>$(path)/lbaselib.c ;
|
|---|
| 81 | result += <source>$(path)/lcode.c ;
|
|---|
| 82 | result += <source>$(path)/ldblib.c ;
|
|---|
| 83 | result += <source>$(path)/ldebug.c ;
|
|---|
| 84 | result += <source>$(path)/ldo.c ;
|
|---|
| 85 | result += <source>$(path)/ldump.c ;
|
|---|
| 86 | result += <source>$(path)/lfunc.c ;
|
|---|
| 87 | result += <source>$(path)/lgc.c ;
|
|---|
| 88 | result += <source>$(path)/linit.c ;
|
|---|
| 89 | result += <source>$(path)/liolib.c ;
|
|---|
| 90 | result += <source>$(path)/llex.c ;
|
|---|
| 91 | result += <source>$(path)/lmathlib.c ;
|
|---|
| 92 | result += <source>$(path)/lmem.c ;
|
|---|
| 93 | result += <source>$(path)/loadlib.c ;
|
|---|
| 94 | result += <source>$(path)/lobject.c ;
|
|---|
| 95 | result += <source>$(path)/lopcodes.c ;
|
|---|
| 96 | result += <source>$(path)/loslib.c ;
|
|---|
| 97 | result += <source>$(path)/lparser.c ;
|
|---|
| 98 | result += <source>$(path)/lstate.c ;
|
|---|
| 99 | result += <source>$(path)/lstring.c ;
|
|---|
| 100 | result += <source>$(path)/lstrlib.c ;
|
|---|
| 101 | result += <source>$(path)/ltable.c ;
|
|---|
| 102 | result += <source>$(path)/ltablib.c ;
|
|---|
| 103 | result += <source>$(path)/ltm.c ;
|
|---|
| 104 | result += <source>$(path)/lundump.c ;
|
|---|
| 105 | result += <source>$(path)/lvm.c ;
|
|---|
| 106 | result += <source>$(path)/lzio.c ;
|
|---|
| 107 | return $(result) ;
|
|---|
| 108 | }
|
|---|
| 109 |
|
|---|
| 110 | lib liblua
|
|---|
| 111 | : # sources
|
|---|
| 112 | : # requirements
|
|---|
| 113 | <conditional>@generate-source
|
|---|
| 114 | #<runtime-link>static
|
|---|
| 115 | <link>static
|
|---|
| 116 | #<name>liblua
|
|---|
| 117 | : # default-build
|
|---|
| 118 | : # usage-requirements
|
|---|
| 119 | <conditional>@usage-requirements
|
|---|
| 120 | ;
|
|---|
| 121 |
|
|---|
| 122 | rule usage-requirements ( properties * )
|
|---|
| 123 | {
|
|---|
| 124 | local result ;
|
|---|
| 125 | if ( $(.enabled) = true ) {
|
|---|
| 126 | result += <define>USE_LUA ;
|
|---|
| 127 | result += <include>$(.source)/src ;
|
|---|
| 128 | }
|
|---|
| 129 | return $(result) ;
|
|---|
| 130 | }
|
|---|
| 131 | alias embedded : liblua
|
|---|
| 132 |
|
|---|
| 133 | : # requirements
|
|---|
| 134 | #<name>lua
|
|---|
| 135 | : # default-build
|
|---|
| 136 | : # usage-requirements
|
|---|
| 137 | <conditional>@usage-requirements
|
|---|
| 138 | ;
|
|---|