lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Sat, Jan 21, 2012 at 4:24 AM, steve donovan
<> wrote:
>> IMO, memoized build systems [4] also look interesting.
> You mean CMake's ability to remember where it found things, so it
> doesn't do extra work each time?

No, I mean like fabricate [1], which was inspired by Bill McCloskey's  I'm not aware of a Lua implementation of this type of
build system, so I wrote an initial implementation today [2].  You can
build Lua 5.2 like this:

  #!/usr/bin/env lua
  -- Example mbuild for Lua 5.2.0.

  local MB = require 'mbuild'
  local gcc_deps = require 'mbuild_gcc'.gcc_deps
  local qw = require 'mbuild_list'.qw

  local CORE_O = qw[[
  	lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o
  	lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o
  	ltm.o lundump.o lvm.o lzio.o
  local LIB_O = qw[[
  	lauxlib.o lbaselib.o lbitlib.o lcorolib.o ldblib.o liolib.o
  	lmathlib.o loslib.o lstrlib.o ltablib.o loadlib.o linit.o
  local BASE_O = CORE_O + LIB_O + qw'lua.c'

  for obj in (BASE_O + qw'lua.o luac.o'):iter() do
    local src = obj:gsub('%.o$', '%.c')'gcc -c '..src, {obj}, {src, defer=gcc_deps})
  end'ar rcu liblua.a '..BASE_O:string(), {'liblua.a'}, BASE_O)'gcc -o lua lua.o liblua.a -lm', {'lua'}, {'lua.o', 'liblua.a'})'gcc -o luac luac.o liblua.a -lm', {'luac'}, {'luac.o', 'liblua.a'})

Rules could be added to further abstract away the toolchain-specific
code (the core implementation knows nothing about toolchains).  strace
support could easily be added too to eliminate the explicit